mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- moved model renderer to hwrenderer after removing the remaining traces of OpenGL.
This commit is contained in:
parent
51acf3053c
commit
9e109995cd
13 changed files with 19 additions and 42 deletions
|
@ -694,6 +694,7 @@ file( GLOB HEADER_FILES
|
||||||
polyrenderer/scene/*.h
|
polyrenderer/scene/*.h
|
||||||
hwrenderer/data/*.h
|
hwrenderer/data/*.h
|
||||||
hwrenderer/dynlights/*.h
|
hwrenderer/dynlights/*.h
|
||||||
|
hwrenderer/models/*.h
|
||||||
hwrenderer/postprocessing/*.h
|
hwrenderer/postprocessing/*.h
|
||||||
hwrenderer/scene/*.h
|
hwrenderer/scene/*.h
|
||||||
hwrenderer/textures/*.h
|
hwrenderer/textures/*.h
|
||||||
|
@ -1041,7 +1042,6 @@ set (PCH_SOURCES
|
||||||
gl/data/gl_viewpointbuffer.cpp
|
gl/data/gl_viewpointbuffer.cpp
|
||||||
gl/dynlights/gl_lightbuffer.cpp
|
gl/dynlights/gl_lightbuffer.cpp
|
||||||
gl/dynlights/gl_shadowmap.cpp
|
gl/dynlights/gl_shadowmap.cpp
|
||||||
gl/models/gl_models.cpp
|
|
||||||
gl/renderer/gl_renderer.cpp
|
gl/renderer/gl_renderer.cpp
|
||||||
gl/renderer/gl_renderstate.cpp
|
gl/renderer/gl_renderstate.cpp
|
||||||
gl/renderer/gl_renderbuffers.cpp
|
gl/renderer/gl_renderbuffers.cpp
|
||||||
|
@ -1060,6 +1060,7 @@ set (PCH_SOURCES
|
||||||
hwrenderer/data/flatvertices.cpp
|
hwrenderer/data/flatvertices.cpp
|
||||||
hwrenderer/dynlights/hw_aabbtree.cpp
|
hwrenderer/dynlights/hw_aabbtree.cpp
|
||||||
hwrenderer/dynlights/hw_shadowmap.cpp
|
hwrenderer/dynlights/hw_shadowmap.cpp
|
||||||
|
hwrenderer/models/hw_models.cpp
|
||||||
hwrenderer/scene/hw_skydome.cpp
|
hwrenderer/scene/hw_skydome.cpp
|
||||||
hwrenderer/postprocessing/hw_postprocess.cpp
|
hwrenderer/postprocessing/hw_postprocess.cpp
|
||||||
hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||||
|
@ -1418,7 +1419,6 @@ source_group("OpenGL Loader" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl
|
||||||
source_group("OpenGL Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/.+")
|
source_group("OpenGL Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/.+")
|
||||||
source_group("OpenGL Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/data/.+")
|
source_group("OpenGL Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/data/.+")
|
||||||
source_group("OpenGL Renderer\\Dynamic Lights" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/dynlights/.+")
|
source_group("OpenGL Renderer\\Dynamic Lights" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/dynlights/.+")
|
||||||
source_group("OpenGL Renderer\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/models/.+")
|
|
||||||
source_group("OpenGL Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/renderer/.+")
|
source_group("OpenGL Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/renderer/.+")
|
||||||
source_group("OpenGL Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/scene/.+")
|
source_group("OpenGL Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/scene/.+")
|
||||||
source_group("OpenGL Renderer\\Shaders" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/shaders/.+")
|
source_group("OpenGL Renderer\\Shaders" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/shaders/.+")
|
||||||
|
|
|
@ -105,8 +105,8 @@ public:
|
||||||
void ResetVertexBuffer()
|
void ResetVertexBuffer()
|
||||||
{
|
{
|
||||||
// forces rebinding with the next 'apply' call.
|
// forces rebinding with the next 'apply' call.
|
||||||
mVertexBuffer = nullptr;
|
mCurrentVertexBuffer = nullptr;
|
||||||
mIndexBuffer = nullptr;
|
mCurrentIndexBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSpecular(float glossiness, float specularLevel)
|
void SetSpecular(float glossiness, float specularLevel)
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include "gl/renderer/gl_renderer.h"
|
#include "gl/renderer/gl_renderer.h"
|
||||||
#include "gl/data/gl_viewpointbuffer.h"
|
#include "gl/data/gl_viewpointbuffer.h"
|
||||||
#include "gl/dynlights/gl_lightbuffer.h"
|
#include "gl/dynlights/gl_lightbuffer.h"
|
||||||
#include "gl/models/gl_models.h"
|
#include "hwrenderer/models/hw_models.h"
|
||||||
|
|
||||||
class FDrawInfoList
|
class FDrawInfoList
|
||||||
{
|
{
|
||||||
|
@ -243,12 +243,14 @@ void FDrawInfo::DrawModel(GLSprite *spr, FRenderState &state)
|
||||||
{
|
{
|
||||||
FGLModelRenderer renderer(this, state, spr->dynlightindex);
|
FGLModelRenderer renderer(this, state, spr->dynlightindex);
|
||||||
renderer.RenderModel(spr->x, spr->y, spr->z, spr->modelframe, spr->actor, Viewpoint.TicFrac);
|
renderer.RenderModel(spr->x, spr->y, spr->z, spr->modelframe, spr->actor, Viewpoint.TicFrac);
|
||||||
|
GLRenderer->mVBO->Bind(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDrawInfo::DrawHUDModel(HUDSprite *huds, FRenderState &state)
|
void FDrawInfo::DrawHUDModel(HUDSprite *huds, FRenderState &state)
|
||||||
{
|
{
|
||||||
FGLModelRenderer renderer(this, state, huds->lightindex);
|
FGLModelRenderer renderer(this, state, huds->lightindex);
|
||||||
renderer.RenderHUDModel(huds->weapon, huds->mx, huds->my);
|
renderer.RenderHUDModel(huds->weapon, huds->mx, huds->my);
|
||||||
|
GLRenderer->mVBO->Bind(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDrawInfo::RenderPortal(HWPortal *p, bool usestencil)
|
void FDrawInfo::RenderPortal(HWPortal *p, bool usestencil)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include "hwrenderer/utility/hw_clock.h"
|
#include "hwrenderer/utility/hw_clock.h"
|
||||||
#include "hwrenderer/utility/hw_vrmodes.h"
|
#include "hwrenderer/utility/hw_vrmodes.h"
|
||||||
#include "gl/data/gl_uniformbuffer.h"
|
#include "gl/data/gl_uniformbuffer.h"
|
||||||
#include "gl/models/gl_models.h"
|
#include "hwrenderer/models/hw_models.h"
|
||||||
#include "gl/shaders/gl_shaderprogram.h"
|
#include "gl/shaders/gl_shaderprogram.h"
|
||||||
#include "gl_debug.h"
|
#include "gl_debug.h"
|
||||||
#include "r_videoscale.h"
|
#include "r_videoscale.h"
|
||||||
|
|
|
@ -22,11 +22,10 @@
|
||||||
/*
|
/*
|
||||||
** gl_models.cpp
|
** gl_models.cpp
|
||||||
**
|
**
|
||||||
** OpenGL renderer model handling code
|
** hardware renderer model handling code
|
||||||
**
|
**
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "gl_load/gl_system.h"
|
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
@ -39,12 +38,10 @@
|
||||||
#include "hwrenderer/textures/hw_material.h"
|
#include "hwrenderer/textures/hw_material.h"
|
||||||
#include "hwrenderer/data/vertexbuffer.h"
|
#include "hwrenderer/data/vertexbuffer.h"
|
||||||
#include "hwrenderer/data/flatvertices.h"
|
#include "hwrenderer/data/flatvertices.h"
|
||||||
|
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||||
#include "gl_load/gl_interface.h"
|
#include "hwrenderer/scene/hw_renderstate.h"
|
||||||
#include "gl/renderer/gl_renderer.h"
|
#include "hwrenderer/scene/hw_portal.h"
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "hw_models.h"
|
||||||
#include "gl/models/gl_models.h"
|
|
||||||
#include "gl/shaders/gl_shader.h"
|
|
||||||
|
|
||||||
CVAR(Bool, gl_light_models, true, CVAR_ARCHIVE)
|
CVAR(Bool, gl_light_models, true, CVAR_ARCHIVE)
|
||||||
|
|
||||||
|
@ -110,11 +107,6 @@ IModelVertexBuffer *FGLModelRenderer::CreateVertexBuffer(bool needindex, bool si
|
||||||
return new FModelVertexBuffer(needindex, singleframe);
|
return new FModelVertexBuffer(needindex, singleframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGLModelRenderer::ResetVertexBuffer()
|
|
||||||
{
|
|
||||||
GLRenderer->mVBO->Bind(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FGLModelRenderer::SetInterpolation(double inter)
|
void FGLModelRenderer::SetInterpolation(double inter)
|
||||||
{
|
{
|
||||||
state.SetInterpolationFactor((float)inter);
|
state.SetInterpolationFactor((float)inter);
|
||||||
|
@ -223,9 +215,7 @@ void FModelVertexBuffer::UnlockIndexBuffer()
|
||||||
|
|
||||||
void FModelVertexBuffer::SetupFrame(FModelRenderer *renderer, unsigned int frame1, unsigned int frame2, unsigned int size)
|
void FModelVertexBuffer::SetupFrame(FModelRenderer *renderer, unsigned int frame1, unsigned int frame2, unsigned int size)
|
||||||
{
|
{
|
||||||
mIndexFrame[0] = frame1;
|
auto &state = static_cast<FGLModelRenderer*>(renderer)->state;
|
||||||
mIndexFrame[1] = frame2;
|
state.SetVertexBuffer(mVertexBuffer, frame1, frame2);
|
||||||
auto state = static_cast<FGLModelRenderer*>(renderer)->state;
|
|
||||||
state.SetVertexBuffer(mVertexBuffer, mIndexFrame[0], mIndexFrame[1]);
|
|
||||||
if (mIndexBuffer) state.SetIndexBuffer(mIndexBuffer);
|
if (mIndexBuffer) state.SetIndexBuffer(mIndexBuffer);
|
||||||
}
|
}
|
|
@ -28,12 +28,11 @@
|
||||||
#include "r_data/models/models.h"
|
#include "r_data/models/models.h"
|
||||||
|
|
||||||
class GLSprite;
|
class GLSprite;
|
||||||
struct FDrawInfo;
|
struct HWDrawInfo;
|
||||||
class FRenderState;
|
class FRenderState;
|
||||||
|
|
||||||
class FModelVertexBuffer : public IModelVertexBuffer
|
class FModelVertexBuffer : public IModelVertexBuffer
|
||||||
{
|
{
|
||||||
int mIndexFrame[2];
|
|
||||||
IVertexBuffer *mVertexBuffer;
|
IVertexBuffer *mVertexBuffer;
|
||||||
IIndexBuffer *mIndexBuffer;
|
IIndexBuffer *mIndexBuffer;
|
||||||
|
|
||||||
|
@ -55,16 +54,15 @@ class FGLModelRenderer : public FModelRenderer
|
||||||
{
|
{
|
||||||
friend class FModelVertexBuffer;
|
friend class FModelVertexBuffer;
|
||||||
int modellightindex = -1;
|
int modellightindex = -1;
|
||||||
FDrawInfo *di;
|
HWDrawInfo *di;
|
||||||
FRenderState &state;
|
FRenderState &state;
|
||||||
public:
|
public:
|
||||||
FGLModelRenderer(FDrawInfo *d, FRenderState &st, int mli) : modellightindex(mli), di(d), state(st)
|
FGLModelRenderer(HWDrawInfo *d, FRenderState &st, int mli) : modellightindex(mli), di(d), state(st)
|
||||||
{}
|
{}
|
||||||
ModelRendererType GetType() const override { return GLModelRendererType; }
|
ModelRendererType GetType() const override { return GLModelRendererType; }
|
||||||
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
||||||
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
||||||
void ResetVertexBuffer() override;
|
|
||||||
VSMatrix GetViewToWorldMatrix() override;
|
VSMatrix GetViewToWorldMatrix() override;
|
||||||
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawHUDModel(AActor *actor) override;
|
void EndDrawHUDModel(AActor *actor) override;
|
|
@ -399,6 +399,7 @@ public:
|
||||||
|
|
||||||
void SetVertexBuffer(IVertexBuffer *vb, int offset0, int offset1)
|
void SetVertexBuffer(IVertexBuffer *vb, int offset0, int offset1)
|
||||||
{
|
{
|
||||||
|
assert(vb);
|
||||||
mVertexBuffer = vb;
|
mVertexBuffer = vb;
|
||||||
mVertexOffsets[0] = offset0;
|
mVertexOffsets[0] = offset0;
|
||||||
mVertexOffsets[1] = offset1;
|
mVertexOffsets[1] = offset1;
|
||||||
|
|
|
@ -143,10 +143,6 @@ IModelVertexBuffer *PolyModelRenderer::CreateVertexBuffer(bool needindex, bool s
|
||||||
return new PolyModelVertexBuffer(needindex, singleframe);
|
return new PolyModelVertexBuffer(needindex, singleframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyModelRenderer::ResetVertexBuffer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
VSMatrix PolyModelRenderer::GetViewToWorldMatrix()
|
VSMatrix PolyModelRenderer::GetViewToWorldMatrix()
|
||||||
{
|
{
|
||||||
Mat4f swapYZ = Mat4f::Null();
|
Mat4f swapYZ = Mat4f::Null();
|
||||||
|
|
|
@ -41,7 +41,6 @@ public:
|
||||||
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
||||||
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
||||||
void ResetVertexBuffer() override;
|
|
||||||
VSMatrix GetViewToWorldMatrix() override;
|
VSMatrix GetViewToWorldMatrix() override;
|
||||||
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawHUDModel(AActor *actor) override;
|
void EndDrawHUDModel(AActor *actor) override;
|
||||||
|
|
|
@ -277,8 +277,6 @@ void FModelRenderer::RenderFrameModels(const FSpriteModelFrame *smf, const FStat
|
||||||
mdl->RenderFrame(this, tex, smf->modelframes[i], smfNext->modelframes[i], inter, translation);
|
mdl->RenderFrame(this, tex, smf->modelframes[i], smfNext->modelframes[i], inter, translation);
|
||||||
else
|
else
|
||||||
mdl->RenderFrame(this, tex, smf->modelframes[i], smf->modelframes[i], 0.f, translation);
|
mdl->RenderFrame(this, tex, smf->modelframes[i], smf->modelframes[i], 0.f, translation);
|
||||||
|
|
||||||
ResetVertexBuffer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,6 @@ public:
|
||||||
|
|
||||||
virtual IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) = 0;
|
virtual IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) = 0;
|
||||||
|
|
||||||
virtual void ResetVertexBuffer() = 0;
|
|
||||||
|
|
||||||
virtual VSMatrix GetViewToWorldMatrix() = 0;
|
virtual VSMatrix GetViewToWorldMatrix() = 0;
|
||||||
|
|
||||||
virtual void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) = 0;
|
virtual void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) = 0;
|
||||||
|
|
|
@ -218,10 +218,6 @@ namespace swrenderer
|
||||||
return new SWModelVertexBuffer(needindex, singleframe);
|
return new SWModelVertexBuffer(needindex, singleframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWModelRenderer::ResetVertexBuffer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
VSMatrix SWModelRenderer::GetViewToWorldMatrix()
|
VSMatrix SWModelRenderer::GetViewToWorldMatrix()
|
||||||
{
|
{
|
||||||
// Calculate the WorldToView matrix as it would have looked like without yshearing:
|
// Calculate the WorldToView matrix as it would have looked like without yshearing:
|
||||||
|
|
|
@ -65,7 +65,6 @@ namespace swrenderer
|
||||||
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
||||||
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
||||||
void ResetVertexBuffer() override;
|
|
||||||
VSMatrix GetViewToWorldMatrix() override;
|
VSMatrix GetViewToWorldMatrix() override;
|
||||||
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawHUDModel(AActor *actor) override;
|
void EndDrawHUDModel(AActor *actor) override;
|
||||||
|
|
Loading…
Reference in a new issue