3 #include "AssetManager.h" 4 #include "effect_file.h" 5 #include "LightManager.h" 66 virtual void InitDeviceObjects();
67 virtual void DeleteDeviceObjects();
68 virtual void RestoreDeviceObjects();
69 virtual void InvalidateDeviceObjects();
99 S0_POS_NORM_TEX0_INSTANCED,
101 S0_POS_NORM_TEX0_COLOR,
103 S0_S1_S2_S3_OCEAN_FFT,
104 S0_POS_NORM_TEX0_TEX1,
110 S0_POS_NORM_TEX0_COLOR0_COLOR1,
112 MAX_DECLARATIONS_NUM,
134 int GetDefaultEffectMapping();
155 int GetCurrentTechHandle();
166 HRESULT SetLight(DWORD Index,
const Para3DLight *pLight);
167 HRESULT LightEnable(DWORD Index, BOOL Enable);
168 HRESULT SetRenderState(D3DRENDERSTATETYPE State, DWORD
Value);
169 HRESULT SetTexture(DWORD Stage, DeviceTexturePtr_type pTexture);
171 HRESULT
SetSamplerState(
int nStage, DWORD dwType, DWORD dwValue,
bool bForceSet =
false);
173 HRESULT
GetSamplerState(
int nStage, DWORD dwType, DWORD* pValue,
bool bForceGet =
false);
179 HRESULT SetTransform(D3DTRANSFORMSTATETYPE State,
const Matrix4 *pMatrix);
180 HRESULT GetTransform(D3DTRANSFORMSTATETYPE State,
Matrix4 * pMatrix);
185 const Matrix4& GetViewTransform();
186 const Matrix4& GetProjTransform();
200 ClipPlane_Enabled_WorldSpace,
201 ClipPlane_Enabled_ClipSpace,
224 void SetClipPlane(DWORD Index,
const float * pPlane,
bool bClipSpace);
268 bool AreTextureEnabled();
297 void EnableZTest(
bool bEnable,
bool bForceSet =
false);
349 bool IsUsingScreenWaveEffect();
350 void EnableScreenWaveEffect(
bool enable);
351 void SetScreenWaveTechnique(
int nTech);
352 int GetScreenWaveTechnique();
382 bool BeginEffectFF(
int nHandle);
383 bool BeginEffectShader(
int nHandle,
CEffectFile** pOutEffect = NULL);
386 map<int, CEffectFile*> m_HandleMap;
388 int m_nCurrentEffect;
400 bool m_bEnableLocalLighting;
404 bool m_bDisableD3DAlphaTesting;
406 bool m_bDisableZWrite;
410 bool m_bUsingShadowMap;
412 bool m_bIsUsingFullScreenGlow;
416 int m_nGlowTechnique;
418 int m_screenWaveTechnique;
421 int m_nMaxLocalLightsNum;
424 bool m_bDisableD3DCulling;
427 bool m_bEnableReflectionRendering;
430 bool m_bClipPlaneEnabled;
431 static const int MaxClipPlanesNum = 3;
432 Plane m_ClipPlaneWorldSpace[MaxClipPlanesNum];
433 Plane m_ClipPlaneClipSpace[MaxClipPlanesNum];
436 bool m_enableScreenWaveEffect;
440 DWORD m_lastSamplerStates[8][16];
441 DWORD m_defaultSamplerStates[8][16];
445 int m_pVertexDeclarations_status[MAX_DECLARATIONS_NUM];
449 #ifdef USE_DIRECTX_RENDERER CEffectFile * GetEffectByName(const string &sName)
the returned effect may not be valid.
Definition: EffectManager.cpp:2970
void EnableZTest(bool bEnable, bool bForceSet=false)
enable ztest
Definition: EffectManager.cpp:689
EffectTechniques
Definition: EffectManager.h:136
fixed function pipeline
Definition: EffectManager.h:145
bool BeginEffect(int nHandle, CEffectFile **pOutEffect=NULL)
Start effect by handle.
Definition: EffectManager.cpp:1434
VERTEX_DECLARATION
predefined vertex declaration.
Definition: EffectManager.h:95
const Matrix4 & GetWorldTransform()
Get the current world transformation matrix which is used by the effect.
Definition: EffectManager.cpp:985
bool IsClipPlaneEnabled()
whether the clip plane is enabled
Definition: EffectManager.cpp:703
void EnableZWrite(bool bZWriteEnabled)
this function only takes effects when IsZWriteDisabled() is false.
Definition: EffectManager.cpp:681
4-dimensional homogeneous vector.
Definition: ParaVector4.h:10
Definition: combase.h:159
int GetGlowTechnique()
Get the glow technique.
Definition: EffectManager.cpp:362
void EnableD3DAlphaBlending(bool bEnable)
enable the D3D device's blending state
Definition: EffectManager.cpp:977
bool IsZWriteDisabled()
return true, if the alpha testing have been disabled.
Definition: EffectManager.cpp:676
Basic scene interface: implemented by the CSceneObject and CMiniScenegraph class. ...
Definition: IScene.h:12
int GetEffectHandle(CEffectFile *effectFile)
Get the integer handle to this asset.
Definition: EffectManager.cpp:906
different physics engine has different winding order.
Definition: EventBinding.h:32
void SetCullingMode(DWORD dwCullMode)
set the culling mode of the current effect file or the fixed function pipeline.
Definition: EffectManager.cpp:655
void SetAllEffectsTechnique(EffectTechniques nTech)
set all effect files to a specified technique.If the effect does not have the specified technique not...
Definition: EffectManager.cpp:2641
HRESULT SetVertexDeclaration(int nIndex)
Set declaration by id.
Definition: EffectManager.cpp:722
EffectTechniques GetCurrentEffectTechniqueType()
current technique in the effect file
Definition: EffectManager.cpp:447
void DisableD3DAlphaTesting(bool bDisable)
Definition: EffectManager.cpp:636
bool SetD3DFogState()
set d3d fog for the fixed function pipeline.
Definition: EffectManager.cpp:608
void EnableGlobalLighting(bool bEnable)
enable global sun lighting.
Definition: EffectManager.cpp:967
CShadowMap * GetShadowMap()
get the shadow map object.
Definition: EffectManager.cpp:310
bool IsD3DAlphaTestingDisabled()
return true, if the alpha testing have been disabled.
Definition: EffectManager.cpp:640
void applySurfaceMaterial(const ParaMaterial *pSurfaceMaterial, bool bUseGlobalAmbient=true)
both Fixed function (FF) pipeline and the programmable pipeline can call this function.
Definition: EffectManager.cpp:1063
Definition: minilua.c:225
void SetMaxLocalLightsNum(int nNum)
set maximum number of local lights per object.
Definition: EffectManager.cpp:298
void SetDefaultEffectMapping(int nLevel)
load the default handle to effect file mapping.
Definition: EffectManager.cpp:2667
CEffectFile * MapHandleToEffect(int nHandle, CEffectFile *pNewEffect)
Map a nHandle to effect object.
Definition: EffectManager.cpp:919
void applyFogParameters()
automatically apply fog.
Definition: EffectManager.cpp:1052
void DisableZWrite(bool bDisable)
disable z write.
Definition: EffectManager.cpp:671
AssetManager manages a set of asset entities of a certain type.
Definition: AssetManager.h:13
CEffectFile * CheckLoadEffect(int nHandle)
get a valid effect.
Definition: EffectManager.cpp:1420
rendering the model with shadow map
Definition: EffectManager.h:143
CEffectFile * GetEffectByHandle(int nHandle)
Return the effect object by its handle.
Definition: EffectManager.cpp:942
void EnableClipPlane(bool bEnable)
enable or disable user clip planes.
Definition: EffectManager.cpp:541
HRESULT SetSamplerState(int nStage, DWORD dwType, DWORD dwValue, bool bForceSet=false)
internally it will cache texture stage to prevent direct d3d calls
Definition: EffectManager.cpp:203
void DisableD3DCulling(bool bDisable)
Definition: EffectManager.cpp:645
void Cleanup()
delete all asset item from memory.
Definition: EffectManager.cpp:284
void SetClipPlane(DWORD Index, const float *pPlane, bool bClipSpace)
Sets the coefficients of a user-defined clipping plane for the device.
Definition: EffectManager.cpp:713
bool IsUsingFullScreenGlow()
whether full screen glow effect is used.
Definition: EffectManager.cpp:327
void applyLocalLightingData()
both Fixed function (FF) pipeline and the programmable pipeline can call this function.
Definition: EffectManager.cpp:1130
bool IsGlobalLightingEnabled()
whether global lighting is enabled.
Definition: EffectManager.cpp:973
const Vector4 & GetGlowness()
glowness controls the intensity of the glow in the full screen glow effect.
Definition: EffectManager.cpp:371
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
Definition: RenderCore.h:50
virtual void RendererRecreated()
callback of listening the event that renderer was recreated on Android/WP8 all opengl related id has ...
Definition: EffectManager.cpp:515
Defines a plane in 3D space.
Definition: ParaPlane.h:23
void EndEffect()
end the effect,this function actually does nothing.
Definition: EffectManager.cpp:2367
vertex element
Definition: VertexDeclarationOpenGL.h:21
shadow map generation technique
Definition: EffectManager.h:141
Definition: effect_file.h:323
bool IsD3DCullingDisabled()
return true, if the alpha testing have been disabled.
Definition: EffectManager.cpp:650
IScene * GetScene()
which scene object the effect manager is current serving
Definition: EffectManager.h:367
void EnableFog(bool bEnabled)
enable or disable fog.
Definition: EffectManager.cpp:981
bool IsUsingShadowMap()
whether shadow map is enabled
Definition: EffectManager.cpp:564
bool IsCurrentEffectValid()
if the last call to BeginEffect() returns false, this function will be set to false.
Definition: EffectManager.h:373
implementation of the full screen glow effect.
Definition: GlowEffect.h:10
some functions about shadow map
Definition: ShadowMap.h:8
void EnableReflectionRendering(bool bEnabled)
disable reflection texture, this is used when rendering in to reflection texture
Definition: EffectManager.h:321
bool IsReflectionRenderingEnabled()
disable reflection texture, this is used when rendering in to reflection texture
Definition: EffectManager.h:319
manager all effects file used by the game engine.
Definition: EffectManager.h:16
ClipPlaneState
clip plane state
Definition: EffectManager.h:198
DWORD GetDefaultSamplerState(int nStage, DWORD dwType)
default sampler state.
Definition: EffectManager.cpp:245
virtual bool DeleteEntity(AssetEntity *entity)
decrease the reference count on the entity, and if it is negative, the asset will be unloaded...
Definition: EffectManager.cpp:520
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
void SetDefaultSamplerState(int nStage, DWORD dwType, DWORD dwValue)
default sampler state.
Definition: EffectManager.cpp:241
Definition: RenderCore.h:34
const Matrix4 * GetTexViewProjMatrix()
get the shadow map's tex view projection matrix
Definition: EffectManager.cpp:569
void applyObjectLocalLighting(CBaseObject *pObj)
automatically apply local lighting to a scene object according to the bounding volume of the object...
Definition: EffectManager.cpp:1137
CGlowEffect * GetGlowEffect()
get the glow effect object.
Definition: EffectManager.cpp:376
int GetMaxLocalLightsNum()
get maximum number of local lights per object.
Definition: EffectManager.cpp:305
void SetGlowness(const Vector4 &Glowness)
glowness controls the intensity of the glow in the full screen glow effect.
Definition: EffectManager.cpp:367
void EnableFullScreenGlow(bool bEnable)
whether full screen glow effect is used.
Definition: EffectManager.cpp:332
void EnableClipPlaneImmediate(EffectManager::ClipPlaneState newState, int nIndex=0)
immediately change the device's clip plane settings if and only if it is different from the current s...
Definition: EffectManager.cpp:580
void EnableUsingShadowMap(bool bEnable)
enable shadow map
Definition: EffectManager.cpp:559
VertexDeclarationPtr GetVertexDeclaration(int nIndex)
Get declaration by id.
Definition: EffectManager.cpp:732
normal rendering
Definition: EffectManager.h:139
void SetScene(IScene *pScene)
which scene object the effect manager is current serving
Definition: EffectManager.h:370
void EnableLocalLighting(bool bEnable)
enable lighting.
Definition: EffectManager.cpp:958
Definition: WaveEffect.h:9
void UpdateD3DPipelineTransform(bool pWorld, bool pView, bool pProjection)
update the transformation for both the fixed and programmable pipeline.
Definition: EffectManager.cpp:998
void SetGlowTechnique(int nTech)
set the glow technique
Definition: EffectManager.cpp:344
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
bool IsLocalLightingEnabled()
whether lighting is enabled.
Definition: EffectManager.cpp:962
HRESULT GetSamplerState(int nStage, DWORD dwType, DWORD *pValue, bool bForceGet=false)
internally it will cache texture stage to prevent direct d3d calls
Definition: EffectManager.cpp:224
bool IsZTestEnabled()
return true, if the alpha testing have been disabled.
Definition: EffectManager.cpp:698
void EnableTextures(bool bEnable)
one occasion to disable textures is during the shadow pass.
Definition: EffectManager.cpp:628