2 #include "effect_file.h" 3 #include "ParameterBlock.h" 5 #include <unordered_map> 29 virtual HRESULT RendererRecreated();
33 static void EnableTextures(
bool bEnable);
34 static bool AreTextureEnabled();
36 int totalPasses()
const;
39 void EnableSunLight(
bool bEnableSunLight);
43 void applySurfaceMaterial(
const ParaMaterial* pSurfaceMaterial,
bool bUseGlobalAmbient =
true);
44 void applyCameraMatrices();
45 void applyWorldMatrices();
46 void applyFogParameters(
bool bEnableFog,
const Vector4* fogParam,
const LinearColor* fogColor);
47 void applyGlobalLightingData(
CSunLight& sunlight);
49 bool setParameter(
eParameterHandles index,
const void* data, int32 size = D3DX_DEFAULT);
58 HRESULT SetRawValue(
const char* hParameter,
const void* pData, uint32 ByteOffset, uint32 Bytes);
59 bool SetBool(
const char* hParameter, BOOL bBoolean);
60 bool SetInt(
const char* hParameter,
int nValue);
61 bool SetFloat(
const char* hParameter,
float fValue);
62 bool SetVector2(
const char* hParameter,
const Vector2& vValue);
63 bool SetVector3(
const char* hParameter,
const Vector3& vValue);
64 bool SetVector4(
const char* hParameter,
const Vector4& vValue);
65 bool SetMatrix(
const char* hParameter,
const Matrix4& data);
72 bool setTexture(
int index, DeviceTexturePtr_type pTex);
74 bool SetBoolean(
int nIndex,
bool value);
76 bool begin(
bool bApplyParam =
true, DWORD flag = 0);
77 bool BeginPass(
int pass,
bool bForceBegin =
false);
79 void EndPass(
bool bForceEnd =
false);
80 void end(
bool bForceEnd =
false);
82 virtual HRESULT InitDeviceObjects();
84 bool LoadBuildinShader();
86 virtual HRESULT DeleteDeviceObjects();
90 void releaseEffect(
int nTech = -1,
int nPass = -1);
93 void SetFileName(
const std::string& filename);
94 const std::string& GetFileName();
101 bool EnableEnvironmentMapping(
bool bEnable);
108 bool EnableReflectionMapping(
bool bEnable,
float fSurfaceHeight = 0.f);
114 void SetReflectFactor(
float fFactor);
119 void EnableNormalMap(
bool bEnable);
125 void EnableLightMap(
bool bEnable);
128 void EnableAlphaBlending(
bool bAlphaBlending);
130 void EnableAlphaTesting(
bool bAlphaTesting);
145 bool SetTechniqueByIndex(
int nIndex);
150 bool setParameter(GLWrapper::Uniform* uniform,
const void* data, int32 size = D3DX_DEFAULT);
152 GLWrapper::GLProgram* GetGLProgram(
int nTech,
int nPass,
bool bCreateIfNotExist =
false);
156 bool initWithByteArrays(
const char* vShaderByteArray,
const char* fShaderByteArray,
int nTech = 0,
int nPass = 0);
160 bool initWithFilenames(
const std::string& vShaderFilename,
const std::string& fShaderFilename,
int nTech = 0,
int nPass = 0);
163 bool link(
int nTech = 0,
int nPass = 0);
165 bool use(
int nTech = -1,
int nPass = -1);
175 void updateUniforms(
int nTech = -1,
int nPass = -1);
178 GLWrapper::Uniform* GetUniform(
const std::string& sName);
181 template <
typename ValueType>
184 for (uint32 i = 0; i < m_pendingChangesCount; ++i)
186 if (m_pendingChanges[i].GetName() == sName)
188 m_pendingChanges[i] = value;
192 ++ m_pendingChangesCount;
193 if (m_pendingChanges.size() < m_pendingChangesCount)
194 m_pendingChanges.resize(m_pendingChangesCount + 4);
195 m_pendingChanges[m_pendingChangesCount - 1].SetName(sName);
196 m_pendingChanges[m_pendingChangesCount - 1] = value;
199 void SetShadowMapSize(
int nsize);
202 bool MappingEffectUniforms();
203 bool GeneratePasses();
206 std::unordered_map<uint32, std::string> m_ID2Names;
207 GLEffectsTree* m_Effect;
211 std::vector<GLWrapper::GLProgram*> mPasses;
213 std::vector<TechniqueDescGL> mTechniques;
218 std::string m_filename;
220 std::vector<CParameter> m_pendingChanges;
221 uint32 m_pendingChangesCount;
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
Definition: effect_file_OpenGL.h:209
a technique description
Definition: effect_file.h:179
4-dimensional homogeneous vector.
Definition: ParaVector4.h:10
different physics engine has different winding order.
Definition: EventBinding.h:32
void AddParamChange(const std::string &sName, const ValueType &value)
add changes to shader parameters, those changes are commited to device when CommitChange() is called...
Definition: effect_file_OpenGL.h:182
TechniqueCategory
The game engine will identified some predefined technique name from the the effect file...
Definition: effect_file.h:27
Definition: effect_file_OpenGL.h:7
Modeling the global sun and its directional light, including sun position, direction, color, time of day, etc.
Definition: SunLight.h:26
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
int m_nActivePassIndex
current active pass
Definition: effect_file_OpenGL.h:216
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
Definition: RenderCore.h:50
Definition: enum_maker.hpp:46
Definition: effect_file.h:323
std::string AssetKey
the unique key object for asset entity.
Definition: AssetEntity.h:13
Definition: effect_file_OpenGL.h:16
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
asset entity: CEffectFile
Definition: effect_file.h:19