00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #pragma once
00014
00015 #include "ihardwareshader.h"
00016 #include "HWMesh.h"
00017
00018
00019 struct D3DXCOLOR;
00020 class IHardwareMesh;
00021 class IHardwareMaterial;
00022 class HardwareMaterial;
00023 class Matrix3;
00024
00025 #define HARDWARE_RENDERER_INTERFACE_ID Interface_ID(0x7f78405c, 0x43894b27)
00026
00027 #define HARDWARE_RENDERER_ST_INTERFACE_ID Interface_ID(0x14716452, 0x65f35430)
00028
00029 #define D3DHWMESHCACHEMANAGER_INTERFACE_ID Interface_ID(0x7f7840ef, 0x11894b11)
00030
00052 class IHardwareRenderer : public IHardwareShader
00053 {
00054 public:
00055 virtual Interface_ID GetID() { return HARDWARE_RENDERER_INTERFACE_ID; }
00056
00057
00058 virtual LifetimeType LifetimeControl() { return noRelease; }
00059
00060
00061 virtual int GetMaxTexStages() = 0;
00062
00063
00064 virtual int GetNumActiveWindows() = 0;
00065
00066
00067 virtual bool UpdateScreen(GFX_ESCAPE_FN fn) = 0;
00068
00069
00070 virtual bool CanDepthPeel() = 0;
00071 virtual void CreateLayer(int layerNum) = 0;
00072 virtual void BlendLayers() = 0;
00073
00074
00075 virtual void StartNode() = 0;
00076 virtual void EndNode(GFX_ESCAPE_FN fn) = 0;
00077
00078
00079 virtual void SetColor(ColorType t, D3DXCOLOR *pClr) = 0;
00080 virtual void SetMaterial(HardwareMaterial *pMtl) = 0;
00081
00082 virtual D3DXCOLOR *GetDiffuseColor() = 0;
00083
00084
00085
00086 virtual bool DisplayAllTriangleEdges() = 0;
00087 virtual void SetDisplayAllTriangleEdges(bool displayAllEdges) = 0;
00088
00089
00090 virtual bool CanCacheMeshData() = 0;
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 virtual void DrawMesh(DWORD type, DWORD nPrim, DWORD *pAttr,
00111 DWORD nComp, DWORD *pUse, DWORD **ppInd, DWORD fComp, DWORD *pLen,
00112 float **ppData, DWORD attr, GFX_ESCAPE_FN fn) = 0;
00113
00114
00115
00116
00117
00118
00119 virtual DWORD_PTR BuildMesh(DWORD nFaces, DWORD *pAttr, DWORD nComp,
00120 DWORD *pUse, DWORD **ppInd, DWORD fComp, DWORD *pLen, float **ppData,
00121 GFX_ESCAPE_FN fn) = 0;
00122
00123 virtual DWORD_PTR BuildMesh(IHardwareMesh *pHWMesh,
00124 GFX_ESCAPE_FN fn) = 0;
00125
00126
00127
00128
00129
00130
00131 virtual void DrawMesh(DWORD_PTR pMesh, DWORD attr,
00132 GFX_ESCAPE_FN fn) = 0;
00133
00134
00135
00136
00137
00138
00139 virtual DWORD_PTR LoadMesh(LPCTSTR filename) = 0;
00140
00141
00142
00143
00144
00145 virtual void SaveMesh(LPCTSTR filename, DWORD_PTR pMesh) = 0;
00146
00147
00148
00149
00150
00151 virtual void FreeMesh(DWORD_PTR pMesh) = 0;
00152
00153
00154
00155
00156
00157 virtual DWORD_PTR BuildIndexedBuffer(DWORD type, DWORD nPrim,
00158 DWORD *pAttr, DWORD nComp, DWORD *pUse, DWORD **ppInd, DWORD fComp,
00159 DWORD *pLen, float **ppData, GFX_ESCAPE_FN fn) = 0;
00160
00161
00162 virtual void DrawIndexedBuffer(DWORD_PTR pBuffer, DWORD attr,
00163 GFX_ESCAPE_FN fn) = 0;
00164
00165
00166 virtual void FreeIndexedBuffer(DWORD_PTR pBuffer) = 0;
00167
00168
00169
00170
00171
00172
00173
00174
00175
00190 virtual DWORD_PTR BuildTexture(BITMAPINFO *bmi, UINT mipLevels,
00191 DWORD usage, DWORD format) = 0;
00192
00193
00194
00195
00199 virtual DWORD_PTR LoadTexture(LPCTSTR filename) = 0;
00200
00201
00202 virtual void SaveTexture(LPCTSTR filename, DWORD_PTR pTex) = 0;
00203
00204
00205 virtual void FreeTexture(DWORD_PTR pTex) = 0;
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217 virtual DWORD_PTR BuildCubeMap(UINT size, UINT mipLevels, DWORD usage,
00218 DWORD format, DWORD_PTR *pTex) = 0;
00219
00220
00221
00222
00223
00224
00225
00226
00227 virtual void SetCubeMapFace(DWORD_PTR pCubeMap, DWORD face,
00228 UINT mipLevel, DWORD_PTR pTex) = 0;
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 virtual DWORD_PTR BuildVertexDecl(DWORD nComp, DWORD *pUse,
00241 DWORD fComp) = 0;
00242
00243
00244 virtual void SetVertexDecl(DWORD_PTR pVertexDecl) = 0;
00245
00246
00247 virtual void FreeVertexDecl(DWORD_PTR pVertexDecl) = 0;
00248
00249
00250
00251
00252
00253
00254
00255 virtual DWORD_PTR BuildVertexShader(LPCSTR code) = 0;
00256
00257
00258
00259
00260
00261 virtual DWORD_PTR LoadVertexShader(LPCTSTR filename) = 0;
00262
00263
00264 virtual void SaveVertexShader(LPCTSTR filename, DWORD_PTR pVertexShader) = 0;
00265
00266
00267 virtual void SetVertexShader(DWORD_PTR pVertexShader) = 0;
00268
00269
00270
00271
00272
00273
00274
00275 virtual void SetVertexShaderConstant(DWORD_PTR pVertexShader,
00276 DWORD nReg, DWORD type, void *pData, DWORD nData) = 0;
00277
00278
00279 virtual void FreeVertexShader(DWORD_PTR pVertexShader) = 0;
00280
00281
00282
00283
00284
00285
00286
00287 virtual DWORD_PTR BuildPixelShader(LPCSTR code) = 0;
00288
00289
00290
00291
00292
00293 virtual DWORD_PTR LoadPixelShader(LPCTSTR filename) = 0;
00294
00295
00296 virtual void SavePixelShader(LPCTSTR filename, DWORD_PTR pPixelShader) = 0;
00297
00298
00299 virtual void SetPixelShader(DWORD_PTR pPixelShader) = 0;
00300
00301
00302
00303
00304
00305
00306
00307 virtual void SetPixelShaderConstant(DWORD_PTR pPixelShader,
00308 DWORD nReg, DWORD type, void *pData, DWORD nData) = 0;
00309
00310
00311 virtual void FreePixelShader(DWORD_PTR pPixelShader) = 0;
00312
00313
00314
00315
00316
00317 virtual DWORD_PTR BuildEffect(LPCSTR code) = 0;
00318
00319
00320 virtual DWORD_PTR LoadEffect(LPCTSTR filename) = 0;
00321
00322
00323 virtual void SaveEffect(LPCTSTR filename, DWORD_PTR pEffect) = 0;
00324
00325
00326
00327
00328
00329
00330 virtual void SetEffectParameter(DWORD_PTR pEffect, LPCTSTR name,
00331 DWORD type, void *pData) = 0;
00332
00333
00334
00335
00336
00337 virtual void SetEffectTechnique(DWORD_PTR pEffect, LPCTSTR name) = 0;
00338
00339
00340 virtual void BeginEffect(DWORD_PTR pEffect) = 0;
00341
00342
00343 virtual void SetEffectPass(DWORD_PTR pEffect, DWORD nPass) = 0;
00344
00345
00346 virtual void EndEffect(DWORD_PTR pEffect) = 0;
00347
00348
00349 virtual void FreeEffect(DWORD_PTR pEffect) = 0;
00350
00351
00352
00353
00354
00355 virtual DWORD_PTR BeginEffectAccess(DWORD_PTR pEffect, GFX_ESCAPE_FN fn) = 0;
00356
00357
00358 virtual void EndEffectAccess(GFX_ESCAPE_FN fn) = 0;
00359
00360
00361
00362
00363
00364 virtual DWORD_PTR BeginDeviceAccess(GFX_ESCAPE_FN fn) = 0;
00365
00366
00367 virtual void EndDeviceAccess(GFX_ESCAPE_FN fn) = 0;
00368
00370
00377 virtual bool ObjectDrawnByShader() = 0;
00378
00380
00388 virtual void DXCacheUpdateVertexBuffer(DWORD_PTR pMesh, Point3 *vertexList,Point3 *gfxNormalList, Point3 *faceNormalList, BitArray &changedVerts, int count) = 0;
00389
00390 };
00391
00392 class IHardwareRendererST : public IHardwareRenderer
00393 {
00394 public:
00395 virtual Interface_ID GetID() { return HARDWARE_RENDERER_ST_INTERFACE_ID; }
00396 };
00397
00398
00412 class ID3DHWMeshCacheManager : public BaseInterface
00413 {
00414 public:
00415
00416 virtual Interface_ID GetID() { return D3DHWMESHCACHEMANAGER_INTERFACE_ID; }
00417
00418
00419 virtual LifetimeType LifetimeControl() { return noRelease; }
00420
00421
00423
00427 virtual void D3DHWMeshCacheManagerReset(BOOL clearBlock = FALSE) = 0;
00428
00430
00440 virtual BOOL D3DHWMeshCacheManagerAddHWMesh( INode *node, GFX_MESH::IHWDrawMesh *pMesh, Material *mtl, HardwareMaterial *pHWMat, Point3 wireframeColor, Matrix3 *tmOverRide, DWORD attr, DWORD renderLimit) = 0;
00441
00443
00451 virtual void D3DHWMeshCacheManagerSetRenderLimit(DWORD limit) = 0;
00452
00454
00459 virtual DWORD D3DHWMeshCacheManagerGetRenderLimit() = 0;
00460
00462
00467 virtual void D3DHWMeshCacheManagerRegisterMaterial(HardwareMaterial *mtl, Point3 wireframeColor) = 0;
00468
00470
00473
00474 virtual void D3DHWMeshCacheManagerDeleteHWMesh(GFX_MESH::IHWDrawMesh * pMesh) = 0;
00475
00477
00480 virtual void D3DHWMeshCacheManagerDisplay(GraphicsWindow *gw) = 0;
00481
00482 virtual int D3DHWMeshCacheManagerTotalBlocksDrawn() = 0;
00483 };
00484
00485
00486