Remove unused class
This commit is contained in:
parent
4ba0b47665
commit
4b0d4a210a
5 changed files with 0 additions and 167 deletions
|
|
@ -1122,7 +1122,6 @@ set (PCH_SOURCES
|
|||
common/rendering/hwrenderer/data/hw_collision.cpp
|
||||
common/rendering/hwrenderer/data/hw_levelmesh.cpp
|
||||
common/rendering/hwrenderer/data/hw_meshbuilder.cpp
|
||||
common/rendering/hwrenderer/data/hw_mesh.cpp
|
||||
common/rendering/hwrenderer/postprocessing/hw_postprocessshader.cpp
|
||||
common/rendering/hwrenderer/postprocessing/hw_postprocess.cpp
|
||||
common/rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||
|
|
|
|||
|
|
@ -1,111 +0,0 @@
|
|||
|
||||
#include "hw_mesh.h"
|
||||
#include "v_video.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
#define USE_MESH_VERTEX_BUFFER
|
||||
|
||||
void Mesh::Draw(FRenderState& renderstate)
|
||||
{
|
||||
#ifdef USE_MESH_VERTEX_BUFFER
|
||||
|
||||
if (!mVertexBuffer && mVertices.Size() != 0)
|
||||
{
|
||||
static const FVertexBufferAttribute format[] =
|
||||
{
|
||||
{ 0, VATTR_VERTEX, VFmt_Float4, (int)myoffsetof(FFlatVertex, x) },
|
||||
{ 0, VATTR_TEXCOORD, VFmt_Float2, (int)myoffsetof(FFlatVertex, u) },
|
||||
{ 0, VATTR_LIGHTMAP, VFmt_Float2, (int)myoffsetof(FFlatVertex, lu) },
|
||||
};
|
||||
mVertexBuffer.reset(screen->CreateVertexBuffer(1, 3, sizeof(FFlatVertex), format));
|
||||
mVertexBuffer->SetData(mVertices.Size() * sizeof(FFlatVertex), mVertices.Data(), BufferUsageType::Static);
|
||||
}
|
||||
|
||||
if (mVertexBuffer)
|
||||
renderstate.SetVertexBuffer(mVertexBuffer.get(), 0, 0);
|
||||
|
||||
#else
|
||||
|
||||
auto pair = renderstate.AllocVertices(mVertices.Size());
|
||||
memcpy(pair.first, mVertices.Data(), mVertices.Size() * sizeof(FFlatVertex));
|
||||
|
||||
#endif
|
||||
|
||||
MeshApplyState origState;
|
||||
origState.applyData.RenderStyle = renderstate.mRenderStyle;
|
||||
origState.applyData.SpecialEffect = renderstate.mSpecialEffect;
|
||||
origState.applyData.TextureEnabled = renderstate.mTextureEnabled;
|
||||
origState.applyData.FogEnabled = renderstate.mFogEnabled;
|
||||
origState.applyData.BrightmapEnabled = renderstate.mBrightmapEnabled;
|
||||
origState.applyData.TextureClamp = renderstate.mTextureClamp;
|
||||
origState.applyData.TextureMode = renderstate.mTextureMode;
|
||||
origState.applyData.TextureModeFlags = renderstate.mTextureModeFlags;
|
||||
origState.surfaceUniforms = renderstate.mSurfaceUniforms;
|
||||
origState.material = renderstate.mMaterial;
|
||||
origState.textureMatrix.loadIdentity();
|
||||
|
||||
int applyIndex = -1;
|
||||
int depthFunc = -1;
|
||||
for (const MeshDrawCommand& cmd : mDraws)
|
||||
{
|
||||
bool apply = applyIndex != cmd.ApplyIndex;
|
||||
if (apply)
|
||||
{
|
||||
int newDepthFunc = mApplys[cmd.ApplyIndex].applyData.DepthFunc;
|
||||
if (depthFunc != newDepthFunc)
|
||||
{
|
||||
depthFunc = newDepthFunc;
|
||||
renderstate.SetDepthFunc(depthFunc);
|
||||
}
|
||||
|
||||
applyIndex = cmd.ApplyIndex;
|
||||
Apply(renderstate, mApplys[cmd.ApplyIndex]);
|
||||
}
|
||||
|
||||
#ifdef USE_MESH_VERTEX_BUFFER
|
||||
renderstate.Draw(cmd.DrawType, cmd.Start, cmd.Count, apply);
|
||||
#else
|
||||
renderstate.Draw(cmd.DrawType, pair.second + cmd.Start, cmd.Count, apply);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_MESH_VERTEX_BUFFER
|
||||
if (mVertexBuffer)
|
||||
renderstate.SetFlatVertexBuffer();
|
||||
#endif
|
||||
|
||||
for (const MeshDrawCommand& cmd : mIndexedDraws)
|
||||
{
|
||||
bool apply = applyIndex != cmd.ApplyIndex;
|
||||
if (apply)
|
||||
{
|
||||
int newDepthFunc = mApplys[cmd.ApplyIndex].applyData.DepthFunc;
|
||||
if (depthFunc != newDepthFunc)
|
||||
{
|
||||
depthFunc = newDepthFunc;
|
||||
renderstate.SetDepthFunc(depthFunc);
|
||||
}
|
||||
|
||||
applyIndex = cmd.ApplyIndex;
|
||||
Apply(renderstate, mApplys[cmd.ApplyIndex]);
|
||||
}
|
||||
renderstate.DrawIndexed(cmd.DrawType, cmd.Start, cmd.Count, apply);
|
||||
}
|
||||
|
||||
Apply(renderstate, origState);
|
||||
}
|
||||
|
||||
void Mesh::Apply(FRenderState& renderstate, const MeshApplyState& state)
|
||||
{
|
||||
renderstate.mRenderStyle = state.applyData.RenderStyle;
|
||||
renderstate.mSpecialEffect = state.applyData.SpecialEffect;
|
||||
renderstate.mTextureEnabled = state.applyData.TextureEnabled;
|
||||
renderstate.mFogEnabled = state.applyData.FogEnabled;
|
||||
renderstate.mBrightmapEnabled = state.applyData.BrightmapEnabled;
|
||||
renderstate.mTextureClamp = state.applyData.TextureClamp;
|
||||
renderstate.mTextureMode = state.applyData.TextureMode;
|
||||
renderstate.mTextureModeFlags = state.applyData.TextureModeFlags;
|
||||
renderstate.mSurfaceUniforms = state.surfaceUniforms;
|
||||
renderstate.mMaterial = state.material;
|
||||
renderstate.SetTextureMatrix(state.textureMatrix);
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "hw_meshbuilder.h"
|
||||
|
||||
class Mesh
|
||||
{
|
||||
public:
|
||||
void Draw(FRenderState& renderstate);
|
||||
|
||||
private:
|
||||
void Apply(FRenderState& renderstate, const MeshApplyState& apply);
|
||||
|
||||
TArray<MeshApplyState> mApplys;
|
||||
TArray<MeshDrawCommand> mDraws;
|
||||
TArray<MeshDrawCommand> mIndexedDraws;
|
||||
TArray<FFlatVertex> mVertices;
|
||||
std::unique_ptr<IBuffer> mVertexBuffer;
|
||||
|
||||
friend class MeshBuilder;
|
||||
};
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
#include "hw_meshbuilder.h"
|
||||
#include "hw_mesh.h"
|
||||
#include "v_video.h"
|
||||
|
||||
MeshBuilder::MeshBuilder()
|
||||
|
|
@ -79,38 +78,6 @@ void MeshBuilder::Apply()
|
|||
mDrawLists = &mSortedLists[state];
|
||||
}
|
||||
|
||||
std::unique_ptr<Mesh> MeshBuilder::Create()
|
||||
{
|
||||
if (mSortedLists.empty())
|
||||
return {};
|
||||
|
||||
auto mesh = std::make_unique<Mesh>();
|
||||
|
||||
int applyIndex = 0;
|
||||
for (auto& it : mSortedLists)
|
||||
{
|
||||
mesh->mApplys.Push(it.first);
|
||||
for (MeshDrawCommand& command : it.second.mDraws)
|
||||
{
|
||||
command.ApplyIndex = applyIndex;
|
||||
mesh->mDraws.Push(command);
|
||||
}
|
||||
for (MeshDrawCommand& command : it.second.mIndexedDraws)
|
||||
{
|
||||
command.ApplyIndex = applyIndex;
|
||||
mesh->mIndexedDraws.Push(command);
|
||||
}
|
||||
applyIndex++;
|
||||
}
|
||||
|
||||
// To do: the various mesh layers have to share the vertex buffer since some vertex allocations happen at the Process stage
|
||||
//mesh->mVertices = std::move(mVertices);
|
||||
//mVertices.Clear();
|
||||
mesh->mVertices = mVertices;
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
std::pair<FFlatVertex*, unsigned int> MeshBuilder::AllocVertices(unsigned int count)
|
||||
{
|
||||
unsigned int offset = mVertices.Reserve(count);
|
||||
|
|
|
|||
|
|
@ -105,8 +105,6 @@ public:
|
|||
void EnableStencil(bool on) override { }
|
||||
void EnableDepthTest(bool on) override { }
|
||||
|
||||
std::unique_ptr<Mesh> Create();
|
||||
|
||||
struct DrawLists
|
||||
{
|
||||
TArray<MeshDrawCommand> mDraws;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue