Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 167 vs 168 for /trunk/Source Code/Rendering/RenderPass/Reflector.cpp

Diff revisions: vs.
  @@ -11,6 +11,7 @@
11 11 _reflectedTexture(NULL),
12 12 _createdFBO(false),
13 13 _updateSelf(false),
14 + _planeDirty(true),
14 15 _excludeSelfReflection(true),
15 16 _previewReflection(false)
16 17 {
  @@ -48,6 +49,11 @@
48 49 assert(_reflectedTexture != NULL);
49 50 /// mark ourselves as reflection target only if we do not wish to reflect ourself back
50 51 _updateSelf = !_excludeSelfReflection;
52 + /// recompute the plane equation
53 + if(_planeDirty) {
54 + updatePlaneEquation();
55 + _planeDirty = false;
56 + }
51 57 /// generate reflection texture
52 58 updateReflection();
53 59 /// unmark from reflection target
  @@ -57,13 +63,16 @@
57 63
58 64 bool Reflector::build(){
59 65 PRINT_FN(Locale::get("REFLECTOR_INIT_FBO"),_resolution.x,_resolution.y );
66 + SamplerDescriptor reflectionSampler;
67 + reflectionSampler.setWrapMode(TEXTURE_CLAMP_TO_EDGE);
68 + reflectionSampler.toggleMipMaps(false);
69 +
60 70 TextureDescriptor reflectionDescriptor(TEXTURE_2D,
61 71 RGBA,
62 72 RGBA8,
63 73 UNSIGNED_BYTE); ///Less precision for reflections
64 74
65 - reflectionDescriptor.setWrapMode(TEXTURE_CLAMP_TO_EDGE,TEXTURE_CLAMP_TO_EDGE);
66 - reflectionDescriptor._generateMipMaps = false;
75 + reflectionDescriptor.setSampler(reflectionSampler);
67 76
68 77 _reflectedTexture = GFX_DEVICE.newFBO(FBO_2D_COLOR);
69 78 _reflectedTexture->AddAttachment(reflectionDescriptor,TextureDescriptor::Color0);
  @@ -83,7 +92,7 @@
83 92 _previewReflectionShader->UniformTexture("tex",0);
84 93 _reflectedTexture->Bind(0);
85 94 GFX_DEVICE.toggle2D(true);
86 - GFX_DEVICE.renderInViewport(vec4<I32>(128,128,256,256),
95 + GFX_DEVICE.renderInViewport(vec4<U32>(128,128,256,256),
87 96 DELEGATE_BIND(&GFXDevice::renderInstance,
88 97 DELEGATE_REF(GFX_DEVICE),
89 98 DELEGATE_REF(_renderQuad->renderInstance())));