diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CShadowVolumeSceneNode.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CShadowVolumeSceneNode.h | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CShadowVolumeSceneNode.h b/libraries/irrlicht-1.8/source/Irrlicht/CShadowVolumeSceneNode.h index c66b8f9..f538d00 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CShadowVolumeSceneNode.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CShadowVolumeSceneNode.h | |||
@@ -1,87 +1,87 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __C_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__ | 5 | #ifndef __C_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__ |
6 | #define __C_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__ | 6 | #define __C_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IShadowVolumeSceneNode.h" | 8 | #include "IShadowVolumeSceneNode.h" |
9 | 9 | ||
10 | namespace irr | 10 | namespace irr |
11 | { | 11 | { |
12 | namespace scene | 12 | namespace scene |
13 | { | 13 | { |
14 | 14 | ||
15 | //! Scene node for rendering a shadow volume into a stencil buffer. | 15 | //! Scene node for rendering a shadow volume into a stencil buffer. |
16 | class CShadowVolumeSceneNode : public IShadowVolumeSceneNode | 16 | class CShadowVolumeSceneNode : public IShadowVolumeSceneNode |
17 | { | 17 | { |
18 | public: | 18 | public: |
19 | 19 | ||
20 | //! constructor | 20 | //! constructor |
21 | CShadowVolumeSceneNode(const IMesh* shadowMesh, ISceneNode* parent, ISceneManager* mgr, | 21 | CShadowVolumeSceneNode(const IMesh* shadowMesh, ISceneNode* parent, ISceneManager* mgr, |
22 | s32 id, bool zfailmethod=true, f32 infinity=10000.0f); | 22 | s32 id, bool zfailmethod=true, f32 infinity=10000.0f); |
23 | 23 | ||
24 | //! destructor | 24 | //! destructor |
25 | virtual ~CShadowVolumeSceneNode(); | 25 | virtual ~CShadowVolumeSceneNode(); |
26 | 26 | ||
27 | //! Sets the mesh from which the shadow volume should be generated. | 27 | //! Sets the mesh from which the shadow volume should be generated. |
28 | /** To optimize shadow rendering, use a simpler mesh for shadows. | 28 | /** To optimize shadow rendering, use a simpler mesh for shadows. |
29 | */ | 29 | */ |
30 | virtual void setShadowMesh(const IMesh* mesh); | 30 | virtual void setShadowMesh(const IMesh* mesh); |
31 | 31 | ||
32 | //! Updates the shadow volumes for current light positions. | 32 | //! Updates the shadow volumes for current light positions. |
33 | /** Called each render cycle from Animated Mesh SceneNode render method. */ | 33 | /** Called each render cycle from Animated Mesh SceneNode render method. */ |
34 | virtual void updateShadowVolumes(); | 34 | virtual void updateShadowVolumes(); |
35 | 35 | ||
36 | //! pre render method | 36 | //! pre render method |
37 | virtual void OnRegisterSceneNode(); | 37 | virtual void OnRegisterSceneNode(); |
38 | 38 | ||
39 | //! renders the node. | 39 | //! renders the node. |
40 | virtual void render(); | 40 | virtual void render(); |
41 | 41 | ||
42 | //! returns the axis aligned bounding box of this node | 42 | //! returns the axis aligned bounding box of this node |
43 | virtual const core::aabbox3d<f32>& getBoundingBox() const; | 43 | virtual const core::aabbox3d<f32>& getBoundingBox() const; |
44 | 44 | ||
45 | //! Returns type of the scene node | 45 | //! Returns type of the scene node |
46 | virtual ESCENE_NODE_TYPE getType() const { return ESNT_SHADOW_VOLUME; } | 46 | virtual ESCENE_NODE_TYPE getType() const { return ESNT_SHADOW_VOLUME; } |
47 | 47 | ||
48 | private: | 48 | private: |
49 | 49 | ||
50 | typedef core::array<core::vector3df> SShadowVolume; | 50 | typedef core::array<core::vector3df> SShadowVolume; |
51 | 51 | ||
52 | void createShadowVolume(const core::vector3df& pos, bool isDirectional=false); | 52 | void createShadowVolume(const core::vector3df& pos, bool isDirectional=false); |
53 | u32 createEdgesAndCaps(const core::vector3df& light, SShadowVolume* svp, core::aabbox3d<f32>* bb); | 53 | u32 createEdgesAndCaps(const core::vector3df& light, SShadowVolume* svp, core::aabbox3d<f32>* bb); |
54 | 54 | ||
55 | //! Generates adjacency information based on mesh indices. | 55 | //! Generates adjacency information based on mesh indices. |
56 | void calculateAdjacency(); | 56 | void calculateAdjacency(); |
57 | 57 | ||
58 | core::aabbox3d<f32> Box; | 58 | core::aabbox3d<f32> Box; |
59 | 59 | ||
60 | // a shadow volume for every light | 60 | // a shadow volume for every light |
61 | core::array<SShadowVolume> ShadowVolumes; | 61 | core::array<SShadowVolume> ShadowVolumes; |
62 | 62 | ||
63 | // a back cap bounding box for every light | 63 | // a back cap bounding box for every light |
64 | core::array<core::aabbox3d<f32> > ShadowBBox; | 64 | core::array<core::aabbox3d<f32> > ShadowBBox; |
65 | 65 | ||
66 | core::array<core::vector3df> Vertices; | 66 | core::array<core::vector3df> Vertices; |
67 | core::array<u16> Indices; | 67 | core::array<u16> Indices; |
68 | core::array<u16> Adjacency; | 68 | core::array<u16> Adjacency; |
69 | core::array<u16> Edges; | 69 | core::array<u16> Edges; |
70 | // tells if face is front facing | 70 | // tells if face is front facing |
71 | core::array<bool> FaceData; | 71 | core::array<bool> FaceData; |
72 | 72 | ||
73 | const scene::IMesh* ShadowMesh; | 73 | const scene::IMesh* ShadowMesh; |
74 | 74 | ||
75 | u32 IndexCount; | 75 | u32 IndexCount; |
76 | u32 VertexCount; | 76 | u32 VertexCount; |
77 | u32 ShadowVolumesUsed; | 77 | u32 ShadowVolumesUsed; |
78 | 78 | ||
79 | f32 Infinity; | 79 | f32 Infinity; |
80 | 80 | ||
81 | bool UseZFailMethod; | 81 | bool UseZFailMethod; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | } // end namespace scene | 84 | } // end namespace scene |
85 | } // end namespace irr | 85 | } // end namespace irr |
86 | 86 | ||
87 | #endif | 87 | #endif |