2 #include "effect_file.h" 15 virtual HRESULT InitDeviceObjects();
16 virtual HRESULT RestoreDeviceObjects();
17 virtual HRESULT InvalidateDeviceObjects();
18 virtual HRESULT DeleteDeviceObjects();
21 bool saveResource(
const char* filename=0);
34 bool begin(
bool bApplyParam =
true, DWORD flag=D3DXFX_DONOTSAVESTATE|D3DXFX_DONOTSAVESAMPLERSTATE|D3DXFX_DONOTSAVESHADERSTATE,
bool bForceBegin =
false);
35 bool BeginPass(
int pass,
bool bForceBegin =
false);
37 void EndPass(
bool bForceEnd =
false);
38 void end(
bool bForceEnd =
false);
39 void EnableShareMode(
bool bEnable);
44 bool BeginSharePassMode(
bool bApplyParam =
true, DWORD flag=D3DXFX_DONOTSAVESTATE|D3DXFX_DONOTSAVESAMPLERSTATE|D3DXFX_DONOTSAVESHADERSTATE,
bool bForceBegin =
true);
59 D3DXHANDLE hTechnique;
60 D3DXTECHNIQUE_DESC techniqueDesc;
89 LPD3DXEFFECT effect()
const;
90 int totalPasses()
const;
94 bool isTextureUsed(
int index)
const;
95 bool isTextureMatrixUsed(
int index)
const;
96 bool isShadowTextureUsed()
const;
98 bool setParameter(
eParameterHandles index,
const void* data, INT32 size=D3DX_DEFAULT)
const;
105 bool setFloatArray(
eParameterHandles index,
const float* data, UINT32 count)
const;
109 bool setTexture(
int index, LPDIRECT3DTEXTURE9 pTex);
110 bool setTextureInternal(
int index, LPDIRECT3DTEXTURE9 pTex);
111 bool setTextureMatrix(
int index,
const Matrix4* data)
const;
113 void SetShadowMapSize(
int nsize);
121 void applyCameraMatrices();
122 void applyWorldMatrices();
123 void applyGlobalLightingData(
CSunLight& sunlight);
124 void applyLocalLightingData(
const LightList* lights,
int nLightNum);
125 void applyFogParameters(
bool bEnableFog,
const Vector4* fogParam,
const LinearColor* fogColor);
126 void applyLayersNum(
int nLayers);
127 void applyTexWorldViewProj(
const Matrix4* mat);
138 static bool AreTextureEnabled();
206 HRESULT SetRawValue(D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes);
207 bool SetBool(D3DXHANDLE hParameter, BOOL bBoolean);
208 bool SetInt(D3DXHANDLE hParameter,
int nValue);
209 bool SetFloat(D3DXHANDLE hParameter,
float fValue);
210 bool SetVector2(D3DXHANDLE hParameter,
const Vector2& vValue);
211 bool SetVector3(D3DXHANDLE hParameter,
const Vector3& vValue);
212 bool SetVector4(D3DXHANDLE hParameter,
const Vector4& vValue);
213 bool SetMatrix(D3DXHANDLE hParameter,
const Matrix4& data);
218 static bool s_bUseHalfPrecision;
221 LPD3DXEFFECT m_pEffect;
222 D3DXEFFECT_DESC m_EffectDesc;
223 vector<TechniqueDescDX> m_techniques;
225 vector<bool> m_LockedTextures;
228 vector<void*> m_LastTextures;
231 int m_nTechniqueIndex;
235 static bool g_bTextureEnabled;
242 D3DXHANDLE m_paramHandle[k_max_param_handles];
245 void parseParameters();
246 void releaseEffect();
248 int BeginWith(LPCSTR str, LPCSTR searchStr);
250 bool GetNumber(LPCSTR str,
int nBeginIndex,
int* pOut);
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
eParameterHandles
Definition: effect_file.h:41
void UnLockTexture(int nIndex)
UnLock a texture at a given index.
LPD3DXEFFECT GetDXEffect()
get directX effect object associated with this object.
Definition: effect_file_DirectX.h:182
4-dimensional homogeneous vector.
Definition: ParaVector4.h:10
void EnableSunLight(bool bEnableSunLight)
whether to enable sun light calculation
void EnableAlphaTesting(bool bAlphaTesting)
whether to enable alpha testing
void EnableNormalMap(bool bEnable)
whether to enable the use of normal map
void EnableShadowmap(int nShadowMethod)
whether to enable rendering with shadow map
bool SetFirstValidTechniqueByCategory(TechniqueCategory nCat)
Set technique if it is different from the current one.
void OnSwitchInShader()
this is called when the shader is selected by the pipeline.
different physics engine has different winding order.
Definition: EventBinding.h:32
void SetFileName(const std::string &filename)
set inner file name, usually at the load time.
TechniqueCategory
The game engine will identified some predefined technique name from the the effect file...
Definition: effect_file.h:27
Modeling the global sun and its directional light, including sun position, direction, color, time of day, etc.
Definition: SunLight.h:26
static void EnableTextures(bool bEnable)
one occasion to disable textures is during the shadow pass.
void SetShadowRadius(float fRadius)
set the shadow radius
const TechniqueDesc * GetCurrentTechniqueDesc()
get the current technique description.
int GetCurrentTechniqueIndex()
current technique index.
void EndSharePassMode()
This is a handy function that calls EnableShareMode(false), EndPass(true), end(true).
void LockTexture(int nIndex)
Lock a texture at a given index.
void SetReflectFactor(float fFactor)
set shader parameter "reflectFactor"
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
a technique description
Definition: effect_file_DirectX.h:57
bool SetBoolean(int nIndex, bool value)
set a boolean parameter.
Definition: effect_file_DirectX.h:6
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
bool EnableReflectionMapping(bool bEnable, float fSurfaceHeight=0.f)
enable reflection mapping
bool BeginSharePassMode(bool bApplyParam=true, DWORD flag=D3DXFX_DONOTSAVESTATE|D3DXFX_DONOTSAVESAMPLERSTATE|D3DXFX_DONOTSAVESHADERSTATE, bool bForceBegin=true)
This is a handy function that calls EnableShareMode(true), begin() and then BeginPass().
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
virtual CParameterBlock * GetParamBlock(bool bCreateIfNotExist=false)
get effect parameter block with this object.
Definition: RenderCore.h:50
bool SetTechniqueByIndex(int nIndex)
Set technique if it is different from the current one.
Definition: enum_maker.hpp:46
Definition: effect_file.h:323
bool begin(bool bApplyParam=true, DWORD flag=D3DXFX_DONOTSAVESTATE|D3DXFX_DONOTSAVESAMPLERSTATE|D3DXFX_DONOTSAVESHADERSTATE, bool bForceBegin=false)
std::string AssetKey
the unique key object for asset entity.
Definition: AssetEntity.h:13
D3DXHANDLE & GetTextureHandle(int nIndex)
get texture handle at the given index.
bool EnableEnvironmentMapping(bool bEnable)
enable environment mapping
void OnSwitchOutShader()
this is called when the shader is deselected by the pipeline.
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
bool IsTextureLocked(int nIndex) const
check whether a given texture is locked at the given index.
void applySurfaceMaterial(const ParaMaterial *pSurfaceMaterial, bool bUseGlobalAmbient=true)
void EnableLightMap(bool bEnable)
whether to enable the use of light map
void EnableAlphaBlending(bool bAlphaBlending)
whether to enable alpha blending in shader.
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108
asset entity: CEffectFile
Definition: effect_file.h:19