- Timestamp:
- 11/05/08 15:14:22 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r3089 r3101 6 6 #include "RenderTraverser.h" 7 7 #include "FrameBufferObject.h" 8 #include "RenderState.h" 8 9 9 10 #include <IL/il.h> … … 75 76 startil(); 76 77 77 ILstring filename = ILstring(" depth.tga");78 ILstring filename = ILstring("sceneQuery.tga"); 78 79 ilRegisterType(IL_FLOAT); 79 80 … … 100 101 101 102 SceneQuery::SceneQuery(const AxisAlignedBox3 &sceneBox, 102 RenderTraverser *renderer ):103 mSceneBox(sceneBox), mDepth(NULL) 103 RenderTraverser *renderer, RenderState *state): 104 mSceneBox(sceneBox), mDepth(NULL), mRenderState(state) 104 105 { 105 106 Prepare(renderer); … … 112 113 const int py = (mSceneBox.Max(1) - pt.y) * (texHeight - 1) / mSceneBox.Size(1); 113 114 114 float d = mDepth[px + py * texHeight];115 const float d = mDepth[px + py * texHeight]; 115 116 116 117 static float depth = d; 117 118 118 if (d > 0)119 if (d > .0f) 119 120 { 120 121 // temporal smoothing of depth values … … 136 137 cout << "Preparing scene queries" << endl; 137 138 138 const float xlen = mSceneBox.Size().x * 0.5f;139 const float ylen = mSceneBox.Size().y * 0.5f;139 const float xlen = mSceneBox.Size().x * .5f; 140 const float ylen = mSceneBox.Size().y * .5f; 140 141 141 142 PerspectiveCamera *orthoCam = new PerspectiveCamera(xlen / ylen); … … 165 166 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 166 167 168 // hack: disable cull face because of alpha textured balconies 167 169 glDisable(GL_CULL_FACE); 168 glEnable(GL_DEPTH_TEST); 170 mRenderState->LockCullFaceEnabled(true); 171 172 //glDisable(GL_CULL_FACE); 173 //glEnable(GL_DEPTH_TEST); 169 174 170 175 glMatrixMode(GL_MODELVIEW); … … 177 182 178 183 glOrtho(xlen, -xlen, ylen, -ylen, 0.0f, mSceneBox.Size().z); 184 //glOrtho(xlen, .0f, ylen, .0f, .0f, mSceneBox.Size().z); 179 185 180 186 glMatrixMode(GL_MODELVIEW); … … 190 196 glEnableClientState(GL_NORMAL_ARRAY); 191 197 198 // forward rendering 199 mRenderState->SetRenderTechnique(0); 200 192 201 renderer->RenderScene(); 193 202 … … 197 206 renderer->SetCamera(oldCam); 198 207 199 200 glEnable(GL_CULL_FACE);208 mRenderState->LockCullFaceEnabled(false); 209 //glEnable(GL_CULL_FACE); 201 210 202 211 glMatrixMode(GL_MODELVIEW); … … 211 220 212 221 GrabDepthBuffer(mDepth, fbo->GetDepthTex()); 213 //ExportDepthBuffer(mDepth); PrintGLerror("grab");222 ExportDepthBuffer(mDepth); PrintGLerror("grab depth"); 214 223 215 224 DEL_PTR(fbo);
Note: See TracChangeset
for help on using the changeset viewer.