IDX10HardwareRenderer.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // DESCRIPTION: General function to wrap the Dx SDK.  They support delayed loading
00012 //              so as to remove the dependency on DX DLLs esp Dx10
00013 // AUTHOR: Neil Hazzard - created Oct.31.06
00014 //***************************************************************************/
00015 
00016 #pragma once
00017 
00018 #include "baseinterface.h"
00019 #include <d3dx10.h>
00020 #include <dxgi.h>
00021 #include "MaxHeap.h"
00022 
00023 #define D3D10_HARDWARE_RENDERER_INTERFACE_ID Interface_ID(0x7f23405c, 0x43314b27)
00024 #define D3D10_GRAPHICS_WINDOW_INTERFACE_ID Interface_ID(0x7f12345e, 0x23564c43)
00025 #define D3D10_SHADER_RESOURCE_INTERFACE_ID Interface_ID(0x4f3254ab, 0x2653de42)
00026 
00027 //forward declaration
00028 class INode;
00029 class Mesh;
00030 class MNMesh;
00031 class Material;
00032 class IHardwareMesh;
00033 
00035 
00039 struct D3D10SceneLight : public MaxHeapOperators
00040 {
00042     D3DXVECTOR4 m_Position;
00044     D3DXVECTOR4 m_Direction;
00046     D3DXVECTOR4 m_Diffuse;
00048     D3DXVECTOR4 m_Specular;
00050     D3DXVECTOR4 m_Ambient;
00052     D3DXVECTOR4 m_Attenuation;
00054 
00061     D3DXVECTOR4 m_LightData;    
00062 };
00063 
00064 typedef D3D10SceneLight* lpD3D10SceneLight;
00065 
00067 
00070 class ID3D10HardwareRenderer : public BaseInterface
00071 {
00072 public:
00073     virtual Interface_ID GetID() { return D3D10_HARDWARE_RENDERER_INTERFACE_ID; }
00074 
00075     virtual bool BuildCachedMesh(IHardwareMesh *pHWMesh)=0;
00076     virtual bool DrawCachedMesh(DWORD_PTR pdwHWMesh, DWORD dwAttrib)=0;
00077     virtual void ReleaseCachedMesh(DWORD_PTR pdwHWMesh) = 0;
00078 
00079     virtual bool CanCacheMesh()=0;
00080     virtual bool ObjectDrawnByShader()=0;
00081     virtual void StartObject() =0;
00082     virtual void EndObject()=0;
00083     virtual int  GetNumActiveWindows()= 0;
00084 
00085     virtual void SetMaterial(const Material & mtl)=0; // Yi GONG, May18th 2007 to fix defect 918155
00086     virtual void SetShaderResource(Material * gfxMat, Mesh * mesh, int mtlNum) =0;
00087     virtual void SetShaderResource(Material * gfxMat, MNMesh * mesh, int mtlNum)=0;
00088 
00089 };
00090 
00092 
00094 class ID3D10GraphicsWindow : public BaseInterface
00095 {
00096 public:
00097 
00098     virtual Interface_ID GetID() { return D3D10_GRAPHICS_WINDOW_INTERFACE_ID; }
00099 
00103     virtual ID3D10Device * GetDevice() = 0;
00104 
00108     virtual D3DXMATRIX  GetWorldXform() const = 0;
00109 
00113     virtual D3DXMATRIX  GetViewXform() const = 0;
00114 
00118     virtual D3DXMATRIX  GetProjXform()const = 0;
00119 
00124     virtual void GetWindowDimension(int * width, int * height)= 0;
00125 
00130     virtual D3D10SceneLight * GetLight(int index)=0;
00131 
00132 };
00133 
00135 
00138 class ID3D10ShaderResource : public BaseInterface
00139 {
00140 public:
00141     virtual Interface_ID GetID() { return D3D10_SHADER_RESOURCE_INTERFACE_ID; }
00142 
00144 
00147     virtual void InitializeDrawSequence(ID3D10GraphicsWindow* pD3D10gw)=0;
00148 
00150 
00155     virtual bool IsShaderResourceActive() =0;
00156 
00158 
00163     virtual void DrawShaderResource(INode * node, Mesh * mesh, int mtlNum) =0;
00164 
00166 
00171     virtual void DrawShaderResource(INode * node, MNMesh * mesh, int mtlNum) =0;
00172 
00173 };
00174