Changeset 3125 for GTP/trunk/App
- Timestamp:
- 11/13/08 13:14:55 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3124 r3125 201 201 mGeometry[mStaticGeometrySize + i] = dynamicEntities[i]; 202 202 } 203 204 cout << "max depth for testing children" << mMaxDepthForTestingChildren << endl; 203 205 } 204 206 … … 227 229 228 230 mMaxDepthForTestingChildren = maxDepthForTestingChildren; 231 cout << "max depth for testing children" << mMaxDepthForTestingChildren << endl; 229 232 } 230 233 … … 592 595 return numNodes; 593 596 } 594 595 #if TODO596 void Bvh::RenderBoundsImmediate(const BvhNodeContainer &nodes, RenderState *state)597 {598 /////////599 //-- Render the tight bounds in immediate mode600 BvhNodeContainer::const_iterator nit, nit_end = nodes.end();601 602 for (nit = nodes.begin(); nit != nit_end; ++ nit)603 {604 BvhNode *node = *nit;605 606 for (int size_t i = 0; i < node->mNumTestNodes; ++ i)607 {608 BvhNode *testNode = node->mTestNodesIdx609 RenderBoundingBoxImmediate((*nit)->GetBox());610 }611 }612 }613 #endif614 597 615 598 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3123 r3125 472 472 473 473 //LoadModel("fisch.dem", dynamicObjects); 474 /*LoadModel("hbuddha.dem", dynamicObjects);474 LoadModel("hbuddha.dem", dynamicObjects); 475 475 buddha = dynamicObjects.back(); 476 476 … … 497 497 ent->SetTransform(transform); 498 498 dynamicObjects.push_back(ent); 499 } */499 } 500 500 501 501 … … 913 913 void MainLoop() 914 914 { 915 #if 0915 #if 1 916 916 GPUProgramParameters *vtxParams = 917 917 buddha->GetShape(0)->GetMaterial()->GetTechnique(1)->GetVertexProgramParameters(); … … 930 930 if (GetOrCreateSceneQuery()->CalcIntersection(newPos)) 931 931 { 932 Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter()); // + Vector3(0, 0, ent->GetBoundingBox().Size(2) * 0.5f));932 Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter()); 933 933 ent->GetTransform()->SetMatrix(mat); 934 934 } … … 937 937 Matrix4x4 rotMatrix = RotationZMatrix(M_PI * 1e-3f); 938 938 dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 939 940 941 ///////////////////////// 942 //-- update animations 943 944 motionPath->Move(0.01f); 945 939 946 #endif 940 947 … … 1164 1171 1165 1172 glutSwapBuffers(); 1166 1167 1168 /////////////////////////1169 //-- update animations1170 motionPath->Move(0.01f);1171 1173 } 1172 1174 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3123 r3125 174 174 // calculate eye space position of sample in old frame 175 175 const float oldDepth = oldPixel.w; 176 // the depth projected into the old frame 176 177 const float projectedDepth = projPos.z; 177 // vector from eye pos to old sample178 // calculate depth difference 178 179 const float depthDif = abs(projectedDepth - oldDepth); 179 180 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
r3103 r3125 19 19 }; 20 20 21 22 /*float4 DownSample(frag IN,23 uniform sampler2D colors,24 uniform float2 downSampleOffs[9]): COLOR25 {26 float4 average = .0f;27 28 const float4 avgColor = tex2Dlod(colors, float4(IN.texCoord, 0, 0));29 30 float j = 0;31 float4 color;32 33 for (int i = 0; i < 9; ++ i)34 {35 color = tex2Dlod(colors, float4(IN.texCoord + downSampleOffs[i], 0, 0));36 if (abs(color.w - avgColor.w) < 1e-3f)37 {38 average += color;39 ++ j;40 }41 }42 43 //average *= 1.0f / 9.0f;44 average *= 1.0f / j;45 46 return average;47 }*/48 21 49 22 50 // let bilinear filtering do its work51 23 float4 DownSample(frag IN, 52 24 uniform sampler2D colors, 53 25 uniform float2 downSampleOffs[NUM_DOWNSAMPLES]): COLOR 54 26 { 27 // let bilinear filtering do its work 55 28 return tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 56 29 /* … … 71 44 intensity. 72 45 */ 73 74 46 float4 GreyScaleDownSample(frag IN, 75 47 uniform sampler2D colors, … … 148 120 float logLum = logLumScaled * LOGLUM_RANGE + MINLOGLUM; 149 121 150 float newImageKey = exp(logLum);122 float newImageKey = max(exp(logLum), 1e-6f); 151 123 152 124 // adjust to middle gray … … 184 156 float logLumScaled = logLum * INV_LOGLUM_RANGE - logLumOffset; 185 157 158 const float expFactor = 0.1f; 186 159 // exponential smoothing of tone mapping over time 187 if (oldLogLum > 1e-5f) // loglum from last frame too bright188 OUT.col.w = lerp(oldLogLum, logLumScaled, 0.1f);160 if (oldLogLum > 1e-5f) // check if loglum from last frame too small (=> tm too bright) 161 OUT.col.w = lerp(oldLogLum, logLumScaled, expFactor); 189 162 else 190 163 OUT.col.w = logLumScaled;
Note: See TracChangeset
for help on using the changeset viewer.