source: GTP/trunk/Lib/Geom/OgreStuff/include/OgreRenderSystemCapabilities.h @ 1809

Revision 1809, 13.6 KB checked in by gumbau, 18 years ago (diff)
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef __RenderSystemCapabilities__
26#define __RenderSystemCapabilities__ 1
27
28// Precompiler options
29#include "OgrePrerequisites.h"
30#include "OgreString.h"
31
32namespace Ogre {
33
34    /// Enum describing the different hardware capabilities we want to check for
35    enum Capabilities
36    {
37        //RSC_MULTITEXTURE          = 0x00000001,
38        /// Supporta generating mipmaps in hardware
39        RSC_AUTOMIPMAP              = 0x00000002,
40        RSC_BLENDING                = 0x00000004,
41        /// Supports anisotropic texture filtering
42        RSC_ANISOTROPY              = 0x00000008,
43        /// Supports fixed-function DOT3 texture blend
44        RSC_DOT3                    = 0x00000010,
45        /// Supports cube mapping
46        RSC_CUBEMAPPING             = 0x00000020,
47        /// Supports hardware stencil buffer
48        RSC_HWSTENCIL               = 0x00000040,
49        /// Supports hardware vertex and index buffers
50        RSC_VBO                     = 0x00000080,
51        /// Supports vertex programs (vertex shaders)
52                RSC_VERTEX_PROGRAM          = 0x00000200,
53        /// Supports fragment programs (pixel shaders)
54                RSC_FRAGMENT_PROGRAM        = 0x00000400,
55        /// Supports compressed textures
56                RSC_TEXTURE_COMPRESSION     = 0x00000800,
57        /// Supports compressed textures in the DXT/ST3C formats
58                RSC_TEXTURE_COMPRESSION_DXT = 0x00001000,
59        /// Supports compressed textures in the VTC format
60                RSC_TEXTURE_COMPRESSION_VTC = 0x00002000,
61        /// Supports performing a scissor test to exclude areas of the screen
62        RSC_SCISSOR_TEST            = 0x00004000,
63        /// Supports separate stencil updates for both front and back faces
64        RSC_TWO_SIDED_STENCIL       = 0x00008000,
65        /// Supports wrapping the stencil value at the range extremeties
66        RSC_STENCIL_WRAP            = 0x00010000,
67        /// Supports hardware occlusion queries
68        RSC_HWOCCLUSION                         = 0x00020000,
69        /// Supports user clipping planes
70        RSC_USER_CLIP_PLANES            = 0x00040000,
71                /// Supports the VET_UBYTE4 vertex element type
72                RSC_VERTEX_FORMAT_UBYTE4        = 0x00080000,
73                /// Supports infinite far plane projection
74                RSC_INFINITE_FAR_PLANE      = 0x00100000,
75        /// Supports hardware render-to-texture (bigger than framebuffer)
76        RSC_HWRENDER_TO_TEXTURE     = 0x00200000,
77        /// Supports float textures and render targets
78        RSC_TEXTURE_FLOAT           = 0x00400000,
79        /// Supports non-power of two textures
80        RSC_NON_POWER_OF_2_TEXTURES = 0x00800000,
81                /// Supports 3d (volume) textures
82                RSC_TEXTURE_3D                          = 0x01000000,
83                /// Supports basic point sprite rendering
84                RSC_POINT_SPRITES                   = 0x02000000,
85                /// Supports extra point parameters (minsize, maxsize, attenuation)
86                RSC_POINT_EXTENDED_PARAMETERS = 0x04000000
87    };
88
89    /** singleton class for storing the capabilities of the graphics card.
90        @remarks
91            This class stores the capabilities of the graphics card.  This
92            information is set by the individual render systems.
93    */
94    class _OgreExport RenderSystemCapabilities
95    {
96        private:
97            /// The number of world matricies available
98            ushort mNumWorldMatrices;
99            /// The number of texture units available
100            ushort mNumTextureUnits;
101            /// The stencil buffer bit depth
102            ushort mStencilBufferBitDepth;
103            /// The number of matrices available for hardware blending
104            ushort mNumVertexBlendMatrices;
105            /// Stores the capabilities flags.
106            int mCapabilities;
107            /// The best vertex program that this card / rendersystem supports
108            String mMaxVertexProgramVersion;
109            /// The best fragment program that this card / rendersystem supports
110            String mMaxFragmentProgramVersion;
111            /// The number of floating-point constants vertex programs support
112            ushort mVertexProgramConstantFloatCount;           
113            /// The number of integer constants vertex programs support
114            ushort mVertexProgramConstantIntCount;           
115            /// The number of boolean constants vertex programs support
116            ushort mVertexProgramConstantBoolCount;           
117            /// The number of floating-point constants fragment programs support
118            ushort mFragmentProgramConstantFloatCount;           
119            /// The number of integer constants fragment programs support
120            ushort mFragmentProgramConstantIntCount;           
121            /// The number of boolean constants fragment programs support
122            ushort mFragmentProgramConstantBoolCount;
123                        /// The number of simultaneous render targets supported
124                        ushort mNumMultiRenderTargets;
125                        /// The maximum point size
126                        Real mMaxPointSize;
127                        /// Are non-POW2 textures feature-limited?
128                        bool mNonPOW2TexturesLimited;
129
130        public:
131            RenderSystemCapabilities ();
132            ~RenderSystemCapabilities ();
133
134            void setNumWorldMatricies(ushort num)
135            {
136                mNumWorldMatrices = num;
137            }
138
139            void setNumTextureUnits(ushort num)
140            {
141                mNumTextureUnits = num;
142            }
143
144            void setStencilBufferBitDepth(ushort num)
145            {
146                mStencilBufferBitDepth = num;
147            }
148
149            void setNumVertexBlendMatrices(ushort num)
150            {
151                mNumVertexBlendMatrices = num;
152            }
153
154                        /// The number of simultaneous render targets supported
155                        void setNumMultiRenderTargets(ushort num)
156                        {
157                                mNumMultiRenderTargets = num;
158                        }
159
160            ushort getNumWorldMatricies(void) const
161            {
162                return mNumWorldMatrices;
163            }
164
165            /** Returns the number of texture units the current output hardware
166                supports.
167
168                For use in rendering, this determines how many texture units the
169                are available for multitexturing (i.e. rendering multiple
170                textures in a single pass). Where a Material has multiple
171                texture layers, it will try to use multitexturing where
172                available, and where it is not available, will perform multipass
173                rendering to achieve the same effect.
174            */
175            ushort getNumTextureUnits(void) const
176            {
177                return mNumTextureUnits;
178            }
179
180            /** Determines the bit depth of the hardware accelerated stencil
181                buffer, if supported.
182                @remarks
183                    If hardware stencilling is not supported, the software will
184                    provide an 8-bit software stencil.
185            */
186            ushort getStencilBufferBitDepth(void) const
187            {
188                return mStencilBufferBitDepth;
189            }
190
191            /** Returns the number of matrices available to hardware vertex
192                blending for this rendering system. */
193            ushort numVertexBlendMatrices(void) const
194            {
195                return mNumVertexBlendMatrices;
196            }
197
198                        /// The number of simultaneous render targets supported
199                        ushort numMultiRenderTargets(void) const
200                        {
201                                return mNumMultiRenderTargets;
202                        }
203
204            /** Adds a capability flag to mCapabilities
205            */
206            void setCapability(const Capabilities c)
207            {
208                mCapabilities |= c;
209            }
210
211            /** Checks for a capability
212            */
213            bool hasCapability(const Capabilities c) const
214            {
215                if(mCapabilities & c)
216                {
217                    return true;
218                }
219                else
220                {
221                    return false;
222                }
223            }
224            /// Gets the best low-level vertex program version supported
225            const String& getMaxVertexProgramVersion(void) const
226            {
227                return mMaxVertexProgramVersion;
228            }
229            /// Gets the best fragment program that this card / rendersystem supports
230            const String& getMaxFragmentProgramVersion(void) const
231            {
232                return mMaxFragmentProgramVersion;
233            }
234            /// The number of floating-point constants vertex programs support
235            ushort getVertexProgramConstantFloatCount(void) const
236            {
237                return mVertexProgramConstantFloatCount;           
238            }
239            /// The number of integer constants vertex programs support
240            ushort getVertexProgramConstantIntCount(void) const
241            {
242                return mVertexProgramConstantIntCount;           
243            }
244            /// The number of boolean constants vertex programs support
245            ushort getVertexProgramConstantBoolCount(void) const
246            {
247                return mVertexProgramConstantBoolCount;           
248            }
249            /// The number of floating-point constants fragment programs support
250            ushort getFragmentProgramConstantFloatCount(void) const
251            {
252                return mFragmentProgramConstantFloatCount;           
253            }
254            /// The number of integer constants fragment programs support
255            ushort getFragmentProgramConstantIntCount(void) const
256            {
257                return mFragmentProgramConstantIntCount;           
258            }
259            /// The number of boolean constants fragment programs support
260            ushort getFragmentProgramConstantBoolCount(void) const
261            {
262                return mFragmentProgramConstantBoolCount;           
263            }
264
265
266
267            /// sets the best low-level vertex program version supported
268            void setMaxVertexProgramVersion(const String& ver)
269            {
270                mMaxVertexProgramVersion = ver;
271            }
272            /// sets the best fragment program that this card / rendersystem supports
273            void setMaxFragmentProgramVersion(const String& ver)
274            {
275                mMaxFragmentProgramVersion = ver;
276            }
277            /// The number of floating-point constants vertex programs support
278            void setVertexProgramConstantFloatCount(ushort c)
279            {
280                mVertexProgramConstantFloatCount = c;           
281            }
282            /// The number of integer constants vertex programs support
283            void setVertexProgramConstantIntCount(ushort c)
284            {
285                mVertexProgramConstantIntCount = c;           
286            }
287            /// The number of boolean constants vertex programs support
288            void setVertexProgramConstantBoolCount(ushort c)
289            {
290                mVertexProgramConstantBoolCount = c;           
291            }
292            /// The number of floating-point constants fragment programs support
293            void setFragmentProgramConstantFloatCount(ushort c)
294            {
295                mFragmentProgramConstantFloatCount = c;           
296            }
297            /// The number of integer constants fragment programs support
298            void setFragmentProgramConstantIntCount(ushort c)
299            {
300                mFragmentProgramConstantIntCount = c;           
301            }
302            /// The number of boolean constants fragment programs support
303            void setFragmentProgramConstantBoolCount(ushort c)
304            {
305                mFragmentProgramConstantBoolCount = c;           
306            }
307                        /// Maximum point screen size in pixels
308                        void setMaxPointSize(Real s)
309                        {
310                                mMaxPointSize = s;
311                        }
312                        /// Maximum point screen size in pixels
313                        Real getMaxPointSize(void) const
314                        {
315                                return mMaxPointSize;
316                        }
317                        /// Non-POW2 textures limited
318                        void setNonPOW2TexturesLimited(bool l)
319                        {
320                                mNonPOW2TexturesLimited = l;
321                        }
322                        /** Are non-power of two textures limited in features?
323                        @remarks
324                                If the RSC_NON_POWER_OF_2_TEXTURES capability is set, but this
325                                method returns true, you can use non power of 2 textures only if:
326                                <ul><li>You load them explicitly with no mip maps</li>
327                                <li>You don't use DXT texture compression</li>
328                                <li>You use clamp texture addressing</li></ul>
329                        */
330                        bool getNonPOW2TexturesLimited(void) const
331                        {
332                                return mNonPOW2TexturesLimited;
333                        }
334
335
336            /** Write the capabilities to the pass in Log */
337            void log(Log* pLog);
338
339
340
341
342    };
343}
344
345#endif // __RenderSystemCapabilities__
346
Note: See TracBrowser for help on using the repository browser.