Graphics: Update Light and Model to new interface
Former-commit-id: 5643f20261524f93a5d080404de5ab0b29151acb
This commit is contained in:
parent
349b322834
commit
8c6806eacb
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -179,3 +179,5 @@ void NzLight::MakeBoundingVolume() const
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NzLightLibrary::LibraryMap NzLight::s_library;
|
||||
|
|
|
|||
|
|
@ -53,16 +53,6 @@ void NzModel::AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatri
|
|||
}
|
||||
}
|
||||
|
||||
NzModel* NzModel::Clone() const
|
||||
{
|
||||
return new NzModel(*this);
|
||||
}
|
||||
|
||||
NzModel* NzModel::Create() const
|
||||
{
|
||||
return new NzModel;
|
||||
}
|
||||
|
||||
NzMaterial* NzModel::GetMaterial(const NzString& subMeshName) const
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
|
|
|
|||
Loading…
Reference in New Issue