Changeset 2964
- Timestamp:
- 09/22/08 18:33:55 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
r2963 r2964 118 118 } 119 119 120 cout << "... finished loading " << bvh->mNumNodes << " scene box: " << bvh->mBox << endl;121 120 122 121 bvh->mBox = bvh->mRoot->GetBox(); 122 123 cout << "... finished loading " << bvh->mNumNodes << " nodes" << endl; 124 cout << "scene box: " << bvh->mBox << endl; 123 125 124 126 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.cpp
r2960 r2964 22 22 23 23 mAmbientColor = RgbaColor(0.2f, 0.2f, 0.2f, 1.0f); 24 //mAmbientColor = RgbaColor(1.0f, 1.0f, 1.0f, 1.0f);25 24 mDiffuseColor = RgbaColor(1.0f, 1.0f, 1.0f, 1.0f); 26 25 mSpecularColor = RgbaColor(.0f, .0f, .0f, 1.0f); … … 60 59 state->SetState(mTexture != NULL, mAlphaTestEnabled, mCullFaceEnabled); 61 60 62 if (mTexture) 63 mTexture->Bind(); 61 if (state->GetRenderPassType() == RenderState::DEFERRED) 62 { 63 if (mTexture) 64 { 65 cgGLSetTextureParameter(RenderState::sTexParam, mTexture->GetId()); 66 cgGLEnableTextureParameter(RenderState::sTexParam); 67 cgGLEnableTextureParameter(RenderState::sDirtTexParamTex); 68 } 69 else 70 { 71 cgGLDisableTextureParameter(RenderState::sTexParam); 72 } 73 } 64 74 else 65 glBindTexture(GL_TEXTURE_2D, 0); 75 { 76 if (mTexture) 77 mTexture->Bind(); 78 else 79 glBindTexture(GL_TEXTURE_2D, 0); 80 } 66 81 67 82 glMaterialfv(GL_FRONT, GL_AMBIENT, (float *)&mAmbientColor.r); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp
r2955 r2964 13 13 CGprogram RenderState::sCgMrtFragmentProgram = NULL; 14 14 CGprogram RenderState::sCgMrtFragmentTexProgram = NULL; 15 CGparameter RenderState::sTexParam; 16 CGparameter RenderState::sDirtTexParamTex; 17 15 18 16 19 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.h
r2955 r2964 81 81 static CGprogram sCgMrtFragmentTexProgram; 82 82 83 static CGparameter sTexParam; 84 85 static CGparameter sDirtTexParamTex; 83 86 84 87 protected: -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Texture.h
r2850 r2964 62 62 */ 63 63 void Create(); 64 64 /** Returns id of this texture. 65 */ 66 int GetId() const { return mTexId; } 65 67 66 68 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2963 r2964 39 39 #include "ObjConverter.h" 40 40 #include "SkyPreetham.h" 41 #include "Texture.h" 41 42 42 43 … … 167 168 PerfTimer frameTimer, algTimer; 168 169 170 Texture *dirtTexture = NULL; 171 169 172 170 173 /// the used render type for this render pass … … 269 272 static CGparameter sMaxDepthParam; 270 273 static CGparameter sMaxDepthParamTex; 274 271 275 static Matrix4x4 oldViewProjMatrix; 272 276 … … 454 458 camera->SetFar(Magnitude(bvh->GetBox().Diagonal())); 455 459 460 dirtTexture = new Texture(model_path + "waterstain.jpg"); 461 //dirtTexture = new Texture(model_path + "dirt.jpg"); 462 dirtTexture->Create(); 463 456 464 InitCg(); 457 465 … … 470 478 471 479 //const string aeroplaneStr = model_path + "toyplane.dem"; 472 const string aeroplaneStr = model_path + "city_full.dem";480 //const string aeroplaneStr = model_path + "city_full.dem"; 473 481 474 482 SceneEntityContainer dummy; 475 483 476 if (loader->Load(aeroplaneStr, dummy)) 477 cout << "successfully loaded " << dummy.size() << " scene entities" << endl; 478 else 479 { 480 cerr << "loading file " << aeroplaneStr << " failed" << endl; 481 482 CleanUp(); 483 exit(0); 484 } 485 484 486 485 string skyDomeStr(model_path + "sky.dem"); 487 486 … … 496 495 } 497 496 498 aeroplane = dummy[0]; 499 skyDome = dummy[1]; 497 skyDome = dummy[0]; 498 499 500 /*if (loader->Load(aeroplaneStr, dummy)) 501 cout << "successfully loaded " << dummy.size() << " scene entities" << endl; 502 else 503 { 504 cerr << "loading file " << aeroplaneStr << " failed" << endl; 505 506 CleanUp(); 507 exit(0); 508 } 509 510 aeroplane = dummy[1]; 500 511 501 512 aeroplane->GetTransform()->MultMatrix(transl); 502 513 */ 503 514 const float turbitiy = 3.0f; 504 515 preetham = new SkyPreetham(turbitiy, skyDome); … … 569 580 570 581 sMaxDepthParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "maxDepth"); 582 RenderState::sDirtTexParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "dirtTex"); 583 RenderState::sTexParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tex"); 584 585 cgGLEnableTextureParameter(RenderState::sDirtTexParamTex); 586 cgGLSetTextureParameter(RenderState::sDirtTexParamTex, dirtTexture->GetId()); 571 587 572 588 cgGLSetParameter1f(sMaxDepthParamTex, MAX_DEPTH_CONST / farDist); … … 1086 1102 { 1087 1103 // actually render the scene geometry using the specified algorithm 1088 //traverser->RenderScene(); 1104 traverser->RenderScene(); 1105 /* 1089 1106 state.Reset(); 1090 /* SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end(); 1107 aeroplane->Render(&state); 1108 1109 SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end(); 1091 1110 1092 1111 for (sit = sceneEntities.begin(); sit != sit_end; ++ sit) 1093 1112 { 1094 1113 renderQueue->Enqueue(*sit); 1095 }*/ 1096 1097 aeroplane->Render(&state); 1114 } 1098 1115 1099 1116 renderQueue->Apply(); 1117 */ 1100 1118 } 1101 1119 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r2954 r2964 29 29 //#define ILLUM_INTENSITY 9e-1f; 30 30 31 #define SSAO_MIPMAP_LEVEL 1 32 #define GI_MIPMAP_LEVEL 2 31 33 32 34 #endif // __SHADERENV_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r2904 r2964 92 92 93 93 // use lower lod level to improve cache coherence 94 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, 1)).xyz;95 float3 sample_color = tex2Dlod(colors, float4(texcoord, 0, 2)).xyz;94 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 95 float3 sample_color = tex2Dlod(colors, float4(texcoord, 0, GI_MIPMAP_LEVEL)).xyz; 96 96 97 97 float3 vector_to_sample = sample_position - centerPosition.xyz; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r2960 r2964 66 66 67 67 pixel fragtex(fragin IN, 68 uniform sampler2D tex, 69 uniform float maxDepth) 68 uniform sampler2D dirtTex, 69 uniform float maxDepth, 70 uniform sampler2D tex) 70 71 { 71 72 pixel pix; 72 73 74 //float4 dirtTexColor = tex2D(dirtTex, IN.texCoord.xy); 75 float4 texColor = tex2D(tex, IN.texCoord.xy); 76 73 77 // save color in first render target 74 78 // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 75 pix.col = (glstate.material.emission + glstate.material.diffuse) * tex2D(tex, IN.texCoord.xy); 79 //pix.col = (glstate.material.emission + glstate.material.diffuse) * texColor * dirtTexColor; 80 pix.col = (glstate.material.emission + glstate.material.diffuse) * texColor; 76 81 77 82 // save world position in second render target -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2911 r2964 73 73 74 74 // sample downsampled texture in order to speed up texture accesses 75 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, 1)).xyz;75 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 76 76 //float3 sample_position = tex2D(positions, texcoord).xyz; 77 77 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao3d.cg
r2903 r2964 76 76 ++ j; 77 77 // sample downsampled texture in order to speed up texture accesses 78 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, 1)).xyz;78 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 79 79 //float3 sample_position = tex2D(positions, texcoord).xyz; 80 80
Note: See TracChangeset
for help on using the changeset viewer.