28 #ifndef __D3D9RENDERSYSTEM_H__
29 #define __D3D9RENDERSYSTEM_H__
45 class D3D9DeviceManager;
46 class D3D9ResourceManager;
95 IDirect3DBaseTexture9 *
pTex;
104 void refreshD3DSettings();
105 void refreshFSAAOptions();
107 void setD3D9Light(
size_t index,
Light* light );
110 HRESULT __SetRenderState(D3DRENDERSTATETYPE state, DWORD value);
111 HRESULT __SetSamplerState(DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value);
112 HRESULT __SetTextureStageState(DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value);
116 #if OGRE_DOUBLE_PRECISION == 1
117 float temp =
static_cast<float>(value);
118 return __SetRenderState(state, *((LPDWORD)(&temp)));
120 return __SetRenderState(state, *((LPDWORD)(&value)));
125 DWORD _getCurrentAnisotropy(
size_t unit);
127 bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
149 void detachRenderTargetImpl(
const String& name);
169 void setClipPlanesImpl(
const PlaneList& clipPlanes);
176 virtual void initConfigOptions();
180 String validateConfigOptions();
181 RenderWindow* _initialise(
bool autoCreateWindow,
const String& windowTitle =
"OGRE Render Window" );
183 RenderWindow* _createRenderWindow(
const String &name,
unsigned int width,
unsigned int height,
198 DepthBuffer* _addManualDepthBuffer( IDirect3DDevice9* depthSurfaceDevice, IDirect3DSurface9 *surf );
210 void _cleanupDepthBuffers( IDirect3DDevice9 *creator );
219 void _cleanupDepthBuffers( IDirect3DSurface9 *manualSurface );
232 String getErrorDescription(
long errorNumber )
const;
233 const String& getName()
const;
235 void setConfigOption(
const String &name,
const String &value );
238 void setAmbientLight(
float r,
float g,
float b );
240 void setLightingEnabled(
bool enabled );
241 void destroyRenderTarget(
const String& name);
243 void setStencilCheckEnabled(
bool enabled);
249 bool twoSidedOperation =
false);
250 void setNormaliseNormals(
bool normalise);
253 void _useLights(
const LightList& lights,
unsigned short limit);
254 void _setWorldMatrix(
const Matrix4 &m );
255 void _setViewMatrix(
const Matrix4 &m );
256 void _setProjectionMatrix(
const Matrix4 &m );
258 void _setPointSpritesEnabled(
bool enabled);
259 void _setPointParameters(
Real size,
bool attenuationEnabled,
261 void _setTexture(
size_t unit,
bool enabled,
const TexturePtr &texPtr);
262 void _setVertexTexture(
size_t unit,
const TexturePtr& tex);
263 void _disableTextureUnit(
size_t texUnit);
264 void _setTextureCoordSet(
size_t unit,
size_t index );
269 void _setTextureBorderColour(
size_t stage,
const ColourValue& colour);
270 void _setTextureMipmapBias(
size_t unit,
float bias);
271 void _setTextureMatrix(
size_t unit,
const Matrix4 &xform );
274 void _setAlphaRejectSettings(
CompareFunction func,
unsigned char value,
bool alphaToCoverage );
282 void _setDepthBufferCheckEnabled(
bool enabled =
true );
283 void _setColourBufferWriteEnabled(
bool red,
bool green,
bool blue,
bool alpha);
284 void _setDepthBufferWriteEnabled(
bool enabled =
true);
286 void _setDepthBias(
float constantBias,
float slopeScaleBias);
288 void _convertProjectionMatrix(
const Matrix4& matrix,
289 Matrix4& dest,
bool forGpuProgram =
false);
290 void _makeProjectionMatrix(
const Radian& fovy,
Real aspect,
Real nearPlane,
Real farPlane,
291 Matrix4& dest,
bool forGpuProgram =
false);
293 Real farPlane,
Matrix4& dest,
bool forGpuProgram =
false);
295 Matrix4& dest,
bool forGpuProgram =
false);
296 void _applyObliqueDepthProjection(
Matrix4& matrix,
const Plane& plane,
300 void _setTextureLayerAnisotropy(
size_t unit,
unsigned int maxAnisotropy);
302 void setVertexDeclaration(
VertexDeclaration* decl,
bool useGlobalInstancingVertexBufferIsAvailable);
304 void setVertexBufferBinding(
VertexBufferBinding* binding,
size_t numberOfInstances,
bool useGlobalInstancingVertexBufferIsAvailable,
bool indexesUsed);
319 void bindGpuProgramPassIterationParameters(
GpuProgramType gptype);
321 void setScissorTest(
bool enabled,
size_t left = 0,
size_t top = 0,
size_t right = 800,
size_t bottom = 600);
322 void clearFrameBuffer(
unsigned int buffers,
324 Real depth = 1.0f,
unsigned short stencil = 0);
326 void enableClipPlane (
ushort index,
bool enable);
328 Real getHorizontalTexelOffset();
329 Real getVerticalTexelOffset();
330 Real getMinimumDepthInputValue();
331 Real getMaximumDepthInputValue();
332 void registerThread();
333 void unregisterThread();
334 void preExtraThreadsStarted();
335 void postExtraThreadsStarted();
339 static IDirect3D9* getDirect3D9();
340 static UINT getResourceCreationDeviceCount();
341 static IDirect3DDevice9* getResourceCreationDevice(UINT index);
342 static IDirect3DDevice9* getActiveD3D9Device();
347 D3DFORMAT _getDepthStencilFormatFor(D3DFORMAT fmt);
355 void determineFSAASettings(IDirect3DDevice9* d3d9Device,
size_t fsaa,
const String& fsaaHint, D3DFORMAT d3dPixelFormat,
356 bool fullScreen, D3DMULTISAMPLE_TYPE *outMultisampleType, DWORD *outMultisampleQuality);
359 unsigned int getDisplayMonitorCount()
const;
362 virtual void beginProfileEvent(
const String &eventName );
365 virtual void endProfileEvent(
void );
368 virtual void markProfileEvent(
const String &eventName );
377 DWORD getSamplerId(
size_t unit);
Manages the target rendering window.
A 'canvas' which can receive the results of a rendering operation.
Class encapsulating a standard 4x4 homogeneous matrix.
HashMap< IDirect3DDevice9 *, unsigned short > mCurrentLights
float Real
Software floating point type.
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Defines a plane in 3D space.
Leave the stencil buffer unchanged.
Class representing colour.
size_t mLastVertexSourceCount
GpuProgramType
Enumerates the types of programs which can run on the GPU.
static const ColourValue White
A frustum represents a pyramid, capped at the near and far end which is used to represent either a vi...
eD3DTexType
enum identifying D3D9 tex. types
Defines a program which runs on the GPU such as a vertex or fragment program.
TexCoordCalcMethod
Enum describing the ways to generate texture coordinates.
IDirect3DBaseTexture9 * pVertexTex
vertex texture
vector< D3D9RenderWindow * >::type D3D9RenderWindowList
structure holding texture unit settings for every stage
SceneBlendFactor
Blending factors for manually blending objects with the scene.
bool mUseNVPerfHUD
NVPerfHUD allowed?
Device manager interface.
D3D9GpuProgramManager * mGpuProgramManager
D3D9Mappings::eD3DTexType texType
the type of the texture
CullingMode
Hardware culling modes based on vertex winding.
D3D9HLSLProgramFactory * mHLSLProgramFactory
This class represents a render target that renders to multiple RenderTextures at once.
This is a abstract class that that provides the interface for the query class for hardware occlusion...
vector< RenderWindow * >::type RenderWindowList
Render window container.
static D3D9RenderSystem * msD3D9RenderSystem
Fast singleton access.
Representation of a dynamic light source in the scene.
vector< Plane >::type PlaneList
#define OGRE_MAX_TEXTURE_LAYERS
Define max number of texture layers allowed per pass on any card.
MultiheadUseType getMultiheadUse() const
Returns how multihead should be activated.
An abstract class that contains a depth/stencil buffer.
ShadeOptions
Light shading modes.
TexCoordCalcMethod autoTexCoordType
type of auto tex. calc. used
PixelFormat
The pixel format used for images, textures, and render surfaces.
Texture addressing mode for each texture coordinate.
map< String, ConfigOption >::type ConfigOptionMap
Specialisation of SharedPtr to allow SharedPtr to be assigned to TexturePtr.
D3D9ResourceManager * mResourceManager
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
HRESULT __SetFloatRenderState(D3DRENDERSTATETYPE state, Real value)
D3D9HardwareBufferManagerBase as a Singleton.
MultiheadUseType mMultiheadUse
const Frustum * frustum
Frustum, used if the above is projection.
Implementation of DirectX9 as a rendering system.
IDirect3D9 * mD3D
Direct3D.
HashMap< unsigned int, D3DFORMAT > DepthStencilHash
Mapping of texture format -> DepthStencil.
High level interface of Direct3D9 Device.
An abstraction of a viewport, i.e.
'New' rendering operation using vertex buffers.
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
D3D9HardwareBufferManager * mHardwareBufferManager
Wrapper class which indicates a given angle value is in Radians.
size_t coordIndex
which texCoordIndex to use
TextureType
Enum identifying the texture type.
PolygonMode
The polygon mode to use when rasterising.
HINSTANCE mhInstance
instance
bool mPerStageConstantSupport
Per-stage constant support? (not in main caps since D3D specific & minor)
static const ColourValue Black
SceneBlendOperation
Blending operations controls how objects are blended into the scene.
Matrix4 mViewMatrix
Saved last view matrix.
singleton class for storing the capabilities of the graphics card.
vector< RenderWindowDescription >::type RenderWindowDescriptionList
Render window creation parameters container.
D3D9DriverList * mDriverList
List of D3D drivers installed (video cards)
D3D9DeviceManager * mDeviceManager
Factory class for D3D9 HLSL programs.
StencilOperation
Enum describing the various actions which can be taken onthe stencil buffer.
FilterOptions
Filtering options for textures / mipmaps.
Defines the functionality of a 3D API.
D3D9Driver * mActiveD3DDriver
Currently active driver.
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
int TrackVertexColourType
An enumeration describing which material properties should track the vertex colours.
Class which manages blending of both colour and alpha components.
void _cleanupDepthBuffers(bool bCleanManualBuffers=true)
Removes all depth buffers.
DepthStencilHash mDepthStencilHash
IDirect3DBaseTexture9 * pTex
texture
D3D9RenderWindowList mRenderWindows