Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 747 vs 749 for /trunk/Source Code/Geometry/Material/Material.cpp

Diff revisions: vs.
  @@ -45,6 +45,8 @@
45 45 _textureExtenalFlag.fill(false);
46 46 _textureExtenalFlag[to_const_uint(ShaderProgram::TextureUsage::REFLECTION)] = true;
47 47 _textureExtenalFlag[to_const_uint(ShaderProgram::TextureUsage::REFRACTION)] = true;
48 + defaultReflectionTexture(nullptr, 0);
49 + defaultRefractionTexture(nullptr, 0);
48 50
49 51 REGISTER_FRAME_LISTENER(this, 9999);
50 52
  @@ -116,6 +118,8 @@
116 118 cloneMat->_parallaxFactor = base._parallaxFactor;
117 119 cloneMat->_reflectionIndex = base._reflectionIndex;
118 120 cloneMat->_refractionIndex = base._refractionIndex;
121 + cloneMat->_defaultReflection = base._defaultReflection;
122 + cloneMat->_defaultRefraction = base._defaultRefraction;
119 123
120 124 cloneMat->_translucencySource.clear();
121 125
  @@ -320,7 +324,7 @@
320 324 const Texture_ptr& refTex = reflectionTarget.getAttachment(RTAttachment::Type::Colour, 0).asTexture();
321 325 setTexture(ShaderProgram::TextureUsage::REFLECTION, refTex);
322 326 } else {
323 - setTexture(ShaderProgram::TextureUsage::REFLECTION, nullptr);
327 + setTexture(ShaderProgram::TextureUsage::REFLECTION, _defaultReflection.first);
324 328 }
325 329 }
326 330
  @@ -331,10 +335,22 @@
331 335 const Texture_ptr& refTex = refractionTarget.getAttachment(RTAttachment::Type::Colour, 0).asTexture();
332 336 setTexture(ShaderProgram::TextureUsage::REFRACTION, refTex);
333 337 } else {
334 - setTexture(ShaderProgram::TextureUsage::REFRACTION, nullptr);
338 + setTexture(ShaderProgram::TextureUsage::REFRACTION, _defaultRefraction.first);
335 339 }
336 340 }
337 341
342 +
343 + void Material::defaultReflectionTexture(Texture_ptr reflectionPtr, U32 arrayIndex) {
344 + _defaultReflection.first = reflectionPtr;
345 + _defaultReflection.second = arrayIndex;
346 + }
347 +
348 + void Material::defaultRefractionTexture(Texture_ptr refractionPtr, U32 arrayIndex) {
349 + _defaultRefraction.first = refractionPtr;
350 + _defaultRefraction.second = arrayIndex;
351 + }
352 +
353 +
338 354 /// If the current material doesn't have a shader associated with it, then add
339 355 /// the default ones.
340 356 bool Material::computeShader(RenderStage renderStage, const bool computeOnAdd){