- Timestamp:
- 10/10/08 13:53:22 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r3019 r3021 42 42 Optimization="0" 43 43 AdditionalIncludeDirectories="libs;libs/GL;libs/Devil/include;src;libs/Zlib/include;"$(CG_INC_PATH)"" 44 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS "44 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SET" 45 45 MinimalRebuild="true" 46 46 BasicRuntimeChecks="3" … … 244 244 </File> 245 245 <File 246 RelativePath=".\src\ShaderProgram.h" 247 > 248 </File> 249 <File 246 250 RelativePath=".\src\SkyPreetham.cpp" 247 251 > -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/AxisAlignedBox3.cpp
r2951 r3021 7 7 #include <cassert> 8 8 #include <iostream> 9 10 #ifdef _CRT_SET 11 #define _CRTDBG_MAP_ALLOC 12 #include <stdlib.h> 13 #include <crtdbg.h> 14 15 // redefine new operator 16 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 17 #define new DEBUG_NEW 18 #endif 19 9 20 10 21 using namespace std; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r2963 r3021 1 #include <queue>2 #include <stack>3 #include <fstream>4 #include <iostream>5 #include <iomanip>6 7 1 #include "Bvh.h" 8 2 #include "Camera.h" … … 15 9 #include "Material.h" 16 10 #include "gzstream.h" 11 12 #include <queue> 13 #include <stack> 14 #include <fstream> 15 #include <iostream> 16 #include <iomanip> 17 18 19 #ifdef _CRT_SET 20 #define _CRTDBG_MAP_ALLOC 21 #include <stdlib.h> 22 #include <crtdbg.h> 23 24 // redefine new operator 25 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 26 #define new DEBUG_NEW 27 #endif 17 28 18 29 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
r2964 r3021 6 6 #include "BvhLoader.h" 7 7 #include "gzstream.h" 8 9 10 #ifdef _CRT_SET 11 #define _CRTDBG_MAP_ALLOC 12 #include <stdlib.h> 13 #include <crtdbg.h> 14 15 // redefine new operator 16 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 17 #define new DEBUG_NEW 18 #endif 8 19 9 20 … … 65 76 BvhNode *root = LoadNextNode(stream, NULL); 66 77 67 #if 078 #if 1 68 79 69 80 bvh->mRoot = root; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3020 r3021 14 14 15 15 16 #ifdef _CRT_SET 17 #define _CRTDBG_MAP_ALLOC 18 #include <stdlib.h> 19 #include <crtdbg.h> 20 21 // redefine new operator 22 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 23 #define new DEBUG_NEW 24 #endif 25 26 16 27 using namespace std; 17 28 … … 62 73 63 74 ShaderContainer DeferredRenderer::sShaders; 75 64 76 65 77 /////////////////////////////////////// … … 347 359 DeferredRenderer::~DeferredRenderer() 348 360 { 361 CLEAR_CONTAINER(mFBOs); 362 glDeleteTextures(1, &noiseTex); 363 } 364 365 366 void DeferredRenderer::SetUseTemporalCoherence(bool temporal) 367 { 368 mUseTemporalCoherence = temporal; 369 } 370 371 372 void DeferredRenderer::ReleaseCG() 373 { 349 374 CLEAR_CONTAINER(sShaders); 350 CLEAR_CONTAINER(mFBOs); 351 352 glDeleteTextures(1, &noiseTex); 353 } 354 355 356 void DeferredRenderer::SetUseTemporalCoherence(bool temporal) 357 { 358 mUseTemporalCoherence = temporal; 359 } 360 361 362 void DeferredRenderer::Init(CGcontext context) 375 } 376 377 378 void DeferredRenderer::InitCG(CGcontext context) 363 379 { 364 380 ShaderProgram *pr; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r3019 r3021 4 4 #include "common.h" 5 5 #include "glInterface.h" 6 #include "ShaderProgram.h" 6 7 7 8 #include <Cg/cg.h> … … 20 21 21 22 22 class ShaderProgram23 {24 public:25 23 26 ShaderProgram(CGprogram program): mProgram(program) {}27 28 ~ShaderProgram() { cgDestroyProgram(mProgram); }29 30 CGprogram mProgram;31 };32 33 34 typedef std::vector<ShaderProgram *> ShaderContainer;35 24 typedef std::vector<FrameBufferObject *> FBOContainer; 36 25 … … 54 43 a smoothing factor for temporal coherence 55 44 */ 45 46 ~DeferredRenderer(); 47 56 48 void Render(FrameBufferObject *fbo, 57 49 const Matrix4x4 &oldProjViewMatrix, … … 63 55 ); 64 56 65 /** Initialises the deferred shader and loads the required shaders: 66 This function has to be called only once. 67 */ 68 static void Init(CGcontext context); 69 70 ~DeferredRenderer(); 71 57 72 58 void SetUseTemporalCoherence(bool temporal); 73 59 … … 78 64 79 65 void SetShadingMethod(SHADING_METHOD s); 66 67 /** Initialises the deferred shader and loads the required shaders: 68 This function has to be called only once. 69 */ 70 static void InitCG(CGcontext context); 71 /** Releases all shader resources. 72 */ 73 static void ReleaseCG(); 74 80 75 static int colorBufferIdx; 81 76 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
r3017 r3021 1 #include <iostream>2 1 #include "FrameBufferObject.h" 3 2 #include "glInterface.h" 3 #include <iostream> 4 5 6 #ifdef _CRT_SET 7 #define _CRTDBG_MAP_ALLOC 8 #include <stdlib.h> 9 #include <crtdbg.h> 10 11 // redefine new operator 12 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 13 #define new DEBUG_NEW 14 #endif 15 4 16 5 17 using namespace std; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
r2980 r3021 3 3 #include "glInterface.h" 4 4 #include "RenderState.h" 5 6 7 #ifdef _CRT_SET 8 #define _CRTDBG_MAP_ALLOC 9 #include <stdlib.h> 10 #include <crtdbg.h> 11 12 // redefine new operator 13 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 14 #define new DEBUG_NEW 15 #endif 5 16 6 17 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Polyhedron.cpp
r2944 r3021 3 3 #include "Polygon3.h" 4 4 #include "Plane3.h" 5 6 7 #ifdef _CRT_SET 8 #define _CRTDBG_MAP_ALLOC 9 #include <stdlib.h> 10 #include <crtdbg.h> 11 12 // redefine new operator 13 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 14 #define new DEBUG_NEW 15 #endif 5 16 6 17 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3019 r3021 13 13 14 14 15 #ifdef _CRT_SET 16 #define _CRTDBG_MAP_ALLOC 17 #include <stdlib.h> 18 #include <crtdbg.h> 19 20 // redefine new operator 21 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 22 #define new DEBUG_NEW 23 #endif 24 25 15 26 using namespace std; 16 27 … … 129 140 mTextureTable[i] = tex; 130 141 mTextures.push_back(tex); 142 143 delete [] texname; 131 144 } 132 145 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r3001 r3021 11 11 12 12 13 #ifdef _CRT_SET 14 #define _CRTDBG_MAP_ALLOC 15 #include <stdlib.h> 16 #include <crtdbg.h> 17 18 // redefine new operator 19 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 20 #define new DEBUG_NEW 21 #endif 22 23 13 24 using namespace std; 14 25 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
r3019 r3021 515 515 516 516 Polyhedron *clippedPolyhedron = box.CalcIntersection(*p); 517 518 517 DEL_PTR(p); 519 518 … … 715 714 glPopMatrix(); 716 715 717 718 716 glDisable(GL_POLYGON_OFFSET_FILL); 719 717 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r3020 r3021 7 7 #include "RenderState.h" 8 8 9 10 #ifdef _CRT_SET 11 #define _CRTDBG_MAP_ALLOC 12 #include <stdlib.h> 13 #include <crtdbg.h> 14 15 // redefine new operator 16 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 17 #define new DEBUG_NEW 18 #endif 19 20 9 21 using namespace CHCDemoEngine; 10 22 using namespace std; 11 12 23 13 24 … … 26 37 static CGparameter sMultiplierParam; 27 38 39 ShaderContainer SkyPreetham::sShaders; 28 40 29 41 … … 40 52 41 53 42 void SkyPreetham::Init (CGcontext context)54 void SkyPreetham::InitCG(CGcontext context) 43 55 { 56 ShaderProgram *pr; 57 44 58 sCgSkyProgram = 45 59 cgCreateProgramFromFile(context, … … 64 78 65 79 sMultiplierParam = cgGetNamedParameter(sCgSkyProgram, "multiplier"); 80 81 pr = new ShaderProgram(sCgSkyProgram); 82 sShaders.push_back(pr); 66 83 } 67 84 else … … 80 97 cgGLLoadProgram(sCgMrtFragmentSkyDomeProgram); 81 98 //cgGLSetParameter1f(sMaxDepthParam, MAX_DEPTH_CONST / farDist); 99 100 pr = new ShaderProgram(sCgMrtFragmentSkyDomeProgram); 101 sShaders.push_back(pr); 82 102 } 83 103 else 84 104 cerr << "fragment skyprogram failed to load" << endl; 105 } 106 107 108 void SkyPreetham::ReleaseCG() 109 { 110 CLEAR_CONTAINER(sShaders); 85 111 } 86 112 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.h
r2983 r3021 4 4 #include "glInterface.h" 5 5 #include "common.h" 6 #include "ShaderProgram.h" 7 6 8 #include <Cg/cg.h> 7 9 #include <Cg/cgGL.h> 8 10 9 11 10 namespace CHCDemoEngine {11 class Vector3;12 class SceneEntity;13 class RenderState;14 class Camera;12 namespace CHCDemoEngine { 13 class Vector3; 14 class SceneEntity; 15 class RenderState; 16 class Camera; 15 17 } 16 18 … … 20 22 /// Constructor taking sky turbitity as parameter and the sky dome geometry 21 23 SkyPreetham(float turbitity, CHCDemoEngine::SceneEntity *skyDome); 22 virtual ~SkyPreetham(); 24 25 ~SkyPreetham(); 23 26 24 void RenderSkyDome(const CHCDemoEngine::Vector3 &sunDir, CHCDemoEngine::Camera *camera, CHCDemoEngine::RenderState *state, bool scaleToRange); 25 26 static void Init(CGcontext context); 27 void RenderSkyDome(const CHCDemoEngine::Vector3 &sunDir, 28 CHCDemoEngine::Camera *camera, 29 CHCDemoEngine::RenderState *state, 30 bool scaleToRange); 27 31 28 32 void ComputeFactors(const CHCDemoEngine::Vector3 &sunDir, … … 35 39 CHCDemoEngine::Vector3 &diffuse, 36 40 bool scaleToRange) const; 41 42 static void InitCG(CGcontext context); 43 static void ReleaseCG(); 37 44 38 45 … … 53 60 54 61 float mTurbidity; 62 63 static CHCDemoEngine::ShaderContainer sShaders; 55 64 }; 56 65 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3020 r3021 1 1 // chcdemo.cpp : Defines the entry point for the console application. 2 2 // 3 4 5 #include "common.h" 3 6 4 7 #ifdef _CRT_SET … … 6 9 #include <stdlib.h> 7 10 #include <crtdbg.h> 8 #endif 9 10 #include "common.h" 11 12 #ifdef _CRT_SET 11 13 12 // redefine new operator 14 13 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 15 14 #define new DEBUG_NEW 16 15 #endif 17 18 16 19 17 #include <math.h> … … 490 488 InitCg(); 491 489 492 DeferredRenderer::Init (sCgContext);493 SkyPreetham::Init (sCgContext);490 DeferredRenderer::InitCG(sCgContext); 491 SkyPreetham::InitCG(sCgContext); 494 492 495 493 Vector3 cubeCenter(470.398f, 240.364f, 182.5f); … … 1788 1786 cgDestroyProgram(RenderState::sCgMrtFragmentTexProgram); 1789 1787 1788 DeferredRenderer::ReleaseCG(); 1789 SkyPreetham::ReleaseCG(); 1790 1790 1791 if (sCgContext) 1791 1792 cgDestroyContext(sCgContext); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/common.cpp
r3019 r3021 1 #include "common.h" 2 3 #ifdef _X_WINDOW_ 4 #include "xwindow.h" 5 #endif 6 7 #ifdef _CRT_SET 8 #define _CRTDBG_MAP_ALLOC 9 #include <stdlib.h> 10 #include <crtdbg.h> 11 12 // redefine new operator 13 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 14 #define new DEBUG_NEW 15 #endif 16 17 #include <stdlib.h> 1 18 #include <math.h> 2 19 #include <stdio.h> 3 #include <stdlib.h>4 20 #include <time.h> 5 6 #include "common.h"7 8 #ifdef _X_WINDOW_9 #include "xwindow.h"10 #endif11 21 12 22 #ifndef _MSC_VER … … 21 31 #include <sys/timeb.h> 22 32 #endif 33 23 34 24 35 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/common.h
r3019 r3021 504 504 #define INITIAL_TRIANGLES_PER_VIRTUAL_LEAVES 1000 505 505 506 507 } 508 509 #endif 510 511 512 513 514 515 516 517 506 } 507 508 509 510 #endif 511 512 513 514 515 516 517 518
Note: See TracChangeset
for help on using the changeset viewer.