Sleeping Wombat GUI  0.100
swGUI
DX11Renderer.h
Go to the documentation of this file.
1 #pragma once
2 
16 
18 typedef DX11Renderer Renderer;
19 
20 
21 inline DX11Buffer* DX11 ( BufferObject* res ) { return static_cast< DX11Buffer* >( res ); }
22 inline DX11Texture* DX11 ( TextureObject* res ) { return static_cast< DX11Texture* >( res ); }
23 inline DX11ComputeShader* DX11 ( ComputeShader* res ) { return static_cast< DX11ComputeShader* >( res ); }
24 inline DX11PixelShader* DX11 ( PixelShader* res ) { return static_cast< DX11PixelShader* >( res ); }
25 inline DX11VertexShader* DX11 ( VertexShader* res ) { return static_cast< DX11VertexShader* >( res ); }
26 inline DX11RenderTarget* DX11 ( RenderTargetObject* res ) { return static_cast< DX11RenderTarget* >( res ); }
27 
28 inline DX11BlendingState* DX11 ( BlendingState* res ) { return static_cast< DX11BlendingState* >( res ); }
29 inline DX11RasterizerState* DX11 ( RasterizerState* res ) { return static_cast< DX11RasterizerState* >( res ); }
30 inline DX11DepthStencilState* DX11 ( DepthStencilState* res ) { return static_cast< DX11DepthStencilState* >( res ); }
31 inline DX11InputLayout* DX11 ( ShaderInputLayout* res ) { return static_cast< DX11InputLayout* >( res ); }
32 
33 
34 //DX11GeometryShader* Typed ( GeometryShader* res ) { return static_cast< DX11GeometryShader* >( res ); }
35 
36 
37 // @todo There're constants in ConstantsBuffersFormats.h file. This is duplicate, but there's no way to do this :(.
38 #define CAMERA_BUFFER_BINDING_POINT 0
39 #define LIGHTS_BUFFER_BINDING_POINT 1
40 #define TRANSFORM_BUFFER_BINDING_POINT 1
41 #define BONES_BUFFER_BINDING_POINT 2
42 #define MATERIAL_BUFFER_BINDING_POINT 2
43 
44 
47 class DX11Renderer : public IRenderer, protected DX11AuxiliaryObjects
48 {
49 private:
53  ID3D11DeviceContext* m_localDeviceContext;
54  bool m_valid;
56 public:
58  ~DX11Renderer();
59 
60  bool SupportsDefferedContextRendering() override { return true; }
61  bool IsValid() override { return m_valid; }
62 
63 
64 
65 
66  virtual void Draw ( const DrawCommand& command ) override;
67  virtual void DrawInstanced ( const DrawInstancedCommand& command ) override;
68 
69  virtual void SetRenderTarget ( const SetRenderTargetCommand& command ) override;
70  virtual void SetRenderTarget ( const SetRenderTargetExCommand& command ) override;
71  virtual void ClearRenderTarget ( const ClearRenderTargetCommand& command ) override;
72 
73  virtual void UpdateBuffer ( const UpdateBufferCommand& command ) override;
74  virtual void BindBuffer ( const BindBufferCommand& command ) override;
75  virtual void UpdateAndBindBuffer ( const UpdateBindBuffer& command ) override;
76 
77  virtual void SetDefaultBuffers ( const SetDefaultBuffersCommand& command ) override;
78 
79  virtual void SetShaderState ( const SetShaderStateCommand& command ) override;
80  virtual void SetShaderState ( const SetShaderStateExCommand& command ) override;
81  virtual void SetShaderState ( const SetRenderStateCommand& command ) override;
82  virtual void SetShaderState ( const SetRenderStateExCommand& command ) override;
83 
84  virtual void CopyTexture ( const CopyTextureCommand& command ) override;
85 
86 private:
87 
88  bool SetVertexBuffer ( BufferObject* buffer, unsigned int offset );
89  void SetIndexBuffer ( BufferObject* buffer, unsigned int offset, bool extendedIndex );
90  void SetRenderTarget ( RenderTargetObject* const targets[ MAX_BOUND_RENDER_TARGETS ], RenderTargetObject* depthStencil );
91  void SetTextures ( TextureObject* const texturesArray[ MAX_BOUND_RENDER_TARGETS ], const uint8 shaderTypes[ MAX_BOUND_RENDER_TARGETS ] );
92 };
93 
94 
95 
Implementacja render targetu w DirectX11.
Definition: DX11RenderTarget.h:9
Definition: DepthStencilState.h:45
RendererUsage m_usageType
Informacja jak będzie używany rederer.
Definition: DX11Renderer.h:55
~DX11Renderer()
Definition: DX11Renderer.cpp:60
DX11Renderer Renderer
Definition: DX11Renderer.h:17
Copy texture.
Definition: RenderCommands.h:183
Sets basic shaders and textures.
Definition: RenderCommands.h:136
Obiekt opakowujący bufor.Bufor może być zarówno buforem wierzchołków, indeksów jak i stałych...
Definition: MeshResources.h:516
Set state of rasterizer and render target.
Definition: RenderCommands.h:36
Sets geometry and tesselation shaders.
Definition: RenderCommands.h:148
bool SupportsDefferedContextRendering() override
Informuje czy Renderer nadaje się do renderowania w wielu wątkach do opóźnionego contextu.
Definition: DX11Renderer.h:60
RasterizerState DirectX11.
Definition: DX11PipelineState.h:23
Renderowanie natychmiastowe.
Definition: IRenderer.h:21
Set state of rasterizer and render target.
Definition: RenderCommands.h:94
virtual void Draw(const DrawCommand &command) override
Definition: DX11Renderer.cpp:75
Renderer obsługujący DirectX 11.
Definition: DX11Renderer.h:47
Klasa interfejsu renderera.
Definition: IRenderer.h:29
virtual void BindBuffer(const BindBufferCommand &command) override
Definition: DX11Renderer.cpp:267
Main draw command.
Definition: RenderCommands.h:109
virtual void SetRenderTarget(const SetRenderTargetCommand &command) override
Definition: DX11Renderer.cpp:128
bool m_valid
Jeżeli klasa nie została zainicjowana poprawnie, to będzie tu wartość false.
Definition: DX11Renderer.h:54
#define MAX_BOUND_RENDER_TARGETS
Definition: RenderCommands.h:19
bool SetVertexBuffer(BufferObject *buffer, unsigned int offset)
Definition: DX11Renderer.cpp:422
Definition: RenderCommands.h:169
ID3D11DeviceContext * m_localDeviceContext
Definition: DX11Renderer.h:53
virtual void ClearRenderTarget(const ClearRenderTargetCommand &command) override
Definition: DX11Renderer.cpp:233
RendererUsage
Sposób użycia renderera.
Definition: IRenderer.h:18
virtual void CopyTexture(const CopyTextureCommand &command) override
Definition: DX11Renderer.cpp:403
Klasa przechowująca pixel shader.
Definition: MeshResources.h:408
Binds buffer to pipeline and updates with given data.
Definition: RenderCommands.h:218
Plik zawiera deklaracje formatów wierzchołków oraz klas zawierających assety shadery itp...
Updates buffer with given data.
Definition: RenderCommands.h:207
Sets default buffers.
Definition: RenderCommands.h:159
Implementacja vertex shadera w DirectX 11.
Definition: DX11VertexShader.h:9
Binds additional buffers.
Definition: RenderCommands.h:196
Instanced drawing command.
Definition: RenderCommands.h:124
Klasa przechowująca tekstury.Klasa bazowa, która będzie używana przez obiekty silnika. Powinny po niej odziedziczyć obiekty konkretnego API graficznego, żeby zaimplementować najważniejsze funkcjonalności.
Definition: MeshResources.h:206
virtual void SetShaderState(const SetShaderStateCommand &command) override
Definition: DX11Renderer.cpp:344
Definition: RenderCommands.h:176
uint8_t uint8
Definition: TypesDefinitions.h:27
Set state of rasterizer and render target.
Definition: RenderCommands.h:82
virtual void UpdateAndBindBuffer(const UpdateBindBuffer &command) override
Definition: DX11Renderer.cpp:288
Klasa zawiera wskaźniki na bufory stałych zawierające podstawowe zestawy elementów przekazywanych do ...
Definition: DX11APIObjects.h:168
Klasa przechowująca compute shader.
Definition: MeshResources.h:492
virtual void DrawInstanced(const DrawInstancedCommand &command) override
Definition: DX11Renderer.cpp:97
void SetIndexBuffer(BufferObject *buffer, unsigned int offset, bool extendedIndex)
Definition: DX11Renderer.cpp:444
DirectX11 buffer implementation.
Definition: DX11Buffer.h:16
virtual void UpdateBuffer(const UpdateBufferCommand &command) override
Definition: DX11Renderer.cpp:257
void SetTextures(TextureObject *const texturesArray[MAX_BOUND_RENDER_TARGETS], const uint8 shaderTypes[MAX_BOUND_RENDER_TARGETS])
Definition: DX11Renderer.cpp:482
Blending state DirectX11.
Definition: DX11PipelineState.h:71
bool IsValid() override
Definition: DX11Renderer.h:61
virtual void SetDefaultBuffers(const SetDefaultBuffersCommand &command) override
Definition: DX11Renderer.cpp:299
Klasa przechowuje layout wierzchołka trafiającego do vertex shadera.
Definition: MeshResources.h:334
Klasa dla render targetów.Klasa umożliwia pobranie jednej z tekstur składowych i udostępnienie dla sh...
Definition: MeshResources.h:301
DX11Renderer(RendererUsage usage=USE_AS_IMMEDIATE)
Klasa będzie renderować w trybie immediate albo deferred.
Definition: DX11Renderer.cpp:38
Depth stencil state DirectX11.
Definition: DX11PipelineState.h:47
DX11Buffer * DX11(BufferObject *res)
Definition: DX11Renderer.h:21
Implementacja tekstury w DirectX 11.
Definition: DX11Texture.h:9
Zawiera deklarację klasy DX11APIObjects i DX11AuxiliaryObjects służących do inicjowania i przechowywa...
Klasa przechowująca vertex shader.
Definition: MeshResources.h:387
Implementacja compute shadera w DirectX11.
Definition: DX11ComputeShader.h:9
Rasterizer state and depth stencil state.
Definition: RasterizerState.h:67
Definition: BlendingState.h:72
Implementacja pixel shadera w DirectX 11.
Definition: DX11PixelShader.h:9
Implementacja layout w DirectX 11.
Definition: DX11InputLayout.h:13