Graphics: Update Light and Model to new interface
Former-commit-id: 5643f20261524f93a5d080404de5ab0b29151acb
This commit is contained in:
@@ -9,12 +9,19 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/ObjectLibrary.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/Renderable.hpp>
|
||||
|
||||
class NzLight;
|
||||
class NzShader;
|
||||
struct NzLightUniforms;
|
||||
|
||||
using NzLightConstRef = NzObjectRef<const NzLight>;
|
||||
using NzLightLibrary = NzObjectLibrary<NzLight>;
|
||||
using NzLightRef = NzObjectRef<NzLight>;
|
||||
|
||||
class NAZARA_API NzLight : public NzRenderable
|
||||
{
|
||||
public:
|
||||
@@ -55,6 +62,8 @@ class NAZARA_API NzLight : public NzRenderable
|
||||
|
||||
NzLight& operator=(const NzLight& light) = default;
|
||||
|
||||
template<typename... Args> static NzLightRef New(Args&&... args);
|
||||
|
||||
private:
|
||||
void MakeBoundingVolume() const override;
|
||||
|
||||
@@ -70,6 +79,8 @@ class NAZARA_API NzLight : public NzRenderable
|
||||
float m_outerAngleCosine;
|
||||
float m_outerAngleTangent;
|
||||
float m_radius;
|
||||
|
||||
static NzLightLibrary::LibraryMap s_library;
|
||||
};
|
||||
|
||||
struct NzLightUniforms
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <memory>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
inline float NzLight::GetAmbientFactor() const
|
||||
{
|
||||
return m_ambientFactor;
|
||||
@@ -90,3 +93,14 @@ inline void NzLight::SetRadius(float radius)
|
||||
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
NzLightRef NzLight::New(Args&&... args)
|
||||
{
|
||||
std::unique_ptr<NzLight> object(new NzLight(std::forward<Args>(args)...));
|
||||
object->SetPersistent(false);
|
||||
|
||||
return object.release();
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
|
||||
@@ -27,7 +27,9 @@ struct NAZARA_API NzModelParameters
|
||||
|
||||
class NzModel;
|
||||
|
||||
using NzModelConstRef = NzObjectRef<const NzModel>;
|
||||
using NzModelLoader = NzResourceLoader<NzModel, NzModelParameters>;
|
||||
using NzModelRef = NzObjectRef<NzModel>;
|
||||
|
||||
class NAZARA_API NzModel : public NzRenderable, public NzResource
|
||||
{
|
||||
@@ -42,9 +44,6 @@ class NAZARA_API NzModel : public NzRenderable, public NzResource
|
||||
|
||||
void AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const override;
|
||||
|
||||
NzModel* Clone() const;
|
||||
NzModel* Create() const;
|
||||
|
||||
NzMaterial* GetMaterial(const NzString& subMeshName) const;
|
||||
NzMaterial* GetMaterial(unsigned int matIndex) const;
|
||||
NzMaterial* GetMaterial(unsigned int skinIndex, const NzString& subMeshName) const;
|
||||
@@ -75,6 +74,8 @@ class NAZARA_API NzModel : public NzRenderable, public NzResource
|
||||
NzModel& operator=(const NzModel& node) = default;
|
||||
NzModel& operator=(NzModel&& node) = default;
|
||||
|
||||
template<typename... Args> static NzModelRef New(Args&&... args);
|
||||
|
||||
protected:
|
||||
void MakeBoundingVolume() const override;
|
||||
|
||||
@@ -87,4 +88,6 @@ class NAZARA_API NzModel : public NzRenderable, public NzResource
|
||||
static NzModelLoader::LoaderList s_loaders;
|
||||
};
|
||||
|
||||
#include <Nazara/Graphics/Model.inl>
|
||||
|
||||
#endif // NAZARA_MODEL_HPP
|
||||
|
||||
17
include/Nazara/Graphics/Model.inl
Normal file
17
include/Nazara/Graphics/Model.inl
Normal file
@@ -0,0 +1,17 @@
|
||||
// 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 <memory>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
template<typename... Args>
|
||||
NzModelRef NzModel::New(Args&&... args)
|
||||
{
|
||||
std::unique_ptr<NzModel> object(new NzModel(std::forward<Args>(args)...));
|
||||
object->SetPersistent(false);
|
||||
|
||||
return object.release();
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user