| 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 __RenderSystem_H_ |
|---|
| 30 | #define __RenderSystem_H_ |
|---|
| 31 | |
|---|
| 32 | // Precompiler options |
|---|
| 33 | #include "OgrePrerequisites.h" |
|---|
| 34 | |
|---|
| 35 | #include "OgreString.h" |
|---|
| 36 | |
|---|
| 37 | #include "OgreTextureUnitState.h" |
|---|
| 38 | #include "OgreCommon.h" |
|---|
| 39 | |
|---|
| 40 | #include "OgreRenderOperation.h" |
|---|
| 41 | #include "OgreRenderSystemCapabilities.h" |
|---|
| 42 | #include "OgreRenderTarget.h" |
|---|
| 43 | #include "OgreRenderTexture.h" |
|---|
| 44 | #include "OgreFrameListener.h" |
|---|
| 45 | #include "OgreConfigOptionMap.h" |
|---|
| 46 | #include "OgreGpuProgram.h" |
|---|
| 47 | #include "OgrePlane.h" |
|---|
| 48 | #include "OgreIteratorWrappers.h" |
|---|
| 49 | |
|---|
| 50 | namespace Ogre |
|---|
| 51 | { |
|---|
| 52 | typedef std::map< String, RenderTarget * > RenderTargetMap; |
|---|
| 53 | typedef std::multimap<uchar, RenderTarget * > RenderTargetPriorityMap; |
|---|
| 54 | |
|---|
| 55 | class TextureManager; |
|---|
| 56 | /// Enum describing the ways to generate texture coordinates |
|---|
| 57 | enum TexCoordCalcMethod |
|---|
| 58 | { |
|---|
| 59 | /// No calculated texture coordinates |
|---|
| 60 | TEXCALC_NONE, |
|---|
| 61 | /// Environment map based on vertex normals |
|---|
| 62 | TEXCALC_ENVIRONMENT_MAP, |
|---|
| 63 | /// Environment map based on vertex positions |
|---|
| 64 | TEXCALC_ENVIRONMENT_MAP_PLANAR, |
|---|
| 65 | TEXCALC_ENVIRONMENT_MAP_REFLECTION, |
|---|
| 66 | TEXCALC_ENVIRONMENT_MAP_NORMAL, |
|---|
| 67 | /// Projective texture |
|---|
| 68 | TEXCALC_PROJECTIVE_TEXTURE |
|---|
| 69 | }; |
|---|
| 70 | /// Enum describing the various actions which can be taken onthe stencil buffer |
|---|
| 71 | enum StencilOperation |
|---|
| 72 | { |
|---|
| 73 | /// Leave the stencil buffer unchanged |
|---|
| 74 | SOP_KEEP, |
|---|
| 75 | /// Set the stencil value to zero |
|---|
| 76 | SOP_ZERO, |
|---|
| 77 | /// Set the stencil value to the reference value |
|---|
| 78 | SOP_REPLACE, |
|---|
| 79 | /// Increase the stencil value by 1, clamping at the maximum value |
|---|
| 80 | SOP_INCREMENT, |
|---|
| 81 | /// Decrease the stencil value by 1, clamping at 0 |
|---|
| 82 | SOP_DECREMENT, |
|---|
| 83 | /// Increase the stencil value by 1, wrapping back to 0 when incrementing the maximum value |
|---|
| 84 | SOP_INCREMENT_WRAP, |
|---|
| 85 | /// Decrease the stencil value by 1, wrapping when decrementing 0 |
|---|
| 86 | SOP_DECREMENT_WRAP, |
|---|
| 87 | /// Invert the bits of the stencil buffer |
|---|
| 88 | SOP_INVERT |
|---|
| 89 | }; |
|---|
| 90 | |
|---|
| 91 | /** Defines the functionality of a 3D API |
|---|
| 92 | @remarks |
|---|
| 93 | The RenderSystem class provides a base interface |
|---|
| 94 | which abstracts the general functionality of the 3D API |
|---|
| 95 | e.g. Direct3D or OpenGL. Whilst a few of the general |
|---|
| 96 | methods have implementations, most of this class is |
|---|
| 97 | abstract, requiring a subclass based on a specific API |
|---|
| 98 | to be constructed to provide the full functionality. |
|---|
| 99 | Note there are 2 levels to the interface - one which |
|---|
| 100 | will be used often by the caller of the Ogre library, |
|---|
| 101 | and one which is at a lower level and will be used by the |
|---|
| 102 | other classes provided by Ogre. These lower level |
|---|
| 103 | methods are prefixed with '_' to differentiate them. |
|---|
| 104 | The advanced user of the library may use these lower |
|---|
| 105 | level methods to access the 3D API at a more fundamental |
|---|
| 106 | level (dealing direct with render states and rendering |
|---|
| 107 | primitives), but still benefitting from Ogre's abstraction |
|---|
| 108 | of exactly which 3D API is in use. |
|---|
| 109 | @author |
|---|
| 110 | Steven Streeting |
|---|
| 111 | @version |
|---|
| 112 | 1.0 |
|---|
| 113 | */ |
|---|
| 114 | class _OgreExport RenderSystem |
|---|
| 115 | { |
|---|
| 116 | public: |
|---|
| 117 | /** Default Constructor. |
|---|
| 118 | */ |
|---|
| 119 | RenderSystem(); |
|---|
| 120 | |
|---|
| 121 | /** Destructor. |
|---|
| 122 | */ |
|---|
| 123 | virtual ~RenderSystem(); |
|---|
| 124 | |
|---|
| 125 | /** Returns the name of the rendering system. |
|---|
| 126 | */ |
|---|
| 127 | virtual const String& getName(void) const = 0; |
|---|
| 128 | |
|---|
| 129 | /** Returns the details of this API's configuration options |
|---|
| 130 | @remarks |
|---|
| 131 | Each render system must be able to inform the world |
|---|
| 132 | of what options must/can be specified for it's |
|---|
| 133 | operation. |
|---|
| 134 | @par |
|---|
| 135 | These are passed as strings for portability, but |
|---|
| 136 | grouped into a structure (_ConfigOption) which includes |
|---|
| 137 | both options and current value. |
|---|
| 138 | @par |
|---|
| 139 | Note that the settings returned from this call are |
|---|
| 140 | affected by the options that have been set so far, |
|---|
| 141 | since some options are interdependent. |
|---|
| 142 | @par |
|---|
| 143 | This routine is called automatically by the default |
|---|
| 144 | configuration dialogue produced by Root::showConfigDialog |
|---|
| 145 | or may be used by the caller for custom settings dialogs |
|---|
| 146 | @returns |
|---|
| 147 | A 'map' of options, i.e. a list of options which is also |
|---|
| 148 | indexed by option name. |
|---|
| 149 | */ |
|---|
| 150 | virtual ConfigOptionMap& getConfigOptions(void) = 0; |
|---|
| 151 | |
|---|
| 152 | /** Sets an option for this API |
|---|
| 153 | @remarks |
|---|
| 154 | Used to confirm the settings (normally chosen by the user) in |
|---|
| 155 | order to make the renderer able to initialise with the settings as required. |
|---|
| 156 | This may be video mode, D3D driver, full screen / windowed etc. |
|---|
| 157 | Called automatically by the default configuration |
|---|
| 158 | dialog, and by the restoration of saved settings. |
|---|
| 159 | These settings are stored and only activated when |
|---|
| 160 | RenderSystem::initialise or RenderSystem::reinitialise |
|---|
| 161 | are called. |
|---|
| 162 | @par |
|---|
| 163 | If using a custom configuration dialog, it is advised that the |
|---|
| 164 | caller calls RenderSystem::getConfigOptions |
|---|
| 165 | again, since some options can alter resulting from a selection. |
|---|
| 166 | @param |
|---|
| 167 | name The name of the option to alter. |
|---|
| 168 | @param |
|---|
| 169 | value The value to set the option to. |
|---|
| 170 | */ |
|---|
| 171 | virtual void setConfigOption(const String &name, const String &value) = 0; |
|---|
| 172 | |
|---|
| 173 | /** Create an object for performing hardware occlusion queries. |
|---|
| 174 | */ |
|---|
| 175 | virtual HardwareOcclusionQuery* createHardwareOcclusionQuery(void) = 0; |
|---|
| 176 | |
|---|
| 177 | /** Destroy a hardware occlusion query object. |
|---|
| 178 | */ |
|---|
| 179 | virtual void destroyHardwareOcclusionQuery(HardwareOcclusionQuery *hq); |
|---|
| 180 | |
|---|
| 181 | /** Validates the options set for the rendering system, returning a message if there are problems. |
|---|
| 182 | @note |
|---|
| 183 | If the returned string is empty, there are no problems. |
|---|
| 184 | */ |
|---|
| 185 | virtual String validateConfigOptions(void) = 0; |
|---|
| 186 | |
|---|
| 187 | /** Start up the renderer using the settings selected (Or the defaults if none have been selected). |
|---|
| 188 | @remarks |
|---|
| 189 | Called by Root::setRenderSystem. Shouldn't really be called |
|---|
| 190 | directly, although this can be done if the app wants to. |
|---|
| 191 | @param |
|---|
| 192 | autoCreateWindow If true, creates a render window |
|---|
| 193 | automatically, based on settings chosen so far. This saves |
|---|
| 194 | an extra call to RenderSystem::createRenderWindow |
|---|
| 195 | for the main render window. |
|---|
| 196 | @par |
|---|
| 197 | If an application has more specific window requirements, |
|---|
| 198 | however (e.g. a level design app), it should specify false |
|---|
| 199 | for this parameter and do it manually. |
|---|
| 200 | @returns |
|---|
| 201 | A pointer to the automatically created window, if requested, otherwise null. |
|---|
| 202 | */ |
|---|
| 203 | virtual RenderWindow* initialise(bool autoCreateWindow, const String& windowTitle = "OGRE Render Window"); |
|---|
| 204 | |
|---|
| 205 | /** Restart the renderer (normally following a change in settings). |
|---|
| 206 | */ |
|---|
| 207 | virtual void reinitialise(void) = 0; |
|---|
| 208 | |
|---|
| 209 | /** Shutdown the renderer and cleanup resources. |
|---|
| 210 | */ |
|---|
| 211 | virtual void shutdown(void); |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | /** Sets the colour & strength of the ambient (global directionless) light in the world. |
|---|
| 215 | */ |
|---|
| 216 | virtual void setAmbientLight(float r, float g, float b) = 0; |
|---|
| 217 | |
|---|
| 218 | /** Sets the type of light shading required (default = Gouraud). |
|---|
| 219 | */ |
|---|
| 220 | virtual void setShadingType(ShadeOptions so) = 0; |
|---|
| 221 | |
|---|
| 222 | /** Sets whether or not dynamic lighting is enabled. |
|---|
| 223 | @param |
|---|
| 224 | enabled If true, dynamic lighting is performed on geometry with normals supplied, geometry without |
|---|
| 225 | normals will not be displayed. If false, no lighting is applied and all geometry will be full brightness. |
|---|
| 226 | */ |
|---|
| 227 | virtual void setLightingEnabled(bool enabled) = 0; |
|---|
| 228 | |
|---|
| 229 | /** Sets whether or not W-buffers are enabled if they are avalible for this renderer. |
|---|
| 230 | @param |
|---|
| 231 | enabled If true and the renderer supports them W-buffers will be used. If false |
|---|
| 232 | W-buffers will not be used even if avalible. W-buffers are enabled by default |
|---|
| 233 | for 16bit depth buffers and disabled for all other depths. |
|---|
| 234 | */ |
|---|
| 235 | void setWBufferEnabled(bool enabled); |
|---|
| 236 | |
|---|
| 237 | /** Returns true if the renderer will try to use W-buffers when avalible. |
|---|
| 238 | */ |
|---|
| 239 | bool getWBufferEnabled(void) const; |
|---|
| 240 | |
|---|
| 241 | /** Creates a new rendering window. |
|---|
| 242 | @remarks |
|---|
| 243 | This method creates a new rendering window as specified |
|---|
| 244 | by the paramteters. The rendering system could be |
|---|
| 245 | responible for only a single window (e.g. in the case |
|---|
| 246 | of a game), or could be in charge of multiple ones (in the |
|---|
| 247 | case of a level editor). The option to create the window |
|---|
| 248 | as a child of another is therefore given. |
|---|
| 249 | This method will create an appropriate subclass of |
|---|
| 250 | RenderWindow depending on the API and platform implementation. |
|---|
| 251 | @par |
|---|
| 252 | After creation, this window can be retrieved using getRenderTarget(). |
|---|
| 253 | @param |
|---|
| 254 | name The name of the window. Used in other methods |
|---|
| 255 | later like setRenderTarget and getRenderWindow. |
|---|
| 256 | @param |
|---|
| 257 | width The width of the new window. |
|---|
| 258 | @param |
|---|
| 259 | height The height of the new window. |
|---|
| 260 | @param |
|---|
| 261 | fullScreen Specify true to make the window full screen |
|---|
| 262 | without borders, title bar or menu bar. |
|---|
| 263 | @param |
|---|
| 264 | miscParams A NameValuePairList describing the other parameters for the new rendering window. |
|---|
| 265 | Options are case sensitive. Unrecognised parameters will be ignored silently. |
|---|
| 266 | These values might be platform dependent, but these are present for all platorms unless |
|---|
| 267 | indicated otherwise: |
|---|
| 268 | ** |
|---|
| 269 | Key: "title" |
|---|
| 270 | Description: The title of the window that will appear in the title bar |
|---|
| 271 | Values: string |
|---|
| 272 | Default: RenderTarget name |
|---|
| 273 | ** |
|---|
| 274 | Key: "colourDepth" |
|---|
| 275 | Description: Colour depth of the resulting rendering window; only applies if fullScreen |
|---|
| 276 | is set. |
|---|
| 277 | Values: 16 or 32 |
|---|
| 278 | Default: desktop depth |
|---|
| 279 | Notes: [W32 specific] |
|---|
| 280 | ** |
|---|
| 281 | Key: "left" |
|---|
| 282 | Description: screen x coordinate from left |
|---|
| 283 | Values: positive integers |
|---|
| 284 | Default: 'center window on screen' |
|---|
| 285 | Notes: Ignored in case of full screen |
|---|
| 286 | ** |
|---|
| 287 | Key: "top" |
|---|
| 288 | Description: screen y coordinate from top |
|---|
| 289 | Values: positive integers |
|---|
| 290 | Default: 'center window on screen' |
|---|
| 291 | Notes: Ignored in case of full screen |
|---|
| 292 | ** |
|---|
| 293 | Key: "depthBuffer" [DX9 specific] |
|---|
| 294 | Description: Use depth buffer |
|---|
| 295 | Values: false or true |
|---|
| 296 | Default: true |
|---|
| 297 | ** |
|---|
| 298 | Key: "externalWindowHandle" [API specific] |
|---|
| 299 | Description: External window handle, for embedding the OGRE context |
|---|
| 300 | Values: positive integer for W32 (HWND handle) |
|---|
| 301 | poslong:posint:poslong (display*:screen:windowHandle) or |
|---|
| 302 | poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*) for GLX |
|---|
| 303 | Default: 0 (None) |
|---|
| 304 | ** |
|---|
| 305 | Key: "externalGLControl" [Win32 OpenGL specific] |
|---|
| 306 | Description: Let the external window control OpenGL i.e. don't select a pixel format for the window, |
|---|
| 307 | do not change v-sync and do not swap buffer. When set to true, the calling application |
|---|
| 308 | is responsible of OpenGL initialization and buffer swapping. It should also create an |
|---|
| 309 | OpenGL context for its own rendering, Ogre will create one for its use. Then the calling |
|---|
| 310 | application must also enable Ogre OpenGL context before calling any Ogre function and |
|---|
| 311 | restore its OpenGL context after these calls. The Ogre OpenGL context can be retrieved |
|---|
| 312 | after Ogre initialisation by calling wglGetCurrentDC() and wglGetCurrentContext(). |
|---|
| 313 | It is only used when the externalWindowHandle parameter is used. |
|---|
| 314 | Values: true, false |
|---|
| 315 | Default: false |
|---|
| 316 | ** |
|---|
| 317 | Key: "externalGLContext" [Win32 OpenGL specific] |
|---|
| 318 | Description: Use an externally created GL context |
|---|
| 319 | Values: <Context as Unsigned Long> |
|---|
| 320 | Default: 0 (create own context) |
|---|
| 321 | ** |
|---|
| 322 | Key: "parentWindowHandle" [API specific] |
|---|
| 323 | Description: Parent window handle, for embedding the OGRE context |
|---|
| 324 | Values: positive integer for W32 (HWND handle) |
|---|
| 325 | poslong:posint:poslong for GLX (display*:screen:windowHandle) |
|---|
| 326 | Default: 0 (None) |
|---|
| 327 | ** |
|---|
| 328 | Key: "FSAA" |
|---|
| 329 | Description: Full screen antialiasing factor |
|---|
| 330 | Values: 0,2,4,6,... |
|---|
| 331 | Default: 0 |
|---|
| 332 | ** |
|---|
| 333 | Key: "displayFrequency" |
|---|
| 334 | Description: Display frequency rate, for fullscreen mode |
|---|
| 335 | Values: 60...? |
|---|
| 336 | Default: Desktop vsync rate |
|---|
| 337 | ** |
|---|
| 338 | Key: "vsync" |
|---|
| 339 | Description: Synchronize buffer swaps to vsync |
|---|
| 340 | Values: true, false |
|---|
| 341 | Default: 0 |
|---|
| 342 | ** |
|---|
| 343 | Key: "border" |
|---|
| 344 | Description: The type of window border (in windowed mode) |
|---|
| 345 | Values: none, fixed, resize |
|---|
| 346 | Default: resize |
|---|
| 347 | ** |
|---|
| 348 | Key: "outerDimensions" |
|---|
| 349 | Description: Whether the width/height is expressed as the size of the |
|---|
| 350 | outer window, rather than the content area |
|---|
| 351 | Values: true, false |
|---|
| 352 | Default: false |
|---|
| 353 | ** |
|---|
| 354 | Key: "useNVPerfHUD" [DX9 specific] |
|---|
| 355 | Description: Enable the use of nVidia NVPerfHUD |
|---|
| 356 | Values: true, false |
|---|
| 357 | Default: false |
|---|
| 358 | */ |
|---|
| 359 | virtual RenderWindow* createRenderWindow(const String &name, unsigned int width, unsigned int height, |
|---|
| 360 | bool fullScreen, const NameValuePairList *miscParams = 0) = 0; |
|---|
| 361 | |
|---|
| 362 | /** Creates and registers a render texture object. |
|---|
| 363 | @param name |
|---|
| 364 | The name for the new render texture. Note that names must be unique. |
|---|
| 365 | @param width |
|---|
| 366 | The requested width for the render texture. See Remarks for more info. |
|---|
| 367 | @param height |
|---|
| 368 | The requested width for the render texture. See Remarks for more info. |
|---|
| 369 | @param texType |
|---|
| 370 | The type of texture; defaults to TEX_TYPE_2D |
|---|
| 371 | @param internalFormat |
|---|
| 372 | The internal format of the texture; defaults to PF_X8R8G8B8 |
|---|
| 373 | @param miscParams This parameter is ignored. |
|---|
| 374 | @returns |
|---|
| 375 | On succes, a pointer to a new platform-dependernt, RenderTexture-derived |
|---|
| 376 | class is returned. On failiure, NULL is returned. |
|---|
| 377 | @remarks |
|---|
| 378 | Because a render texture is basically a wrapper around a texture object, |
|---|
| 379 | the width and height parameters of this method just hint the preferred |
|---|
| 380 | size for the texture. Depending on the hardware driver or the underlying |
|---|
| 381 | API, these values might change when the texture is created. The same applies |
|---|
| 382 | to the internalFormat parameter. |
|---|
| 383 | @deprecated |
|---|
| 384 | This method is deprecated, and exists only for backward compatibility. You can create |
|---|
| 385 | arbitrary rendertextures with the TextureManager::createManual call with usage |
|---|
| 386 | TU_RENDERTARGET. |
|---|
| 387 | */ |
|---|
| 388 | RenderTexture * createRenderTexture( const String & name, unsigned int width, unsigned int height, |
|---|
| 389 | TextureType texType = TEX_TYPE_2D, PixelFormat internalFormat = PF_X8R8G8B8, |
|---|
| 390 | const NameValuePairList *miscParams = 0 ); |
|---|
| 391 | |
|---|
| 392 | /** Create a MultiRenderTarget, which is a render target that renders to multiple RenderTextures |
|---|
| 393 | at once. Surfaces can be bound and unbound at will. |
|---|
| 394 | This fails if mCapabilities->numMultiRenderTargets() is smaller than 2. |
|---|
| 395 | */ |
|---|
| 396 | virtual MultiRenderTarget * createMultiRenderTarget(const String & name) = 0; |
|---|
| 397 | |
|---|
| 398 | /** Destroys a render window */ |
|---|
| 399 | virtual void destroyRenderWindow(const String& name); |
|---|
| 400 | /** Destroys a render texture */ |
|---|
| 401 | virtual void destroyRenderTexture(const String& name); |
|---|
| 402 | /** Destroys a render target of any sort */ |
|---|
| 403 | virtual void destroyRenderTarget(const String& name); |
|---|
| 404 | |
|---|
| 405 | /** Attaches the passed render target to the render system. |
|---|
| 406 | */ |
|---|
| 407 | virtual void attachRenderTarget( RenderTarget &target ); |
|---|
| 408 | /** Returns a pointer to the render target with the passed name, or NULL if that |
|---|
| 409 | render target cannot be found. |
|---|
| 410 | */ |
|---|
| 411 | virtual RenderTarget * getRenderTarget( const String &name ); |
|---|
| 412 | /** Detaches the render target with the passed name from the render system and |
|---|
| 413 | returns a pointer to it. |
|---|
| 414 | @note |
|---|
| 415 | If the render target cannot be found, NULL is returned. |
|---|
| 416 | */ |
|---|
| 417 | virtual RenderTarget * detachRenderTarget( const String &name ); |
|---|
| 418 | |
|---|
| 419 | /// Iterator over RenderTargets |
|---|
| 420 | typedef MapIterator<Ogre::RenderTargetMap> RenderTargetIterator; |
|---|
| 421 | |
|---|
| 422 | /** Returns a specialised MapIterator over all render targets attached to the RenderSystem. */ |
|---|
| 423 | virtual RenderTargetIterator getRenderTargetIterator(void) { |
|---|
| 424 | return RenderTargetIterator( mRenderTargets.begin(), mRenderTargets.end() ); |
|---|
| 425 | } |
|---|
| 426 | /** Returns a description of an error code. |
|---|
| 427 | */ |
|---|
| 428 | virtual String getErrorDescription(long errorNumber) const = 0; |
|---|
| 429 | |
|---|
| 430 | /** Defines whether or now fullscreen render windows wait for the vertical blank before flipping buffers. |
|---|
| 431 | @remarks |
|---|
| 432 | By default, all rendering windows wait for a vertical blank (when the CRT beam turns off briefly to move |
|---|
| 433 | from the bottom right of the screen back to the top left) before flipping the screen buffers. This ensures |
|---|
| 434 | that the image you see on the screen is steady. However it restricts the frame rate to the refresh rate of |
|---|
| 435 | the monitor, and can slow the frame rate down. You can speed this up by not waiting for the blank, but |
|---|
| 436 | this has the downside of introducing 'tearing' artefacts where part of the previous frame is still displayed |
|---|
| 437 | as the buffers are switched. Speed vs quality, you choose. |
|---|
| 438 | @note |
|---|
| 439 | Has NO effect on windowed mode render targets. Only affects fullscreen mode. |
|---|
| 440 | @param |
|---|
| 441 | enabled If true, the system waits for vertical blanks - quality over speed. If false it doesn't - speed over quality. |
|---|
| 442 | */ |
|---|
| 443 | void setWaitForVerticalBlank(bool enabled); |
|---|
| 444 | |
|---|
| 445 | /** Returns true if the system is synchronising frames with the monitor vertical blank. |
|---|
| 446 | */ |
|---|
| 447 | bool getWaitForVerticalBlank(void) const; |
|---|
| 448 | |
|---|
| 449 | // ------------------------------------------------------------------------ |
|---|
| 450 | // Internal Rendering Access |
|---|
| 451 | // All methods below here are normally only called by other OGRE classes |
|---|
| 452 | // They can be called by library user if required |
|---|
| 453 | // ------------------------------------------------------------------------ |
|---|
| 454 | |
|---|
| 455 | |
|---|
| 456 | /** Tells the rendersystem to use the attached set of lights (and no others) |
|---|
| 457 | up to the number specified (this allows the same list to be used with different |
|---|
| 458 | count limits) */ |
|---|
| 459 | virtual void _useLights(const LightList& lights, unsigned short limit) = 0; |
|---|
| 460 | /** Sets the world transform matrix. */ |
|---|
| 461 | virtual void _setWorldMatrix(const Matrix4 &m) = 0; |
|---|
| 462 | /** Sets multiple world matrices (vertex blending). */ |
|---|
| 463 | virtual void _setWorldMatrices(const Matrix4* m, unsigned short count); |
|---|
| 464 | /** Sets the view transform matrix */ |
|---|
| 465 | virtual void _setViewMatrix(const Matrix4 &m) = 0; |
|---|
| 466 | /** Sets the projection transform matrix */ |
|---|
| 467 | virtual void _setProjectionMatrix(const Matrix4 &m) = 0; |
|---|
| 468 | /** Utility function for setting all the properties of a texture unit at once. |
|---|
| 469 | This method is also worth using over the individual texture unit settings because it |
|---|
| 470 | only sets those settings which are different from the current settings for this |
|---|
| 471 | unit, thus minimising render state changes. |
|---|
| 472 | */ |
|---|
| 473 | virtual void _setTextureUnitSettings(size_t texUnit, TextureUnitState& tl); |
|---|
| 474 | /** Turns off a texture unit. */ |
|---|
| 475 | virtual void _disableTextureUnit(size_t texUnit); |
|---|
| 476 | /** Disables all texture units from the given unit upwards */ |
|---|
| 477 | virtual void _disableTextureUnitsFrom(size_t texUnit); |
|---|
| 478 | /** Sets the surface properties to be used for future rendering. |
|---|
| 479 | |
|---|
| 480 | This method sets the the properties of the surfaces of objects |
|---|
| 481 | to be rendered after it. In this context these surface properties |
|---|
| 482 | are the amount of each type of light the object reflects (determining |
|---|
| 483 | it's colour under different types of light), whether it emits light |
|---|
| 484 | itself, and how shiny it is. Textures are not dealt with here, |
|---|
| 485 | see the _setTetxure method for details. |
|---|
| 486 | This method is used by _setMaterial so does not need to be called |
|---|
| 487 | direct if that method is being used. |
|---|
| 488 | |
|---|
| 489 | @param ambient The amount of ambient (sourceless and directionless) |
|---|
| 490 | light an object reflects. Affected by the colour/amount of ambient light in the scene. |
|---|
| 491 | @param diffuse The amount of light from directed sources that is |
|---|
| 492 | reflected (affected by colour/amount of point, directed and spot light sources) |
|---|
| 493 | @param specular The amount of specular light reflected. This is also |
|---|
| 494 | affected by directed light sources but represents the colour at the |
|---|
| 495 | highlights of the object. |
|---|
| 496 | @param emissive The colour of light emitted from the object. Note that |
|---|
| 497 | this will make an object seem brighter and not dependent on lights in |
|---|
| 498 | the scene, but it will not act as a light, so will not illuminate other |
|---|
| 499 | objects. Use a light attached to the same SceneNode as the object for this purpose. |
|---|
| 500 | @param shininess A value which only has an effect on specular highlights (so |
|---|
| 501 | specular must be non-black). The higher this value, the smaller and crisper the |
|---|
| 502 | specular highlights will be, imitating a more highly polished surface. |
|---|
| 503 | This value is not constrained to 0.0-1.0, in fact it is likely to |
|---|
| 504 | be more (10.0 gives a modest sheen to an object). |
|---|
| 505 | @param tracking A bit field that describes which of the ambient, diffuse, specular |
|---|
| 506 | and emissive colours follow the vertex colour of the primitive. When a bit in this field is set |
|---|
| 507 | its ColourValue is ignored. This is a combination of TVC_AMBIENT, TVC_DIFFUSE, TVC_SPECULAR(note that the shininess value is still |
|---|
| 508 | taken from shininess) and TVC_EMISSIVE. TVC_NONE means that there will be no material property |
|---|
| 509 | tracking the vertex colours. |
|---|
| 510 | */ |
|---|
| 511 | virtual void _setSurfaceParams(const ColourValue &ambient, |
|---|
| 512 | const ColourValue &diffuse, const ColourValue &specular, |
|---|
| 513 | const ColourValue &emissive, Real shininess, |
|---|
| 514 | TrackVertexColourType tracking = TVC_NONE) = 0; |
|---|
| 515 | |
|---|
| 516 | /** Sets whether or not rendering points using OT_POINT_LIST will |
|---|
| 517 | render point sprites (textured quads) or plain points. |
|---|
| 518 | @param enabled True enables point sprites, false returns to normal |
|---|
| 519 | point rendering. |
|---|
| 520 | */ |
|---|
| 521 | virtual void _setPointSpritesEnabled(bool enabled) = 0; |
|---|
| 522 | |
|---|
| 523 | /** Sets the size of points and how they are attenuated with distance. |
|---|
| 524 | @remarks |
|---|
| 525 | When performing point rendering or point sprite rendering, |
|---|
| 526 | point size can be attenuated with distance. The equation for |
|---|
| 527 | doing this is attenuation = 1 / (constant + linear * dist + quadratic * d^2) . |
|---|
| 528 | @par |
|---|
| 529 | For example, to disable distance attenuation (constant screensize) |
|---|
| 530 | you would set constant to 1, and linear and quadratic to 0. A |
|---|
| 531 | standard perspective attenuation would be 0, 1, 0 respectively. |
|---|
| 532 | */ |
|---|
| 533 | virtual void _setPointParameters(Real size, bool attenuationEnabled, |
|---|
| 534 | Real constant, Real linear, Real quadratic, Real minSize, Real maxSize) = 0; |
|---|
| 535 | |
|---|
| 536 | |
|---|
| 537 | /** |
|---|
| 538 | Sets the texture to bind to a given texture unit. |
|---|
| 539 | |
|---|
| 540 | User processes would not normally call this direct unless rendering |
|---|
| 541 | primitives themselves. |
|---|
| 542 | |
|---|
| 543 | @param unit The index of the texture unit to modify. Multitexturing |
|---|
| 544 | hardware can support multiple units (see |
|---|
| 545 | RenderSystemCapabilites::getNumTextureUnits) |
|---|
| 546 | @param enabled Boolean to turn the unit on/off |
|---|
| 547 | @param texPtr Pointer to the texture to use. |
|---|
| 548 | */ |
|---|
| 549 | virtual void _setTexture(size_t unit, bool enabled, |
|---|
| 550 | const TexturePtr &texPtr) = 0; |
|---|
| 551 | /** |
|---|
| 552 | Sets the texture to bind to a given texture unit. |
|---|
| 553 | |
|---|
| 554 | User processes would not normally call this direct unless rendering |
|---|
| 555 | primitives themselves. |
|---|
| 556 | |
|---|
| 557 | @param unit The index of the texture unit to modify. Multitexturing |
|---|
| 558 | hardware can support multiple units (see |
|---|
| 559 | RenderSystemCapabilites::getNumTextureUnits) |
|---|
| 560 | @param enabled Boolean to turn the unit on/off |
|---|
| 561 | @param texname The name of the texture to use - this should have |
|---|
| 562 | already been loaded with TextureManager::load. |
|---|
| 563 | */ |
|---|
| 564 | virtual void _setTexture(size_t unit, bool enabled, const String &texname); |
|---|
| 565 | |
|---|
| 566 | /** Binds a texture to a vertex sampler. |
|---|
| 567 | @remarks |
|---|
| 568 | Not all rendersystems support separate vertex samplers. For those that |
|---|
| 569 | do, you can set a texture for them, separate to the regular texture |
|---|
| 570 | samplers, using this method. For those that don't, you should use the |
|---|
| 571 | regular texture samplers which are shared between the vertex and |
|---|
| 572 | fragment units; calling this method will throw an exception. |
|---|
| 573 | @see RenderSystemCapabilites::getVertexTextureUnitsShared |
|---|
| 574 | */ |
|---|
| 575 | virtual void _setVertexTexture(size_t unit, const TexturePtr& tex); |
|---|
| 576 | |
|---|
| 577 | /** |
|---|
| 578 | Sets the texture coordinate set to use for a texture unit. |
|---|
| 579 | |
|---|
| 580 | Meant for use internally - not generally used directly by apps - the Material and TextureUnitState |
|---|
| 581 | classes let you manage textures far more easily. |
|---|
| 582 | |
|---|
| 583 | @param unit Texture unit as above |
|---|
| 584 | @param index The index of the texture coordinate set to use. |
|---|
| 585 | */ |
|---|
| 586 | virtual void _setTextureCoordSet(size_t unit, size_t index) = 0; |
|---|
| 587 | |
|---|
| 588 | /** |
|---|
| 589 | Sets a method for automatically calculating texture coordinates for a stage. |
|---|
| 590 | Should not be used by apps - for use by Ogre only. |
|---|
| 591 | @param unit Texture unit as above |
|---|
| 592 | @param m Calculation method to use |
|---|
| 593 | @param frustum Optional Frustum param, only used for projective effects |
|---|
| 594 | */ |
|---|
| 595 | virtual void _setTextureCoordCalculation(size_t unit, TexCoordCalcMethod m, |
|---|
| 596 | const Frustum* frustum = 0) = 0; |
|---|
| 597 | |
|---|
| 598 | /** Sets the texture blend modes from a TextureUnitState record. |
|---|
| 599 | Meant for use internally only - apps should use the Material |
|---|
| 600 | and TextureUnitState classes. |
|---|
| 601 | @param unit Texture unit as above |
|---|
| 602 | @param bm Details of the blending mode |
|---|
| 603 | */ |
|---|
| 604 | virtual void _setTextureBlendMode(size_t unit, const LayerBlendModeEx& bm) = 0; |
|---|
| 605 | |
|---|
| 606 | /** Sets the filtering options for a given texture unit. |
|---|
| 607 | @param unit The texture unit to set the filtering options for |
|---|
| 608 | @param minFilter The filter used when a texture is reduced in size |
|---|
| 609 | @param magFilter The filter used when a texture is magnified |
|---|
| 610 | @param mipFilter The filter used between mipmap levels, FO_NONE disables mipmapping |
|---|
| 611 | */ |
|---|
| 612 | virtual void _setTextureUnitFiltering(size_t unit, FilterOptions minFilter, |
|---|
| 613 | FilterOptions magFilter, FilterOptions mipFilter); |
|---|
| 614 | |
|---|
| 615 | /** Sets a single filter for a given texture unit. |
|---|
| 616 | @param unit The texture unit to set the filtering options for |
|---|
| 617 | @param ftype The filter type |
|---|
| 618 | @param filter The filter to be used |
|---|
| 619 | */ |
|---|
| 620 | virtual void _setTextureUnitFiltering(size_t unit, FilterType ftype, FilterOptions filter) = 0; |
|---|
| 621 | |
|---|
| 622 | /** Sets the maximal anisotropy for the specified texture unit.*/ |
|---|
| 623 | virtual void _setTextureLayerAnisotropy(size_t unit, unsigned int maxAnisotropy) = 0; |
|---|
| 624 | |
|---|
| 625 | /** Sets the texture addressing mode for a texture unit.*/ |
|---|
| 626 | virtual void _setTextureAddressingMode(size_t unit, const TextureUnitState::UVWAddressingMode& uvw) = 0; |
|---|
| 627 | |
|---|
| 628 | /** Sets the texture border colour for a texture unit.*/ |
|---|
| 629 | virtual void _setTextureBorderColour(size_t unit, const ColourValue& colour) = 0; |
|---|
| 630 | |
|---|
| 631 | /** Sets the mipmap bias value for a given texture unit. |
|---|
| 632 | @remarks |
|---|
| 633 | This allows you to adjust the mipmap calculation up or down for a |
|---|
| 634 | given texture unit. Negative values force a larger mipmap to be used, |
|---|
| 635 | positive values force a smaller mipmap to be used. Units are in numbers |
|---|
| 636 | of levels, so +1 forces the mipmaps to one smaller level. |
|---|
| 637 | @note Only does something if render system has capability RSC_MIPMAP_LOD_BIAS. |
|---|
| 638 | */ |
|---|
| 639 | virtual void _setTextureMipmapBias(size_t unit, float bias) = 0; |
|---|
| 640 | |
|---|
| 641 | /** Sets the texture coordinate transformation matrix for a texture unit. |
|---|
| 642 | @param unit Texture unit to affect |
|---|
| 643 | @param xform The 4x4 matrix |
|---|
| 644 | */ |
|---|
| 645 | virtual void _setTextureMatrix(size_t unit, const Matrix4& xform) = 0; |
|---|
| 646 | |
|---|
| 647 | /** Sets the global blending factors for combining subsequent renders with the existing frame contents. |
|---|
| 648 | The result of the blending operation is:</p> |
|---|
| 649 | <p align="center">final = (texture * sourceFactor) + (pixel * destFactor)</p> |
|---|
| 650 | Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor |
|---|
| 651 | enumerated type. |
|---|
| 652 | @param sourceFactor The source factor in the above calculation, i.e. multiplied by the texture colour components. |
|---|
| 653 | @param destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components. |
|---|
| 654 | */ |
|---|
| 655 | virtual void _setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor) = 0; |
|---|
| 656 | |
|---|
| 657 | /** Sets the global alpha rejection approach for future renders. |
|---|
| 658 | By default images are rendered regardless of texture alpha. This method lets you change that. |
|---|
| 659 | @param func The comparison function which must pass for a pixel to be written. |
|---|
| 660 | @param val The value to compare each pixels alpha value to (0-255) |
|---|
| 661 | */ |
|---|
| 662 | virtual void _setAlphaRejectSettings(CompareFunction func, unsigned char value) = 0; |
|---|
| 663 | /** |
|---|
| 664 | * Signifies the beginning of a frame, ie the start of rendering on a single viewport. Will occur |
|---|
| 665 | * several times per complete frame if multiple viewports exist. |
|---|
| 666 | */ |
|---|
| 667 | virtual void _beginFrame(void) = 0; |
|---|
| 668 | |
|---|
| 669 | |
|---|
| 670 | /** |
|---|
| 671 | * Ends rendering of a frame to the current viewport. |
|---|
| 672 | */ |
|---|
| 673 | virtual void _endFrame(void) = 0; |
|---|
| 674 | /** |
|---|
| 675 | Sets the provided viewport as the active one for future |
|---|
| 676 | rendering operations. This viewport is aware of it's own |
|---|
| 677 | camera and render target. Must be implemented by subclass. |
|---|
| 678 | |
|---|
| 679 | @param target Pointer to the appropriate viewport. |
|---|
| 680 | */ |
|---|
| 681 | virtual void _setViewport(Viewport *vp) = 0; |
|---|
| 682 | /** Get the current active viewport for rendering. */ |
|---|
| 683 | virtual Viewport* _getViewport(void); |
|---|
| 684 | |
|---|
| 685 | /** Sets the culling mode for the render system based on the 'vertex winding'. |
|---|
| 686 | A typical way for the rendering engine to cull triangles is based on the |
|---|
| 687 | 'vertex winding' of triangles. Vertex winding refers to the direction in |
|---|
| 688 | which the vertices are passed or indexed to in the rendering operation as viewed |
|---|
| 689 | from the camera, and will wither be clockwise or anticlockwise (that's 'counterclockwise' for |
|---|
| 690 | you Americans out there ;) The default is CULL_CLOCKWISE i.e. that only triangles whose vertices |
|---|
| 691 | are passed/indexed in anticlockwise order are rendered - this is a common approach and is used in 3D studio models |
|---|
| 692 | for example. You can alter this culling mode if you wish but it is not advised unless you know what you are doing. |
|---|
| 693 | You may wish to use the CULL_NONE option for mesh data that you cull yourself where the vertex |
|---|
| 694 | winding is uncertain. |
|---|
| 695 | */ |
|---|
| 696 | virtual void _setCullingMode(CullingMode mode) = 0; |
|---|
| 697 | |
|---|
| 698 | virtual CullingMode _getCullingMode(void) const; |
|---|
| 699 | |
|---|
| 700 | /** Sets the mode of operation for depth buffer tests from this point onwards. |
|---|
| 701 | Sometimes you may wish to alter the behaviour of the depth buffer to achieve |
|---|
| 702 | special effects. Because it's unlikely that you'll set these options for an entire frame, |
|---|
| 703 | but rather use them to tweak settings between rendering objects, this is an internal |
|---|
| 704 | method (indicated by the '_' prefix) which will be used by a SceneManager implementation |
|---|
| 705 | rather than directly from the client application. |
|---|
| 706 | If this method is never called the settings are automatically the same as the default parameters. |
|---|
| 707 | @param depthTest If true, the depth buffer is tested for each pixel and the frame buffer is only updated |
|---|
| 708 | if the depth function test succeeds. If false, no test is performed and pixels are always written. |
|---|
| 709 | @param depthWrite If true, the depth buffer is updated with the depth of the new pixel if the depth test succeeds. |
|---|
| 710 | If false, the depth buffer is left unchanged even if a new pixel is written. |
|---|
| 711 | @param depthFunction Sets the function required for the depth test. |
|---|
| 712 | */ |
|---|
| 713 | virtual void _setDepthBufferParams(bool depthTest = true, bool depthWrite = true, CompareFunction depthFunction = CMPF_LESS_EQUAL) = 0; |
|---|
| 714 | |
|---|
| 715 | /** Sets whether or not the depth buffer check is performed before a pixel write. |
|---|
| 716 | @param enabled If true, the depth buffer is tested for each pixel and the frame buffer is only updated |
|---|
| 717 | if the depth function test succeeds. If false, no test is performed and pixels are always written. |
|---|
| 718 | */ |
|---|
| 719 | virtual void _setDepthBufferCheckEnabled(bool enabled = true) = 0; |
|---|
| 720 | /** Sets whether or not the depth buffer is updated after a pixel write. |
|---|
| 721 | @param enabled If true, the depth buffer is updated with the depth of the new pixel if the depth test succeeds. |
|---|
| 722 | If false, the depth buffer is left unchanged even if a new pixel is written. |
|---|
| 723 | */ |
|---|
| 724 | virtual void _setDepthBufferWriteEnabled(bool enabled = true) = 0; |
|---|
| 725 | /** Sets the comparison function for the depth buffer check. |
|---|
| 726 | Advanced use only - allows you to choose the function applied to compare the depth values of |
|---|
| 727 | new and existing pixels in the depth buffer. Only an issue if the deoth buffer check is enabled |
|---|
| 728 | (see _setDepthBufferCheckEnabled) |
|---|
| 729 | @param func The comparison between the new depth and the existing depth which must return true |
|---|
| 730 | for the new pixel to be written. |
|---|
| 731 | */ |
|---|
| 732 | virtual void _setDepthBufferFunction(CompareFunction func = CMPF_LESS_EQUAL) = 0; |
|---|
| 733 | /** Sets whether or not colour buffer writing is enabled, and for which channels. |
|---|
| 734 | @remarks |
|---|
| 735 | For some advanced effects, you may wish to turn off the writing of certain colour |
|---|
| 736 | channels, or even all of the colour channels so that only the depth buffer is updated |
|---|
| 737 | in a rendering pass. However, the chances are that you really want to use this option |
|---|
| 738 | through the Material class. |
|---|
| 739 | @param red, green, blue, alpha Whether writing is enabled for each of the 4 colour channels. */ |
|---|
| 740 | virtual void _setColourBufferWriteEnabled(bool red, bool green, bool blue, bool alpha) = 0; |
|---|
| 741 | /** Sets the depth bias, NB you should use the Material version of this. |
|---|
| 742 | @remarks |
|---|
| 743 | When polygons are coplanar, you can get problems with 'depth fighting' where |
|---|
| 744 | the pixels from the two polys compete for the same screen pixel. This is particularly |
|---|
| 745 | a problem for decals (polys attached to another surface to represent details such as |
|---|
| 746 | bulletholes etc.). |
|---|
| 747 | @par |
|---|
| 748 | A way to combat this problem is to use a depth bias to adjust the depth buffer value |
|---|
| 749 | used for the decal such that it is slightly higher than the true value, ensuring that |
|---|
| 750 | the decal appears on top. |
|---|
| 751 | @note |
|---|
| 752 | The final bias value is a combination of a constant bias and a bias proportional |
|---|
| 753 | to the maximum depth slope of the polygon being rendered. The final bias |
|---|
| 754 | is constantBias + slopeScaleBias * maxslope. Slope scale biasing is |
|---|
| 755 | generally preferable but is not available on older hardware. |
|---|
| 756 | @param constantBias The constant bias value, expressed as a value in |
|---|
| 757 | homogenous depth coordinates. |
|---|
| 758 | @param slopeScaleBias The bias value which is factored by the maximum slope |
|---|
| 759 | of the polygon, see the description above. This is not supported by all |
|---|
| 760 | cards. |
|---|
| 761 | |
|---|
| 762 | */ |
|---|
| 763 | virtual void _setDepthBias(float constantBias, float slopeScaleBias = 0.0f) = 0; |
|---|
| 764 | /** Sets the fogging mode for future geometry. |
|---|
| 765 | @param mode Set up the mode of fog as described in the FogMode enum, or set to FOG_NONE to turn off. |
|---|
| 766 | @param colour The colour of the fog. Either set this to the same as your viewport background colour, |
|---|
| 767 | or to blend in with a skydome or skybox. |
|---|
| 768 | @param expDensity The density of the fog in FOG_EXP or FOG_EXP2 mode, as a value between 0 and 1. The default is 1. i.e. completely opaque, lower values can mean |
|---|
| 769 | that fog never completely obscures the scene. |
|---|
| 770 | @param linearStart Distance at which linear fog starts to encroach. The distance must be passed |
|---|
| 771 | as a parametric value between 0 and 1, with 0 being the near clipping plane, and 1 being the far clipping plane. Only applicable if mode is FOG_LINEAR. |
|---|
| 772 | @param linearEnd Distance at which linear fog becomes completely opaque.The distance must be passed |
|---|
| 773 | as a parametric value between 0 and 1, with 0 being the near clipping plane, and 1 being the far clipping plane. Only applicable if mode is FOG_LINEAR. |
|---|
| 774 | */ |
|---|
| 775 | virtual void _setFog(FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, Real expDensity = 1.0, Real linearStart = 0.0, Real linearEnd = 1.0) = 0; |
|---|
| 776 | |
|---|
| 777 | |
|---|
| 778 | /** The RenderSystem will keep a count of tris rendered, this resets the count. */ |
|---|
| 779 | virtual void _beginGeometryCount(void); |
|---|
| 780 | /** Reports the number of tris rendered since the last _beginGeometryCount call. */ |
|---|
| 781 | virtual unsigned int _getFaceCount(void) const; |
|---|
| 782 | /** Reports the number of batches rendered since the last _beginGeometryCount call. */ |
|---|
| 783 | virtual unsigned int _getBatchCount(void) const; |
|---|
| 784 | /** Reports the number of vertices passed to the renderer since the last _beginGeometryCount call. */ |
|---|
| 785 | virtual unsigned int _getVertexCount(void) const; |
|---|
| 786 | |
|---|
| 787 | /** Generates a packed data version of the passed in ColourValue suitable for |
|---|
| 788 | use as with this RenderSystem. |
|---|
| 789 | @remarks |
|---|
| 790 | Since different render systems have different colour data formats (eg |
|---|
| 791 | RGBA for GL, ARGB for D3D) this method allows you to use 1 method for all. |
|---|
| 792 | @param colour The colour to convert |
|---|
| 793 | @param pDest Pointer to location to put the result. |
|---|
| 794 | */ |
|---|
| 795 | virtual void convertColourValue(const ColourValue& colour, uint32* pDest); |
|---|
| 796 | /** Get the native VertexElementType for a compact 32-bit colour value |
|---|
| 797 | for this rendersystem. |
|---|
| 798 | */ |
|---|
| 799 | virtual VertexElementType getColourVertexElementType(void) const = 0; |
|---|
| 800 | |
|---|
| 801 | /** Converts a uniform projection matrix to suitable for this render system. |
|---|
| 802 | @remarks |
|---|
| 803 | Because different APIs have different requirements (some incompatible) for the |
|---|
| 804 | projection matrix, this method allows each to implement their own correctly and pass |
|---|
| 805 | back a generic OGRE matrix for storage in the engine. |
|---|
| 806 | */ |
|---|
| 807 | virtual void _convertProjectionMatrix(const Matrix4& matrix, |
|---|
| 808 | Matrix4& dest, bool forGpuProgram = false) = 0; |
|---|
| 809 | |
|---|
| 810 | /** Builds a perspective projection matrix suitable for this render system. |
|---|
| 811 | @remarks |
|---|
| 812 | Because different APIs have different requirements (some incompatible) for the |
|---|
| 813 | projection matrix, this method allows each to implement their own correctly and pass |
|---|
| 814 | back a generic OGRE matrix for storage in the engine. |
|---|
| 815 | */ |
|---|
| 816 | virtual void _makeProjectionMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, |
|---|
| 817 | Matrix4& dest, bool forGpuProgram = false) = 0; |
|---|
| 818 | |
|---|
| 819 | /** Builds a perspective projection matrix for the case when frustum is |
|---|
| 820 | not centered around camera. |
|---|
| 821 | @remarks |
|---|
| 822 | Viewport coordinates are in camera coordinate frame, i.e. camera is |
|---|
| 823 | at the origin. |
|---|
| 824 | */ |
|---|
| 825 | virtual void _makeProjectionMatrix(Real left, Real right, Real bottom, Real top, |
|---|
| 826 | Real nearPlane, Real farPlane, Matrix4& dest, bool forGpuProgram = false) = 0; |
|---|
| 827 | /** Builds an orthographic projection matrix suitable for this render system. |
|---|
| 828 | @remarks |
|---|
| 829 | Because different APIs have different requirements (some incompatible) for the |
|---|
| 830 | projection matrix, this method allows each to implement their own correctly and pass |
|---|
| 831 | back a generic OGRE matrix for storage in the engine. |
|---|
| 832 | */ |
|---|
| 833 | virtual void _makeOrthoMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, |
|---|
| 834 | Matrix4& dest, bool forGpuProgram = false) = 0; |
|---|
| 835 | |
|---|
| 836 | /** Update a perspective projection matrix to use 'oblique depth projection'. |
|---|
| 837 | @remarks |
|---|
| 838 | This method can be used to change the nature of a perspective |
|---|
| 839 | transform in order to make the near plane not perpendicular to the |
|---|
| 840 | camera view direction, but to be at some different orientation. |
|---|
| 841 | This can be useful for performing arbitrary clipping (e.g. to a |
|---|
| 842 | reflection plane) which could otherwise only be done using user |
|---|
| 843 | clip planes, which are more expensive, and not necessarily supported |
|---|
| 844 | on all cards. |
|---|
| 845 | @param matrix The existing projection matrix. Note that this must be a |
|---|
| 846 | perspective transform (not orthographic), and must not have already |
|---|
| 847 | been altered by this method. The matrix will be altered in-place. |
|---|
| 848 | @param plane The plane which is to be used as the clipping plane. This |
|---|
| 849 | plane must be in CAMERA (view) space. |
|---|
| 850 | @param forGpuProgram Is this for use with a Gpu program or fixed-function |
|---|
| 851 | */ |
|---|
| 852 | virtual void _applyObliqueDepthProjection(Matrix4& matrix, const Plane& plane, |
|---|
| 853 | bool forGpuProgram) = 0; |
|---|
| 854 | |
|---|
| 855 | /** Sets how to rasterise triangles, as points, wireframe or solid polys. */ |
|---|
| 856 | virtual void _setPolygonMode(PolygonMode level) = 0; |
|---|
| 857 | |
|---|
| 858 | /** Turns stencil buffer checking on or off. |
|---|
| 859 | @remarks |
|---|
| 860 | Stencilling (masking off areas of the rendering target based on the stencil |
|---|
| 861 | buffer) canbe turned on or off using this method. By default, stencilling is |
|---|
| 862 | disabled. |
|---|
| 863 | */ |
|---|
| 864 | virtual void setStencilCheckEnabled(bool enabled) = 0; |
|---|
| 865 | /** Determines if this system supports hardware accelerated stencil buffer. |
|---|
| 866 | @remarks |
|---|
| 867 | Note that the lack of this function doesn't mean you can't do stencilling, but |
|---|
| 868 | the stencilling operations will be provided in software, which will NOT be |
|---|
| 869 | fast. |
|---|
| 870 | @par |
|---|
| 871 | Generally hardware stencils are only supported in 32-bit colour modes, because |
|---|
| 872 | the stencil buffer shares the memory of the z-buffer, and in most cards the |
|---|
| 873 | z-buffer has to be the same depth as the colour buffer. This means that in 32-bit |
|---|
| 874 | mode, 24 bits of the z-buffer are depth and 8 bits are stencil. In 16-bit mode there |
|---|
| 875 | is no room for a stencil (although some cards support a 15:1 depth:stencil option, |
|---|
| 876 | this isn't useful for very much) so 8 bits of stencil are provided in software. |
|---|
| 877 | This can mean that if you use stencilling, your applications may be faster in |
|---|
| 878 | 32-but colour than in 16-bit, which may seem odd to some people. |
|---|
| 879 | */ |
|---|
| 880 | /*virtual bool hasHardwareStencil(void) = 0;*/ |
|---|
| 881 | |
|---|
| 882 | /** This method allows you to set all the stencil buffer parameters in one call. |
|---|
| 883 | @remarks |
|---|
| 884 | The stencil buffer is used to mask out pixels in the render target, allowing |
|---|
| 885 | you to do effects like mirrors, cut-outs, stencil shadows and more. Each of |
|---|
| 886 | your batches of rendering is likely to ignore the stencil buffer, |
|---|
| 887 | update it with new values, or apply it to mask the output of the render. |
|---|
| 888 | The stencil test is:<PRE> |
|---|
| 889 | (Reference Value & Mask) CompareFunction (Stencil Buffer Value & Mask)</PRE> |
|---|
| 890 | The result of this will cause one of 3 actions depending on whether the test fails, |
|---|
| 891 | succeeds but with the depth buffer check still failing, or succeeds with the |
|---|
| 892 | depth buffer check passing too. |
|---|
| 893 | @par |
|---|
| 894 | Unlike other render states, stencilling is left for the application to turn |
|---|
| 895 | on and off when it requires. This is because you are likely to want to change |
|---|
| 896 | parameters between batches of arbitrary objects and control the ordering yourself. |
|---|
| 897 | In order to batch things this way, you'll want to use OGRE's separate render queue |
|---|
| 898 | groups (see RenderQueue) and register a RenderQueueListener to get notifications |
|---|
| 899 | between batches. |
|---|
| 900 | @par |
|---|
| 901 | There are individual state change methods for each of the parameters set using |
|---|
| 902 | this method. |
|---|
| 903 | Note that the default values in this method represent the defaults at system |
|---|
| 904 | start up too. |
|---|
| 905 | @param func The comparison function applied. |
|---|
| 906 | @param refValue The reference value used in the comparison |
|---|
| 907 | @param mask The bitmask applied to both the stencil value and the reference value |
|---|
| 908 | before comparison |
|---|
| 909 | @param stencilFailOp The action to perform when the stencil check fails |
|---|
| 910 | @param depthFailOp The action to perform when the stencil check passes, but the |
|---|
| 911 | depth buffer check still fails |
|---|
| 912 | @param passOp The action to take when both the stencil and depth check pass. |
|---|
| 913 | @param twoSidedOperation If set to true, then if you render both back and front faces |
|---|
| 914 | (you'll have to turn off culling) then these parameters will apply for front faces, |
|---|
| 915 | and the inverse of them will happen for back faces (keep remains the same). |
|---|
| 916 | */ |
|---|
| 917 | virtual void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, |
|---|
| 918 | uint32 refValue = 0, uint32 mask = 0xFFFFFFFF, |
|---|
| 919 | StencilOperation stencilFailOp = SOP_KEEP, |
|---|
| 920 | StencilOperation depthFailOp = SOP_KEEP, |
|---|
| 921 | StencilOperation passOp = SOP_KEEP, |
|---|
| 922 | bool twoSidedOperation = false) = 0; |
|---|
| 923 | |
|---|
| 924 | |
|---|
| 925 | |
|---|
| 926 | /** Sets the current vertex declaration, ie the source of vertex data. */ |
|---|
| 927 | virtual void setVertexDeclaration(VertexDeclaration* decl) = 0; |
|---|
| 928 | /** Sets the current vertex buffer binding state. */ |
|---|
| 929 | virtual void setVertexBufferBinding(VertexBufferBinding* binding) = 0; |
|---|
| 930 | |
|---|
| 931 | /** Sets whether or not normals are to be automatically normalised. |
|---|
| 932 | @remarks |
|---|
| 933 | This is useful when, for example, you are scaling SceneNodes such that |
|---|
| 934 | normals may not be unit-length anymore. Note though that this has an |
|---|
| 935 | overhead so should not be turn on unless you really need it. |
|---|
| 936 | @par |
|---|
| 937 | You should not normally call this direct unless you are rendering |
|---|
| 938 | world geometry; set it on the Renderable because otherwise it will be |
|---|
| 939 | overridden by material settings. |
|---|
| 940 | */ |
|---|
| 941 | virtual void setNormaliseNormals(bool normalise) = 0; |
|---|
| 942 | |
|---|
| 943 | /** |
|---|
| 944 | Render something to the active viewport. |
|---|
| 945 | |
|---|
| 946 | Low-level rendering interface to perform rendering |
|---|
| 947 | operations. Unlikely to be used directly by client |
|---|
| 948 | applications, since the SceneManager and various support |
|---|
| 949 | classes will be responsible for calling this method. |
|---|
| 950 | Can only be called between _beginScene and _endScene |
|---|
| 951 | |
|---|
| 952 | @param op A rendering operation instance, which contains |
|---|
| 953 | details of the operation to be performed. |
|---|
| 954 | */ |
|---|
| 955 | virtual void _render(const RenderOperation& op); |
|---|
| 956 | |
|---|
| 957 | /** Gets the capabilities of the render system. */ |
|---|
| 958 | const RenderSystemCapabilities* getCapabilities(void) const { return mCapabilities; } |
|---|
| 959 | |
|---|
| 960 | /** Binds a given GpuProgram (but not the parameters). |
|---|
| 961 | @remarks Only one GpuProgram of each type can be bound at once, binding another |
|---|
| 962 | one will simply replace the exsiting one. |
|---|
| 963 | */ |
|---|
| 964 | virtual void bindGpuProgram(GpuProgram* prg); |
|---|
| 965 | |
|---|
| 966 | /** Bind Gpu program parameters. |
|---|
| 967 | */ |
|---|
| 968 | virtual void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params) = 0; |
|---|
| 969 | /** Only binds Gpu program parameters used for passes that have more than one iteration rendering |
|---|
| 970 | */ |
|---|
| 971 | virtual void bindGpuProgramPassIterationParameters(GpuProgramType gptype) = 0; |
|---|
| 972 | /** Unbinds GpuPrograms of a given GpuProgramType. |
|---|
| 973 | @remarks |
|---|
| 974 | This returns the pipeline to fixed-function processing for this type. |
|---|
| 975 | */ |
|---|
| 976 | virtual void unbindGpuProgram(GpuProgramType gptype); |
|---|
| 977 | |
|---|
| 978 | /** Returns whether or not a Gpu program of the given type is currently bound. */ |
|---|
| 979 | virtual bool isGpuProgramBound(GpuProgramType gptype); |
|---|
| 980 | |
|---|
| 981 | /** sets the clipping region. |
|---|
| 982 | */ |
|---|
| 983 | virtual void setClipPlanes(const PlaneList& clipPlanes) = 0; |
|---|
| 984 | |
|---|
| 985 | /** Utility method for initialising all render targets attached to this rendering system. */ |
|---|
| 986 | virtual void _initRenderTargets(void); |
|---|
| 987 | |
|---|
| 988 | /** Utility method to notify all render targets that a camera has been removed, |
|---|
| 989 | incase they were referring to it as their viewer. |
|---|
| 990 | */ |
|---|
| 991 | virtual void _notifyCameraRemoved(const Camera* cam); |
|---|
| 992 | |
|---|
| 993 | /** Internal method for updating all render targets attached to this rendering system. */ |
|---|
| 994 | virtual void _updateAllRenderTargets(void); |
|---|
| 995 | |
|---|
| 996 | /** Set a clipping plane. */ |
|---|
| 997 | virtual void setClipPlane (ushort index, const Plane &p); |
|---|
| 998 | /** Set a clipping plane. */ |
|---|
| 999 | virtual void setClipPlane (ushort index, Real A, Real B, Real C, Real D) = 0; |
|---|
| 1000 | /** Enable the clipping plane. */ |
|---|
| 1001 | virtual void enableClipPlane (ushort index, bool enable) = 0; |
|---|
| 1002 | |
|---|
| 1003 | /** Sets whether or not vertex windings set should be inverted; this can be important |
|---|
| 1004 | for rendering reflections. */ |
|---|
| 1005 | virtual void setInvertVertexWinding(bool invert); |
|---|
| 1006 | /** Sets the 'scissor region' ie the region of the target in which rendering can take place. |
|---|
| 1007 | @remarks |
|---|
| 1008 | This method allows you to 'mask off' rendering in all but a given rectangular area |
|---|
| 1009 | as identified by the parameters to this method. |
|---|
| 1010 | @note |
|---|
| 1011 | Not all systems support this method. Check the RenderSystemCapabilities for the |
|---|
| 1012 | RSC_SCISSOR_TEST capability to see if it is supported. |
|---|
| 1013 | @param enabled True to enable the scissor test, false to disable it. |
|---|
| 1014 | @param left, top, right, bottom The location of the corners of the rectangle, expressed in |
|---|
| 1015 | <i>pixels</i>. |
|---|
| 1016 | */ |
|---|
| 1017 | virtual void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, |
|---|
| 1018 | size_t right = 800, size_t bottom = 600) = 0; |
|---|
| 1019 | |
|---|
| 1020 | /** Clears one or more frame buffers on the active render target. |
|---|
| 1021 | @param buffers Combination of one or more elements of FrameBufferType |
|---|
| 1022 | denoting which buffers are to be cleared |
|---|
| 1023 | @param colour The colour to clear the colour buffer with, if enabled |
|---|
| 1024 | @param depth The value to initialise the depth buffer with, if enabled |
|---|
| 1025 | @param stencil The value to initialise the stencil buffer with, if enabled. |
|---|
| 1026 | */ |
|---|
| 1027 | virtual void clearFrameBuffer(unsigned int buffers, |
|---|
| 1028 | const ColourValue& colour = ColourValue::Black, |
|---|
| 1029 | Real depth = 1.0f, unsigned short stencil = 0) = 0; |
|---|
| 1030 | /** Returns the horizontal texel offset value required for mapping |
|---|
| 1031 | texel origins to pixel origins in this rendersystem. |
|---|
| 1032 | @remarks |
|---|
| 1033 | Since rendersystems sometimes disagree on the origin of a texel, |
|---|
| 1034 | mapping from texels to pixels can sometimes be problematic to |
|---|
| 1035 | implement generically. This method allows you to retrieve the offset |
|---|
| 1036 | required to map the origin of a texel to the origin of a pixel in |
|---|
| 1037 | the horizontal direction. |
|---|
| 1038 | */ |
|---|
| 1039 | virtual Real getHorizontalTexelOffset(void) = 0; |
|---|
| 1040 | /** Returns the vertical texel offset value required for mapping |
|---|
| 1041 | texel origins to pixel origins in this rendersystem. |
|---|
| 1042 | @remarks |
|---|
| 1043 | Since rendersystems sometimes disagree on the origin of a texel, |
|---|
| 1044 | mapping from texels to pixels can sometimes be problematic to |
|---|
| 1045 | implement generically. This method allows you to retrieve the offset |
|---|
| 1046 | required to map the origin of a texel to the origin of a pixel in |
|---|
| 1047 | the vertical direction. |
|---|
| 1048 | */ |
|---|
| 1049 | virtual Real getVerticalTexelOffset(void) = 0; |
|---|
| 1050 | |
|---|
| 1051 | /** Gets the minimum (closest) depth value to be used when rendering |
|---|
| 1052 | using identity transforms. |
|---|
| 1053 | @remarks |
|---|
| 1054 | When using identity transforms you can manually set the depth |
|---|
| 1055 | of a vertex; however the input values required differ per |
|---|
| 1056 | rendersystem. This method lets you retrieve the correct value. |
|---|
| 1057 | @see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection |
|---|
| 1058 | */ |
|---|
| 1059 | virtual Real getMinimumDepthInputValue(void) = 0; |
|---|
| 1060 | /** Gets the maximum (farthest) depth value to be used when rendering |
|---|
| 1061 | using identity transforms. |
|---|
| 1062 | @remarks |
|---|
| 1063 | When using identity transforms you can manually set the depth |
|---|
| 1064 | of a vertex; however the input values required differ per |
|---|
| 1065 | rendersystem. This method lets you retrieve the correct value. |
|---|
| 1066 | @see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection |
|---|
| 1067 | */ |
|---|
| 1068 | virtual Real getMaximumDepthInputValue(void) = 0; |
|---|
| 1069 | /** set the current multi pass count value. This must be set prior to |
|---|
| 1070 | calling _render() if multiple renderings of the same pass state are |
|---|
| 1071 | required. |
|---|
| 1072 | @param count Number of times to render the current state. |
|---|
| 1073 | */ |
|---|
| 1074 | void setCurrentPassIterationCount(const size_t count) { mCurrentPassIterationCount = count; } |
|---|
| 1075 | |
|---|
| 1076 | /** Defines a listener on the custom events that this render system |
|---|
| 1077 | can raise. |
|---|
| 1078 | @see RenderSystem::addListener |
|---|
| 1079 | */ |
|---|
| 1080 | class _OgreExport Listener |
|---|
| 1081 | { |
|---|
| 1082 | public: |
|---|
| 1083 | Listener() {} |
|---|
| 1084 | virtual ~Listener() {} |
|---|
| 1085 | |
|---|
| 1086 | /** A rendersystem-specific event occurred. |
|---|
| 1087 | @param eventName The name of the event which has occurred |
|---|
| 1088 | @param parameters A list of parameters that may belong to this event, |
|---|
| 1089 | may be null if there are no parameters |
|---|
| 1090 | */ |
|---|
| 1091 | virtual void eventOccurred(const String& eventName, |
|---|
| 1092 | const NameValuePairList* parameters = 0) = 0; |
|---|
| 1093 | }; |
|---|
| 1094 | /** Adds a listener to the custom events that this render system can raise. |
|---|
| 1095 | @remarks |
|---|
| 1096 | Some render systems have quite specific, internally generated events |
|---|
| 1097 | that the application may wish to be notified of. Many applications |
|---|
| 1098 | don't have to worry about these events, and can just trust OGRE to |
|---|
| 1099 | handle them, but if you want to know, you can add a listener here. |
|---|
| 1100 | @par |
|---|
| 1101 | Events are raised very generically by string name. Perhaps the most |
|---|
| 1102 | common example of a render system specific event is the loss and |
|---|
| 1103 | restoration of a device in DirectX; which OGRE deals with, but you |
|---|
| 1104 | may wish to know when it happens. |
|---|
| 1105 | @see RenderSystem::getRenderSystemEvents |
|---|
| 1106 | */ |
|---|
| 1107 | virtual void addListener(Listener* l); |
|---|
| 1108 | /** Remove a listener to the custom events that this render system can raise. |
|---|
| 1109 | */ |
|---|
| 1110 | virtual void removeListener(Listener* l); |
|---|
| 1111 | |
|---|
| 1112 | /** Gets a list of the rendersystem specific events that this rendersystem |
|---|
| 1113 | can raise. |
|---|
| 1114 | @see RenderSystem::addListener |
|---|
| 1115 | */ |
|---|
| 1116 | virtual const StringVector& getRenderSystemEvents(void) const { return mEventNames; } |
|---|
| 1117 | |
|---|
| 1118 | /** Tell the rendersystem to perform any prep tasks it needs to directly |
|---|
| 1119 | before other threads which might access the rendering API are registered. |
|---|
| 1120 | @remarks |
|---|
| 1121 | Call this from your main thread before starting your other threads |
|---|
| 1122 | (which themselves should call registerThread()). Note that if you |
|---|
| 1123 | start your own threads, there is a specific startup sequence which |
|---|
| 1124 | must be respected and requires synchronisation between the threads: |
|---|
| 1125 | <ol> |
|---|
| 1126 | <li>[Main thread]Call preExtraThreadsStarted</li> |
|---|
| 1127 | <li>[Main thread]Start other thread, wait</li> |
|---|
| 1128 | <li>[Other thread]Call registerThread, notify main thread & continue</li> |
|---|
| 1129 | <li>[Main thread]Wake up & call postExtraThreadsStarted</li> |
|---|
| 1130 | </ol> |
|---|
| 1131 | Once this init sequence is completed the threads are independent but |
|---|
| 1132 | this startup sequence must be respected. |
|---|
| 1133 | */ |
|---|
| 1134 | virtual void preExtraThreadsStarted() = 0; |
|---|
| 1135 | |
|---|
| 1136 | /* Tell the rendersystem to perform any tasks it needs to directly |
|---|
| 1137 | after other threads which might access the rendering API are registered. |
|---|
| 1138 | @see RenderSystem::preExtraThreadsStarted |
|---|
| 1139 | */ |
|---|
| 1140 | virtual void postExtraThreadsStarted() = 0; |
|---|
| 1141 | |
|---|
| 1142 | /** Register the an additional thread which may make calls to rendersystem-related |
|---|
| 1143 | objects. |
|---|
| 1144 | @remarks |
|---|
| 1145 | This method should only be called by additional threads during their |
|---|
| 1146 | initialisation. If they intend to use hardware rendering system resources |
|---|
| 1147 | they should call this method before doing anything related to the render system. |
|---|
| 1148 | Some rendering APIs require a per-thread setup and this method will sort that |
|---|
| 1149 | out. It is also necessary to call unregisterThread before the thread shuts down. |
|---|
| 1150 | @note |
|---|
| 1151 | This method takes no parameters - it must be called from the thread being |
|---|
| 1152 | registered and that context is enough. |
|---|
| 1153 | */ |
|---|
| 1154 | virtual void registerThread() = 0; |
|---|
| 1155 | |
|---|
| 1156 | /** Unregister an additional thread which may make calls to rendersystem-related objects. |
|---|
| 1157 | @see RenderSystem::registerThread |
|---|
| 1158 | */ |
|---|
| 1159 | virtual void unregisterThread() = 0; |
|---|
| 1160 | protected: |
|---|
| 1161 | |
|---|
| 1162 | |
|---|
| 1163 | /** The render targets. */ |
|---|
| 1164 | RenderTargetMap mRenderTargets; |
|---|
| 1165 | /** The render targets, ordered by priority. */ |
|---|
| 1166 | RenderTargetPriorityMap mPrioritisedRenderTargets; |
|---|
| 1167 | /** The Active render target. */ |
|---|
| 1168 | RenderTarget * mActiveRenderTarget; |
|---|
| 1169 | /** The Active GPU programs and gpu program parameters*/ |
|---|
| 1170 | GpuProgramParametersSharedPtr mActiveVertexGpuProgramParameters; |
|---|
| 1171 | GpuProgramParametersSharedPtr mActiveFragmentGpuProgramParameters; |
|---|
| 1172 | |
|---|
| 1173 | // Texture manager |
|---|
| 1174 | // A concrete class of this will be created and |
|---|
| 1175 | // made available under the TextureManager singleton, |
|---|
| 1176 | // managed by the RenderSystem |
|---|
| 1177 | TextureManager* mTextureManager; |
|---|
| 1178 | |
|---|
| 1179 | /// Used to store the capabilities of the graphics card |
|---|
| 1180 | RenderSystemCapabilities* mCapabilities; |
|---|
| 1181 | |
|---|
| 1182 | // Active viewport (dest for future rendering operations) |
|---|
| 1183 | Viewport* mActiveViewport; |
|---|
| 1184 | |
|---|
| 1185 | CullingMode mCullingMode; |
|---|
| 1186 | |
|---|
| 1187 | bool mVSync; |
|---|
| 1188 | bool mWBuffer; |
|---|
| 1189 | |
|---|
| 1190 | size_t mBatchCount; |
|---|
| 1191 | size_t mFaceCount; |
|---|
| 1192 | size_t mVertexCount; |
|---|
| 1193 | |
|---|
| 1194 | /// Saved manual colour blends |
|---|
| 1195 | ColourValue mManualBlendColours[OGRE_MAX_TEXTURE_LAYERS][2]; |
|---|
| 1196 | |
|---|
| 1197 | bool mInvertVertexWinding; |
|---|
| 1198 | |
|---|
| 1199 | /// Texture units from this upwards are disabled |
|---|
| 1200 | size_t mDisabledTexUnitsFrom; |
|---|
| 1201 | |
|---|
| 1202 | /// number of times to render the current state |
|---|
| 1203 | size_t mCurrentPassIterationCount; |
|---|
| 1204 | |
|---|
| 1205 | /** updates pass iteration rendering state including bound gpu program parameter |
|---|
| 1206 | pass iteration auto constant entry |
|---|
| 1207 | @returns True if more iterations are required |
|---|
| 1208 | */ |
|---|
| 1209 | bool updatePassIterationRenderState(void); |
|---|
| 1210 | |
|---|
| 1211 | /// List of names of events this rendersystem may raise |
|---|
| 1212 | StringVector mEventNames; |
|---|
| 1213 | |
|---|
| 1214 | /// Internal method for firing a rendersystem event |
|---|
| 1215 | virtual void fireEvent(const String& name, const NameValuePairList* params = 0); |
|---|
| 1216 | |
|---|
| 1217 | typedef std::list<Listener*> ListenerList; |
|---|
| 1218 | ListenerList mEventListeners; |
|---|
| 1219 | |
|---|
| 1220 | typedef std::list<HardwareOcclusionQuery*> HardwareOcclusionQueryList; |
|---|
| 1221 | HardwareOcclusionQueryList mHwOcclusionQueries; |
|---|
| 1222 | |
|---|
| 1223 | bool mVertexProgramBound; |
|---|
| 1224 | bool mFragmentProgramBound; |
|---|
| 1225 | |
|---|
| 1226 | |
|---|
| 1227 | |
|---|
| 1228 | }; |
|---|
| 1229 | } |
|---|
| 1230 | |
|---|
| 1231 | #endif |
|---|