New Render queues (#161)
* Add new render queues proof of concept + scissoring support (WIP) * Graphics: Adapt basic sprites rendering to new render queue system * Graphics: Fix layers when rendering sprites * Graphics/RenderQueue: Fix sprite default overlay * Graphics: Enable scissor test by default * SDK/Widgets: Enable scissoring on widgets * Graphics: Handle almost everything with the new renderqueues system Todo: - Billboard rendering - Proper model rendering * Graphics/RenderQueue: Billboard drawing now works (WIP) At 1/4 of previous code performances due to individually process of billboards * Add new render queues proof of concept + scissoring support (WIP) * Graphics: Adapt basic sprites rendering to new render queue system * Graphics: Fix layers when rendering sprites * Graphics/RenderQueue: Fix sprite default overlay * Graphics: Enable scissor test by default * SDK/Widgets: Enable scissoring on widgets * Graphics: Handle almost everything with the new renderqueues system Todo: - Billboard rendering - Proper model rendering * Graphics/RenderQueue: Billboard drawing now works (WIP) At 1/4 of previous code performances due to individually process of billboards * Graphics/RenderQueues: Add full support for billboards * Graphics/RenderQueue: Cleanup and improve billboard rendering * Graphics/RenderQueue: Fix model drawing * Examples/Particles: Fix lighting on space station * Graphics: Cleanup forward render queue/technique * Fix compilation under Linux * Graphics/ForwardRenderTechnique: Fix case when scissoring is enabled on material but disabled on element * Add support for Deferred Shading * SDK/Widgets: Fix widget rendering * Graphics: Remove legacy code from render queues * Graphics: Fix some objects sometimes not showing up due to broken scissor box * Fix compilation error * Sdk/GraphicsGraphics: Fix bounding volume * SDK/World: Fix self-assignation * Update changelog for render queues
This commit is contained in:
@@ -267,6 +267,8 @@ ParticleDemo("Space battle", sharedData)
|
||||
if (!m_spacestationModel.LoadFromFile("resources/SpaceStation/space_station.obj", parameters))
|
||||
NazaraWarning("Failed to load space_station.obj");
|
||||
|
||||
m_spacestationModel.GetMesh()->GenerateNormalsAndTangents();
|
||||
|
||||
parameters.mesh.texCoordScale.Set(1.f, -1.f);
|
||||
parameters.mesh.matrix.MakeRotation(Nz::EulerAnglesf(0.f, -90.f, 0.f));
|
||||
|
||||
@@ -471,7 +473,7 @@ void SpacebattleExample::Enter(Ndk::StateMachine& fsm)
|
||||
auto rotationPtr = mapper.GetComponentPtr<const float>(Nz::ParticleComponent_Rotation);
|
||||
auto sizePtr = mapper.GetComponentPtr<const Nz::Vector2f>(Nz::ParticleComponent_Size);
|
||||
|
||||
renderQueue->AddBillboards(0, sparkleMat1, endId - startId + 1, positionPtr, sizePtr, rotationPtr);
|
||||
renderQueue->AddBillboards(0, sparkleMat1, endId - startId + 1, Nz::Recti(-1, -1), positionPtr, sizePtr, rotationPtr);
|
||||
for (unsigned int i = startId; i <= endId; ++i)
|
||||
{
|
||||
Nz::AbstractRenderQueue::PointLight pointLight;
|
||||
@@ -607,6 +609,7 @@ void SpacebattleExample::Enter(Ndk::StateMachine& fsm)
|
||||
fireMat->EnableFaceCulling(true);
|
||||
fireMat->SetDiffuseMap("resources/fire_particle.png");
|
||||
// Additive blending for fire
|
||||
fireMat->EnableDepthSorting(false); //< No need for depth sort
|
||||
fireMat->SetDstBlend(Nz::BlendFunc_One);
|
||||
fireMat->SetSrcBlend(Nz::BlendFunc_SrcAlpha);
|
||||
|
||||
@@ -622,7 +625,7 @@ void SpacebattleExample::Enter(Ndk::StateMachine& fsm)
|
||||
auto rotPtr = mapper.GetComponentPtr<const float>(Nz::ParticleComponent_Rotation);
|
||||
auto sizePtr = mapper.GetComponentPtr<const Nz::Vector2f>(Nz::ParticleComponent_Size);
|
||||
|
||||
renderQueue->AddBillboards(0, fireMat, endId - startId + 1, posPtr, sizePtr, rotPtr, colorPtr);
|
||||
renderQueue->AddBillboards(0, fireMat, endId - startId + 1, Nz::Recti(-1, -1), posPtr, sizePtr, rotPtr, colorPtr);
|
||||
}));
|
||||
|
||||
m_smokeGroup->SetRenderer(Nz::ParticleFunctionRenderer::New([smokeMat] (const Nz::ParticleGroup& /*group*/, const Nz::ParticleMapper& mapper, unsigned int startId, unsigned int endId, Nz::AbstractRenderQueue* renderQueue)
|
||||
@@ -632,7 +635,7 @@ void SpacebattleExample::Enter(Ndk::StateMachine& fsm)
|
||||
auto rotPtr = mapper.GetComponentPtr<const float>(Nz::ParticleComponent_Rotation);
|
||||
auto sizePtr = mapper.GetComponentPtr<const Nz::Vector2f>(Nz::ParticleComponent_Size);
|
||||
|
||||
renderQueue->AddBillboards(0, smokeMat, endId - startId + 1, posPtr, sizePtr, rotPtr, colorPtr);
|
||||
renderQueue->AddBillboards(0, smokeMat, endId - startId + 1, Nz::Recti(-1, -1), posPtr, sizePtr, rotPtr, colorPtr);
|
||||
}));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -647,6 +650,7 @@ void SpacebattleExample::Enter(Ndk::StateMachine& fsm)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Nz::TextSpriteRef introText = Nz::TextSprite::New();
|
||||
introText->SetMaterial(Nz::Material::New("Translucent3D"));
|
||||
introText->Update(Nz::SimpleTextDrawer::Draw("--Tourelle de défense du secteur A407M2--\nLes contrôles ont été adaptés à vos contrôleurs:\nLa souris contrôle l'orientation de la tourelle, cliquez pour tirer.\n", 72));
|
||||
introText->SetScale(0.5f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user