Merge branch 'NDK' into NDK-ShadowMapping
Former-commit-id: b07de3853987ffc91946b307208c0ec26eda280a
This commit is contained in:
28
src/Nazara/Graphics/Billboard.cpp
Normal file
28
src/Nazara/Graphics/Billboard.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/Billboard.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Math/Algorithm.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
void NzBillboard::AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const InstanceData& instanceData) const
|
||||
{
|
||||
if (!m_material)
|
||||
return;
|
||||
|
||||
renderQueue->AddBillboard(m_material, instanceData.transformMatrix.GetTranslation(), m_size, m_sinCos, m_color);
|
||||
}
|
||||
|
||||
void NzBillboard::MakeBoundingVolume() const
|
||||
{
|
||||
constexpr float sqrt2 = float(M_SQRT2);
|
||||
|
||||
m_boundingVolume.Set(NzVector3f(0.f), sqrt2*m_size.x*NzVector3f::Right() + sqrt2*m_size.y*NzVector3f::Down());
|
||||
}
|
||||
|
||||
NzBillboardLibrary::LibraryMap NzBillboard::s_library;
|
||||
@@ -388,6 +388,9 @@ void NzForwardRenderTechnique::DrawBillboards(const NzSceneData& sceneData) cons
|
||||
// Les uniformes sont conservées au sein d'un programme, inutile de les renvoyer tant qu'il ne change pas
|
||||
if (shader != lastShader)
|
||||
{
|
||||
// Index des uniformes dans le shader
|
||||
shaderUniforms = GetShaderUniforms(shader);
|
||||
|
||||
// Couleur ambiante de la scène
|
||||
shader->SendColor(shaderUniforms->sceneAmbient, sceneData.ambientColor);
|
||||
// Position de la caméra
|
||||
|
||||
@@ -69,6 +69,7 @@ void main()
|
||||
gl_Position = ViewProjMatrix * vec4(vertexPos, 1.0);
|
||||
texCoords = VertexTexCoord;
|
||||
#endif
|
||||
texCoords.y = 1.0 - texCoords.y;
|
||||
#else
|
||||
#if FLAG_INSTANCING
|
||||
#if TRANSFORM
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -78,6 +78,7 @@ void main()
|
||||
gl_Position = ViewProjMatrix * vec4(vertexPos, 1.0);
|
||||
texCoords = VertexTexCoord;
|
||||
#endif
|
||||
texCoords.y = 1.0 - texCoords.y;
|
||||
#else
|
||||
#if FLAG_INSTANCING
|
||||
#if TRANSFORM
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -48,3 +48,5 @@ void NzSprite::UpdateData(InstanceData* instanceData) const
|
||||
*posPtr++ = instanceData->transformMatrix.Transform(m_size.x*NzVector3f::Right() + m_size.y*NzVector3f::Down());
|
||||
*texCoordPtr++ = m_textureCoords.GetCorner(nzRectCorner_RightBottom);
|
||||
}
|
||||
|
||||
NzSpriteLibrary::LibraryMap NzSprite::s_library;
|
||||
|
||||
Reference in New Issue
Block a user