Merge remote-tracking branch 'refs/remotes/origin/master' into gui
This commit is contained in:
@@ -159,13 +159,13 @@ namespace Nz
|
||||
instanceBuffer->SetVertexDeclaration(VertexDeclaration::Get(VertexLayout_Matrix4));
|
||||
|
||||
const Matrix4f* instanceMatrices = &instances[0];
|
||||
unsigned int instanceCount = instances.size();
|
||||
unsigned int maxInstanceCount = instanceBuffer->GetVertexCount(); // The number of matrices that can be hold in the buffer
|
||||
std::size_t instanceCount = instances.size();
|
||||
std::size_t maxInstanceCount = instanceBuffer->GetVertexCount(); // The number of matrices that can be hold in the buffer
|
||||
|
||||
while (instanceCount > 0)
|
||||
{
|
||||
// We compute the number of instances that we will be able to show this time (Depending on the instance buffer size)
|
||||
unsigned int renderedInstanceCount = std::min(instanceCount, maxInstanceCount);
|
||||
std::size_t renderedInstanceCount = std::min(instanceCount, maxInstanceCount);
|
||||
instanceCount -= renderedInstanceCount;
|
||||
|
||||
// We fill the instancing buffer with our world matrices
|
||||
|
||||
@@ -267,13 +267,13 @@ namespace Nz
|
||||
const Texture* overlay = overlayIt.first;
|
||||
auto& spriteChainVector = overlayIt.second.spriteChains;
|
||||
|
||||
unsigned int spriteChainCount = spriteChainVector.size();
|
||||
std::size_t spriteChainCount = spriteChainVector.size();
|
||||
if (spriteChainCount > 0)
|
||||
{
|
||||
Renderer::SetTexture(overlayUnit, (overlay) ? overlay : &m_whiteTexture);
|
||||
|
||||
unsigned int spriteChain = 0; // Which chain of sprites are we treating
|
||||
unsigned int spriteChainOffset = 0; // Where was the last offset where we stopped in the last chain
|
||||
std::size_t spriteChain = 0; // Which chain of sprites are we treating
|
||||
std::size_t spriteChainOffset = 0; // Where was the last offset where we stopped in the last chain
|
||||
|
||||
do
|
||||
{
|
||||
@@ -281,13 +281,13 @@ namespace Nz
|
||||
BufferMapper<VertexBuffer> vertexMapper(m_spriteBuffer, BufferAccess_DiscardAndWrite);
|
||||
VertexStruct_XYZ_Color_UV* vertices = static_cast<VertexStruct_XYZ_Color_UV*>(vertexMapper.GetPointer());
|
||||
|
||||
unsigned int spriteCount = 0;
|
||||
unsigned int maxSpriteCount = std::min(s_maxQuads, m_spriteBuffer.GetVertexCount() / 4);
|
||||
std::size_t spriteCount = 0;
|
||||
std::size_t maxSpriteCount = std::min(s_maxQuads, m_spriteBuffer.GetVertexCount() / 4);
|
||||
|
||||
do
|
||||
{
|
||||
ForwardRenderQueue::SpriteChain_XYZ_Color_UV& currentChain = spriteChainVector[spriteChain];
|
||||
unsigned int count = std::min(maxSpriteCount - spriteCount, currentChain.spriteCount - spriteChainOffset);
|
||||
std::size_t count = std::min(maxSpriteCount - spriteCount, currentChain.spriteCount - spriteChainOffset);
|
||||
|
||||
std::memcpy(vertices, currentChain.vertices + spriteChainOffset * 4, 4 * count * sizeof(VertexStruct_XYZ_Color_UV));
|
||||
vertices += count * 4;
|
||||
@@ -373,17 +373,17 @@ namespace Nz
|
||||
auto& entry = matIt.second;
|
||||
auto& billboardVector = entry.billboards;
|
||||
|
||||
unsigned int billboardCount = billboardVector.size();
|
||||
std::size_t billboardCount = billboardVector.size();
|
||||
if (billboardCount > 0)
|
||||
{
|
||||
// We begin to apply the material (and get the shader activated doing so)
|
||||
material->Apply(pipelineInstance);
|
||||
|
||||
const ForwardRenderQueue::BillboardData* data = &billboardVector[0];
|
||||
unsigned int maxBillboardPerDraw = instanceBuffer->GetVertexCount();
|
||||
std::size_t maxBillboardPerDraw = instanceBuffer->GetVertexCount();
|
||||
do
|
||||
{
|
||||
unsigned int renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
std::size_t renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
billboardCount -= renderedBillboardCount;
|
||||
|
||||
instanceBuffer->Fill(data, 0, renderedBillboardCount, true);
|
||||
@@ -435,12 +435,12 @@ namespace Nz
|
||||
auto& billboardVector = entry.billboards;
|
||||
|
||||
const ForwardRenderQueue::BillboardData* data = &billboardVector[0];
|
||||
unsigned int maxBillboardPerDraw = std::min(s_maxQuads, m_billboardPointBuffer.GetVertexCount() / 4);
|
||||
std::size_t maxBillboardPerDraw = std::min(s_maxQuads, m_billboardPointBuffer.GetVertexCount() / 4);
|
||||
|
||||
unsigned int billboardCount = billboardVector.size();
|
||||
std::size_t billboardCount = billboardVector.size();
|
||||
do
|
||||
{
|
||||
unsigned int renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
std::size_t renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
billboardCount -= renderedBillboardCount;
|
||||
|
||||
BufferMapper<VertexBuffer> vertexMapper(m_billboardPointBuffer, BufferAccess_DiscardAndWrite, 0, renderedBillboardCount * 4);
|
||||
@@ -584,13 +584,13 @@ namespace Nz
|
||||
instanceBuffer->SetVertexDeclaration(VertexDeclaration::Get(VertexLayout_Matrix4));
|
||||
|
||||
const Matrix4f* instanceMatrices = &instances[0];
|
||||
unsigned int instanceCount = instances.size();
|
||||
unsigned int maxInstanceCount = instanceBuffer->GetVertexCount(); // Maximum number of instance in one batch
|
||||
std::size_t instanceCount = instances.size();
|
||||
std::size_t maxInstanceCount = instanceBuffer->GetVertexCount(); // Maximum number of instance in one batch
|
||||
|
||||
while (instanceCount > 0)
|
||||
{
|
||||
// We compute the number of instances that we will be able to draw this time (depending on the instancing buffer size)
|
||||
unsigned int renderedInstanceCount = std::min(instanceCount, maxInstanceCount);
|
||||
std::size_t renderedInstanceCount = std::min(instanceCount, maxInstanceCount);
|
||||
instanceCount -= renderedInstanceCount;
|
||||
|
||||
// We fill the instancing buffer with our world matrices
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace Nz
|
||||
auto& transparentModelData = currentLayer.transparentModelData;
|
||||
|
||||
// The material is transparent, we must draw this mesh using another way (after the rendering of opages objects while sorting them)
|
||||
unsigned int index = transparentModelData.size();
|
||||
std::size_t index = transparentModelData.size();
|
||||
transparentModelData.resize(index+1);
|
||||
|
||||
TransparentModelData& data = transparentModelData.back();
|
||||
@@ -527,6 +527,24 @@ namespace Nz
|
||||
layers.erase(it++);
|
||||
else
|
||||
{
|
||||
for (auto& pipelinePair : layer.billboards)
|
||||
{
|
||||
auto& pipelineEntry = pipelinePair.second;
|
||||
|
||||
if (pipelineEntry.enabled)
|
||||
{
|
||||
for (auto& matIt : pipelinePair.second.materialMap)
|
||||
{
|
||||
auto& entry = matIt.second;
|
||||
auto& billboardVector = entry.billboards;
|
||||
|
||||
billboardVector.clear();
|
||||
}
|
||||
}
|
||||
|
||||
pipelineEntry.enabled = false;
|
||||
}
|
||||
|
||||
for (auto& pipelinePair : layer.basicSprites)
|
||||
{
|
||||
auto& pipelineEntry = pipelinePair.second;
|
||||
@@ -603,7 +621,7 @@ namespace Nz
|
||||
{
|
||||
Layer& layer = pair.second;
|
||||
|
||||
std::sort(layer.transparentModels.begin(), layer.transparentModels.end(), [&layer, &nearPlane, &viewerNormal] (unsigned int index1, unsigned int index2)
|
||||
std::sort(layer.transparentModels.begin(), layer.transparentModels.end(), [&layer, &nearPlane, &viewerNormal] (std::size_t index1, std::size_t index2)
|
||||
{
|
||||
const Spheref& sphere1 = layer.transparentModelData[index1].squaredBoundingSphere;
|
||||
const Spheref& sphere2 = layer.transparentModelData[index2].squaredBoundingSphere;
|
||||
@@ -672,7 +690,7 @@ namespace Nz
|
||||
BatchedBillboardEntry& entry = it->second;
|
||||
|
||||
auto& billboardVector = entry.billboards;
|
||||
unsigned int prevSize = billboardVector.size();
|
||||
std::size_t prevSize = billboardVector.size();
|
||||
billboardVector.resize(prevSize + count);
|
||||
|
||||
return &billboardVector[prevSize];
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace Nz
|
||||
Vector2f uv;
|
||||
};
|
||||
|
||||
unsigned int s_maxQuads = std::numeric_limits<UInt16>::max() / 6;
|
||||
unsigned int s_vertexBufferSize = 4 * 1024 * 1024; // 4 MiB
|
||||
std::size_t s_maxQuads = std::numeric_limits<UInt16>::max() / 6;
|
||||
std::size_t s_vertexBufferSize = 4 * 1024 * 1024; // 4 MiB
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -347,13 +347,13 @@ namespace Nz
|
||||
const Texture* overlay = overlayIt.first;
|
||||
auto& spriteChainVector = overlayIt.second.spriteChains;
|
||||
|
||||
unsigned int spriteChainCount = spriteChainVector.size();
|
||||
std::size_t spriteChainCount = spriteChainVector.size();
|
||||
if (spriteChainCount > 0)
|
||||
{
|
||||
Renderer::SetTexture(overlayUnit, (overlay) ? overlay : &m_whiteTexture);
|
||||
|
||||
unsigned int spriteChain = 0; // Which chain of sprites are we treating
|
||||
unsigned int spriteChainOffset = 0; // Where was the last offset where we stopped in the last chain
|
||||
std::size_t spriteChain = 0; // Which chain of sprites are we treating
|
||||
std::size_t spriteChainOffset = 0; // Where was the last offset where we stopped in the last chain
|
||||
|
||||
do
|
||||
{
|
||||
@@ -361,13 +361,13 @@ namespace Nz
|
||||
BufferMapper<VertexBuffer> vertexMapper(m_spriteBuffer, BufferAccess_DiscardAndWrite);
|
||||
VertexStruct_XYZ_Color_UV* vertices = static_cast<VertexStruct_XYZ_Color_UV*>(vertexMapper.GetPointer());
|
||||
|
||||
unsigned int spriteCount = 0;
|
||||
unsigned int maxSpriteCount = std::min(s_maxQuads, m_spriteBuffer.GetVertexCount() / 4);
|
||||
std::size_t spriteCount = 0;
|
||||
std::size_t maxSpriteCount = std::min<std::size_t>(s_maxQuads, m_spriteBuffer.GetVertexCount() / 4);
|
||||
|
||||
do
|
||||
{
|
||||
ForwardRenderQueue::SpriteChain_XYZ_Color_UV& currentChain = spriteChainVector[spriteChain];
|
||||
unsigned int count = std::min(maxSpriteCount - spriteCount, currentChain.spriteCount - spriteChainOffset);
|
||||
std::size_t count = std::min(maxSpriteCount - spriteCount, currentChain.spriteCount - spriteChainOffset);
|
||||
|
||||
std::memcpy(vertices, currentChain.vertices + spriteChainOffset * 4, 4 * count * sizeof(VertexStruct_XYZ_Color_UV));
|
||||
vertices += count * 4;
|
||||
@@ -450,17 +450,17 @@ namespace Nz
|
||||
auto& entry = matIt.second;
|
||||
auto& billboardVector = entry.billboards;
|
||||
|
||||
unsigned int billboardCount = billboardVector.size();
|
||||
std::size_t billboardCount = billboardVector.size();
|
||||
if (billboardCount > 0)
|
||||
{
|
||||
// We begin to apply the material (and get the shader activated doing so)
|
||||
material->Apply(pipelineInstance);
|
||||
|
||||
const ForwardRenderQueue::BillboardData* data = &billboardVector[0];
|
||||
unsigned int maxBillboardPerDraw = instanceBuffer->GetVertexCount();
|
||||
std::size_t maxBillboardPerDraw = instanceBuffer->GetVertexCount();
|
||||
do
|
||||
{
|
||||
unsigned int renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
std::size_t renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
billboardCount -= renderedBillboardCount;
|
||||
|
||||
instanceBuffer->Fill(data, 0, renderedBillboardCount, true);
|
||||
@@ -512,12 +512,12 @@ namespace Nz
|
||||
auto& billboardVector = entry.billboards;
|
||||
|
||||
const ForwardRenderQueue::BillboardData* data = &billboardVector[0];
|
||||
unsigned int maxBillboardPerDraw = std::min(s_maxQuads, m_billboardPointBuffer.GetVertexCount() / 4);
|
||||
std::size_t maxBillboardPerDraw = std::min<std::size_t>(s_maxQuads, m_billboardPointBuffer.GetVertexCount() / 4);
|
||||
|
||||
unsigned int billboardCount = billboardVector.size();
|
||||
std::size_t billboardCount = billboardVector.size();
|
||||
do
|
||||
{
|
||||
unsigned int renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
std::size_t renderedBillboardCount = std::min(billboardCount, maxBillboardPerDraw);
|
||||
billboardCount -= renderedBillboardCount;
|
||||
|
||||
BufferMapper<VertexBuffer> vertexMapper(m_billboardPointBuffer, BufferAccess_DiscardAndWrite, 0, renderedBillboardCount * 4);
|
||||
@@ -561,8 +561,6 @@ namespace Nz
|
||||
Renderer::DrawIndexedPrimitives(PrimitiveMode_TriangleList, 0, renderedBillboardCount * 6);
|
||||
}
|
||||
while (billboardCount > 0);
|
||||
|
||||
billboardVector.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -666,16 +664,16 @@ namespace Nz
|
||||
|
||||
// With instancing, impossible to select the lights for each object
|
||||
// So, it's only activated for directional lights
|
||||
unsigned int lightCount = m_renderQueue.directionalLights.size();
|
||||
unsigned int lightIndex = 0;
|
||||
std::size_t lightCount = m_renderQueue.directionalLights.size();
|
||||
std::size_t lightIndex = 0;
|
||||
RendererComparison oldDepthFunc = Renderer::GetDepthFunc();
|
||||
|
||||
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount - 1) / NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
|
||||
for (unsigned int pass = 0; pass < passCount; ++pass)
|
||||
std::size_t passCount = (lightCount == 0) ? 1 : (lightCount - 1) / NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
|
||||
for (std::size_t pass = 0; pass < passCount; ++pass)
|
||||
{
|
||||
if (shaderUniforms->hasLightUniforms)
|
||||
{
|
||||
unsigned int renderedLightCount = std::min(lightCount, NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
|
||||
std::size_t renderedLightCount = std::min<std::size_t>(lightCount, NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS);
|
||||
lightCount -= renderedLightCount;
|
||||
|
||||
if (pass == 1)
|
||||
@@ -690,18 +688,18 @@ namespace Nz
|
||||
}
|
||||
|
||||
// Sends the uniforms
|
||||
for (unsigned int i = 0; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||
for (std::size_t i = 0; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||
SendLightUniforms(shader, shaderUniforms->lightUniforms, lightIndex++, shaderUniforms->lightOffset * i, freeTextureUnit + i);
|
||||
}
|
||||
|
||||
const Matrix4f* instanceMatrices = &instances[0];
|
||||
unsigned int instanceCount = instances.size();
|
||||
unsigned int maxInstanceCount = instanceBuffer->GetVertexCount(); // Maximum number of instance in one batch
|
||||
std::size_t instanceCount = instances.size();
|
||||
std::size_t maxInstanceCount = instanceBuffer->GetVertexCount(); // Maximum number of instance in one batch
|
||||
|
||||
while (instanceCount > 0)
|
||||
{
|
||||
// We compute the number of instances that we will be able to draw this time (depending on the instancing buffer size)
|
||||
unsigned int renderedInstanceCount = std::min(instanceCount, maxInstanceCount);
|
||||
std::size_t renderedInstanceCount = std::min(instanceCount, maxInstanceCount);
|
||||
instanceCount -= renderedInstanceCount;
|
||||
|
||||
// We fill the instancing buffer with our world matrices
|
||||
@@ -726,16 +724,16 @@ namespace Nz
|
||||
// Choose the lights depending on an object position and apparent radius
|
||||
ChooseLights(Spheref(matrix.GetTranslation() + squaredBoundingSphere.GetPosition(), squaredBoundingSphere.radius));
|
||||
|
||||
unsigned int lightCount = m_lights.size();
|
||||
std::size_t lightCount = m_lights.size();
|
||||
|
||||
Renderer::SetMatrix(MatrixType_World, matrix);
|
||||
unsigned int lightIndex = 0;
|
||||
std::size_t lightIndex = 0;
|
||||
RendererComparison oldDepthFunc = Renderer::GetDepthFunc(); // In the case where we have to change it
|
||||
|
||||
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount - 1) / NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
|
||||
for (unsigned int pass = 0; pass < passCount; ++pass)
|
||||
std::size_t passCount = (lightCount == 0) ? 1 : (lightCount - 1) / NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
|
||||
for (std::size_t pass = 0; pass < passCount; ++pass)
|
||||
{
|
||||
lightCount -= std::min(lightCount, NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
|
||||
lightCount -= std::min<std::size_t>(lightCount, NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS);
|
||||
|
||||
if (pass == 1)
|
||||
{
|
||||
@@ -749,7 +747,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
// Sends the light uniforms to the shader
|
||||
for (unsigned int i = 0; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||
for (std::size_t i = 0; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||
SendLightUniforms(shader, shaderUniforms->lightUniforms, lightIndex++, shaderUniforms->lightOffset*i, freeTextureUnit + i);
|
||||
|
||||
// And we draw
|
||||
@@ -772,7 +770,6 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
}
|
||||
instances.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -835,7 +832,7 @@ namespace Nz
|
||||
{
|
||||
lightCount = std::min(m_renderQueue.directionalLights.size(), static_cast<decltype(m_renderQueue.directionalLights.size())>(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS));
|
||||
|
||||
for (unsigned int i = 0; i < lightCount; ++i)
|
||||
for (std::size_t i = 0; i < lightCount; ++i)
|
||||
SendLightUniforms(shader, shaderUniforms->lightUniforms, i, shaderUniforms->lightOffset * i, freeTextureUnit++);
|
||||
}
|
||||
|
||||
@@ -874,7 +871,7 @@ namespace Nz
|
||||
float radius = modelData.squaredBoundingSphere.radius;
|
||||
ChooseLights(Spheref(position, radius), false);
|
||||
|
||||
for (unsigned int i = lightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||
for (std::size_t i = lightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||
SendLightUniforms(shader, shaderUniforms->lightUniforms, i, shaderUniforms->lightOffset*i, freeTextureUnit++);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace Nz
|
||||
void InstancedRenderable::UpdateData(InstanceData* instanceData) const
|
||||
{
|
||||
NazaraAssert(instanceData, "Invalid instance data");
|
||||
NazaraUnused(instanceData);
|
||||
}
|
||||
|
||||
InstancedRenderableLibrary::LibraryMap InstancedRenderable::s_library;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if type is not supported
|
||||
*/
|
||||
|
||||
void ParticleDeclaration::EnableComponent(ParticleComponent component, ComponentType type, unsigned int offset)
|
||||
void ParticleDeclaration::EnableComponent(ParticleComponent component, ComponentType type, std::size_t offset)
|
||||
{
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (component > ParticleComponent_Max)
|
||||
@@ -145,7 +145,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if enumeration is equal to ParticleComponent_Unused
|
||||
*/
|
||||
|
||||
void ParticleDeclaration::GetComponent(ParticleComponent component, bool* enabled, ComponentType* type, unsigned int* offset) const
|
||||
void ParticleDeclaration::GetComponent(ParticleComponent component, bool* enabled, ComponentType* type, std::size_t* offset) const
|
||||
{
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (component > ParticleComponent_Max)
|
||||
@@ -180,7 +180,7 @@ namespace Nz
|
||||
* \return Stride of the declaration
|
||||
*/
|
||||
|
||||
unsigned int ParticleDeclaration::GetStride() const
|
||||
std::size_t ParticleDeclaration::GetStride() const
|
||||
{
|
||||
return m_stride;
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ namespace Nz
|
||||
if (emissionCount >= 1.f)
|
||||
{
|
||||
// We compute the maximum number of particles which can be emitted
|
||||
unsigned int emissionCountInt = static_cast<unsigned int>(emissionCount);
|
||||
unsigned int maxParticleCount = emissionCountInt * m_emissionCount;
|
||||
std::size_t emissionCountInt = static_cast<std::size_t>(emissionCount);
|
||||
std::size_t maxParticleCount = emissionCountInt * m_emissionCount;
|
||||
|
||||
// We get the number of particles that we are able to create (depending on the free space)
|
||||
unsigned int particleCount = std::min(maxParticleCount, system.GetMaxParticleCount() - system.GetParticleCount());
|
||||
std::size_t particleCount = std::min(maxParticleCount, system.GetMaxParticleCount() - system.GetParticleCount());
|
||||
if (particleCount == 0)
|
||||
return;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Nz
|
||||
* \return Current emission count
|
||||
*/
|
||||
|
||||
unsigned int ParticleEmitter::GetEmissionCount() const
|
||||
std::size_t ParticleEmitter::GetEmissionCount() const
|
||||
{
|
||||
return m_emissionCount;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace Nz
|
||||
* \param count Emission count
|
||||
*/
|
||||
|
||||
void ParticleEmitter::SetEmissionCount(unsigned int count)
|
||||
void ParticleEmitter::SetEmissionCount(std::size_t count)
|
||||
{
|
||||
m_emissionCount = count;
|
||||
}
|
||||
|
||||
@@ -142,11 +142,10 @@ namespace Nz
|
||||
* \remark Produces a NazaraAssert if renderQueue is invalid
|
||||
*/
|
||||
|
||||
void ParticleGroup::AddToRenderQueue(AbstractRenderQueue* renderQueue, const Matrix4f& transformMatrix) const
|
||||
void ParticleGroup::AddToRenderQueue(AbstractRenderQueue* renderQueue, const Matrix4f& /*transformMatrix*/) const
|
||||
{
|
||||
NazaraAssert(m_renderer, "Invalid particle renderer");
|
||||
NazaraAssert(renderQueue, "Invalid renderqueue");
|
||||
NazaraUnused(transformMatrix);
|
||||
|
||||
if (m_particleCount > 0)
|
||||
{
|
||||
@@ -215,7 +214,7 @@ namespace Nz
|
||||
if (m_particleCount + count > m_maxParticleCount)
|
||||
return nullptr;
|
||||
|
||||
unsigned int particlesIndex = m_particleCount;
|
||||
std::size_t particlesIndex = m_particleCount;
|
||||
m_particleCount += count;
|
||||
|
||||
return &m_buffer[particlesIndex * m_particleSize];
|
||||
@@ -264,7 +263,7 @@ namespace Nz
|
||||
* \return Current maximum number
|
||||
*/
|
||||
|
||||
unsigned int ParticleGroup::GetMaxParticleCount() const
|
||||
std::size_t ParticleGroup::GetMaxParticleCount() const
|
||||
{
|
||||
return m_maxParticleCount;
|
||||
}
|
||||
@@ -274,7 +273,7 @@ namespace Nz
|
||||
* \return Current number
|
||||
*/
|
||||
|
||||
unsigned int ParticleGroup::GetParticleCount() const
|
||||
std::size_t ParticleGroup::GetParticleCount() const
|
||||
{
|
||||
return m_particleCount;
|
||||
}
|
||||
@@ -284,7 +283,7 @@ namespace Nz
|
||||
* \return Current size
|
||||
*/
|
||||
|
||||
unsigned int ParticleGroup::GetParticleSize() const
|
||||
std::size_t ParticleGroup::GetParticleSize() const
|
||||
{
|
||||
return m_particleSize;
|
||||
}
|
||||
@@ -295,7 +294,7 @@ namespace Nz
|
||||
* \param index Index of the particle
|
||||
*/
|
||||
|
||||
void ParticleGroup::KillParticle(unsigned int index)
|
||||
void ParticleGroup::KillParticle(std::size_t index)
|
||||
{
|
||||
///FIXME: Verify the index
|
||||
|
||||
@@ -402,10 +401,8 @@ namespace Nz
|
||||
* \param transformMatrix Matrix transformation for our bounding volume
|
||||
*/
|
||||
|
||||
void ParticleGroup::UpdateBoundingVolume(const Matrix4f& transformMatrix)
|
||||
void ParticleGroup::UpdateBoundingVolume(const Matrix4f& /*transformMatrix*/)
|
||||
{
|
||||
NazaraUnused(transformMatrix);
|
||||
|
||||
// Nothing to do here (our bounding volume is global)
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace Nz
|
||||
* \return Number of techniques
|
||||
*/
|
||||
|
||||
unsigned int RenderTechniques::GetCount()
|
||||
std::size_t RenderTechniques::GetCount()
|
||||
{
|
||||
return s_renderTechniques.size();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,64 @@ namespace Nz
|
||||
m_boundingVolume.Set(-origin, m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down() - origin);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the material of the sprite from a name
|
||||
*
|
||||
* Tries to get a material from the MaterialLibrary and then the MaterialManager (which will treat the name as a path)
|
||||
* Fails if the texture name is not a part of the MaterialLibrary nor the MaterialManager (which fails if it couldn't load the texture from its filepath)
|
||||
*
|
||||
* \param materialName Named texture for the material
|
||||
* \param resizeSprite Should the sprite be resized to the material diffuse map size?
|
||||
*
|
||||
* \return True if the material was found or loaded from its name/path, false if it couldn't
|
||||
*/
|
||||
bool Sprite::SetMaterial(String materialName, bool resizeSprite)
|
||||
{
|
||||
MaterialRef material = MaterialLibrary::Query(materialName);
|
||||
if (!material)
|
||||
{
|
||||
material = MaterialManager::Get(materialName);
|
||||
if (!material)
|
||||
{
|
||||
NazaraError("Failed to get material \"" + materialName + "\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SetMaterial(std::move(material), resizeSprite);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the texture of the sprite from a name
|
||||
*
|
||||
* Tries to get a texture from the TextureLibrary and then the TextureManager (which will treat the name as a path)
|
||||
* Fails if the texture name is not a part of the TextureLibrary nor the TextureManager (which fails if it couldn't load the texture from its filepath)
|
||||
*
|
||||
* \param textureName Named texture for the sprite
|
||||
* \param resizeSprite Should the sprite be resized to the texture size?
|
||||
*
|
||||
* \return True if the texture was found or loaded from its name/path, false if it couldn't
|
||||
*
|
||||
* \remark The sprite material gets copied to prevent accidentally changing other drawable materials
|
||||
*/
|
||||
bool Sprite::SetTexture(String textureName, bool resizeSprite)
|
||||
{
|
||||
TextureRef texture = TextureLibrary::Query(textureName);
|
||||
if (!texture)
|
||||
{
|
||||
texture = TextureManager::Get(textureName);
|
||||
if (!texture)
|
||||
{
|
||||
NazaraError("Failed to get texture \"" + textureName + "\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SetTexture(std::move(texture), resizeSprite);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Updates the data of the sprite
|
||||
*
|
||||
|
||||
@@ -202,8 +202,8 @@ namespace Nz
|
||||
void TextSprite::MakeBoundingVolume() const
|
||||
{
|
||||
Rectf bounds(m_localBounds);
|
||||
Vector2f max = bounds.GetMaximum();
|
||||
Vector2f min = bounds.GetMinimum();
|
||||
Vector2f max = m_scale * bounds.GetMaximum();
|
||||
Vector2f min = m_scale * bounds.GetMinimum();
|
||||
|
||||
m_boundingVolume.Set(min.x * Vector3f::Right() + min.y * Vector3f::Down(), max.x * Vector3f::Right() + max.y * Vector3f::Down());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user