2024-06-10 12:31:41 -07:00
|
|
|
/* Copyright (C) 2024 Wildfire Games.
|
2023-12-02 16:30:12 -08:00
|
|
|
* This file is part of 0 A.D.
|
2009-04-18 10:00:33 -07:00
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2009-04-18 10:00:33 -07:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
2009-04-18 10:00:33 -07:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2023-12-02 16:30:12 -08:00
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
2009-04-18 10:00:33 -07:00
|
|
|
*/
|
|
|
|
|
|
2005-10-29 17:22:22 -07:00
|
|
|
#include "precompiled.h"
|
2019-01-06 13:04:01 -08:00
|
|
|
#include "renderer/InstancingModelRenderer.h"
|
2005-10-29 17:22:22 -07:00
|
|
|
|
|
|
|
|
#include "graphics/Color.h"
|
2006-02-13 06:18:20 -08:00
|
|
|
#include "graphics/LightEnv.h"
|
2005-10-29 17:22:22 -07:00
|
|
|
#include "graphics/Model.h"
|
|
|
|
|
#include "graphics/ModelDef.h"
|
2019-01-06 13:04:01 -08:00
|
|
|
#include "maths/Vector3D.h"
|
|
|
|
|
#include "maths/Vector4D.h"
|
|
|
|
|
#include "ps/CLogger.h"
|
2023-01-05 16:39:25 -08:00
|
|
|
#include "ps/containers/StaticVector.h"
|
2021-05-18 04:09:54 -07:00
|
|
|
#include "ps/CStrInternStatic.h"
|
2005-10-29 17:22:22 -07:00
|
|
|
#include "renderer/Renderer.h"
|
|
|
|
|
#include "renderer/RenderModifiers.h"
|
|
|
|
|
#include "renderer/VertexArray.h"
|
2012-10-29 06:20:21 -07:00
|
|
|
#include "third_party/mikktspace/weldmesh.h"
|
|
|
|
|
|
2005-10-29 17:22:22 -07:00
|
|
|
|
|
|
|
|
struct IModelDef : public CModelDefRPrivate
|
|
|
|
|
{
|
|
|
|
|
/// Static per-CModel vertex array
|
|
|
|
|
VertexArray m_Array;
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2012-07-23 15:49:46 -07:00
|
|
|
/// Position and normals are static
|
2005-10-29 17:22:22 -07:00
|
|
|
VertexArray::Attribute m_Position;
|
|
|
|
|
VertexArray::Attribute m_Normal;
|
2012-08-06 12:10:47 -07:00
|
|
|
VertexArray::Attribute m_Tangent;
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2012-07-23 15:49:46 -07:00
|
|
|
/// The number of UVs is determined by the model
|
2012-07-23 19:57:25 -07:00
|
|
|
std::vector<VertexArray::Attribute> m_UVs;
|
2012-07-23 15:49:46 -07:00
|
|
|
|
2023-01-05 16:39:25 -08:00
|
|
|
Renderer::Backend::IVertexInputLayout* m_VertexInputLayout = nullptr;
|
|
|
|
|
|
2005-10-29 17:22:22 -07:00
|
|
|
/// Indices are the same for all models, so share them
|
2011-03-13 11:58:09 -07:00
|
|
|
VertexIndexArray m_IndexArray;
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2024-12-09 13:47:17 -08:00
|
|
|
IModelDef(const CModelDefPtr& mdef, bool calculateTangents);
|
2005-10-29 17:22:22 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2024-12-09 13:47:17 -08:00
|
|
|
IModelDef::IModelDef(const CModelDefPtr& mdef, bool calculateTangents)
|
2024-06-10 12:31:41 -07:00
|
|
|
: m_IndexArray(Renderer::Backend::IBuffer::Usage::TRANSFER_DST),
|
|
|
|
|
m_Array(Renderer::Backend::IBuffer::Type::VERTEX, Renderer::Backend::IBuffer::Usage::TRANSFER_DST)
|
2005-10-29 17:22:22 -07:00
|
|
|
{
|
|
|
|
|
size_t numVertices = mdef->GetNumVertices();
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2022-03-08 15:28:31 -08:00
|
|
|
m_Position.format = Renderer::Backend::Format::R32G32B32_SFLOAT;
|
2005-10-29 17:22:22 -07:00
|
|
|
m_Array.AddAttribute(&m_Position);
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2022-03-08 15:28:31 -08:00
|
|
|
m_Normal.format = Renderer::Backend::Format::R32G32B32_SFLOAT;
|
2005-10-29 17:22:22 -07:00
|
|
|
m_Array.AddAttribute(&m_Normal);
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2012-07-23 19:57:25 -07:00
|
|
|
m_UVs.resize(mdef->GetNumUVsPerVertex());
|
2012-07-23 15:49:46 -07:00
|
|
|
for (size_t i = 0; i < mdef->GetNumUVsPerVertex(); i++)
|
|
|
|
|
{
|
2022-03-08 15:28:31 -08:00
|
|
|
m_UVs[i].format = Renderer::Backend::Format::R32G32_SFLOAT;
|
2012-07-23 15:49:46 -07:00
|
|
|
m_Array.AddAttribute(&m_UVs[i]);
|
|
|
|
|
}
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
if (calculateTangents)
|
2012-04-12 08:43:59 -07:00
|
|
|
{
|
2012-08-06 12:10:47 -07:00
|
|
|
// Generate tangents for the geometry:-
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2022-03-08 15:28:31 -08:00
|
|
|
m_Tangent.format = Renderer::Backend::Format::R32G32B32A32_SFLOAT;
|
2012-08-06 12:10:47 -07:00
|
|
|
m_Array.AddAttribute(&m_Tangent);
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2024-12-09 13:47:17 -08:00
|
|
|
// floats per vertex; position + normal + tangent + UV*sets
|
2012-08-06 12:10:47 -07:00
|
|
|
int numVertexAttrs = 3 + 3 + 4 + 2 * mdef->GetNumUVsPerVertex();
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
// the tangent generation can increase the number of vertices temporarily
|
|
|
|
|
// so reserve a bit more memory to avoid reallocations in GenTangents (in most cases)
|
|
|
|
|
std::vector<float> newVertices;
|
|
|
|
|
newVertices.reserve(numVertexAttrs * numVertices * 2);
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
// Generate the tangents
|
2024-12-09 13:47:17 -08:00
|
|
|
ModelRenderer::GenTangents(mdef, newVertices, false);
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
// how many vertices do we have after generating tangents?
|
|
|
|
|
int newNumVert = newVertices.size() / numVertexAttrs;
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
std::vector<int> remapTable(newNumVert);
|
|
|
|
|
std::vector<float> vertexDataOut(newNumVert * numVertexAttrs);
|
|
|
|
|
|
|
|
|
|
// re-weld the mesh to remove duplicated vertices
|
|
|
|
|
int numVertices2 = WeldMesh(&remapTable[0], &vertexDataOut[0],
|
|
|
|
|
&newVertices[0], newNumVert, numVertexAttrs);
|
|
|
|
|
|
|
|
|
|
// Copy the model data to graphics memory:-
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2022-02-18 09:33:12 -08:00
|
|
|
m_Array.SetNumberOfVertices(numVertices2);
|
2012-08-06 12:10:47 -07:00
|
|
|
m_Array.Layout();
|
|
|
|
|
|
|
|
|
|
VertexArrayIterator<CVector3D> Position = m_Position.GetIterator<CVector3D>();
|
|
|
|
|
VertexArrayIterator<CVector3D> Normal = m_Normal.GetIterator<CVector3D>();
|
|
|
|
|
VertexArrayIterator<CVector4D> Tangent = m_Tangent.GetIterator<CVector4D>();
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
// copy everything into the vertex array
|
|
|
|
|
for (int i = 0; i < numVertices2; i++)
|
|
|
|
|
{
|
|
|
|
|
int q = numVertexAttrs * i;
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
Position[i] = CVector3D(vertexDataOut[q + 0], vertexDataOut[q + 1], vertexDataOut[q + 2]);
|
2012-10-29 06:20:21 -07:00
|
|
|
q += 3;
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-10-29 06:20:21 -07:00
|
|
|
Normal[i] = CVector3D(vertexDataOut[q + 0], vertexDataOut[q + 1], vertexDataOut[q + 2]);
|
|
|
|
|
q += 3;
|
2012-08-06 12:10:47 -07:00
|
|
|
|
2016-11-23 05:02:58 -08:00
|
|
|
Tangent[i] = CVector4D(vertexDataOut[q + 0], vertexDataOut[q + 1], vertexDataOut[q + 2],
|
2012-10-29 06:20:21 -07:00
|
|
|
vertexDataOut[q + 3]);
|
|
|
|
|
q += 4;
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
for (size_t j = 0; j < mdef->GetNumUVsPerVertex(); j++)
|
|
|
|
|
{
|
|
|
|
|
VertexArrayIterator<float[2]> UVit = m_UVs[j].GetIterator<float[2]>();
|
2012-10-29 06:20:21 -07:00
|
|
|
UVit[i][0] = vertexDataOut[q + 0 + 2 * j];
|
|
|
|
|
UVit[i][1] = vertexDataOut[q + 1 + 2 * j];
|
2012-08-06 12:10:47 -07:00
|
|
|
}
|
|
|
|
|
}
|
2012-04-12 08:43:59 -07:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
// upload vertex data
|
|
|
|
|
m_Array.Upload();
|
|
|
|
|
m_Array.FreeBackingStore();
|
|
|
|
|
|
2022-02-18 09:33:12 -08:00
|
|
|
m_IndexArray.SetNumberOfVertices(mdef->GetNumFaces() * 3);
|
2012-08-06 12:10:47 -07:00
|
|
|
m_IndexArray.Layout();
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
VertexArrayIterator<u16> Indices = m_IndexArray.GetIterator();
|
2016-11-23 06:09:58 -08:00
|
|
|
|
|
|
|
|
size_t idxidx = 0;
|
2012-08-06 12:10:47 -07:00
|
|
|
|
|
|
|
|
// reindex geometry and upload index
|
2016-11-23 05:02:58 -08:00
|
|
|
for (size_t j = 0; j < mdef->GetNumFaces(); ++j)
|
2016-11-23 06:09:58 -08:00
|
|
|
{
|
2012-08-06 12:10:47 -07:00
|
|
|
Indices[idxidx++] = remapTable[j * 3 + 0];
|
|
|
|
|
Indices[idxidx++] = remapTable[j * 3 + 1];
|
|
|
|
|
Indices[idxidx++] = remapTable[j * 3 + 2];
|
|
|
|
|
}
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
m_IndexArray.Upload();
|
|
|
|
|
m_IndexArray.FreeBackingStore();
|
2012-04-12 08:43:59 -07:00
|
|
|
}
|
2012-08-06 12:10:47 -07:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Upload model without calculating tangents:-
|
2016-11-23 06:09:58 -08:00
|
|
|
|
2022-02-18 09:33:12 -08:00
|
|
|
m_Array.SetNumberOfVertices(numVertices);
|
2012-08-06 12:10:47 -07:00
|
|
|
m_Array.Layout();
|
2005-10-29 17:22:22 -07:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
VertexArrayIterator<CVector3D> Position = m_Position.GetIterator<CVector3D>();
|
|
|
|
|
VertexArrayIterator<CVector3D> Normal = m_Normal.GetIterator<CVector3D>();
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
ModelRenderer::CopyPositionAndNormals(mdef, Position, Normal);
|
2012-07-23 15:49:46 -07:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
for (size_t i = 0; i < mdef->GetNumUVsPerVertex(); i++)
|
|
|
|
|
{
|
|
|
|
|
VertexArrayIterator<float[2]> UVit = m_UVs[i].GetIterator<float[2]>();
|
|
|
|
|
ModelRenderer::BuildUV(mdef, UVit, i);
|
|
|
|
|
}
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2012-08-06 12:10:47 -07:00
|
|
|
m_Array.Upload();
|
|
|
|
|
m_Array.FreeBackingStore();
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2022-02-18 09:33:12 -08:00
|
|
|
m_IndexArray.SetNumberOfVertices(mdef->GetNumFaces()*3);
|
2012-08-06 12:10:47 -07:00
|
|
|
m_IndexArray.Layout();
|
|
|
|
|
ModelRenderer::BuildIndices(mdef, m_IndexArray.GetIterator());
|
|
|
|
|
m_IndexArray.Upload();
|
|
|
|
|
m_IndexArray.FreeBackingStore();
|
|
|
|
|
}
|
2005-10-29 17:22:22 -07:00
|
|
|
|
2023-01-05 16:39:25 -08:00
|
|
|
const uint32_t stride = m_Array.GetStride();
|
|
|
|
|
constexpr size_t MAX_UV = 2;
|
|
|
|
|
|
|
|
|
|
PS::StaticVector<Renderer::Backend::SVertexAttributeFormat, 5 + MAX_UV> attributes{
|
|
|
|
|
{Renderer::Backend::VertexAttributeStream::POSITION,
|
|
|
|
|
m_Position.format, m_Position.offset, stride,
|
|
|
|
|
Renderer::Backend::VertexAttributeRate::PER_VERTEX, 0},
|
|
|
|
|
{Renderer::Backend::VertexAttributeStream::NORMAL,
|
|
|
|
|
m_Normal.format, m_Normal.offset, stride,
|
|
|
|
|
Renderer::Backend::VertexAttributeRate::PER_VERTEX, 0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (size_t uv = 0; uv < std::min(MAX_UV, mdef->GetNumUVsPerVertex()); ++uv)
|
|
|
|
|
{
|
|
|
|
|
const Renderer::Backend::VertexAttributeStream stream =
|
|
|
|
|
static_cast<Renderer::Backend::VertexAttributeStream>(
|
|
|
|
|
static_cast<int>(Renderer::Backend::VertexAttributeStream::UV0) + uv);
|
|
|
|
|
attributes.push_back({
|
|
|
|
|
stream, m_UVs[uv].format, m_UVs[uv].offset, stride,
|
|
|
|
|
Renderer::Backend::VertexAttributeRate::PER_VERTEX, 0});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (calculateTangents)
|
|
|
|
|
{
|
|
|
|
|
attributes.push_back({
|
2024-12-09 13:47:17 -08:00
|
|
|
Renderer::Backend::VertexAttributeStream::UV2,
|
2023-01-05 16:39:25 -08:00
|
|
|
m_Tangent.format, m_Tangent.offset, stride,
|
|
|
|
|
Renderer::Backend::VertexAttributeRate::PER_VERTEX, 0});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_VertexInputLayout = g_Renderer.GetVertexInputLayout({attributes.begin(), attributes.end()});
|
|
|
|
|
}
|
2005-10-29 17:22:22 -07:00
|
|
|
|
|
|
|
|
struct InstancingModelRendererInternals
|
|
|
|
|
{
|
2012-08-06 12:10:47 -07:00
|
|
|
bool calculateTangents;
|
2012-04-12 08:43:59 -07:00
|
|
|
|
2005-10-29 17:22:22 -07:00
|
|
|
/// Previously prepared modeldef
|
|
|
|
|
IModelDef* imodeldef;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Construction and Destruction
|
2024-12-09 13:47:17 -08:00
|
|
|
InstancingModelRenderer::InstancingModelRenderer(bool calculateTangents)
|
2005-10-29 17:22:22 -07:00
|
|
|
{
|
|
|
|
|
m = new InstancingModelRendererInternals;
|
2012-08-06 12:10:47 -07:00
|
|
|
m->calculateTangents = calculateTangents;
|
2005-11-05 15:15:23 -08:00
|
|
|
m->imodeldef = 0;
|
2005-10-29 17:22:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InstancingModelRenderer::~InstancingModelRenderer()
|
|
|
|
|
{
|
|
|
|
|
delete m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Build modeldef data if necessary - we have no per-CModel data
|
2012-04-03 11:44:46 -07:00
|
|
|
CModelRData* InstancingModelRenderer::CreateModelData(const void* key, CModel* model)
|
2005-10-29 17:22:22 -07:00
|
|
|
{
|
|
|
|
|
CModelDefPtr mdef = model->GetModelDef();
|
|
|
|
|
IModelDef* imodeldef = (IModelDef*)mdef->GetRenderData(m);
|
|
|
|
|
|
2024-12-09 13:47:17 -08:00
|
|
|
ENSURE(!model->IsSkinned());
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2005-10-29 17:22:22 -07:00
|
|
|
if (!imodeldef)
|
|
|
|
|
{
|
2024-12-09 13:47:17 -08:00
|
|
|
imodeldef = new IModelDef(mdef, m->calculateTangents);
|
2005-10-29 17:22:22 -07:00
|
|
|
mdef->SetRenderData(m, imodeldef);
|
|
|
|
|
}
|
2006-02-13 06:18:20 -08:00
|
|
|
|
2012-04-03 11:44:46 -07:00
|
|
|
return new CModelRData(key);
|
2005-10-29 17:22:22 -07:00
|
|
|
}
|
|
|
|
|
|
2024-11-06 06:41:19 -08:00
|
|
|
void InstancingModelRenderer::UpdateModelsData(
|
|
|
|
|
Renderer::Backend::IDeviceCommandContext* UNUSED(deviceCommandContext),
|
|
|
|
|
PS::span<CModel*> UNUSED(models))
|
2005-10-29 17:22:22 -07:00
|
|
|
{
|
|
|
|
|
// We have no per-CModel data
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-06 06:41:19 -08:00
|
|
|
void InstancingModelRenderer::UploadModelsData(
|
2022-10-29 16:20:04 -07:00
|
|
|
Renderer::Backend::IDeviceCommandContext* UNUSED(deviceCommandContext),
|
2024-11-06 06:41:19 -08:00
|
|
|
PS::span<CModel*> UNUSED(models))
|
2011-03-26 13:17:21 -07:00
|
|
|
{
|
2022-10-29 16:20:04 -07:00
|
|
|
// Data uploaded once during creation as we don't update it dynamically.
|
2011-03-26 13:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
2011-04-06 15:02:05 -07:00
|
|
|
// Prepare UV coordinates for this modeldef
|
2022-02-18 09:33:12 -08:00
|
|
|
void InstancingModelRenderer::PrepareModelDef(
|
2022-05-08 15:02:46 -07:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2022-05-02 13:57:22 -07:00
|
|
|
const CModelDef& def)
|
2011-03-26 13:17:21 -07:00
|
|
|
{
|
2012-04-03 11:44:46 -07:00
|
|
|
m->imodeldef = (IModelDef*)def.GetRenderData(m);
|
2011-04-30 06:01:45 -07:00
|
|
|
ENSURE(m->imodeldef);
|
2022-04-23 13:11:14 -07:00
|
|
|
|
2023-01-05 16:39:25 -08:00
|
|
|
deviceCommandContext->SetVertexInputLayout(m->imodeldef->m_VertexInputLayout);
|
|
|
|
|
|
2022-03-02 23:09:59 -08:00
|
|
|
deviceCommandContext->SetIndexBuffer(m->imodeldef->m_IndexArray.GetBuffer());
|
2011-03-26 13:17:21 -07:00
|
|
|
|
2022-04-23 13:11:14 -07:00
|
|
|
const uint32_t stride = m->imodeldef->m_Array.GetStride();
|
|
|
|
|
const uint32_t firstVertexOffset = m->imodeldef->m_Array.GetOffset() * stride;
|
|
|
|
|
|
2022-10-09 04:47:34 -07:00
|
|
|
deviceCommandContext->SetVertexBuffer(
|
|
|
|
|
0, m->imodeldef->m_Array.GetBuffer(), firstVertexOffset);
|
2011-03-26 13:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
2011-04-06 15:02:05 -07:00
|
|
|
|
|
|
|
|
// Render one model
|
2022-02-18 09:33:12 -08:00
|
|
|
void InstancingModelRenderer::RenderModel(
|
2022-05-08 15:02:46 -07:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2024-12-09 13:47:17 -08:00
|
|
|
Renderer::Backend::IShaderProgram* UNUSED(shader), CModel* model, CModelRData* UNUSED(data))
|
2011-03-26 13:17:21 -07:00
|
|
|
{
|
2020-01-26 13:32:12 -08:00
|
|
|
const CModelDefPtr& mdldef = model->GetModelDef();
|
2011-03-26 13:17:21 -07:00
|
|
|
|
2022-03-02 23:09:59 -08:00
|
|
|
// Render the lot.
|
|
|
|
|
const size_t numberOfFaces = mdldef->GetNumFaces();
|
2011-03-26 13:17:21 -07:00
|
|
|
|
2022-03-02 23:09:59 -08:00
|
|
|
deviceCommandContext->DrawIndexedInRange(
|
|
|
|
|
m->imodeldef->m_IndexArray.GetOffset(), numberOfFaces * 3, 0, m->imodeldef->m_Array.GetNumberOfVertices() - 1);
|
2011-03-26 13:17:21 -07:00
|
|
|
|
2022-03-02 23:09:59 -08:00
|
|
|
// Bump stats.
|
2011-03-26 13:17:21 -07:00
|
|
|
g_Renderer.m_Stats.m_DrawCalls++;
|
2022-03-02 23:09:59 -08:00
|
|
|
g_Renderer.m_Stats.m_ModelTris += numberOfFaces;
|
2011-03-26 13:17:21 -07:00
|
|
|
}
|