00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #pragma once
00014
00015 #include "baseinterface.h"
00016 #include "color.h"
00017
00018 class INode;
00019
00020
00021 #ifndef __D3DX9_H__
00022 # include <d3dx9.h>
00023 #endif
00024
00025
00026 #define IHARDWARE_MATERIAL_INTERFACE_ID Interface_ID(0x40c926b7, 0x7b3a66b7)
00027 #define IHARDWARE_MATERIAL2_INTERFACE_ID Interface_ID(0x43d32666, 0x3a4467b1)
00028 #define IHARDWARE_MATERIAL3_INTERFACE_ID Interface_ID(0x63d72368, 0xcc4859e3)
00029
00030
00039 enum MapUsageType
00040 {
00041 MAPUSAGE_UNDEFINED = 0,
00042 MAPUSAGE_DIFFUSE = (1 << 0),
00043 MAPUSAGE_OPACITY = (1 << 1),
00044 MAPUSAGE_SPECULAR_COLOR = (1 << 2),
00045 MAPUSAGE_SPECULAR_LEVEL = (1 << 3),
00046 MAPUSAGE_GLOSSINESS = (1 << 4),
00047 MAPUSAGE_BUMP = (1 << 5),
00048 MAPUSAGE_SELF_ILLUM = (1 << 6),
00049 MAPUSAGE_FILTER_COLOR = (1 << 7),
00050 MAPUSAGE_REFLECTION = (1 << 8),
00051 MAPUSAGE_REFRACTION = (1 << 9),
00052 MAPUSAGE_DISPLACEMENT = (1 << 10),
00053 MAPUSAGE_DIFFUSE_OPACITY = MAPUSAGE_DIFFUSE|MAPUSAGE_OPACITY,
00054 MAPUSAGE_SPECULAR_COLOR_GLOSS = MAPUSAGE_SPECULAR_COLOR|MAPUSAGE_GLOSSINESS,
00055 MAPUSAGE_SPECULAR_LEVEL_GLOSS = MAPUSAGE_SPECULAR_LEVEL|MAPUSAGE_GLOSSINESS,
00056 MAPUSAGE_BUMP_GLOSS = MAPUSAGE_BUMP|MAPUSAGE_GLOSSINESS,
00057 MAPUSAGE_SELF_ILLUM_GLOSS = MAPUSAGE_SELF_ILLUM|MAPUSAGE_GLOSSINESS,
00058 MAPUSAGE_OPACITY_SPLEVEL = MAPUSAGE_OPACITY|MAPUSAGE_SPECULAR_LEVEL,
00059 MAPUSAGE_SUPPORT_PROGRAMMABLE_PIPELINE = (1 << 31),
00060 };
00061
00062
00078 class IHardwareMaterial : public BaseInterface
00079 {
00080 public:
00083 virtual Interface_ID GetID() { return IHARDWARE_MATERIAL_INTERFACE_ID; }
00084
00085
00086 virtual LifetimeType LifetimeControl() { return noRelease; }
00087
00088
00089 virtual void SetCustomFlag(bool bVal) = 0;
00090
00091
00099 virtual void SetFillMode(DWORD mode) = 0;
00107 virtual void SetShadeMode(DWORD mode) = 0;
00108
00109
00113 virtual void SetMaterial(LPD3DXMATERIAL pMtl) = 0;
00114
00118 virtual void SetDiffuseColor(LPD3DXCOLOR pClr) = 0;
00127 virtual void SetDiffuseColor(Color c, float alpha = 1.0f) = 0;
00135 virtual void SetDiffuseColor(Point3 c, float alpha = 1.0f) = 0;
00136
00140 virtual void SetAmbientColor(LPD3DXCOLOR pClr) = 0;
00148 virtual void SetAmbientColor(Color c, float alpha = 1.0f) = 0;
00156 virtual void SetAmbientColor(Point3 c, float alpha = 1.0f) = 0;
00157
00161 virtual void SetSpecularColor(LPD3DXCOLOR pClr) = 0;
00169 virtual void SetSpecularColor(Color c, float alpha = 1.0f) = 0;
00177 virtual void SetSpecularColor(Point3 c, float alpha = 1.0f) = 0;
00178
00182 virtual void SetEmissiveColor(LPD3DXCOLOR pClr) = 0;
00191 virtual void SetEmissiveColor(Color c, float alpha = 1.0f) = 0;
00200 virtual void SetEmissiveColor(Point3 c, float alpha = 1.0f) = 0;
00201
00207 virtual void SetSpecularPower(float power) = 0;
00208
00209
00217 virtual bool SetNumTexStages(DWORD numStages) = 0;
00230 virtual bool SetTexture(DWORD stage, DWORD_PTR pTexture) = 0;
00239 virtual bool SetTexture(DWORD stage, LPCSTR filename) = 0;
00253 virtual bool SetTexture(DWORD stage, DWORD_PTR pTexture, MapUsageType usage) = 0;
00264 virtual bool SetTexture(DWORD stage, LPCSTR filename, MapUsageType usage) = 0;
00265
00282 virtual bool SetTextureUVWSource(DWORD stage, DWORD type) = 0;
00292 virtual bool SetTextureMapChannel(DWORD stage, DWORD numChan) = 0;
00301 virtual bool SetTextureCoordIndex(DWORD stage, DWORD index) = 0;
00302
00303
00312 virtual bool SetTextureTransformFlag(DWORD stage, DWORD flag) = 0;
00322 virtual bool SetTextureTransform(DWORD stage, LPD3DXMATRIX pTransform) = 0;
00323
00324
00334 virtual bool SetTextureColorOp(DWORD stage, DWORD colorOp) = 0;
00347 virtual bool SetTextureColorArg(DWORD stage, DWORD argNum, DWORD colorArg) = 0;
00356 virtual bool SetTextureAlphaOp(DWORD stage, DWORD alphaArg) = 0;
00369 virtual bool SetTextureAlphaArg(DWORD stage, DWORD argNum, DWORD alphaArg) = 0;
00370 virtual bool SetTextureAddressMode(DWORD stage, DWORD coordNum, DWORD mode) = 0;
00371
00372
00383 virtual bool SetVertexShader(DWORD_PTR pVertexShader) = 0;
00393 virtual bool SetPixelShader(DWORD_PTR pPixelShader) = 0;
00394
00395
00405 virtual bool SetEffect(DWORD_PTR pEffect) = 0;
00406
00407
00408 virtual bool SetPlugin(BaseInterface *pPlugin) = 0;
00409
00410
00411 virtual bool SetINode(INode *pINode) = 0;
00412
00418 virtual void SetTextureFactor(DWORD factor) = 0;
00419
00426 virtual void SetSpecularLevel(float level) = 0;
00427
00428
00429 };
00430
00431
00436 class IHardwareMaterial2 : public IHardwareMaterial
00437 {
00438 public:
00442 virtual void SetSelfIllumColorOn(BOOL bOn) = 0;
00443 };
00444
00449 class IHardwareMaterial3 : public IHardwareMaterial2
00450 {
00451 public:
00457 virtual bool SetSamplerBorderColor(int stage, DWORD borderColor) = 0;
00458 };
00459