aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CQuake3ShaderSceneNode.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CQuake3ShaderSceneNode.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CQuake3ShaderSceneNode.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CQuake3ShaderSceneNode.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CQuake3ShaderSceneNode.h
new file mode 100644
index 0000000..6ec026f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CQuake3ShaderSceneNode.h
@@ -0,0 +1,118 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten
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_QUAKE3_SCENE_NODE_H_INCLUDED__
6#define __C_QUAKE3_SCENE_NODE_H_INCLUDED__
7
8#include "IMeshSceneNode.h"
9#include "IQ3Shader.h"
10#include "IFileSystem.h"
11#include "SMeshBuffer.h"
12#include "SMeshBufferLightMap.h"
13#include "SMesh.h"
14#include "ISceneManager.h"
15
16namespace irr
17{
18namespace scene
19{
20
21//! Scene node which is a quake3 shader.
22class CQuake3ShaderSceneNode : public scene::IMeshSceneNode
23{
24public:
25
26 CQuake3ShaderSceneNode( ISceneNode* parent, ISceneManager* mgr, s32 id,
27 io::IFileSystem* fileSystem,
28 const IMeshBuffer* original,
29 const quake3::IShader* shader
30 );
31
32 virtual ~CQuake3ShaderSceneNode();
33
34 virtual void OnRegisterSceneNode();
35 virtual void render();
36 virtual void OnAnimate(u32 timeMs);
37 virtual const core::aabbox3d<f32>& getBoundingBox() const;
38
39 virtual u32 getMaterialCount() const;
40 virtual video::SMaterial& getMaterial(u32 i);
41
42 //! Returns type of the scene node
43 virtual ESCENE_NODE_TYPE getType() const { return ESNT_Q3SHADER_SCENE_NODE; }
44
45 virtual void setMesh(IMesh* mesh){}
46 virtual IMesh* getMesh() { return Mesh; }
47 virtual void setReadOnlyMaterials(bool readonly) {}
48 virtual bool isReadOnlyMaterials() const { return true; }
49
50 //! Creates shadow volume scene node as child of this node
51 //! and returns a pointer to it.
52 virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh,
53 s32 id, bool zfailmethod=true, f32 infinity=10000.0f);
54
55 //! Removes a child from this scene node.
56 //! Implemented here, to be able to remove the shadow properly, if there is one,
57 //! or to remove attached childs.
58 virtual bool removeChild(ISceneNode* child);
59
60private:
61 const quake3::IShader* Shader;
62 SMesh *Mesh;
63 IShadowVolumeSceneNode* Shadow;
64 const SMeshBufferLightMap* Original;
65 SMeshBuffer* MeshBuffer;
66 core::vector3df MeshOffset;
67
68 struct SQ3Texture
69 {
70 SQ3Texture () :
71 TextureIndex ( 0 ),
72 TextureFrequency(0.f),
73 TextureAddressMode( video::ETC_REPEAT )
74 {
75 Texture.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
76 }
77
78 quake3::tTexArray Texture;
79
80 u32 TextureIndex;
81 f32 TextureFrequency;
82 video::E_TEXTURE_CLAMP TextureAddressMode; // Wrapping/Clamping
83 };
84
85 core::array< SQ3Texture > Q3Texture;
86
87 void loadTextures ( io::IFileSystem * fileSystem );
88 void addBuffer ( scene::SMeshBufferLightMap * buffer );
89 void cloneBuffer ( scene::SMeshBuffer *dest, const scene::SMeshBufferLightMap * buffer, bool translateCenter );
90
91 void deformvertexes_wave ( f32 dt, quake3::SModifierFunction &function );
92 void deformvertexes_move ( f32 dt, quake3::SModifierFunction &function );
93 void deformvertexes_bulge( f32 dt, quake3::SModifierFunction &function );
94 void deformvertexes_autosprite( f32 dt, quake3::SModifierFunction &function );
95 void deformvertexes_autosprite2( f32 dt, quake3::SModifierFunction &function );
96 void deformvertexes_normal ( f32 dt, quake3::SModifierFunction &function );
97
98 void vertextransform_tcgen ( f32 dt, quake3::SModifierFunction &function );
99 void vertextransform_rgbgen ( f32 dt, quake3::SModifierFunction &function );
100 void vertextransform_alphagen ( f32 dt, quake3::SModifierFunction &function );
101
102 void transformtex ( const core::matrix4 &m, const u32 clamp );
103
104 f32 TimeAbs;
105
106 void animate( u32 stage, core::matrix4 &texture );
107
108 E_SCENE_NODE_RENDER_PASS getRenderStage() const;
109
110};
111
112
113} // end namespace scene
114} // end namespace irr
115
116
117#endif
118