~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/CQuake3ShaderSceneNode.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 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
 
 
16
namespace irr
 
17
{
 
18
namespace scene
 
19
{
 
20
 
 
21
//! Scene node which is a quake3 shader.
 
22
class CQuake3ShaderSceneNode : public scene::IMeshSceneNode
 
23
{
 
24
public:
 
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
private:
 
51
        const quake3::IShader* Shader;
 
52
        SMesh *Mesh;
 
53
        const SMeshBufferLightMap* Original;
 
54
        SMeshBuffer* MeshBuffer;
 
55
        core::vector3df MeshOffset;
 
56
 
 
57
        struct SQ3Texture
 
58
        {
 
59
                SQ3Texture () :
 
60
                        TextureIndex ( 0 ),
 
61
                        TextureFrequency(0.f),
 
62
                        TextureAddressMode( video::ETC_REPEAT )
 
63
                        {
 
64
                                Texture.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
 
65
                        }
 
66
 
 
67
                quake3::tTexArray Texture;
 
68
 
 
69
                u32 TextureIndex;
 
70
                f32 TextureFrequency;
 
71
                video::E_TEXTURE_CLAMP TextureAddressMode;      // Wrapping/Clamping
 
72
        };
 
73
 
 
74
        core::array< SQ3Texture > Q3Texture;
 
75
 
 
76
        void loadTextures ( io::IFileSystem * fileSystem );
 
77
        void addBuffer ( scene::SMeshBufferLightMap * buffer );
 
78
        void cloneBuffer ( scene::SMeshBuffer *dest, const scene::SMeshBufferLightMap * buffer, bool translateCenter );
 
79
 
 
80
        void deformvertexes_wave ( f32 dt, quake3::SModifierFunction &function );
 
81
        void deformvertexes_move ( f32 dt, quake3::SModifierFunction &function );
 
82
        void deformvertexes_bulge( f32 dt, quake3::SModifierFunction &function );
 
83
        void deformvertexes_autosprite( f32 dt, quake3::SModifierFunction &function );
 
84
        void deformvertexes_autosprite2( f32 dt, quake3::SModifierFunction &function );
 
85
        void deformvertexes_normal ( f32 dt, quake3::SModifierFunction &function );
 
86
 
 
87
        void vertextransform_tcgen ( f32 dt, quake3::SModifierFunction &function );
 
88
        void vertextransform_rgbgen ( f32 dt, quake3::SModifierFunction &function );
 
89
        void vertextransform_alphagen ( f32 dt, quake3::SModifierFunction &function );
 
90
 
 
91
        void transformtex ( const core::matrix4 &m, const u32 clamp );
 
92
 
 
93
        f32 TimeAbs;
 
94
 
 
95
        void animate( u32 stage, core::matrix4 &texture );
 
96
 
 
97
        E_SCENE_NODE_RENDER_PASS getRenderStage() const;
 
98
 
 
99
};
 
100
 
 
101
 
 
102
} // end namespace scene
 
103
} // end namespace irr
 
104
 
 
105
 
 
106
#endif
 
107