VPS
Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 343 vs 350 for /trunk/Source Code/Graphs/Components/Headers/RenderingComponent.h

Diff revisions: vs.
  @@ -4,18 +4,27 @@
4 4
5 5 This file is part of DIVIDE Framework.
6 6
7 - Permission is hereby granted, free of charge, to any person obtaining a copy of this software
8 - and associated documentation files (the "Software"), to deal in the Software without restriction,
9 - including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 - and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
7 + Permission is hereby granted, free of charge, to any person obtaining a copy of
8 + this software
9 + and associated documentation files (the "Software"), to deal in the Software
10 + without restriction,
11 + including without limitation the rights to use, copy, modify, merge, publish,
12 + distribute, sublicense,
13 + and/or sell copies of the Software, and to permit persons to whom the Software
14 + is furnished to do so,
11 15 subject to the following conditions:
12 16
13 - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
17 + The above copyright notice and this permission notice shall be included in all
18 + copies or substantial portions of the Software.
14 19
15 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 - INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 + IMPLIED,
22 + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 + PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 + DAMAGES OR OTHER LIABILITY,
26 + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 + CONNECTION WITH THE SOFTWARE
19 28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 29
21 30 */
  @@ -29,78 +38,86 @@
29 38
30 39 namespace Divide {
31 40
32 - class Material;
33 - class ShaderProgram;
34 - class SceneGraphNode;
35 - class RenderingComponent : public SGNComponent {
41 + class Material;
42 + class ShaderProgram;
43 + class SceneGraphNode;
44 + class RenderingComponent : public SGNComponent {
45 + public:
46 + RenderingComponent(Material* const materialInstance,
47 + SceneGraphNode* const parentSGN);
48 + ~RenderingComponent();
49 +
50 + /// Draw the parent scene graph node
51 + void render(const SceneRenderState& sceneRenderState,
52 + const RenderStage& currentRenderStage);
53 + bool onDraw(RenderStage currentStage);
54 + void update(const U64 deltaTime);
55 +
56 + void renderWireframe(const bool state);
57 + void renderBoundingBox(const bool state);
58 + void renderSkeleton(const bool state);
59 +
60 + inline bool renderWireframe() const { return _renderWireframe; }
61 + inline bool renderBoundingBox() const { return _renderBoundingBox; }
62 + inline bool renderSkeleton() const { return _renderSkeleton; }
63 +
64 + void castsShadows(const bool state);
65 + void receivesShadows(const bool state);
66 +
67 + bool castsShadows() const;
68 + bool receivesShadows() const;
69 +
70 + /// Called after the parent node was rendered
71 + void postDraw(const SceneRenderState& sceneRenderState,
72 + RenderStage renderStage);
73 +
74 + U8 lodLevel() const;
75 + void lodLevel(U8 LoD);
76 +
77 + ShaderProgram* const getDrawShader(RenderStage renderStage = FINAL_STAGE);
78 + size_t getDrawStateHash(RenderStage renderStage);
79 +
80 + inline const vectorImpl<GenericDrawCommand>& getDrawCommands() const {
81 + return _drawCommandsCache;
82 + }
83 + inline void getMaterialColorMatrix(mat4<F32>& matOut) const {
84 + return matOut.set(_materialColorMatrix);
85 + }
86 + inline void getMaterialPropertyMatrix(mat4<F32>& matOut) const {
87 + return matOut.set(_materialPropertyMatrix);
88 + }
89 + inline Material* const getMaterialInstance() { return _materialInstance; }
90 +
91 + const vectorImpl<GenericDrawCommand>& getDrawCommands(
92 + vectorAlg::vecSize commandOffset, SceneRenderState& sceneRenderState,
93 + RenderStage renderStage);
36 94
37 - public:
38 -
39 - RenderingComponent(Material* const materialInstance, SceneGraphNode* const parentSGN);
40 - ~RenderingComponent();
41 -
42 - /// Draw the parent scene graph node
43 - void render(const SceneRenderState& sceneRenderState, const RenderStage& currentRenderStage);
44 - bool onDraw(RenderStage currentStage);
45 - void update(const U64 deltaTime);
46 -
47 - void renderWireframe(const bool state);
48 - void renderBoundingBox(const bool state);
49 - void renderSkeleton(const bool state);
50 -
51 - inline bool renderWireframe() const { return _renderWireframe; }
52 - inline bool renderBoundingBox() const { return _renderBoundingBox; }
53 - inline bool renderSkeleton() const { return _renderSkeleton; }
54 -
55 - void castsShadows(const bool state);
56 - void receivesShadows(const bool state);
57 -
58 - bool castsShadows() const;
59 - bool receivesShadows() const;
60 -
61 - /// Called after the parent node was rendered
62 - void postDraw(const SceneRenderState& sceneRenderState, RenderStage renderStage);
63 -
64 - U8 lodLevel() const;
65 - void lodLevel(U8 LoD);
66 -
67 - ShaderProgram* const getDrawShader(RenderStage renderStage = FINAL_STAGE);
68 - size_t getDrawStateHash(RenderStage renderStage);
69 -
70 - inline const vectorImpl<GenericDrawCommand>& getDrawCommands() const { return _drawCommandsCache; }
71 - inline void getMaterialColorMatrix(mat4<F32>& matOut) const { return matOut.set(_materialColorMatrix); }
72 - inline void getMaterialPropertyMatrix(mat4<F32>& matOut) const { return matOut.set(_materialPropertyMatrix); }
73 - inline Material* const getMaterialInstance() { return _materialInstance; }
74 -
75 - const vectorImpl<GenericDrawCommand>& getDrawCommands(vectorAlg::vecSize commandOffset,
76 - SceneRenderState& sceneRenderState,
77 - RenderStage renderStage);
78 -
79 95 #ifdef _DEBUG
80 - void drawDebugAxis();
96 + void drawDebugAxis();
81 97 #endif
82 - protected:
83 - friend class SceneGraphNode;
84 - void inViewCallback();
85 -
86 - protected:
87 - Material* _materialInstance;
88 - ///LOD level is updated at every visibility check (SceneNode::isInView(...));
89 - U8 _lodLevel; ///<Relative to camera distance
90 - bool _castsShadows;
91 - bool _receiveShadows;
92 - bool _renderWireframe;
93 - bool _renderBoundingBox;
94 - bool _renderSkeleton;
95 - mat4<F32> _materialColorMatrix;
96 - mat4<F32> _materialPropertyMatrix;
97 - vectorImpl<GenericDrawCommand> _drawCommandsCache;
98 + protected:
99 + friend class SceneGraphNode;
100 + void inViewCallback();
101 +
102 + protected:
103 + Material* _materialInstance;
104 + /// LOD level is updated at every visibility check
105 + /// (SceneNode::isInView(...));
106 + U8 _lodLevel; ///<Relative to camera distance
107 + bool _castsShadows;
108 + bool _receiveShadows;
109 + bool _renderWireframe;
110 + bool _renderBoundingBox;
111 + bool _renderSkeleton;
112 + mat4<F32> _materialColorMatrix;
113 + mat4<F32> _materialPropertyMatrix;
114 + vectorImpl<GenericDrawCommand> _drawCommandsCache;
98 115
99 116 #ifdef _DEBUG
100 - vectorImpl<Line > _axisLines;
101 - IMPrimitive* _axisGizmo;
117 + vectorImpl<Line> _axisLines;
118 + IMPrimitive* _axisGizmo;
102 119 #endif
103 - };
120 + };
104 121
105 - }; //namespace Divide
122 + }; // namespace Divide
106 123 #endif