Merge remote-tracking branch 'origin/Scene-Update'
Former-commit-id: 4185e7a826476d3d5b4275b3900fe695bd791f3a
This commit is contained in:
@@ -9,12 +9,12 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/SceneNode.hpp>
|
||||
#include <Nazara/Math/Frustum.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Renderer/RenderTarget.hpp>
|
||||
#include <Nazara/Utility/Node.hpp>
|
||||
|
||||
class NAZARA_API NzCamera : public NzAbstractViewer, public NzNode, NzRenderTarget::Listener
|
||||
{
|
||||
|
||||
@@ -18,17 +18,19 @@ struct NzLightUniforms;
|
||||
class NAZARA_API NzLight : public NzSceneNode
|
||||
{
|
||||
public:
|
||||
NzLight(nzLightType type);
|
||||
NzLight(nzLightType type = nzLightType_Point);
|
||||
NzLight(const NzLight& light);
|
||||
~NzLight() = default;
|
||||
|
||||
void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const override;
|
||||
|
||||
NzLight* Clone() const;
|
||||
NzLight* Create() const;
|
||||
|
||||
void Enable(const NzShader* shader, const NzLightUniforms& uniforms, int offset = 0) const;
|
||||
|
||||
float GetAmbientFactor() const;
|
||||
float GetAttenuation() const;
|
||||
const NzBoundingVolumef& GetBoundingVolume() const;
|
||||
NzColor GetColor() const;
|
||||
float GetDiffuseFactor() const;
|
||||
float GetInnerAngle() const;
|
||||
@@ -54,15 +56,13 @@ class NAZARA_API NzLight : public NzSceneNode
|
||||
|
||||
private:
|
||||
bool FrustumCull(const NzFrustumf& frustum) const override;
|
||||
void InvalidateNode() override;
|
||||
void MakeBoundingVolume() const override;
|
||||
void Register() override;
|
||||
void Unregister() override;
|
||||
void UpdateBoundingVolume() const;
|
||||
|
||||
nzLightType m_type;
|
||||
mutable NzBoundingVolumef m_boundingVolume;
|
||||
NzColor m_color;
|
||||
mutable bool m_boundingVolumeUpdated;
|
||||
float m_ambientFactor;
|
||||
float m_attenuation;
|
||||
float m_diffuseFactor;
|
||||
|
||||
@@ -41,10 +41,12 @@ class NAZARA_API NzModel : public NzSceneNode
|
||||
void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const override;
|
||||
void AdvanceAnimation(float elapsedTime);
|
||||
|
||||
NzModel* Clone() const;
|
||||
NzModel* Create() const;
|
||||
|
||||
void EnableAnimation(bool animation);
|
||||
|
||||
NzAnimation* GetAnimation() const;
|
||||
const NzBoundingVolumef& GetBoundingVolume() const;
|
||||
NzMaterial* GetMaterial(const NzString& subMeshName) const;
|
||||
NzMaterial* GetMaterial(unsigned int matIndex) const;
|
||||
NzMaterial* GetMaterial(unsigned int skinIndex, const NzString& subMeshName) const;
|
||||
@@ -84,13 +86,10 @@ class NAZARA_API NzModel : public NzSceneNode
|
||||
NzModel& operator=(const NzModel& node);
|
||||
|
||||
protected:
|
||||
void InvalidateNode() override;
|
||||
virtual void UpdateBoundingVolume() const;
|
||||
void MakeBoundingVolume() const override;
|
||||
|
||||
std::vector<NzMaterialRef> m_materials;
|
||||
mutable NzBoundingVolumef m_boundingVolume;
|
||||
NzMeshRef m_mesh;
|
||||
mutable bool m_boundingVolumeUpdated;
|
||||
unsigned int m_matCount;
|
||||
unsigned int m_skin;
|
||||
unsigned int m_skinCount;
|
||||
|
||||
@@ -43,7 +43,6 @@ class NAZARA_API NzParticleSystem : public NzSceneNode, NzUpdatable
|
||||
void* GenerateParticle();
|
||||
void* GenerateParticles(unsigned int count);
|
||||
|
||||
const NzBoundingVolumef& GetBoundingVolume() const override;
|
||||
const NzParticleDeclaration* GetDeclaration() const;
|
||||
float GetFixedStepSize() const;
|
||||
unsigned int GetMaxParticleCount() const;
|
||||
@@ -67,22 +66,19 @@ class NAZARA_API NzParticleSystem : public NzSceneNode, NzUpdatable
|
||||
NzParticleSystem& operator=(const NzParticleSystem& emitter);
|
||||
|
||||
private:
|
||||
void GenerateAABB() const;
|
||||
void MakeBoundingVolume() const override;
|
||||
void Register() override;
|
||||
void ResizeBuffer();
|
||||
void Unregister() override;
|
||||
void Update() override;
|
||||
void UpdateBoundingVolume() const;
|
||||
|
||||
std::set<unsigned int, std::greater<unsigned int>> m_dyingParticles;
|
||||
mutable std::vector<nzUInt8> m_buffer;
|
||||
std::vector<NzParticleControllerRef> m_controllers;
|
||||
std::vector<NzParticleEmitter*> m_emitters;
|
||||
std::vector<NzParticleGeneratorRef> m_generators;
|
||||
mutable NzBoundingVolumef m_boundingVolume;
|
||||
NzParticleDeclarationConstRef m_declaration;
|
||||
NzParticleRendererRef m_renderer;
|
||||
mutable bool m_boundingVolumeUpdated;
|
||||
bool m_fixedStepEnabled;
|
||||
bool m_processing;
|
||||
float m_stepAccumulator;
|
||||
|
||||
@@ -8,37 +8,49 @@
|
||||
#define NAZARA_SCENE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Core/Updatable.hpp>
|
||||
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/SceneRoot.hpp>
|
||||
#include <Nazara/Math/Frustum.hpp>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class NzAbstractRenderQueue;
|
||||
class NzAbstractViewer;
|
||||
class NzCamera;
|
||||
class NzLight;
|
||||
class NzModel;
|
||||
class NzNode;
|
||||
class NzRenderQueue;
|
||||
class NzSceneNode;
|
||||
struct NzSceneImpl;
|
||||
|
||||
class NAZARA_API NzScene
|
||||
{
|
||||
friend NzCamera;
|
||||
friend NzSceneNode;
|
||||
|
||||
public:
|
||||
NzScene();
|
||||
~NzScene();
|
||||
~NzScene() = default;
|
||||
|
||||
void AddToVisibilityList(NzUpdatable* object);
|
||||
|
||||
template<typename T, typename... Args> T* CreateNode(Args&&... args);
|
||||
template<typename T, typename... Args> T* CreateNode(const NzString& name, Args&&... args);
|
||||
template<typename T, typename... Args> T* CreateNode(const NzString& name, const NzString& templateNodeName);
|
||||
|
||||
void Clear();
|
||||
|
||||
void Cull();
|
||||
void Draw();
|
||||
|
||||
void EnableBackground(bool enable);
|
||||
|
||||
NzSceneNode* FindNode(const NzString& name);
|
||||
const NzSceneNode* FindNode(const NzString& name) const;
|
||||
template<typename T> T* FindNodeAs(const NzString& name);
|
||||
template<typename T> const T* FindNodeAs(const NzString& name) const;
|
||||
|
||||
NzColor GetAmbientColor() const;
|
||||
NzAbstractBackground* GetBackground() const;
|
||||
NzVector3f GetBackward() const;
|
||||
@@ -47,7 +59,8 @@ class NAZARA_API NzScene
|
||||
NzVector3f GetLeft() const;
|
||||
NzAbstractRenderTechnique* GetRenderTechnique() const;
|
||||
NzVector3f GetRight() const;
|
||||
NzSceneNode& GetRoot() const;
|
||||
NzSceneNode& GetRoot();
|
||||
const NzSceneNode& GetRoot() const;
|
||||
NzAbstractViewer* GetViewer() const;
|
||||
NzVector3f GetUp() const;
|
||||
float GetUpdateTime() const;
|
||||
@@ -57,6 +70,11 @@ class NAZARA_API NzScene
|
||||
|
||||
void RegisterForUpdate(NzUpdatable* object);
|
||||
|
||||
void RemoveNode(NzSceneNode* node);
|
||||
void RemoveNode(const NzString& name);
|
||||
|
||||
void RenderFrame();
|
||||
|
||||
void SetAmbientColor(const NzColor& color);
|
||||
void SetBackground(NzAbstractBackground* background);
|
||||
void SetRenderTechnique(NzAbstractRenderTechnique* renderTechnique);
|
||||
@@ -72,9 +90,28 @@ class NAZARA_API NzScene
|
||||
operator const NzSceneNode&() const;
|
||||
|
||||
private:
|
||||
bool ChangeNodeName(NzSceneNode* node, const NzString& newName);
|
||||
bool RegisterSceneNode(const NzString& name, NzSceneNode* node);
|
||||
void RecursiveFrustumCull(NzAbstractRenderQueue* renderQueue, const NzFrustumf& frustum, NzNode* node);
|
||||
|
||||
NzSceneImpl* m_impl;
|
||||
mutable std::unique_ptr<NzAbstractBackground> m_background;
|
||||
mutable std::unique_ptr<NzAbstractRenderTechnique> m_renderTechnique;
|
||||
std::unordered_map<NzString, NzSceneNode*> m_nodeMap;
|
||||
std::vector<std::unique_ptr<NzSceneNode>> m_nodes;
|
||||
std::vector<NzUpdatable*> m_updateList;
|
||||
std::vector<NzUpdatable*> m_visibleUpdateList;
|
||||
NzClock m_updateClock;
|
||||
NzColor m_ambientColor;
|
||||
NzSceneRoot m_root;
|
||||
NzAbstractViewer* m_viewer;
|
||||
bool m_backgroundEnabled;
|
||||
bool m_update;
|
||||
float m_frameTime;
|
||||
float m_updateTime;
|
||||
mutable int m_renderTechniqueRanking;
|
||||
unsigned int m_updatePerSecond;
|
||||
};
|
||||
|
||||
#include <Nazara/Graphics/Scene.inl>
|
||||
|
||||
#endif // NAZARA_SCENE_HPP
|
||||
|
||||
139
include/Nazara/Graphics/Scene.inl
Normal file
139
include/Nazara/Graphics/Scene.inl
Normal file
@@ -0,0 +1,139 @@
|
||||
// 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/Enums.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
///TODO: Déplacer vers SceneNode et exposer
|
||||
|
||||
// Pour être sûr que ce code soit à jour
|
||||
static_assert(nzSceneNodeType_Max == 6, "Please update the code below");
|
||||
|
||||
class NzLight;
|
||||
class NzModel;
|
||||
class NzParticleEmitter;
|
||||
class NzSceneRoot;
|
||||
class NzSprite;
|
||||
class NzTextSprite;
|
||||
|
||||
template<typename T>
|
||||
constexpr nzSceneNodeType NzImplGetType()
|
||||
{
|
||||
return nzSceneNodeType_User;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline constexpr nzSceneNodeType NzImplGetType<NzLight>()
|
||||
{
|
||||
return nzSceneNodeType_Light;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline constexpr nzSceneNodeType NzImplGetType<NzModel>()
|
||||
{
|
||||
return nzSceneNodeType_Model;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline constexpr nzSceneNodeType NzImplGetType<NzParticleEmitter>()
|
||||
{
|
||||
return nzSceneNodeType_ParticleEmitter;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline constexpr nzSceneNodeType NzImplGetType<NzSceneRoot>()
|
||||
{
|
||||
return nzSceneNodeType_Root;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline constexpr nzSceneNodeType NzImplGetType<NzSprite>()
|
||||
{
|
||||
return nzSceneNodeType_Sprite;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline constexpr nzSceneNodeType NzImplGetType<NzTextSprite>()
|
||||
{
|
||||
return nzSceneNodeType_TextSprite;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, typename... Args>
|
||||
T* NzScene::CreateNode(Args&&... args)
|
||||
{
|
||||
std::unique_ptr<T> node(new T(std::forward<Args>(args)...));
|
||||
if (!RegisterSceneNode(NzString(), node.get()))
|
||||
return nullptr;
|
||||
|
||||
return node.release();
|
||||
}
|
||||
|
||||
template<typename T, typename... Args>
|
||||
T* NzScene::CreateNode(const NzString& name, Args&&... args)
|
||||
{
|
||||
std::unique_ptr<T> node(new T(std::forward<Args>(args)...));
|
||||
if (!RegisterSceneNode(name, node.get()))
|
||||
return nullptr;
|
||||
|
||||
return node.release();
|
||||
}
|
||||
|
||||
template<typename T, typename... Args>
|
||||
T* NzScene::CreateNode(const NzString& name, const NzString& templateNodeName)
|
||||
{
|
||||
auto it = m_nodeMap.find(templateNodeName);
|
||||
if (it == m_nodeMap.end())
|
||||
{
|
||||
NazaraError("Node \"" + templateNodeName + "\" is not registred");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NzSceneNode* sceneNode = it->second;
|
||||
if (sceneNode->GetSceneNodeType() != NzImplGetType<T>())
|
||||
{
|
||||
NazaraError("Scene node type of T (" + NzString::Number(NzImplGetType<T>()) + ") doesn't match template scene node type (" + NzString::Number(sceneNode->GetSceneNodeType()) + ")");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<T> node(static_cast<T*>(sceneNode)->Copy());
|
||||
if (!RegisterSceneNode(name, node.get()))
|
||||
return nullptr;
|
||||
|
||||
return node.release();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* NzScene::FindNodeAs(const NzString& name)
|
||||
{
|
||||
NzSceneNode* sceneNode = FindNode(name);
|
||||
if (!sceneNode)
|
||||
return nullptr;
|
||||
|
||||
if (sceneNode->GetSceneNodeType() != NzImplGetType<T>())
|
||||
{
|
||||
NazaraError("Scene node type of T (" + NzString::Number(NzImplGetType<T>()) + ") doesn't match \"" + name + "\" scene node type (" + NzString::Number(sceneNode->GetSceneNodeType()) + ")");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return static_cast<T*>(sceneNode);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* NzScene::FindNodeAs(const NzString& name) const
|
||||
{
|
||||
const NzSceneNode* sceneNode = FindNode(name);
|
||||
if (!sceneNode)
|
||||
return nullptr;
|
||||
|
||||
if (sceneNode->GetSceneNodeType() != NzImplGetType<T>())
|
||||
{
|
||||
NazaraError("Scene node type of T (" + NzString::Number(NzImplGetType<T>()) + ") doesn't match \"" + name + "\" scene node type (" + NzString::Number(sceneNode->GetSceneNodeType()) + ")");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return static_cast<const T*>(sceneNode);
|
||||
}
|
||||
|
||||
#include <Nazara/Graphics/DebugOff.hpp>
|
||||
@@ -9,14 +9,16 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/Scene.hpp>
|
||||
#include <Nazara/Math/BoundingVolume.hpp>
|
||||
#include <Nazara/Math/Frustum.hpp>
|
||||
#include <Nazara/Utility/Node.hpp>
|
||||
|
||||
class NzAbstractRenderQueue;
|
||||
class NzScene;
|
||||
|
||||
class NAZARA_API NzSceneNode : public NzNode
|
||||
{
|
||||
friend class NzScene;
|
||||
friend NzScene;
|
||||
|
||||
public:
|
||||
NzSceneNode();
|
||||
@@ -26,42 +28,59 @@ class NAZARA_API NzSceneNode : public NzNode
|
||||
|
||||
virtual void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const = 0;
|
||||
|
||||
// Idiôme "virtual constructor"
|
||||
virtual NzSceneNode* Clone() const = 0;
|
||||
virtual NzSceneNode* Create() const = 0;
|
||||
|
||||
void EnableDrawing(bool drawingEnabled);
|
||||
|
||||
NzVector3f GetBackward() const;
|
||||
virtual const NzBoundingVolumef& GetBoundingVolume() const = 0;
|
||||
virtual const NzBoundingVolumef& GetBoundingVolume() const;
|
||||
NzVector3f GetDown() const;
|
||||
NzVector3f GetForward() const;
|
||||
NzVector3f GetLeft() const;
|
||||
const NzString& GetName() const;
|
||||
nzNodeType GetNodeType() const final;
|
||||
NzVector3f GetRight() const;
|
||||
NzScene* GetScene() const;
|
||||
virtual nzSceneNodeType GetSceneNodeType() const = 0;
|
||||
NzVector3f GetUp() const;
|
||||
|
||||
void InvalidateAABB();
|
||||
|
||||
virtual bool IsDrawable() const = 0;
|
||||
bool IsDrawingEnabled() const;
|
||||
bool IsVisible() const;
|
||||
|
||||
bool SetName(const NzString& name);
|
||||
|
||||
NzSceneNode& operator=(const NzSceneNode& sceneNode);
|
||||
NzSceneNode& operator=(NzSceneNode&& sceneNode) = delete;
|
||||
|
||||
protected:
|
||||
virtual bool FrustumCull(const NzFrustumf& frustum) const;
|
||||
virtual void InvalidateNode() override;
|
||||
virtual void MakeBoundingVolume() const = 0;
|
||||
virtual void OnParenting(const NzNode* parent) override;
|
||||
virtual void OnVisibilityChange(bool visibility);
|
||||
void RecursiveSetScene(NzScene* scene, NzNode* node);
|
||||
virtual void Register();
|
||||
void SetNameInternal(const NzString& name);
|
||||
void SetScene(NzScene* scene);
|
||||
virtual void Unregister();
|
||||
virtual void Update();
|
||||
virtual void UpdateBoundingVolume() const;
|
||||
|
||||
mutable NzBoundingVolumef m_boundingVolume;
|
||||
NzScene* m_scene;
|
||||
mutable bool m_boundingVolumeUpdated;
|
||||
bool m_drawingEnabled;
|
||||
bool m_visible;
|
||||
|
||||
private:
|
||||
void UpdateVisibility(const NzFrustumf& frustum);
|
||||
|
||||
NzString m_name;
|
||||
};
|
||||
|
||||
#endif // NAZARA_SCENENODE_HPP
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Graphics/SceneNode.hpp>
|
||||
|
||||
class NzScene;
|
||||
|
||||
class NAZARA_API NzSceneRoot : public NzSceneNode
|
||||
{
|
||||
friend struct NzSceneImpl;
|
||||
friend NzScene;
|
||||
|
||||
public:
|
||||
void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const override;
|
||||
|
||||
const NzBoundingVolumef& GetBoundingVolume() const override;
|
||||
nzSceneNodeType GetSceneNodeType() const override;
|
||||
|
||||
bool IsDrawable() const;
|
||||
@@ -26,6 +27,10 @@ class NAZARA_API NzSceneRoot : public NzSceneNode
|
||||
NzSceneRoot(NzScene* scene);
|
||||
virtual ~NzSceneRoot();
|
||||
|
||||
NzSceneRoot* Clone() const;
|
||||
NzSceneRoot* Create() const;
|
||||
|
||||
void MakeBoundingVolume() const override;
|
||||
void Register();
|
||||
void Unregister();
|
||||
};
|
||||
|
||||
@@ -31,7 +31,6 @@ using NzSkeletalModelLoader = NzResourceLoader<NzSkeletalModel, NzSkeletalModelP
|
||||
class NAZARA_API NzSkeletalModel : public NzModel, NzUpdatable
|
||||
{
|
||||
friend NzSkeletalModelLoader;
|
||||
//friend class NzScene;
|
||||
|
||||
public:
|
||||
NzSkeletalModel();
|
||||
@@ -42,6 +41,9 @@ class NAZARA_API NzSkeletalModel : public NzModel, NzUpdatable
|
||||
void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const override;
|
||||
void AdvanceAnimation(float elapsedTime);
|
||||
|
||||
NzSkeletalModel* Clone() const;
|
||||
NzSkeletalModel* Create() const;
|
||||
|
||||
void EnableAnimation(bool animation);
|
||||
|
||||
NzAnimation* GetAnimation() const;
|
||||
@@ -69,10 +71,10 @@ class NAZARA_API NzSkeletalModel : public NzModel, NzUpdatable
|
||||
NzSkeletalModel& operator=(NzSkeletalModel&& node);
|
||||
|
||||
private:
|
||||
void MakeBoundingVolume() const override;
|
||||
void Register() override;
|
||||
void Unregister() override;
|
||||
void Update() override;
|
||||
void UpdateBoundingVolume() const;
|
||||
|
||||
NzAnimationRef m_animation;
|
||||
NzSkeleton m_skeleton;
|
||||
|
||||
@@ -22,7 +22,9 @@ class NAZARA_API NzSprite : public NzSceneNode
|
||||
|
||||
void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const override;
|
||||
|
||||
const NzBoundingVolumef& GetBoundingVolume() const override;
|
||||
NzSprite* Clone() const;
|
||||
NzSprite* Create() const;
|
||||
|
||||
const NzColor& GetColor() const;
|
||||
NzMaterial* GetMaterial() const;
|
||||
nzSceneNodeType GetSceneNodeType() const override;
|
||||
@@ -44,18 +46,16 @@ class NAZARA_API NzSprite : public NzSceneNode
|
||||
|
||||
private:
|
||||
void InvalidateNode() override;
|
||||
void MakeBoundingVolume() const override;
|
||||
void Register() override;
|
||||
void Unregister() override;
|
||||
void UpdateBoundingVolume() const;
|
||||
void UpdateVertices() const;
|
||||
|
||||
mutable NzBoundingVolumef m_boundingVolume;
|
||||
NzColor m_color;
|
||||
NzMaterialRef m_material;
|
||||
NzRectf m_textureCoords;
|
||||
NzVector2f m_size;
|
||||
mutable NzVertexStruct_XYZ_Color_UV m_vertices[4];
|
||||
mutable bool m_boundingVolumeUpdated;
|
||||
mutable bool m_verticesUpdated;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@ class NAZARA_API NzTextSprite : public NzSceneNode, NzAbstractAtlas::Listener
|
||||
|
||||
void Clear();
|
||||
|
||||
const NzBoundingVolumef& GetBoundingVolume() const override;
|
||||
NzTextSprite* Clone() const;
|
||||
NzTextSprite* Create() const;
|
||||
|
||||
const NzColor& GetColor() const;
|
||||
NzMaterial* GetMaterial() const;
|
||||
nzSceneNodeType GetSceneNodeType() const override;
|
||||
@@ -47,12 +49,12 @@ class NAZARA_API NzTextSprite : public NzSceneNode, NzAbstractAtlas::Listener
|
||||
private:
|
||||
void ClearAtlases();
|
||||
void InvalidateNode() override;
|
||||
void MakeBoundingVolume() const override;
|
||||
bool OnAtlasCleared(const NzAbstractAtlas* atlas, void* userdata) override;
|
||||
bool OnAtlasLayerChange(const NzAbstractAtlas* atlas, NzAbstractImage* oldLayer, NzAbstractImage* newLayer, void* userdata) override;
|
||||
void OnAtlasReleased(const NzAbstractAtlas* atlas, void* userdata) override;
|
||||
void Register() override;
|
||||
void Unregister() override;
|
||||
void UpdateBoundingVolume() const;
|
||||
void UpdateVertices() const;
|
||||
|
||||
struct RenderIndices
|
||||
@@ -65,11 +67,9 @@ class NAZARA_API NzTextSprite : public NzSceneNode, NzAbstractAtlas::Listener
|
||||
mutable std::unordered_map<NzTexture*, RenderIndices> m_renderInfos;
|
||||
mutable std::vector<NzVertexStruct_XY_Color> m_localVertices;
|
||||
mutable std::vector<NzVertexStruct_XYZ_Color_UV> m_vertices;
|
||||
mutable NzBoundingVolumef m_boundingVolume;
|
||||
NzColor m_color;
|
||||
NzMaterialRef m_material;
|
||||
NzRectui m_localBounds;
|
||||
mutable bool m_boundingVolumeUpdated;
|
||||
mutable bool m_verticesUpdated;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/SceneNode.hpp>
|
||||
#include <Nazara/Math/Frustum.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Renderer/RenderTarget.hpp>
|
||||
#include <Nazara/Utility/Node.hpp>
|
||||
|
||||
class NAZARA_API NzView : public NzAbstractViewer, public NzNode, NzRenderTarget::Listener
|
||||
{
|
||||
|
||||
@@ -35,7 +35,6 @@ class NAZARA_API NzNode
|
||||
NzQuaternionf GetInitialRotation() const;
|
||||
NzVector3f GetInitialScale() const;
|
||||
virtual NzVector3f GetLeft() const;
|
||||
const NzString& GetName() const;
|
||||
virtual nzNodeType GetNodeType() const;
|
||||
const NzNode* GetParent() const;
|
||||
NzVector3f GetPosition(nzCoordSys coordSys = nzCoordSys_Global) const;
|
||||
@@ -67,7 +66,6 @@ class NAZARA_API NzNode
|
||||
void SetInitialScale(float scaleX, float scaleY, float scaleZ = 1.f);
|
||||
void SetInitialPosition(const NzVector3f& translation);
|
||||
void SetInitialPosition(float translationX, float translationXY, float translationZ = 0.f);
|
||||
void SetName(const NzString& name);
|
||||
void SetParent(const NzNode* node = nullptr, bool keepDerived = false);
|
||||
void SetParent(const NzNode& node, bool keepDerived = false);
|
||||
void SetPosition(const NzVector3f& translation, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
@@ -103,7 +101,6 @@ class NAZARA_API NzNode
|
||||
mutable NzQuaternionf m_derivedRotation;
|
||||
NzQuaternionf m_initialRotation;
|
||||
NzQuaternionf m_rotation;
|
||||
NzString m_name;
|
||||
mutable NzVector3f m_derivedPosition;
|
||||
mutable NzVector3f m_derivedScale;
|
||||
NzVector3f m_initialPosition;
|
||||
|
||||
Reference in New Issue
Block a user