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-2005 The OGRE Team
|
---|
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 | */
|
---|
25 | #ifndef __QUAKE3SHADER_H__
|
---|
26 | #define __QUAKE3SHADER_H__
|
---|
27 |
|
---|
28 | #include "OgreResource.h"
|
---|
29 | #include "OgreBspPrerequisites.h"
|
---|
30 | #include "OgreQuake3Types.h"
|
---|
31 | #include "OgreCommon.h"
|
---|
32 | #include "OgreColourValue.h"
|
---|
33 | #include "OgreBlendMode.h"
|
---|
34 | #include "OgreTextureUnitState.h"
|
---|
35 |
|
---|
36 | namespace Ogre {
|
---|
37 |
|
---|
38 |
|
---|
39 | /** Class for recording Quake3 shaders.
|
---|
40 | This is a temporary holding area since shaders are actually converted into
|
---|
41 | Material objects for use in the engine proper. However, because we have to read
|
---|
42 | in shader definitions en masse (because they are stored in shared .shader files)
|
---|
43 | without knowing which will actually be used, we store their definitions here
|
---|
44 | temporarily since their instantiations as Materials would use precious resources
|
---|
45 | because of the automatic loading of textures etc.
|
---|
46 | */
|
---|
47 | class Quake3Shader
|
---|
48 | {
|
---|
49 | protected:
|
---|
50 | String getAlternateName(const String& texName);
|
---|
51 | String mName;
|
---|
52 |
|
---|
53 | public:
|
---|
54 |
|
---|
55 | /** Default constructor - used by Quake3ShaderManager (do not call directly) */
|
---|
56 | Quake3Shader(const String& name);
|
---|
57 | ~Quake3Shader();
|
---|
58 |
|
---|
59 | /** Creates this shader as an OGRE material.
|
---|
60 | Creates a new material based on this shaders settings.
|
---|
61 | Material name shader#lightmap.
|
---|
62 | */
|
---|
63 | MaterialPtr createAsMaterial(int lightmapNumber);
|
---|
64 |
|
---|
65 | struct Pass {
|
---|
66 | unsigned int flags;
|
---|
67 | String textureName;
|
---|
68 | TexGen texGen;
|
---|
69 | // Multitexture blend
|
---|
70 | LayerBlendOperation blend;
|
---|
71 | // Multipass blends (Quake3 only supports multipass?? Surely not?)
|
---|
72 | SceneBlendFactor blendSrc;
|
---|
73 | SceneBlendFactor blendDest;
|
---|
74 | bool customBlend;
|
---|
75 | CompareFunction depthFunc;
|
---|
76 | TextureUnitState::TextureAddressingMode addressMode;
|
---|
77 | // TODO - alphaFunc
|
---|
78 | GenFunc rgbGenFunc;
|
---|
79 | WaveType rgbGenWave;
|
---|
80 | Real rgbGenParams[4]; // base, amplitude, phase, frequency
|
---|
81 | Real tcModScale[2];
|
---|
82 | Real tcModRotate;
|
---|
83 | Real tcModScroll[2];
|
---|
84 | Real tcModTransform[6];
|
---|
85 | bool tcModTurbOn;
|
---|
86 | Real tcModTurb[4];
|
---|
87 | WaveType tcModStretchWave;
|
---|
88 | Real tcModStretchParams[4]; // base, amplitude, phase, frequency
|
---|
89 | CompareFunction alphaFunc;
|
---|
90 | unsigned char alphaVal;
|
---|
91 |
|
---|
92 | Real animFps;
|
---|
93 | unsigned int animNumFrames;
|
---|
94 | String frames[32];
|
---|
95 | };
|
---|
96 |
|
---|
97 | unsigned int flags;
|
---|
98 | int numPasses;
|
---|
99 | typedef std::vector<Pass> PassList;
|
---|
100 | PassList pass;
|
---|
101 | bool farbox; // Skybox
|
---|
102 | String farboxName;
|
---|
103 | bool skyDome;
|
---|
104 | Real cloudHeight; // Skydome
|
---|
105 | DeformFunc deformFunc;
|
---|
106 | Real deformParams[5];
|
---|
107 | ManualCullingMode cullMode;
|
---|
108 |
|
---|
109 | bool fog;
|
---|
110 | ColourValue fogColour;
|
---|
111 | Real fogDistance;
|
---|
112 |
|
---|
113 | };
|
---|
114 | }
|
---|
115 |
|
---|
116 | #endif
|
---|