You.i Engine
YiEffect.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_EFFECT_H_
3 #define _YI_EFFECT_H_
4 
5 #include "animation/YiVariant.h"
6 #include "renderer/YiMaterial.h"
7 #include "renderer/YiMesh.h"
9 
10 #include <vector>
11 
23 class CYISceneNode;
24 class CYITimelineTrack;
25 
27 {
31  uint32_t count;
33 };
34 
36 {
38  uint32_t count;
39  uint32_t trackID;
40 };
41 
42 class CYIEffect : public std::enable_shared_from_this<CYIEffect>
43 {
44 public:
45  CYIEffect();
46  virtual ~CYIEffect();
47 
49  {
50  uint32_t passesNeeded;
52  uint32_t width;
53  uint32_t height;
54  uint32_t compWidth;
55  uint32_t compHeight;
56  std::vector<CYIString> ShaderFileNames;
57  float *pEffectValues;
58  uint32_t effectValueCount;
59  std::vector<EffectUniform> Uniforms;
60  bool isTextNode;
61  std::unique_ptr<CYIAbstractCameraSceneNode> pCamera;
62  void *pReserved1;
63  void *pReserved2;
64  void *pReserved3;
65  void *pReserved4;
66  void *pReserved5;
67  void *pReserved6;
68 
69  EFFECT_CONFIG();
70  };
71 
75  bool SetEffect(CYISceneNode *pOwner, EFFECT_CONFIG config);
76 
80  void ResetEffectSize(int32_t width, int32_t height);
81 
85  void SetEffectOwner(CYISceneNode *pOwner);
86 
90  const std::shared_ptr<CYIRenderTarget> &GetRenderTarget(size_t index) const;
91 
95  void SetRenderTarget(const std::shared_ptr<CYIOffscreenRenderTarget> &pTarget, size_t index);
96 
100  const std::shared_ptr<CYIMesh> &GetMesh() const;
101 
105  const glm::mat4 &GetTransform() const;
106 
110  void SetTransform(glm::mat4 &Transform);
111 
118  CYIAbstractCameraSceneNode *GetCamera() const;
119 
123  const std::shared_ptr<CYIMaterial> &GetMaterial(size_t index) const;
124 
128  const EFFECT_CONFIG &GetConfig() const;
129 
136  void SetNeedsUpdate(bool update) const;
137 
141  bool GetNeedsUpdate() const;
142 
146  void SetCustomUniforms();
147 
152  void ConnectTimelineTrack(const CYITimelineTrack *pTrack);
153 
157  void SetUniformValue(uint32_t trackID, const CYIVariant &value);
158 
162  void SetUniformValueDirect(size_t index, const CYIVariant &value);
163 
167  void Enable(bool enable);
168 
169 protected:
172  std::shared_ptr<CYIMesh> m_pMesh;
173  std::vector<std::shared_ptr<CYIMaterial>> m_pMaterials;
174  std::vector<std::shared_ptr<CYIRenderTarget>> m_pTargets;
175  std::vector<EffectUniformVariable> UniformVariables;
176  glm::mat4 m_Transform;
177  mutable bool m_needsUpdate;
178  bool m_enable;
179  std::shared_ptr<CYIMaterial> m_pOrigMaterial;
180  std::shared_ptr<CYIRenderTarget> m_pOrigTarget;
181  std::shared_ptr<CYIMesh> m_pOrigMesh;
182 };
183 
186 #endif // _YI_EFFECT_H_
glm::mat4 m_Transform
Definition: YiEffect.h:176
A container class for common data types.
Definition: YiVariant.h:33
CYIUniformBufferId UniformId
Definition: YiEffect.h:28
std::vector< std::shared_ptr< CYIRenderTarget > > m_pTargets
Definition: YiEffect.h:174
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
std::vector< CYIString > ShaderFileNames
Definition: YiEffect.h:56
std::unique_ptr< CYIAbstractCameraSceneNode > pCamera
Definition: YiEffect.h:61
Definition: YiEffect.h:48
uint32_t compHeight
Definition: YiEffect.h:55
uint32_t count
Definition: YiEffect.h:38
A representation of a single track of a CYITimeline.
Definition: YiTimelineTrack.h:25
Provides a base for the definition of camera objects.
Definition: YiAbstractCameraSceneNode.h:31
void * pReserved3
Definition: YiEffect.h:64
EFFECT_CONFIG m_config
Definition: YiEffect.h:171
uint32_t trackID
Definition: YiEffect.h:39
uint32_t compWidth
Definition: YiEffect.h:54
void * pReserved1
Definition: YiEffect.h:62
bool m_needsUpdate
Definition: YiEffect.h:177
void * pReserved4
Definition: YiEffect.h:65
void * pReserved6
Definition: YiEffect.h:67
float * pEffectValues
Definition: YiEffect.h:57
bool isTextNode
Definition: YiEffect.h:60
The CYIUniformBufferId class is an identification class for Uniform buffers that also reveals the nam...
Definition: YiUniformBufferId.h:30
CYISceneNode * m_pOwner
Definition: YiEffect.h:170
uint32_t count
Definition: YiEffect.h:31
CYIVariant Variable
Definition: YiEffect.h:37
void * pReserved2
Definition: YiEffect.h:63
uint32_t effectValueCount
Definition: YiEffect.h:58
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
uint32_t existingPassToStartOn
Definition: YiEffect.h:51
CYIVariant Variable
Definition: YiEffect.h:32
std::shared_ptr< CYIRenderTarget > m_pOrigTarget
Definition: YiEffect.h:180
Definition: YiEffect.h:26
std::shared_ptr< CYIMesh > m_pOrigMesh
Definition: YiEffect.h:181
Type
Definition: YiUniformBufferObject.h:19
std::shared_ptr< CYIMesh > m_pMesh
Definition: YiEffect.h:172
Definition: YiEffect.h:42
Definition: YiEffect.h:35
uint32_t width
Definition: YiEffect.h:52
std::shared_ptr< CYIMaterial > m_pOrigMaterial
Definition: YiEffect.h:179
bool m_enable
Definition: YiEffect.h:178
std::vector< EffectUniformVariable > UniformVariables
Definition: YiEffect.h:175
std::vector< EffectUniform > Uniforms
Definition: YiEffect.h:59
CYIString AELinkName
Definition: YiEffect.h:29
void * pReserved5
Definition: YiEffect.h:66
std::vector< std::shared_ptr< CYIMaterial > > m_pMaterials
Definition: YiEffect.h:173
IYIUniformBufferObject::Type UniformType
Definition: YiEffect.h:30
uint32_t height
Definition: YiEffect.h:53
uint32_t passesNeeded
Definition: YiEffect.h:50