You.i Engine
YiRenderer.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_RENDERER_H_
3 #define _YI_RENDERER_H_
4 
5 #include "framework/YiPredef.h"
7 
8 #include <glm/fwd.hpp>
9 
10 #include <functional>
11 #include <memory>
12 #include <vector>
13 
15 class CYISceneNode;
16 class CYIMaterial;
17 class CYIMesh;
18 class IYIShaderProgram;
20 
35 {
36 public:
37  struct Command
38  {
39  public:
40  using CommandFunction = std::function<void()>;
41 
42  enum class Type
43  {
44  NodeDraw = 1,
60  PopCamera,
61  ClearTarget,
64  };
65 
66  union Data {
67  Data(const CYISceneNode *pNode)
68  : pNode(pNode)
69  {
70  }
72  : pCamera(pCamera)
73  {
74  }
75  Data(const CommandFunction *pCallFunction)
76  : pCallFunction(pCallFunction)
77  {
78  }
79 
83  };
84 
87  };
88 
90 
91  virtual ~IYIRenderer() {}
92 
99  virtual void SetScreenFrameBufferBinding(int32_t fboID = 0) = 0;
100 
111  virtual void SetFrontFaceWinding(CYIRenderSystem::Winding winding) = 0;
112 
118  virtual void SetDepthTest(CYIRenderSystem::DepthTest test) = 0;
119 
128  virtual void SetBlendMode(CYIRenderSystem::BlendMode mode) = 0;
129 
133  virtual void SetBlendColor(float red, float green, float blue, float alpha) = 0;
134 
145  virtual void RenderNodes(const std::vector<Command> &renderList) = 0;
146 
150  virtual const std::shared_ptr<IYIShaderProgram> &GetActiveShader() const = 0;
151 
155  virtual void Draw(const std::shared_ptr<CYIMesh> &pMesh,
156  const std::shared_ptr<CYIMaterial> &pMat,
157  const std::shared_ptr<IYIUniformBufferObject> &pNodeProperties,
158  const glm::mat4 *pModelMatrixOverride) = 0;
159 
163  virtual void PushScreenClipping(const YI_RECT_REL &clipBox) = 0;
164 
168  virtual void PushScreenClippingDisabled() = 0;
169 
173  virtual void PopScreenClipping() = 0;
174 };
175 
178 #endif // _YI_RENDERER_H_
Pop : Restore the previous blending rules.
virtual void SetDepthTest(CYIRenderSystem::DepthTest test)=0
IYIRenderer()
Definition: YiRenderer.h:89
Data(const CYIAbstractCameraSceneNode *pCamera)
Definition: YiRenderer.h:71
Push : Apply the blending rules for the subsequent draw operations. These rules will apply until the ...
Apply a new camera, this will concatenate on to the current camera, use YI_PUSH_CURRENT_CAMERA and YI...
virtual void PopScreenClipping()=0
Definition: YiPredef.h:291
Type m_type
Definition: YiRenderer.h:85
Push : Apply clipping for the node.
Class representing an instance of geometry information.
Definition: YiMesh.h:33
BlendMode
Definition: YiRenderSystem.h:34
virtual void SetScreenFrameBufferBinding(int32_t fboID=0)=0
virtual void SetFrontFaceWinding(CYIRenderSystem::Winding winding)=0
Push : Apply the render target of the node, everything until the matching pop will be drawn into this...
Replace with this camera, use YI_PUSH_CURRENT_CAMERA and YI_POP_CAMERA if the previous state should b...
virtual void Draw(const std::shared_ptr< CYIMesh > &pMesh, const std::shared_ptr< CYIMaterial > &pMat, const std::shared_ptr< IYIUniformBufferObject > &pNodeProperties, const glm::mat4 *pModelMatrixOverride)=0
Provides a base for the definition of camera objects.
Definition: YiAbstractCameraSceneNode.h:31
virtual void SetBlendMode(CYIRenderSystem::BlendMode mode)=0
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:26
Recalculates clipping using the current camera.
Pop : Restore to the previous clipping state prior to pushing the clipping.
Push : Save the current camera, this render action takes no node.
Push : Apply a mask, this mask will apply to everything drawn after this instruction until the matchi...
Winding
Definition: YiRenderSystem.h:101
const CYIAbstractCameraSceneNode * pCamera
Definition: YiRenderer.h:81
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:99
Data(const CYISceneNode *pNode)
Definition: YiRenderer.h:67
virtual ~IYIRenderer()
Definition: YiRenderer.h:91
Pop : Restore the previous camera.
Data m_data
Definition: YiRenderer.h:86
const CYISceneNode * pNode
Definition: YiRenderer.h:80
virtual void PushScreenClippingDisabled()=0
Definition: YiRenderer.h:66
virtual const std::shared_ptr< IYIShaderProgram > & GetActiveShader() const =0
DepthTest
Definition: YiRenderSystem.h:68
Definition: YiRenderer.h:37
Render the effects defined by the attached node.
std::function< void()> CommandFunction
Definition: YiRenderer.h:40
This class provides a common interface for creating and interacting with shader programs.
Definition: YiShaderProgram.h:28
virtual void SetBlendColor(float red, float green, float blue, float alpha)=0
Pop : Restore the previous render target.
Type
Definition: YiRenderer.h:42
Push : Apply an effect framebuffer, everything following this will render into that framebuffer until...
Common interface for shader uniform buffers.
Definition: YiUniformBufferObject.h:16
Clears the current rendertarget.
virtual void RenderNodes(const std::vector< Command > &renderList)=0
virtual void PushScreenClipping(const YI_RECT_REL &clipBox)=0
const CommandFunction * pCallFunction
Definition: YiRenderer.h:82
Data(const CommandFunction *pCallFunction)
Definition: YiRenderer.h:75
Definition: YiRenderer.h:34
Push : Apply the render target of the node but do not clear it.
Pop : Restore the previous framebuffer.
Executes arbitrary code by calling the provided function.