Graphics: Make Background/RenderTechnique independent from Scene
Former-commit-id: d588a3bb74b08d79990a278ad2e399e9797755b4
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
|
||||
class NzScene;
|
||||
class NzAbstractViewer;
|
||||
|
||||
class NAZARA_API NzAbstractBackground
|
||||
{
|
||||
@@ -18,7 +18,7 @@ class NAZARA_API NzAbstractBackground
|
||||
NzAbstractBackground() = default;
|
||||
virtual ~NzAbstractBackground();
|
||||
|
||||
virtual void Draw(const NzScene* scene) const = 0;
|
||||
virtual void Draw(const NzAbstractViewer* viewer) const = 0;
|
||||
|
||||
virtual nzBackgroundType GetBackgroundType() const = 0;
|
||||
};
|
||||
|
||||
@@ -8,13 +8,16 @@
|
||||
#define NAZARA_ABSTRACTRENDERTECHNIQUE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
|
||||
class NzAbstractViewer;
|
||||
class NzBackground;
|
||||
class NzScene;
|
||||
struct SceneData;
|
||||
|
||||
class NAZARA_API NzAbstractRenderTechnique : NzNonCopyable
|
||||
{
|
||||
@@ -22,7 +25,7 @@ class NAZARA_API NzAbstractRenderTechnique : NzNonCopyable
|
||||
NzAbstractRenderTechnique();
|
||||
virtual ~NzAbstractRenderTechnique();
|
||||
|
||||
virtual bool Draw(const NzScene* scene) const = 0;
|
||||
virtual bool Draw(const NzAbstractViewer* viewer, const NzSceneData& sceneData) const = 0;
|
||||
|
||||
virtual void EnableInstancing(bool instancing);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class NAZARA_API NzColorBackground : public NzAbstractBackground
|
||||
public:
|
||||
NzColorBackground(const NzColor& color = NzColor::Black);
|
||||
|
||||
void Draw(const NzScene* scene) const;
|
||||
void Draw(const NzAbstractViewer* viewer) const;
|
||||
|
||||
nzBackgroundType GetBackgroundType() const;
|
||||
NzColor GetColor() const;
|
||||
|
||||
@@ -27,7 +27,7 @@ class NAZARA_API NzDeferredBloomPass : public NzDeferredRenderPass
|
||||
float GetBrightThreshold() const;
|
||||
NzTexture* GetTexture(unsigned int i) const;
|
||||
|
||||
bool Process(const NzScene* scene, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Resize(const NzVector2ui& dimensions);
|
||||
|
||||
void SetBlurPassCount(unsigned int passCount);
|
||||
|
||||
@@ -21,7 +21,7 @@ class NAZARA_API NzDeferredDOFPass : public NzDeferredRenderPass
|
||||
NzDeferredDOFPass();
|
||||
virtual ~NzDeferredDOFPass();
|
||||
|
||||
bool Process(const NzScene* scene, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Resize(const NzVector2ui& dimensions);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -19,7 +19,7 @@ class NAZARA_API NzDeferredFXAAPass : public NzDeferredRenderPass
|
||||
NzDeferredFXAAPass();
|
||||
virtual ~NzDeferredFXAAPass();
|
||||
|
||||
bool Process(const NzScene* scene, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
|
||||
protected:
|
||||
NzRenderStates m_states;
|
||||
|
||||
@@ -19,7 +19,7 @@ class NAZARA_API NzDeferredFinalPass : public NzDeferredRenderPass
|
||||
NzDeferredFinalPass();
|
||||
virtual ~NzDeferredFinalPass();
|
||||
|
||||
bool Process(const NzScene* scene, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
|
||||
protected:
|
||||
NzRenderStates m_states;
|
||||
|
||||
@@ -19,7 +19,7 @@ class NAZARA_API NzDeferredFogPass : public NzDeferredRenderPass
|
||||
NzDeferredFogPass();
|
||||
virtual ~NzDeferredFogPass();
|
||||
|
||||
bool Process(const NzScene* scene, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
|
||||
protected:
|
||||
NzRenderStates m_states;
|
||||
|
||||
@@ -19,7 +19,7 @@ class NAZARA_API NzDeferredForwardPass : public NzDeferredRenderPass
|
||||
virtual ~NzDeferredForwardPass();
|
||||
|
||||
void Initialize(NzDeferredRenderTechnique* technique);
|
||||
bool Process(const NzScene* scene, unsigned int workTexture, unsigned sceneTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int workTexture, unsigned sceneTexture) const;
|
||||
|
||||
protected:
|
||||
const NzForwardRenderTechnique* m_forwardTechnique;
|
||||
|
||||
@@ -18,7 +18,7 @@ class NAZARA_API NzDeferredGeometryPass : public NzDeferredRenderPass
|
||||
NzDeferredGeometryPass();
|
||||
virtual ~NzDeferredGeometryPass();
|
||||
|
||||
bool Process(const NzScene* scene, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Resize(const NzVector2ui& dimensions);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -26,7 +26,7 @@ class NAZARA_API NzDeferredPhongLightingPass : public NzDeferredRenderPass
|
||||
|
||||
bool IsLightMeshesDrawingEnabled() const;
|
||||
|
||||
bool Process(const NzScene* scene, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int firstWorkTexture, unsigned secondWorkTexture) const;
|
||||
|
||||
protected:
|
||||
NzLightUniforms m_directionalLightUniforms;
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
|
||||
class NzAbstractViewer;
|
||||
class NzDeferredRenderTechnique;
|
||||
class NzDeferredRenderQueue;
|
||||
class NzRenderBuffer;
|
||||
@@ -32,7 +34,7 @@ class NAZARA_API NzDeferredRenderPass
|
||||
|
||||
bool IsEnabled() const;
|
||||
|
||||
virtual bool Process(const NzScene* scene, unsigned int workTexture, unsigned sceneTexture) const = 0;
|
||||
virtual bool Process(const NzAbstractViewer* viewer, const NzSceneData& sceneData, unsigned int workTexture, unsigned sceneTexture) const = 0;
|
||||
virtual bool Resize(const NzVector2ui& GBufferSize);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -30,7 +30,7 @@ class NAZARA_API NzDeferredRenderTechnique : public NzAbstractRenderTechnique
|
||||
NzDeferredRenderTechnique();
|
||||
~NzDeferredRenderTechnique();
|
||||
|
||||
bool Draw(const NzScene* scene) const override;
|
||||
bool Draw(const NzAbstractViewer* viewer, const NzSceneData& sceneData) const override;
|
||||
|
||||
void EnablePass(nzRenderPassType renderPass, int position, bool enable);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class NAZARA_API NzForwardRenderTechnique : public NzAbstractRenderTechnique
|
||||
NzForwardRenderTechnique();
|
||||
~NzForwardRenderTechnique() = default;
|
||||
|
||||
bool Draw(const NzScene* scene) const override;
|
||||
bool Draw(const NzAbstractViewer* viewer, const NzSceneData& sceneData) const override;
|
||||
|
||||
unsigned int GetMaxLightPassPerObject() const;
|
||||
NzAbstractRenderQueue* GetRenderQueue() override;
|
||||
@@ -36,10 +36,10 @@ class NAZARA_API NzForwardRenderTechnique : public NzAbstractRenderTechnique
|
||||
struct ShaderUniforms;
|
||||
|
||||
bool ChooseLights(const NzSpheref& object, bool includeDirectionalLights = true) const;
|
||||
void DrawBasicSprites(const NzScene* scene) const;
|
||||
void DrawBillboards(const NzScene* scene) const;
|
||||
void DrawOpaqueModels(const NzScene* scene) const;
|
||||
void DrawTransparentModels(const NzScene* scene) const;
|
||||
void DrawBasicSprites(const NzAbstractViewer* viewer, const NzSceneData& sceneData) const;
|
||||
void DrawBillboards(const NzAbstractViewer* viewer, const NzSceneData& sceneData) const;
|
||||
void DrawOpaqueModels(const NzAbstractViewer* viewer, const NzSceneData& sceneData) const;
|
||||
void DrawTransparentModels(const NzAbstractViewer* viewer, const NzSceneData& sceneData) const;
|
||||
const ShaderUniforms* GetShaderUniforms(const NzShader* shader) const;
|
||||
void OnShaderInvalidated(const NzShader* shader) const;
|
||||
void SendLightUniforms(const NzShader* shader, const NzLightUniforms& uniforms, unsigned int uniformOffset, unsigned int index) const;
|
||||
|
||||
20
include/Nazara/Graphics/SceneData.hpp
Normal file
20
include/Nazara/Graphics/SceneData.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_SCENEDATA_HPP
|
||||
#define NAZARA_SCENEDATA_HPP
|
||||
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
|
||||
class NzAbstractBackground;
|
||||
|
||||
struct NzSceneData
|
||||
{
|
||||
NzColor ambientColor;
|
||||
NzAbstractBackground* background;
|
||||
};
|
||||
|
||||
#endif // NAZARA_SCENEDATA_HPP
|
||||
@@ -22,7 +22,7 @@ class NAZARA_API NzSkyboxBackground : public NzAbstractBackground
|
||||
NzSkyboxBackground(NzTexture* cubemapTexture);
|
||||
~NzSkyboxBackground();
|
||||
|
||||
void Draw(const NzScene* scene) const;
|
||||
void Draw(const NzAbstractViewer* viewer) const;
|
||||
|
||||
nzBackgroundType GetBackgroundType() const;
|
||||
NzTexture* GetTexture() const;
|
||||
|
||||
@@ -18,7 +18,7 @@ class NAZARA_API NzTextureBackground : public NzAbstractBackground
|
||||
NzTextureBackground();
|
||||
NzTextureBackground(NzTexture* texture);
|
||||
|
||||
void Draw(const NzScene* scene) const;
|
||||
void Draw(const NzAbstractViewer* viewer) const;
|
||||
|
||||
nzBackgroundType GetBackgroundType() const;
|
||||
NzTexture* GetTexture() const;
|
||||
|
||||
Reference in New Issue
Block a user