Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 170 vs 221 for /trunk/Source Code/Rendering/PostFX/CustomOperators/SSAOPreRenderOperator.cpp

Diff revisions: vs.
  @@ -7,51 +7,51 @@
7 7 #include "Geometry/Shapes/Headers/Predefined/Quad3D.h"
8 8
9 9 SSAOPreRenderOperator::SSAOPreRenderOperator(Quad3D* target,
10 - FrameBufferObject* result,
11 - const vec2<U16>& resolution,
12 - SamplerDescriptor* const sampler) : PreRenderOperator(SSAO_STAGE,target,resolution,sampler),
13 - _outputFBO(result)
10 + FrameBufferObject* result,
11 + const vec2<U16>& resolution,
12 + SamplerDescriptor* const sampler) : PreRenderOperator(SSAO_STAGE,target,resolution,sampler),
13 + _outputFBO(result)
14 14 {
15 - TextureDescriptor outputDescriptor(TEXTURE_2D,
16 - RGB,
17 - RGB8,
18 - UNSIGNED_BYTE);
19 - outputDescriptor.setSampler(*_internalSampler);
20 - _outputFBO->AddAttachment(outputDescriptor,TextureDescriptor::Color0);
21 - _outputFBO->Create(_resolution.width, _resolution.height);
22 - _ssaoShader = CreateResource<ShaderProgram>(ResourceDescriptor("SSAOPass"));
23 - _ssaoShader->UniformTexture("texScreen", 0);
24 - _ssaoShader->UniformTexture("texDepth", 1);
15 + TextureDescriptor outputDescriptor(TEXTURE_2D,
16 + RGB,
17 + RGB8,
18 + UNSIGNED_BYTE);
19 + outputDescriptor.setSampler(*_internalSampler);
20 + _outputFBO->AddAttachment(outputDescriptor,TextureDescriptor::Color0);
21 + _outputFBO->Create(_resolution.width, _resolution.height);
22 + _ssaoShader = CreateResource<ShaderProgram>(ResourceDescriptor("SSAOPass"));
23 + _ssaoShader->UniformTexture("texScreen", 0);
24 + _ssaoShader->UniformTexture("texDepth", 1);
25 25 }
26 26
27 27 SSAOPreRenderOperator::~SSAOPreRenderOperator(){
28 - RemoveResource(_ssaoShader);
28 + RemoveResource(_ssaoShader);
29 29 }
30 30
31 31 void SSAOPreRenderOperator::reshape(I32 width, I32 height){
32 - _outputFBO->Create(width, height);
32 + _outputFBO->Create(width, height);
33 33 }
34 34
35 35 void SSAOPreRenderOperator::operation(){
36 - if(!_enabled || !_renderQuad) return;
36 + if(!_enabled || !_renderQuad) return;
37 37
38 - GFXDevice& gfx = GFX_DEVICE;
38 + GFXDevice& gfx = GFX_DEVICE;
39 39
40 - gfx.toggle2D(true);
40 + gfx.toggle2D(true);
41 41
42 - _ssaoShader->bind();
43 - _renderQuad->setCustomShader(_ssaoShader);
42 + _ssaoShader->bind();
43 + _renderQuad->setCustomShader(_ssaoShader);
44 44
45 - _outputFBO->Begin();
46 - _inputFBO[0]->Bind(0); // screen
47 - _inputFBO[1]->Bind(1); // depth
45 + _outputFBO->Begin(FrameBufferObject::defaultPolicy());
46 + _inputFBO[0]->Bind(0); // screen
47 + _inputFBO[1]->Bind(1, TextureDescriptor::Depth); // depth
48 48
49 - gfx.renderInstance(_renderQuad->renderInstance());
49 + gfx.renderInstance(_renderQuad->renderInstance());
50 50
51 - _inputFBO[1]->Unbind(1);
52 - _inputFBO[0]->Unbind(0);
51 + _inputFBO[1]->Unbind(1);
52 + _inputFBO[0]->Unbind(0);
53 53
54 - _outputFBO->End();
54 + _outputFBO->End();
55 55
56 - gfx.toggle2D(false);
56 + gfx.toggle2D(false);
57 57 }