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