Renamed FillInstancingData to SetInstancingData
Former-commit-id: 081209d333fc8884a453e9052acfaac653d3133b
This commit is contained in:
parent
200f46b442
commit
086408f95f
|
|
@ -43,8 +43,6 @@ class NAZARA_API NzRenderer
|
||||||
|
|
||||||
static void Enable(nzRendererParameter parameter, bool enable);
|
static void Enable(nzRendererParameter parameter, bool enable);
|
||||||
|
|
||||||
static void FillInstancingBuffer(const InstancingData* instancingData, unsigned int instanceCount);
|
|
||||||
|
|
||||||
static void Flush();
|
static void Flush();
|
||||||
|
|
||||||
static float GetLineWidth();
|
static float GetLineWidth();
|
||||||
|
|
@ -74,6 +72,7 @@ class NAZARA_API NzRenderer
|
||||||
static void SetFaceCulling(nzFaceCulling cullingMode);
|
static void SetFaceCulling(nzFaceCulling cullingMode);
|
||||||
static void SetFaceFilling(nzFaceFilling fillingMode);
|
static void SetFaceFilling(nzFaceFilling fillingMode);
|
||||||
static bool SetIndexBuffer(const NzIndexBuffer* indexBuffer);
|
static bool SetIndexBuffer(const NzIndexBuffer* indexBuffer);
|
||||||
|
static void SetInstancingData(const InstancingData* instancingData, unsigned int instanceCount);
|
||||||
static void SetLineWidth(float size);
|
static void SetLineWidth(float size);
|
||||||
static void SetMatrix(nzMatrixType type, const NzMatrix4f& matrix);
|
static void SetMatrix(nzMatrixType type, const NzMatrix4f& matrix);
|
||||||
static void SetPointSize(float size);
|
static void SetPointSize(float size);
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ void NzScene::Draw()
|
||||||
m_impl->instancingData[count++].worldMatrix = matrix;
|
m_impl->instancingData[count++].worldMatrix = matrix;
|
||||||
if (count == m_impl->instancingData.size())
|
if (count == m_impl->instancingData.size())
|
||||||
{
|
{
|
||||||
NzRenderer::FillInstancingBuffer(&m_impl->instancingData[0], count);
|
NzRenderer::SetInstancingData(&m_impl->instancingData[0], count);
|
||||||
instancedDraw(count, primitiveType, 0, indexCount);
|
instancedDraw(count, primitiveType, 0, indexCount);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
@ -270,7 +270,7 @@ void NzScene::Draw()
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
NzRenderer::FillInstancingBuffer(&m_impl->instancingData[0], count);
|
NzRenderer::SetInstancingData(&m_impl->instancingData[0], count);
|
||||||
instancedDraw(count, primitiveType, 0, indexCount);
|
instancedDraw(count, primitiveType, 0, indexCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -344,40 +344,16 @@ void NzRenderer::Enable(nzRendererParameter parameter, bool enable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NzRenderer::FillInstancingBuffer(const NzRenderer::InstancingData* instancingData, unsigned int instanceCount)
|
void NzRenderer::Flush()
|
||||||
{
|
{
|
||||||
#if NAZARA_RENDERER_SAFE
|
#ifdef NAZARA_DEBUG
|
||||||
if (!s_capabilities[nzRendererCap_Instancing])
|
if (NzContext::GetCurrent() == nullptr)
|
||||||
{
|
{
|
||||||
NazaraError("Instancing not supported");
|
NazaraError("No active context");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!instancingData)
|
|
||||||
{
|
|
||||||
NazaraError("Instancing data must be valid");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instanceCount == 0)
|
|
||||||
{
|
|
||||||
NazaraError("Instance count must be over 0");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instanceCount > NAZARA_RENDERER_INSTANCING_MAX)
|
|
||||||
{
|
|
||||||
NazaraError("Instance count is over maximum instance count (" + NzString::Number(instanceCount) + " >= " + NzString::Number(NAZARA_RENDERER_INSTANCING_MAX) + ')');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!s_instancingBuffer->Fill(instancingData, 0, instanceCount, true))
|
|
||||||
NazaraError("Failed to fill instancing buffer");
|
|
||||||
}
|
|
||||||
|
|
||||||
void NzRenderer::Flush()
|
|
||||||
{
|
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -846,6 +822,38 @@ bool NzRenderer::SetIndexBuffer(const NzIndexBuffer* indexBuffer)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NzRenderer::SetInstancingData(const NzRenderer::InstancingData* instancingData, unsigned int instanceCount)
|
||||||
|
{
|
||||||
|
#if NAZARA_RENDERER_SAFE
|
||||||
|
if (!s_capabilities[nzRendererCap_Instancing])
|
||||||
|
{
|
||||||
|
NazaraError("Instancing not supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!instancingData)
|
||||||
|
{
|
||||||
|
NazaraError("Instancing data must be valid");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instanceCount == 0)
|
||||||
|
{
|
||||||
|
NazaraError("Instance count must be over 0");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instanceCount > NAZARA_RENDERER_INSTANCING_MAX)
|
||||||
|
{
|
||||||
|
NazaraError("Instance count is over maximum instance count (" + NzString::Number(instanceCount) + " >= " + NzString::Number(NAZARA_RENDERER_INSTANCING_MAX) + ')');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!s_instancingBuffer->Fill(instancingData, 0, instanceCount, true))
|
||||||
|
NazaraError("Failed to fill instancing buffer");
|
||||||
|
}
|
||||||
|
|
||||||
void NzRenderer::SetLineWidth(float width)
|
void NzRenderer::SetLineWidth(float width)
|
||||||
{
|
{
|
||||||
#ifdef NAZARA_DEBUG
|
#ifdef NAZARA_DEBUG
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue