Add new Renderer architecture (far from complete)
Former-commit-id: 52226793d7a087dfe0523315d3303934daffee49 [formerly 9de1c04df6b371f861a2eee8bba38902ee5041cd] [formerly ecd3099df5498722f6390447f40bd3907b8e40c4 [formerly 3076df585565fc9759ab3e718270f2e5ef620840]] Former-commit-id: 92d52f967d0b088d1271afef26069e08cacd6b0f [formerly 5fe27e2ead104278951c772c2121a7b677f88d4d] Former-commit-id: fb6c2456d8edd3ec022d5d953f79fecdd4f2b8f4
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
@@ -8,120 +8,33 @@
|
||||
#define NAZARA_RENDERER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Initializer.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Renderer/GpuQuery.hpp>
|
||||
#include <Nazara/Renderer/RenderStates.hpp>
|
||||
#include <Nazara/Renderer/TextureSampler.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/VertexDeclaration.hpp>
|
||||
#include <Nazara/Core/DynLib.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/RendererImpl.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class Color;
|
||||
class Context;
|
||||
class IndexBuffer;
|
||||
class RenderTarget;
|
||||
class Shader;
|
||||
class Texture;
|
||||
class VertexBuffer;
|
||||
|
||||
class NAZARA_RENDERER_API Renderer
|
||||
{
|
||||
friend Texture;
|
||||
|
||||
public:
|
||||
using DrawCall = void (*)(PrimitiveMode, unsigned int, unsigned int);
|
||||
using DrawCallInstanced = void (*)(unsigned int, PrimitiveMode, unsigned int, unsigned int);
|
||||
|
||||
Renderer() = delete;
|
||||
~Renderer() = delete;
|
||||
|
||||
static void BeginCondition(const GpuQuery& query, GpuQueryCondition condition);
|
||||
|
||||
static void Clear(UInt32 flags = RendererBuffer_Color | RendererBuffer_Depth);
|
||||
|
||||
static void DrawFullscreenQuad();
|
||||
static void DrawIndexedPrimitives(PrimitiveMode mode, unsigned int firstIndex, unsigned int indexCount);
|
||||
static void DrawIndexedPrimitivesInstanced(unsigned int instanceCount, PrimitiveMode mode, unsigned int firstIndex, unsigned int indexCount);
|
||||
static void DrawPrimitives(PrimitiveMode mode, unsigned int firstVertex, unsigned int vertexCount);
|
||||
static void DrawPrimitivesInstanced(unsigned int instanceCount, PrimitiveMode mode, unsigned int firstVertex, unsigned int vertexCount);
|
||||
|
||||
static void Enable(RendererParameter parameter, bool enable);
|
||||
|
||||
static void EndCondition();
|
||||
|
||||
static void Flush();
|
||||
|
||||
static RendererComparison GetDepthFunc();
|
||||
static VertexBuffer* GetInstanceBuffer();
|
||||
static float GetLineWidth();
|
||||
static Matrix4f GetMatrix(MatrixType type);
|
||||
static UInt8 GetMaxAnisotropyLevel();
|
||||
static unsigned int GetMaxColorAttachments();
|
||||
static unsigned int GetMaxRenderTargets();
|
||||
static unsigned int GetMaxTextureSize();
|
||||
static unsigned int GetMaxTextureUnits();
|
||||
static unsigned int GetMaxVertexAttribs();
|
||||
static float GetPointSize();
|
||||
static const RenderStates& GetRenderStates();
|
||||
static Recti GetScissorRect();
|
||||
static const Shader* GetShader();
|
||||
static const RenderTarget* GetTarget();
|
||||
static Recti GetViewport();
|
||||
|
||||
static bool HasCapability(RendererCap capability);
|
||||
|
||||
static inline RendererImpl* GetRendererImpl();
|
||||
|
||||
static bool Initialize();
|
||||
|
||||
static bool IsComponentTypeSupported(ComponentType type);
|
||||
static bool IsEnabled(RendererParameter parameter);
|
||||
static bool IsInitialized();
|
||||
|
||||
static void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend);
|
||||
static void SetClearColor(const Color& color);
|
||||
static void SetClearColor(UInt8 r, UInt8 g, UInt8 b, UInt8 a = 255);
|
||||
static void SetClearDepth(double depth);
|
||||
static void SetClearStencil(unsigned int value);
|
||||
static void SetDepthFunc(RendererComparison compareFunc);
|
||||
static void SetFaceCulling(FaceSide faceSide);
|
||||
static void SetFaceFilling(FaceFilling fillingMode);
|
||||
static void SetIndexBuffer(const IndexBuffer* indexBuffer);
|
||||
static void SetLineWidth(float size);
|
||||
static void SetMatrix(MatrixType type, const Matrix4f& matrix);
|
||||
static void SetPointSize(float size);
|
||||
static void SetRenderStates(const RenderStates& states);
|
||||
static void SetScissorRect(const Recti& rect);
|
||||
static void SetShader(const Shader* shader);
|
||||
static void SetStencilCompareFunction(RendererComparison compareFunc, FaceSide faceSide = FaceSide_FrontAndBack);
|
||||
static void SetStencilFailOperation(StencilOperation failOperation, FaceSide faceSide = FaceSide_FrontAndBack);
|
||||
static void SetStencilMask(UInt32 mask, FaceSide faceSide = FaceSide_FrontAndBack);
|
||||
static void SetStencilPassOperation(StencilOperation passOperation, FaceSide faceSide = FaceSide_FrontAndBack);
|
||||
static void SetStencilReferenceValue(unsigned int refValue, FaceSide faceSide = FaceSide_FrontAndBack);
|
||||
static void SetStencilZFailOperation(StencilOperation zfailOperation, FaceSide faceSide = FaceSide_FrontAndBack);
|
||||
static bool SetTarget(const RenderTarget* target);
|
||||
static void SetTexture(UInt8 unit, const Texture* texture);
|
||||
static void SetTextureSampler(UInt8 textureUnit, const TextureSampler& sampler);
|
||||
static void SetVertexBuffer(const VertexBuffer* vertexBuffer);
|
||||
static void SetViewport(const Recti& viewport);
|
||||
static inline bool IsInitialized();
|
||||
|
||||
static void Uninitialize();
|
||||
|
||||
private:
|
||||
static void EnableInstancing(bool instancing);
|
||||
static bool EnsureStateUpdate();
|
||||
static void OnContextRelease(const Context* context);
|
||||
static void OnIndexBufferRelease(const IndexBuffer* indexBuffer);
|
||||
static void OnShaderReleased(const Shader* shader);
|
||||
static void OnTextureReleased(const Texture* texture);
|
||||
static void OnVertexBufferRelease(const VertexBuffer* vertexBuffer);
|
||||
static void OnVertexDeclarationRelease(const VertexDeclaration* vertexDeclaration);
|
||||
static void UpdateMatrix(MatrixType type);
|
||||
|
||||
static DynLib s_rendererLib;
|
||||
static std::unique_ptr<RendererImpl> s_rendererImpl;
|
||||
static unsigned int s_moduleReferenceCounter;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/Renderer.inl>
|
||||
|
||||
#endif // NAZARA_RENDERER_HPP
|
||||
|
||||
Reference in New Issue
Block a user