You.i Engine
YiRenderer.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. 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 
20 class CYISceneNode;
21 class CYIMaterial;
22 class CYIMesh;
23 class IYIShaderProgram;
25 
35 {
36 public:
37  struct Command
38  {
39  public:
40  using CommandFunction = std::function<void()>;
41 
43  {
44  NODE_DRAW = 1,
64  };
65 
66  union CommandData {
68  pNode(pNode) {}
70  pCamera(pCamera) {}
72  pCallFunction(pCallFunction) {}
73 
77  };
78 
81  };
82 
84 
85  virtual ~IYIRenderer() {}
86 
93  virtual void SetScreenFrameBufferBinding(int32_t nFBO_ID = 0) = 0;
94 
105  virtual void SetFrontFaceWinding(CYIRenderSystem::YI_WINDING eWinding) = 0;
106 
112  virtual void SetDepthTest(CYIRenderSystem::YI_DEPTH_TEST eTest) = 0;
113 
122  virtual void SetBlendMode(CYIRenderSystem::YI_BLEND_MODE mode) = 0;
123 
127  virtual void SetBlendColor(float fRed, float fGreen, float fBlue, float fAlpha) = 0;
128 
139  virtual void RenderNodes(const std::vector<Command> &renderList) = 0;
140 
144  virtual const std::shared_ptr<IYIShaderProgram> &GetActiveShader() const = 0;
145 
149  virtual void Draw(const std::shared_ptr<CYIMesh> &pMesh,
150  const std::shared_ptr<CYIMaterial> &pMat,
151  const std::shared_ptr<IYIUniformBufferObject> &pNodeProperties,
152  const glm::mat4 *pModelMatrixOverride) = 0;
153 
157  virtual void PushScreenClipping(const YI_RECT_REL &clipBox) = 0;
158 
162  virtual void PushScreenClippingDisabled() = 0;
163 
167  virtual void PopScreenClipping() = 0;
168 };
169 
172 #endif // _YI_RENDERER_H_
YI_BLEND_MODE
Definition: YiRenderSystem.h:36
IYIRenderer()
Definition: YiRenderer.h:83
Push : Apply a mask, this mask will apply to everything drawn after this instruction until the matchi...
Definition: YiRenderer.h:51
virtual void PopScreenClipping()=0
CommandData(const CYISceneNode *pNode)
Definition: YiRenderer.h:67
Definition: YiPredef.h:234
YI_DEPTH_TEST
Definition: YiRenderSystem.h:70
Pop : Restore the previous render target.
Definition: YiRenderer.h:48
Pop : Remove the mask.
Definition: YiRenderer.h:52
Class representing an instance of geometry information.
Definition: YiMesh.h:33
virtual void SetBlendColor(float fRed, float fGreen, float fBlue, float fAlpha)=0
Pop : Restore the previous camera.
Definition: YiRenderer.h:60
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:30
CommandType m_type
Definition: YiRenderer.h:79
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:27
Pop : Restore to the previous clipping state prior to pushing the clipping.
Definition: YiRenderer.h:46
Definition: YiRenderer.h:44
Definition: YiRenderer.h:66
CommandData(const CYIAbstractCameraSceneNode *pCamera)
Definition: YiRenderer.h:69
const CommandFunction * pCallFunction
Definition: YiRenderer.h:76
Clears the current rendertarget.
Definition: YiRenderer.h:61
virtual void SetDepthTest(CYIRenderSystem::YI_DEPTH_TEST eTest)=0
CommandData(const CommandFunction *pCallFunction)
Definition: YiRenderer.h:71
const CYIAbstractCameraSceneNode * pCamera
Definition: YiRenderer.h:75
CommandType
Definition: YiRenderer.h:42
const CYISceneNode * pNode
Definition: YiRenderer.h:74
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:114
virtual ~IYIRenderer()
Definition: YiRenderer.h:85
Recalculates clipping using the current camera.
Definition: YiRenderer.h:62
Replace with this camera, use YI_PUSH_CURRENT_CAMERA and YI_POP_CAMERA if the previous state should b...
Definition: YiRenderer.h:58
Push : Apply the render target of the node but do not clear it.
Definition: YiRenderer.h:56
virtual void PushScreenClippingDisabled()=0
Render the effects defined by the attached node.
Definition: YiRenderer.h:55
virtual const std::shared_ptr< IYIShaderProgram > & GetActiveShader() const =0
YI_WINDING
Definition: YiRenderSystem.h:103
Definition: YiRenderer.h:37
std::function< void()> CommandFunction
Definition: YiRenderer.h:40
Push : Apply an effect framebuffer, everything following this will render into that framebuffer until...
Definition: YiRenderer.h:53
This class provides a common interface for creating and interacting with shader programs.
Definition: YiShaderProgram.h:29
Pop : Restore the previous framebuffer.
Definition: YiRenderer.h:54
Push : Apply the blending rules for the subsequent draw operations. These rules will apply until the ...
Definition: YiRenderer.h:49
Push : Save the current camera, this render action takes no node.
Definition: YiRenderer.h:57
Pop : Restore the previous blending rules.
Definition: YiRenderer.h:50
CommandData m_data
Definition: YiRenderer.h:80
Common interface for shader uniform buffers.
Definition: YiUniformBufferObject.h:16
virtual void RenderNodes(const std::vector< Command > &renderList)=0
virtual void PushScreenClipping(const YI_RECT_REL &clipBox)=0
virtual void SetBlendMode(CYIRenderSystem::YI_BLEND_MODE mode)=0
Push : Apply clipping for the node.
Definition: YiRenderer.h:45
virtual void SetFrontFaceWinding(CYIRenderSystem::YI_WINDING eWinding)=0
Executes arbitrary code by calling the provided function.
Definition: YiRenderer.h:63
virtual void SetScreenFrameBufferBinding(int32_t nFBO_ID=0)=0
Definition: YiRenderer.h:34
Push : Apply the render target of the node, everything until the matching pop will be drawn into this...
Definition: YiRenderer.h:47
Apply a new camera, this will concatenate on to the current camera, use YI_PUSH_CURRENT_CAMERA and YI...
Definition: YiRenderer.h:59