1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | #ifndef __QUAKE3SHADER_H__ |
---|
30 | #define __QUAKE3SHADER_H__ |
---|
31 | |
---|
32 | #include "OgreResource.h" |
---|
33 | #include "OgreBspPrerequisites.h" |
---|
34 | #include "OgreQuake3Types.h" |
---|
35 | #include "OgreCommon.h" |
---|
36 | #include "OgreColourValue.h" |
---|
37 | #include "OgreBlendMode.h" |
---|
38 | #include "OgreTextureUnitState.h" |
---|
39 | |
---|
40 | namespace Ogre { |
---|
41 | |
---|
42 | |
---|
43 | /** Class for recording Quake3 shaders. |
---|
44 | This is a temporary holding area since shaders are actually converted into |
---|
45 | Material objects for use in the engine proper. However, because we have to read |
---|
46 | in shader definitions en masse (because they are stored in shared .shader files) |
---|
47 | without knowing which will actually be used, we store their definitions here |
---|
48 | temporarily since their instantiations as Materials would use precious resources |
---|
49 | because of the automatic loading of textures etc. |
---|
50 | */ |
---|
51 | class Quake3Shader |
---|
52 | { |
---|
53 | protected: |
---|
54 | String getAlternateName(const String& texName); |
---|
55 | String mName; |
---|
56 | |
---|
57 | public: |
---|
58 | |
---|
59 | /** Default constructor - used by Quake3ShaderManager (do not call directly) */ |
---|
60 | Quake3Shader(const String& name); |
---|
61 | ~Quake3Shader(); |
---|
62 | |
---|
63 | /** Creates this shader as an OGRE material. |
---|
64 | Creates a new material based on this shaders settings. |
---|
65 | Material name shader#lightmap. |
---|
66 | */ |
---|
67 | MaterialPtr createAsMaterial(int lightmapNumber); |
---|
68 | |
---|
69 | struct Pass { |
---|
70 | unsigned int flags; |
---|
71 | String textureName; |
---|
72 | TexGen texGen; |
---|
73 | // Multitexture blend |
---|
74 | LayerBlendOperation blend; |
---|
75 | // Multipass blends (Quake3 only supports multipass?? Surely not?) |
---|
76 | SceneBlendFactor blendSrc; |
---|
77 | SceneBlendFactor blendDest; |
---|
78 | bool customBlend; |
---|
79 | CompareFunction depthFunc; |
---|
80 | TextureUnitState::TextureAddressingMode addressMode; |
---|
81 | // TODO - alphaFunc |
---|
82 | GenFunc rgbGenFunc; |
---|
83 | WaveType rgbGenWave; |
---|
84 | Real rgbGenParams[4]; // base, amplitude, phase, frequency |
---|
85 | Real tcModScale[2]; |
---|
86 | Real tcModRotate; |
---|
87 | Real tcModScroll[2]; |
---|
88 | Real tcModTransform[6]; |
---|
89 | bool tcModTurbOn; |
---|
90 | Real tcModTurb[4]; |
---|
91 | WaveType tcModStretchWave; |
---|
92 | Real tcModStretchParams[4]; // base, amplitude, phase, frequency |
---|
93 | CompareFunction alphaFunc; |
---|
94 | unsigned char alphaVal; |
---|
95 | |
---|
96 | Real animFps; |
---|
97 | unsigned int animNumFrames; |
---|
98 | String frames[32]; |
---|
99 | }; |
---|
100 | |
---|
101 | unsigned int flags; |
---|
102 | int numPasses; |
---|
103 | typedef std::vector<Pass> PassList; |
---|
104 | PassList pass; |
---|
105 | bool farbox; // Skybox |
---|
106 | String farboxName; |
---|
107 | bool skyDome; |
---|
108 | Real cloudHeight; // Skydome |
---|
109 | DeformFunc deformFunc; |
---|
110 | Real deformParams[5]; |
---|
111 | ManualCullingMode cullMode; |
---|
112 | |
---|
113 | bool fog; |
---|
114 | ColourValue fogColour; |
---|
115 | Real fogDistance; |
---|
116 | |
---|
117 | }; |
---|
118 | } |
---|
119 | |
---|
120 | #endif |
---|