28 #ifndef __D3D9RENDERSYSTEM_H__ 29 #define __D3D9RENDERSYSTEM_H__ 45 class D3D9DeviceManager;
46 class D3D9ResourceManager;
110 void refreshD3DSettings();
111 void refreshFSAAOptions();
113 void setD3D9Light(
size_t index,
Light* light );
116 HRESULT __SetRenderState(D3DRENDERSTATETYPE state, DWORD value);
117 HRESULT __SetSamplerState(DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value);
118 HRESULT __SetTextureStageState(DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value);
122 #if OGRE_DOUBLE_PRECISION == 1 123 float temp =
static_cast<float>(value);
124 return __SetRenderState(state, *((LPDWORD)(&temp)));
126 return __SetRenderState(state, *((LPDWORD)(&value)));
131 DWORD _getCurrentAnisotropy(
size_t unit);
133 bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
155 void detachRenderTargetImpl(
const String& name);
175 void setClipPlanesImpl(
const PlaneList& clipPlanes);
182 virtual void initConfigOptions();
186 String validateConfigOptions();
187 RenderWindow* _initialise(
bool autoCreateWindow,
const String& windowTitle =
"OGRE Render Window" );
189 RenderWindow* _createRenderWindow(
const String &name,
unsigned int width,
unsigned int height,
204 DepthBuffer* _addManualDepthBuffer( IDirect3DDevice9* depthSurfaceDevice, IDirect3DSurface9 *surf );
216 void _cleanupDepthBuffers( IDirect3DDevice9 *creator );
225 void _cleanupDepthBuffers( IDirect3DSurface9 *manualSurface );
238 String getErrorDescription(
long errorNumber )
const;
239 const String& getName()
const;
241 void setConfigOption(
const String &name,
const String &value );
244 void setAmbientLight(
float r,
float g,
float b );
246 void setLightingEnabled(
bool enabled );
247 void destroyRenderTarget(
const String& name);
249 void setStencilCheckEnabled(
bool enabled);
255 bool twoSidedOperation =
false);
256 void setNormaliseNormals(
bool normalise);
259 void _useLights(
const LightList& lights,
unsigned short limit);
260 void _setWorldMatrix(
const Matrix4 &m );
261 void _setViewMatrix(
const Matrix4 &m );
262 void _setProjectionMatrix(
const Matrix4 &m );
264 void _setPointSpritesEnabled(
bool enabled);
265 void _setPointParameters(
Real size,
bool attenuationEnabled,
267 void _setTexture(
size_t unit,
bool enabled,
const TexturePtr &texPtr);
268 void _setVertexTexture(
size_t unit,
const TexturePtr& tex);
269 void _disableTextureUnit(
size_t texUnit);
270 void _setTextureCoordSet(
size_t unit,
size_t index );
275 void _setTextureBorderColour(
size_t stage,
const ColourValue& colour);
276 void _setTextureMipmapBias(
size_t unit,
float bias);
277 void _setTextureMatrix(
size_t unit,
const Matrix4 &xform );
280 void _setAlphaRejectSettings(
CompareFunction func,
unsigned char value,
bool alphaToCoverage );
288 void _setDepthBufferCheckEnabled(
bool enabled =
true );
289 void _setColourBufferWriteEnabled(
bool red,
bool green,
bool blue,
bool alpha);
290 void _setDepthBufferWriteEnabled(
bool enabled =
true);
292 void _setDepthBias(
float constantBias,
float slopeScaleBias);
294 void _convertProjectionMatrix(
const Matrix4& matrix,
295 Matrix4& dest,
bool forGpuProgram =
false);
296 void _makeProjectionMatrix(
const Radian& fovy,
Real aspect,
Real nearPlane,
Real farPlane,
297 Matrix4& dest,
bool forGpuProgram =
false);
299 Real farPlane,
Matrix4& dest,
bool forGpuProgram =
false);
301 Matrix4& dest,
bool forGpuProgram =
false);
302 void _applyObliqueDepthProjection(
Matrix4& matrix,
const Plane& plane,
306 void _setTextureUnitCompareFunction(
size_t unit,
CompareFunction function);
307 void _setTextureUnitCompareEnabled(
size_t unit,
bool compare);
308 void _setTextureLayerAnisotropy(
size_t unit,
unsigned int maxAnisotropy);
310 void setVertexDeclaration(
VertexDeclaration* decl,
bool useGlobalInstancingVertexBufferIsAvailable);
312 void setVertexBufferBinding(
VertexBufferBinding* binding,
size_t numberOfInstances,
bool useGlobalInstancingVertexBufferIsAvailable,
bool indexesUsed);
327 void bindGpuProgramPassIterationParameters(
GpuProgramType gptype);
329 void setScissorTest(
bool enabled,
size_t left = 0,
size_t top = 0,
size_t right = 800,
size_t bottom = 600);
330 void clearFrameBuffer(
unsigned int buffers,
332 Real depth = 1.0f,
unsigned short stencil = 0);
334 void enableClipPlane (
ushort index,
bool enable);
336 Real getHorizontalTexelOffset();
337 Real getVerticalTexelOffset();
338 Real getMinimumDepthInputValue();
339 Real getMaximumDepthInputValue();
340 void registerThread();
341 void unregisterThread();
342 void preExtraThreadsStarted();
343 void postExtraThreadsStarted();
356 static IDirect3D9* getDirect3D9();
357 static UINT getResourceCreationDeviceCount();
358 static IDirect3DDevice9* getResourceCreationDevice(UINT index);
359 static IDirect3DDevice9* getActiveD3D9Device();
364 D3DFORMAT _getDepthStencilFormatFor(D3DFORMAT fmt);
372 void determineFSAASettings(IDirect3DDevice9* d3d9Device,
size_t fsaa,
const String& fsaaHint, D3DFORMAT d3dPixelFormat,
373 bool fullScreen, D3DMULTISAMPLE_TYPE *outMultisampleType, DWORD *outMultisampleQuality);
376 unsigned int getDisplayMonitorCount()
const;
382 virtual void beginProfileEvent(
const String &eventName );
385 virtual void endProfileEvent(
void );
388 virtual void markProfileEvent(
const String &eventName );
397 DWORD getSamplerId(
size_t unit);
vector< Plane >::type PlaneList
A 'canvas' which can receive the results of a rendering operation.
TexCoordCalcMethod autoTexCoordType
type of auto tex. calc. used
D3D9DeviceManager * mDeviceManager
bool mIsDirectX9Ex
Tells whether the system is initialized with DirectX 9Ex driver Read more in http://msdn.microsoft.com/en-us/library/windows/desktop/ee890072(v=vs.85).aspx.
D3D9ResourceManager * mResourceManager
Texture addressing mode for each texture coordinate.
size_t mLastVertexSourceCount
D3D9HardwareBufferManager * mHardwareBufferManager
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
virtual bool isStaticBufferLockable() const
bool mAllowDirectX9Ex
Tells whether to attempt to initialize the system with DirectX 9Ex driver Read more in http://msdn...
Leave the stencil buffer unchanged.
High level interface of Direct3D9 Device.
static D3D9RenderSystem * msD3D9RenderSystem
Fast singleton access.
eD3DTexType
enum identifying D3D9 tex. types
Class representing colour.
float Real
Software floating point type.
static const ColourValue Black
vector< RenderWindowDescription >::type RenderWindowDescriptionList
Render window creation parameters container.
PixelFormat
The pixel format used for images, textures, and render surfaces.
structure holding texture unit settings for every stage
An abstraction of a viewport, i.e.
MultiheadUseType getMultiheadUse() const
Returns how multihead should be activated.
virtual bool hasAnisotropicMipMapFilter() const
Determines if the system has anisotropic mip map filter support.
Implementation of DirectX9 as a rendering system.
HINSTANCE mhInstance
instance
D3D9Mappings::eD3DTexType texType
the type of the texture
Factory class for D3D9 HLSL programs.
Defines a plane in 3D space.
vector< D3D9RenderWindow * >::type D3D9RenderWindowList
static const ColourValue White
vector< RenderWindow * >::type RenderWindowList
Render window container.
Class encapsulating a standard 4x4 homogeneous matrix.
static bool isDirectX9Ex()
Tells whether the system is initialized with DirectX 9Ex driver Read more in http://msdn.microsoft.com/en-us/library/windows/desktop/ee890072(v=vs.85).aspx.
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
#define OGRE_MAX_TEXTURE_LAYERS
Define max number of texture layers allowed per pass on any card.
bool mUseNVPerfHUD
NVPerfHUD allowed?
CullingMode
Hardware culling modes based on vertex winding.
IDirect3DBaseTexture9 * pVertexTex
vertex texture
int TrackVertexColourType
An enumeration describing which material properties should track the vertex colours.
D3D9DriverList * mDriverList
List of D3D drivers installed (video cards)
IDirect3DBaseTexture9 * pTex
texture
Class which manages blending of both colour and alpha components.
Defines the functionality of a 3D API.
map< String, ConfigOption >::type ConfigOptionMap
Device manager interface.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
TextureType
Enum identifying the texture type.
D3D9HLSLProgramFactory * mHLSLProgramFactory
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
HashMap< unsigned int, D3DFORMAT > DepthStencilHash
Mapping of texture format -> DepthStencil.
TexCoordCalcMethod
Enum describing the ways to generate texture coordinates.
An abstract class that contains a depth/stencil buffer.
DepthStencilHash mDepthStencilHash
MultiheadUseType mMultiheadUse
GpuProgramType
Enumerates the types of programs which can run on the GPU.
singleton class for storing the capabilities of the graphics card.
D3D9Driver * mActiveD3DDriver
Currently active driver.
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
Defines a program which runs on the GPU such as a vertex or fragment program.
SceneBlendFactor
Blending factors for manually blending objects with the scene.
FilterOptions
Filtering options for textures / mipmaps.
This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info...
bool mPerStageConstantSupport
Per-stage constant support? (not in main caps since D3D specific & minor)
Manages the target rendering window.
This is a abstract class that that provides the interface for the query class for hardware occlusion...
size_t coordIndex
which texCoordIndex to use
const Frustum * frustum
Frustum, used if the above is projection.
D3D9GpuProgramManager * mGpuProgramManager
D3D9RenderWindowList mRenderWindows
StencilOperation
Enum describing the various actions which can be taken on the stencil buffer.
'New' rendering operation using vertex buffers.
IDirect3D9 * mD3D
Direct3D.
ShadeOptions
Light shading modes.
HRESULT __SetFloatRenderState(D3DRENDERSTATETYPE state, Real value)
PolygonMode
The polygon mode to use when rasterising.
SceneBlendOperation
Blending operations controls how objects are blended into the scene.
HashMap< IDirect3DDevice9 *, unsigned short > mCurrentLights
A frustum represents a pyramid, capped at the near and far end which is used to represent either a vi...
This class represents a render target that renders to multiple RenderTextures at once.
Representation of a dynamic light source in the scene.
Matrix4 mViewMatrix
Saved last view matrix.
void _cleanupDepthBuffers(bool bCleanManualBuffers=true)
Removes all depth buffers.
Wrapper class which indicates a given angle value is in Radians.
D3D9HardwareBufferManagerBase as a Singleton.