Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 330 vs 331 for /trunk/Source Code/Geometry/Material/Material.cpp

Diff revisions: vs.
  @@ -29,14 +29,17 @@
29 29
30 30 /// Normal state for final rendering
31 31 RenderStateBlockDescriptor stateDescriptor;
32 - hashAlg::insert(_defaultRenderStates, hashAlg::makePair(FINAL_STAGE, GFX_DEVICE.getOrCreateStateBlock(stateDescriptor)));
32 + hashAlg::insert(_defaultRenderStates,
33 + hashAlg::makePair(FINAL_STAGE, GFX_DEVICE.getOrCreateStateBlock(stateDescriptor)));
33 34 /// the reflection descriptor is the same as the normal descriptor
34 35 RenderStateBlockDescriptor reflectorDescriptor(stateDescriptor);
35 - hashAlg::insert(_defaultRenderStates, hashAlg::makePair(REFLECTION_STAGE, GFX_DEVICE.getOrCreateStateBlock(reflectorDescriptor)));
36 + hashAlg::insert(_defaultRenderStates,
37 + hashAlg::makePair(REFLECTION_STAGE, GFX_DEVICE.getOrCreateStateBlock(reflectorDescriptor)));
36 38 /// the z-pre-pass descriptor does not process colors
37 39 RenderStateBlockDescriptor zPrePassDescriptor(stateDescriptor);
38 40 zPrePassDescriptor.setColorWrites(false, false, false, false);
39 - hashAlg::insert(_defaultRenderStates, hashAlg::makePair(Z_PRE_PASS_STAGE, GFX_DEVICE.getOrCreateStateBlock(zPrePassDescriptor)));
41 + hashAlg::insert(_defaultRenderStates,
42 + hashAlg::makePair(Z_PRE_PASS_STAGE, GFX_DEVICE.getOrCreateStateBlock(zPrePassDescriptor)));
40 43 /// A descriptor used for rendering to depth map
41 44 RenderStateBlockDescriptor shadowDescriptor(stateDescriptor);
42 45 shadowDescriptor.setCullMode(CULL_MODE_CCW);
  @@ -44,7 +47,8 @@
44 47 //shadowDescriptor.setZBias(1.0f, 2.0f);
45 48 /// ignore colors - Some shadowing techniques require drawing to the a color buffer
46 49 shadowDescriptor.setColorWrites(true, true, false, false);
47 - hashAlg::insert(_defaultRenderStates, hashAlg::makePair(SHADOW_STAGE, GFX_DEVICE.getOrCreateStateBlock(shadowDescriptor)));
50 + hashAlg::insert(_defaultRenderStates,
51 + hashAlg::makePair(SHADOW_STAGE, GFX_DEVICE.getOrCreateStateBlock(shadowDescriptor)));
48 52
49 53 assert(_defaultRenderStates[FINAL_STAGE] != 0);
50 54 assert(_defaultRenderStates[Z_PRE_PASS_STAGE] != 0);
  @@ -170,12 +174,18 @@
170 174 }
171 175
172 176 //Here we set the shader's name
173 - void Material::setShaderProgram(const stringImpl& shader, const RenderStage& renderStage, const bool computeOnAdd, const DELEGATE_CBK<>& shaderCompileCallback) {
177 + void Material::setShaderProgram(const stringImpl& shader,
178 + const RenderStage& renderStage,
179 + const bool computeOnAdd,
180 + const DELEGATE_CBK<>& shaderCompileCallback) {
174 181 _shaderInfo[renderStage]._isCustomShader = true;
175 182 setShaderProgramInternal(shader, renderStage, computeOnAdd, shaderCompileCallback);
176 183 }
177 184
178 - void Material::setShaderProgramInternal(const stringImpl& shader, const RenderStage& renderStage, const bool computeOnAdd, const DELEGATE_CBK<>& shaderCompileCallback) {
185 + void Material::setShaderProgramInternal(const stringImpl& shader,
186 + const RenderStage& renderStage,
187 + const bool computeOnAdd,
188 + const DELEGATE_CBK<>& shaderCompileCallback) {
179 189 ShaderProgram* shaderReference = _shaderInfo[renderStage]._shaderRef;
180 190 //if we already had a shader assigned ...
181 191 if (!_shaderInfo[renderStage]._shader.empty()){
  @@ -235,7 +245,9 @@
235 245
236 246 ///If the current material doesn't have a shader associated with it, then add the default ones.
237 247 ///Manually setting a shader, overrides this function by setting _computedShaders to "true"
238 - bool Material::computeShader(const RenderStage& renderStage, const bool computeOnAdd, const DELEGATE_CBK<>& shaderCompileCallback){
248 + bool Material::computeShader(const RenderStage& renderStage,
249 + const bool computeOnAdd,
250 + const DELEGATE_CBK<>& shaderCompileCallback) {
239 251 if ( _shaderInfo[renderStage]._shaderCompStage == ShaderInfo::SHADER_STAGE_COMPUTED ) {
240 252 return true;
241 253 }
  @@ -492,8 +504,10 @@
492 504 void Material::getSortKeys(I32& shaderKey, I32& textureKey) const {
493 505 shaderInfoMap::const_iterator it = _shaderInfo.find(FINAL_STAGE);
494 506
495 - shaderKey = (it != _shaderInfo.end() && it->second._shaderRef) ? it->second._shaderRef->getId() : -std::numeric_limits<I8>::max();
496 - textureKey = _textures[ShaderProgram::TEXTURE_UNIT0] ? _textures[ShaderProgram::TEXTURE_UNIT0]->getHandle() : -std::numeric_limits<I8>::max();
507 + shaderKey = (it != _shaderInfo.end() && it->second._shaderRef) ? it->second._shaderRef->getId() :
508 + -std::numeric_limits<I8>::max();
509 + textureKey = _textures[ShaderProgram::TEXTURE_UNIT0] ? _textures[ShaderProgram::TEXTURE_UNIT0]->getHandle() :
510 + -std::numeric_limits<I8>::max();
497 511 }
498 512
499 513 };