Changeset 2955
- Timestamp:
- 09/18/08 08:06:31 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.cpp
r2844 r2955 74 74 } 75 75 76 if (state->GetRender Type() == RenderState::DEFERRED)76 if (state->GetRenderPassType() == RenderState::DEFERRED) 77 77 { 78 78 if (mTexture) … … 87 87 } 88 88 } 89 else if (state->GetRender Type() == RenderState::FIXED)89 else if (state->GetRenderPassType() == RenderState::FIXED) 90 90 { 91 91 glMaterialfv(GL_FRONT, GL_AMBIENT, (float *)&mAmbientColor.r); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp
r2950 r2955 23 23 mMode(RENDER), 24 24 mRenderType(FIXED), 25 mUseAlphaToCoverage(true) 25 mUseAlphaToCoverage(true), 26 mLockCullFaceEnabled(false) 26 27 { 27 28 Reset(); … … 82 83 void RenderState::SetState(bool texturing, bool alphaTest, bool cullFace) 83 84 { 84 if ( mCullFaceEnabled && !cullFace)85 if (!mLockCullFaceEnabled) 85 86 { 86 mCullFaceEnabled = false; 87 glDisable(GL_CULL_FACE); 87 if (mCullFaceEnabled && !cullFace) 88 { 89 mCullFaceEnabled = false; 90 glDisable(GL_CULL_FACE); 91 } 92 else if (!mCullFaceEnabled && cullFace) 93 { 94 mCullFaceEnabled = true; 95 glEnable(GL_CULL_FACE); 96 } 88 97 } 89 else if (!mCullFaceEnabled && cullFace)90 {91 mCullFaceEnabled = true;92 glEnable(GL_CULL_FACE);93 }94 95 98 if (mAlphaTestEnabled && !alphaTest) 96 99 { … … 144 147 mCurrentVboId = -1; 145 148 146 SetState(false, false, true); 149 mCullFaceEnabled = true; 150 glEnable(GL_CULL_FACE); 151 152 mAlphaTestEnabled = false; 153 154 glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); 155 glDisable(GL_ALPHA_TEST); 156 157 mTexturesEnabled = false; 158 159 glDisable(GL_TEXTURE_2D); 160 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 161 147 162 SetState(RENDER); 148 163 } … … 155 170 156 171 172 void RenderState::SetRenderPassType(RenderPassType t) 173 { 174 mRenderType = t; 157 175 } 176 177 178 RenderState::RenderPassType RenderState::GetRenderPassType() const 179 { 180 return mRenderType; 181 } 182 183 184 void RenderState::LockCullFaceEnabled(bool lockCull) 185 { 186 mLockCullFaceEnabled = lockCull; 187 } 188 189 190 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.h
r2948 r2955 24 24 }; 25 25 26 enum RenderType 26 /// the used render type for this render pass 27 enum RenderPassType 27 28 { 28 29 FIXED, 29 30 DEPTH_PASS, 30 DEFERRED, 31 DEPTH_PASS_DEFERRED, 32 NUM_RENDER_TYPES 31 DEFERRED 33 32 }; 34 33 … … 38 37 39 38 ~RenderState() { Reset(); }; 40 41 39 /** This must be called each time before and after an occlusion test. 42 40 Mode is one of render mode or query mode. Returns true if a state … … 62 60 */ 63 61 void SetUseAlphaToCoverage(bool useAlphaToCoverage); 64 65 void SetRenderType(RenderType type) { mRenderType = type; } 66 RenderType GetRenderType() const { return mRenderType; } 67 68 69 /////////////////// 62 /** Sets the type of rendering used (foreward, depth pass, deferred) 63 */ 64 void SetRenderPassType(RenderPassType t); 65 /** See Set 66 */ 67 RenderPassType GetRenderPassType() const; 68 /** If true, the current value of cull face enabled / disable will 69 not be changed by the render state. 70 */ 71 void LockCullFaceEnabled(bool lockCull); 70 72 71 73 … … 90 92 int mCurrentVboId; 91 93 92 Render Type mRenderType;94 RenderPassType mRenderType; 93 95 94 96 bool mUseAlphaToCoverage; 97 98 bool mLockCullFaceEnabled; 95 99 }; 96 100 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp
r2954 r2955 197 197 for (int i = 0; i < mNumSamples; ++ i) 198 198 { 199 Sample2 spl = s[i];199 Sample2 &spl = s[i]; 200 200 201 201 float len = sqrt(spl.x * spl.x + spl.y * spl.y); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r2954 r2955 1 1 #include "SkyPreetham.h" 2 #include "common.h" 3 #include "Vector3.h" 4 5 2 6 //#include <rendering/effect/FEffect.h> 3 7 //#include <rendering/FVertexbuffer.h> 4 8 5 9 10 inline float CBQ(float x) 11 { 12 return x * x * x; 13 } 14 15 16 inline float SQR(float x) 17 { 18 return x * x ; 19 } 6 20 7 21 … … 9 23 10 24 11 SkyPreetham::SkyPreetham( ):12 mEffect(NULL),13 mTurbidity( 4.0),14 mSunEffect(NULL),15 mSunTexture(NULL),16 mSunQuad(NULL)25 SkyPreetham::SkyPreetham(float turbitity): 26 // mEffect(NULL), 27 mTurbidity(turbitity) 28 // mSunEffect(NULL), 29 // mSunTexture(NULL), 30 // mSunQuad(NULL) 17 31 { 18 mEffect = D().getScene().getEffect("../effects/sky_preetham.fx");32 /* mEffect = D().getScene().getEffect("../effects/sky_preetham.fx"); 19 33 20 34 mVertexBuffer = D().getScene().getVertexBuffer("../models/sky.vbo"); … … 22 36 mSunEffect = D().getScene().getEffect("../effects/sky_sun.fx"); 23 37 mSunTexture = D().getScene().getTexture2D("../textures/sky_sun.png"); 24 25 createSunQuad();38 */ 39 CreateSunQuad(); 26 40 } 27 41 … … 29 43 SkyPreetham::~SkyPreetham() 30 44 { 31 FDelete(mSunQuad);45 //DEL_PTR(mSunQuad); 32 46 } 33 47 34 48 35 49 36 void SkyPreetham::Compute( )50 void SkyPreetham::Compute(const Vector3 &sunDir) 37 51 { 52 float sun_theta[2]; 38 53 39 FVector2 sun_theta; 40 FVector3 l_dir = D().getScene().getLight().getDirection(); 41 mTurbidity = D().getScene().getLight().getTurbitity(); 54 sun_theta[0] = acos(sunDir.y); 42 55 43 sun_theta.x = acos(l_dir.y);44 sun_theta .y = cos( sun_theta.x ) * cos( sun_theta.x );56 const float cos_theta = cos(sun_theta[0]); 57 sun_theta[1] = cos_theta * cos_theta; 45 58 59 Vector3 zenithColor; 46 60 47 #define CBQ(X) ((X) * (X) * (X)) 48 #define SQR(X) ((X) * (X)) 61 zenithColor.x = ( 0.00165f * CBQ(sun_theta[0]) - 0.00374f * SQR(sun_theta[0]) + 0.00208f * sun_theta[0] + 0.0f) * SQR(mTurbidity) + 62 (-0.02902f * CBQ(sun_theta[0]) + 0.06377f * SQR(sun_theta[0]) - 0.03202f * sun_theta[0] + 0.00394f) * mTurbidity + 63 ( 0.11693f * CBQ(sun_theta[0]) - 0.21196f * SQR(sun_theta[0]) + 0.06052f * sun_theta[0] + 0.25885f); 49 64 50 const double PI = (double)3.1415926535897932; 65 zenithColor.y = (0.00275f * CBQ(sun_theta[0]) - 0.00610f * SQR(sun_theta[0]) + 0.00316f * sun_theta[0] + 0.0f) * SQR(mTurbidity) + 66 (-0.04214f * CBQ(sun_theta[0]) + 0.08970f * SQR(sun_theta[0]) - 0.04153f * sun_theta[0] + 0.00515f) * mTurbidity + 67 ( 0.15346f * CBQ(sun_theta[0]) - 0.26756f * SQR(sun_theta[0]) + 0.06669f * sun_theta[0] + 0.26688f); 68 69 zenithColor.z = (float)((4.0453f * mTurbidity - 4.9710f) * tan((4.0f / 9.0f - mTurbidity / 120.0f) * 70 (M_PI - 2.0f * sun_theta[0])) - 0.2155f * mTurbidity + 2.4192f); 51 71 52 FVector3 zenithColor;53 54 zenithColor.x = ( 0.00165f * CBQ(sun_theta.x) - 0.00374f * SQR(sun_theta.x) +55 0.00208f * sun_theta.x + 0.0f) * SQR(mTurbidity) +56 (-0.02902f * CBQ(sun_theta.x) + 0.06377f * SQR(sun_theta.x) -57 0.03202f * sun_theta.x + 0.00394f) * mTurbidity +58 ( 0.11693f * CBQ(sun_theta.x) - 0.21196f * SQR(sun_theta.x) +59 0.06052f * sun_theta.x + 0.25885f);60 61 zenithColor.y = ( 0.00275f * CBQ(sun_theta.x) - 0.00610f * SQR(sun_theta.x) +62 0.00316f * sun_theta.x + 0.0f) * SQR(mTurbidity) +63 (-0.04214f * CBQ(sun_theta.x) + 0.08970f * SQR(sun_theta.x) -64 0.04153f * sun_theta.x + 0.00515f) * mTurbidity +65 ( 0.15346f * CBQ(sun_theta.x) - 0.26756f * SQR(sun_theta.x) +66 0.06669f * sun_theta.x + 0.26688f);67 68 zenithColor.z = (float)((4.0453f * mTurbidity - 4.9710f) *69 tan((4.0f / 9.0f - mTurbidity / 120.0f) * (PI - 2.0f * sun_theta.x)) -70 0.2155f * mTurbidity + 2.4192f);71 72 // convert kcd/m² to cd/m² 72 73 zenithColor.z *= 1000; … … 74 75 double ABCDE_x[5], ABCDE_y[5], ABCDE_Y[5]; 75 76 76 ABCDE_x[0] = -0.01925 * mTurbidity 77 ABCDE_x[1] = -0.06651 * mTurbidity 78 ABCDE_x[2] = -0.00041 * mTurbidity 79 ABCDE_x[3] = -0.06409 * mTurbidity 80 ABCDE_x[4] = -0.00325 * mTurbidity 77 ABCDE_x[0] = -0.01925 * mTurbidity - 0.25922; 78 ABCDE_x[1] = -0.06651 * mTurbidity + 0.00081; 79 ABCDE_x[2] = -0.00041 * mTurbidity + 0.21247; 80 ABCDE_x[3] = -0.06409 * mTurbidity - 0.89887; 81 ABCDE_x[4] = -0.00325 * mTurbidity + 0.04517; 81 82 82 ABCDE_y[0] = -0.01669 * mTurbidity 83 ABCDE_y[1] = -0.09495 * mTurbidity 84 ABCDE_y[2] = -0.00792 * mTurbidity 85 ABCDE_y[3] = -0.04405 * mTurbidity 86 ABCDE_y[4] = -0.01092 * mTurbidity 83 ABCDE_y[0] = -0.01669 * mTurbidity - 0.26078; 84 ABCDE_y[1] = -0.09495 * mTurbidity + 0.00921; 85 ABCDE_y[2] = -0.00792 * mTurbidity + 0.21023; 86 ABCDE_y[3] = -0.04405 * mTurbidity - 1.65369; 87 ABCDE_y[4] = -0.01092 * mTurbidity + 0.05291; 87 88 88 ABCDE_Y[0] = 0.17872 * mTurbidity 89 ABCDE_Y[1] = -0.35540 * mTurbidity 90 ABCDE_Y[2] = -0.02266 * mTurbidity 91 ABCDE_Y[3] = 0.12064 * mTurbidity 92 ABCDE_Y[4] = -0.06696 * mTurbidity 89 ABCDE_Y[0] = 0.17872 * mTurbidity - 1.46303; 90 ABCDE_Y[1] = -0.35540 * mTurbidity + 0.42749; 91 ABCDE_Y[2] = -0.02266 * mTurbidity + 5.32505; 92 ABCDE_Y[3] = 0.12064 * mTurbidity - 2.57705; 93 ABCDE_Y[4] = -0.06696 * mTurbidity + 0.37027; 93 94 94 95 /* 95 96 F().getRenderDevice().setDefaultDepthStencilMode(FRenderDevice::DEPTHSTENCIL_TEST_NO_OVERWRITE); 96 97 … … 126 127 127 128 F().getRenderDevice().setDefaultDepthStencilMode(FRenderDevice::DEPTHSTENCIL_TEST_AND_OVERWRITE); 129 */ 128 130 } 129 131 130 132 131 void SkyPreetham:: renderSunDisk()133 void SkyPreetham::RenderSunDisk() 132 134 { 135 /* 133 136 F().getRenderDevice().setDefaultBlendingMode(FRenderDevice::BLENDING_ADDITIVE); 134 137 … … 154 157 155 158 F().getRenderDevice().setDefaultBlendingMode(FRenderDevice::BLENDING_NONE); 159 */ 156 160 } 157 161 158 162 159 void SkyPreetham:: createSunQuad()163 void SkyPreetham::CreateSunQuad() 160 164 { 165 /* 161 166 mSunQuad = new FVertexBuffer(); 162 167 mSunQuad->setupPrimitiveType(FVertexBuffer::PRIMITIVES_TRIANGLES); … … 180 185 mSunQuad->setIndex(4, 1); 181 186 mSunQuad->setIndex(5, 3); 187 */ 182 188 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.h
r2954 r2955 2 2 #define _SKYPREETHAM_H__ 3 3 4 class SkyPreetham: public Entity 4 5 namespace CHCDemoEngine{ 6 class Vector3; 7 } 8 9 class SkyPreetham 5 10 { 6 11 public: … … 9 14 virtual ~SkyPreetham(); 10 15 16 void Compute(const CHCDemoEngine::Vector3 &sunDir); 17 11 18 protected: 12 19 13 void renderSunDisk();14 void createSunQuad();20 void RenderSunDisk(); 21 void CreateSunQuad(); 15 22 16 23 17 24 /// Members. 18 FEffect* mEffect;25 /* FEffect* mEffect; 19 26 20 27 FEffect* mSunEffect; 21 28 FTexture2D* mSunTexture; 22 29 FVertexBuffer* mSunQuad; 23 30 */ 24 31 float mTurbidity; 25 32 }; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SunColor.cpp
r2954 r2955 71 71 float ABCDE_x[5], ABCDE_y[5], ABCDE_Y[5]; 72 72 73 ABCDE_x[0] = -0.01925f * turbidity 74 ABCDE_x[1] = -0.06651f * turbidity 75 ABCDE_x[2] = -0.00041f * turbidity 76 ABCDE_x[3] = -0.06409f * turbidity 77 ABCDE_x[4] = -0.00325f * turbidity 73 ABCDE_x[0] = -0.01925f * turbidity - 0.25922f; 74 ABCDE_x[1] = -0.06651f * turbidity + 0.00081f; 75 ABCDE_x[2] = -0.00041f * turbidity + 0.21247f; 76 ABCDE_x[3] = -0.06409f * turbidity - 0.89887f; 77 ABCDE_x[4] = -0.00325f * turbidity + 0.04517f; 78 78 79 ABCDE_y[0] = -0.01669f * turbidity 80 ABCDE_y[1] = -0.09495f * turbidity 81 ABCDE_y[2] = -0.00792f * turbidity 82 ABCDE_y[3] = -0.04405f * turbidity 83 ABCDE_y[4] = -0.01092f * turbidity 79 ABCDE_y[0] = -0.01669f * turbidity - 0.26078f; 80 ABCDE_y[1] = -0.09495f * turbidity + 0.00921f; 81 ABCDE_y[2] = -0.00792f * turbidity + 0.21023f; 82 ABCDE_y[3] = -0.04405f * turbidity - 1.65369f; 83 ABCDE_y[4] = -0.01092f * turbidity + 0.05291f; 84 84 85 ABCDE_Y[0] = 0.17872f * turbidity 86 ABCDE_Y[1] = -0.35540f * turbidity 87 ABCDE_Y[2] = -0.02266f * turbidity 88 ABCDE_Y[3] = 0.12064f * turbidity 89 ABCDE_Y[4] = -0.06696f * turbidity 85 ABCDE_Y[0] = 0.17872f * turbidity - 1.46303f; 86 ABCDE_Y[1] = -0.35540f * turbidity + 0.42749f; 87 ABCDE_Y[2] = -0.02266f * turbidity + 5.32505f; 88 ABCDE_Y[3] = 0.12064f * turbidity - 2.57705f; 89 ABCDE_Y[4] = -0.06696f * turbidity + 0.37027f; 90 90 91 91 Vector3 num; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SunColor.h
r2954 r2955 2 2 #define __SUNCOLOR_H__ 3 3 4 //#include "Vector3.h"5 6 4 namespace CHCDemoEngine{ 7 8 5 class Vector3; 9 6 } 7 10 8 /** Class describing a plane in 3D space. 11 9 */ -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp
r2952 r2955 25 25 if (!mMatrix) return; 26 26 27 if (state->GetRender Type() == RenderState::DEFERRED)27 if (state->GetRenderPassType() == RenderState::DEFERRED) 28 28 { 29 29 cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)mMatrix->x); … … 39 39 if (!mMatrix) return; 40 40 41 if (state->GetRender Type() == RenderState::DEFERRED)41 if (state->GetRenderPassType() == RenderState::DEFERRED) 42 42 { 43 43 static Matrix4x4 identity = IdentityMatrix(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2954 r2955 166 166 PerfTimer frameTimer, algTimer; 167 167 168 int renderType = RenderState::FIXED; 168 /// the used render type for this render pass 169 enum RenderMethod 170 { 171 RENDER_FIXED, 172 RENDER_DEPTH_PASS, 173 RENDER_DEFERRED, 174 RENDER_DEPTH_PASS_DEFERRED, 175 RENDER_NUM_RENDER_TYPES 176 }; 177 178 /// one of four possible render methods 179 int renderMethod = RENDER_FIXED; 169 180 170 181 PerformanceGraph *perfGraph = NULL; … … 459 470 visualization = new Visualization(bvh, camera, NULL, &state); 460 471 461 state.SetRender Type(RenderState::FIXED);472 state.SetRenderPassType(RenderState::FIXED); 462 473 sceneQuery = new SceneQuery(bvh->GetBox(), traverser); 463 474 … … 756 767 tr->SetUseMultiQueries(useMultiQueries); 757 768 tr->SetUseTightBounds(useTightBounds); 758 tr->SetUseDepthPass((render Type == RenderState::DEPTH_PASS) || (renderType == RenderState::DEPTH_PASS_DEFERRED));769 tr->SetUseDepthPass((renderMethod == RENDER_DEPTH_PASS) || (renderMethod == RENDER_DEPTH_PASS_DEFERRED)); 759 770 tr->SetRenderQueue(renderQueue); 760 771 … … 840 851 matProjectionView = matViewing * matProjection; 841 852 842 if ((render Type == RenderState::DEFERRED) || (renderType == RenderState::DEPTH_PASS_DEFERRED))853 if ((renderMethod == RENDER_DEFERRED) || (renderMethod == RENDER_DEPTH_PASS_DEFERRED)) 843 854 { 844 855 cgGLSetMatrixParameterfc(Transform3::sModelMatrixParam, (const float *)IdentityMatrix().x); … … 878 889 glDisable(GL_MULTISAMPLE_ARB); 879 890 880 state.SetRender Type(RenderState::DEFERRED);891 state.SetRenderPassType(RenderState::DEFERRED); 881 892 882 893 cgGLEnableProfile(RenderState::sCgVertexProfile); … … 933 944 934 945 // hack 935 int oldRender Type = renderType;946 int oldRenderMethod = renderMethod; 936 947 937 948 if (renderLightView) 938 render Type= RenderState::FIXED;949 renderMethod = RenderState::FIXED; 939 950 940 951 glEnableClientState(GL_VERTEX_ARRAY); … … 942 953 943 954 // render with the specified method (forward rendering, forward + depth, deferred) 944 switch (render Type)945 { 946 case R enderState::FIXED:955 switch (renderMethod) 956 { 957 case RENDER_FIXED: 947 958 948 959 glEnable(GL_MULTISAMPLE_ARB); 949 960 950 state.SetRender Type(RenderState::FIXED);961 state.SetRenderPassType(RenderState::FIXED); 951 962 glEnable(GL_LIGHTING); 952 963 … … 960 971 break; 961 972 962 case R enderState::DEPTH_PASS_DEFERRED:973 case RENDER_DEPTH_PASS_DEFERRED: 963 974 964 975 glDisable(GL_MULTISAMPLE_ARB); 965 976 state.SetUseAlphaToCoverage(false); 966 977 967 state.Reset(); 968 state.SetRenderType(RenderState::DEPTH_PASS); 978 state.SetRenderPassType(RenderState::DEPTH_PASS); 969 979 970 980 if (!fbo) InitFBO(); fbo->Bind(); … … 985 995 break; 986 996 987 case R enderState::DEPTH_PASS:997 case RENDER_DEPTH_PASS: 988 998 989 999 glEnable(GL_MULTISAMPLE_ARB); … … 992 1002 cgGLDisableProfile(RenderState::sCgVertexProfile); 993 1003 994 state.SetRender Type(RenderState::DEPTH_PASS);1004 state.SetRenderPassType(RenderState::DEPTH_PASS); 995 1005 996 1006 // the scene is rendered withouth any shading … … 1060 1070 1061 1071 // reset depth pass and render visible objects 1062 if ((render Type == RenderState::DEPTH_PASS) ||1063 (render Type == RenderState::DEPTH_PASS_DEFERRED))1072 if ((renderMethod == RENDER_DEPTH_PASS) || 1073 (renderMethod == RENDER_DEPTH_PASS_DEFERRED)) 1064 1074 { 1065 1075 RenderVisibleObjects(); … … 1078 1088 1079 1089 1080 if ((renderType == RenderState::DEFERRED) || (renderType == RenderState::DEPTH_PASS_DEFERRED)) 1090 if ((renderMethod == RENDER_DEFERRED) || 1091 (renderMethod == RENDER_DEPTH_PASS_DEFERRED)) 1081 1092 { 1082 1093 //glPopAttrib(); … … 1111 1122 1112 1123 1113 state.SetRender Type(RenderState::FIXED);1124 state.SetRenderPassType(RenderState::FIXED); 1114 1125 state.Reset(); 1115 1126 … … 1118 1129 glDisableClientState(GL_NORMAL_ARRAY); 1119 1130 1120 render Type = oldRenderType;1131 renderMethod = oldRenderMethod; 1121 1132 1122 1133 … … 1375 1386 case GLUT_KEY_F7: 1376 1387 1377 renderType = (renderType + 1) % RenderState::NUM_RENDER_TYPES; 1378 traverser->SetUseDepthPass((renderType == RenderState::DEPTH_PASS) || (renderType == RenderState::DEPTH_PASS_DEFERRED)); 1388 renderMethod = (renderMethod + 1) % 4; 1389 1390 traverser->SetUseDepthPass( 1391 (renderMethod == RENDER_DEPTH_PASS) || 1392 (renderMethod == RENDER_DEPTH_PASS_DEFERRED) 1393 ); 1379 1394 1380 1395 break; … … 1850 1865 int i = 0; 1851 1866 1852 static char *render TypeStr[] = {"forward", "depth pass + forward", "deferred shading", "depth pass + deferred"};1867 static char *renderMethodStr[] = {"forward", "depth pass + forward", "deferred shading", "depth pass + deferred"}; 1853 1868 1854 1869 sprintf(msg[i ++], "multiqueries: %d, tight bounds: %d, render queue: %d", 1855 1870 useMultiQueries, useTightBounds, useRenderQueue); 1856 1871 1857 sprintf(msg[i ++], "render technique: %s, SSAO: %d", render TypeStr[renderType], useAdvancedShading);1872 sprintf(msg[i ++], "render technique: %s, SSAO: %d", renderMethodStr[renderMethod], useAdvancedShading); 1858 1873 1859 1874 sprintf(msg[i ++], "triangles per virtual leaf: %5d", trianglesPerVirtualLeaf); … … 1940 1955 void RenderVisibleObjects() 1941 1956 { 1942 if (render Type == RenderState::DEPTH_PASS_DEFERRED)1957 if (renderMethod == RENDER_DEPTH_PASS_DEFERRED) 1943 1958 { 1944 1959 if (showShadowMap && !renderLightView) … … 1956 1971 glDrawBuffers(3, mrt); 1957 1972 glClear(GL_COLOR_BUFFER_BIT); 1958 //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);1959 1973 } 1960 1974 else … … 1963 1977 glEnable(GL_LIGHTING); 1964 1978 1965 state.SetRender Type(RenderState::FIXED);1979 state.SetRenderPassType(RenderState::FIXED); 1966 1980 } 1967 1981 … … 2015 2029 glDisableClientState(GL_NORMAL_ARRAY); 2016 2030 2017 state.SetRenderType(RenderState::DEPTH_PASS); 2031 state.SetRenderPassType(RenderState::DEPTH_PASS); 2032 state.LockCullFaceEnabled(true); 2033 state.SetUseAlphaToCoverage(false); 2018 2034 2019 2035 // change CHC++ set of state variables (must be done for each change of camera because 2020 2036 // otherwise the temporal coherency is broken 2021 2037 BvhNode::SetCurrentState(1); 2022 state.SetUseAlphaToCoverage(false);2023 2038 2024 2039 // hack: temporarily change camera far plane 2025 2040 camera->SetFar(newfar); 2026 2041 glDisable(GL_CULL_FACE); 2042 2027 2043 // the scene is rendered withouth any shading 2028 2044 shadowMap->ComputeShadowMap(shadowTraverser, matProjectionView); 2029 2045 2046 glEnable(GL_CULL_FACE); 2030 2047 camera->SetFar(farDist); 2031 2048 2032 2049 state.SetUseAlphaToCoverage(true); 2050 state.LockCullFaceEnabled(false); 2033 2051 2034 2052 glEnableClientState(GL_NORMAL_ARRAY);
Note: See TracChangeset
for help on using the changeset viewer.