Changeset 1940 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/04/07 21:39:44 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 3 added
- 11 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1931 r1940 149 149 void InitGL(); 150 150 151 virtual int GetWidth() const = 0;152 virtual int GetHeight() const = 0;151 virtual int GetWidth() const { return 0; } 152 virtual int GetHeight() const { return 0; } 153 153 154 154 int GetId(int r, int g, int b) const; … … 164 164 165 165 public: 166 166 167 int mFrame; 167 168 bool mWireFrame; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1932 r1940 740 740 Environment::GetSingleton()->GetStringValue("ViewCells.geometryFilename", vcGeomFilename); 741 741 742 // create view cells from specified geometry 742 743 if (loadVcGeometry) 743 744 { … … 769 770 770 771 mViewCellsManager->SetRenderer(mRenderSimulator); 771 772 772 773 773 mViewCellsManager->SetPreprocessor(this); 774 774 775 return true; 775 776 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r1936 r1940 217 217 OptimizeForProcessor="3" 218 218 OptimizeForWindowsApplication="TRUE" 219 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl" "219 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";"$(CG_INC_PATH)"" 220 220 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT" 221 221 ExceptionHandling="TRUE" … … 384 384 <File 385 385 RelativePath="..\src\glInterface.h"> 386 </File> 387 <File 388 RelativePath=".\GlobalLinesRenderer.cpp"> 389 </File> 390 <File 391 RelativePath=".\GlobalLinesRenderer.h"> 386 392 </File> 387 393 <File … … 694 700 </File> 695 701 <File 702 RelativePath=".\RenderTexture.cpp"> 703 </File> 704 <File 705 RelativePath=".\RenderTexture.h"> 706 </File> 707 <File 696 708 RelativePath="..\src\ResourceManager.h"> 697 709 </File> -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/GlobalLinesRenderer.cpp
r1939 r1940 6 6 #include <Cg/cgGL.h> 7 7 8 //#include <QVBoxLayout>8 #include <QtOpenGL> 9 9 10 10 namespace GtpVisibilityPreprocessor { … … 14 14 static CGprofile sCgFragmentProfile; 15 15 16 16 17 static void handleCgError() 17 18 { 18 Debug<< "Cg error: " << cgGetErrorString(cgGetError()) << endl;19 cerr << "Cg error: " << cgGetErrorString(cgGetError()) << endl; 19 20 exit(1); 20 21 } 21 22 22 /*QtGlRendererBuffer::~QtGlRendererBuffer() 23 24 GlobalLinesRenderer::GlobalLinesRenderer(QGLPixelBuffer *buffer1, QGLPixelBuffer *buffer2): 25 mNewBuffer(buffer1), mOldBuffer(buffer2) 23 26 { 24 if (sCgFragmentProgram) 25 cgDestroyProgram(sCgFragmentProgram); 27 } 28 29 30 GlobalLinesRenderer::~GlobalLinesRenderer() 31 { 26 32 if (sCgDepthPeelingProgram) 27 33 cgDestroyProgram(sCgDepthPeelingProgram); … … 30 36 } 31 37 32 */ 38 39 void GlobalLinesRenderer::CastGlobalLines(Beam &beam, const int samples) 40 { 41 // bind pixel shader implementing the front depth buffer functionality 42 cgGLBindProgram(sCgDepthPeelingProgram); 43 cgGLEnableProfile(sCgFragmentProfile); 44 45 ApplyDepthPeeling(beam, samples); 46 } 47 48 49 void GlobalLinesRenderer::DrawGeometry() 50 { 51 } 52 53 void GlobalLinesRenderer::ApplyDepthPeeling(Beam &beam, const int samples) 54 { 55 /* if (rtNew->IsDoubleBuffered()) 56 glDrawBuffer(GL_BACK); 57 58 rtNew->BeginCapture(); 59 { 60 cgGLBindProgram(passthru); 61 glColor3f(0,0.0,0.0); 62 DrawGeometry(); //just random geomerty 63 } 64 rtNew->EndCapture(); 65 66 for(int l = 0; l < mCurrentDepth; l++) 67 { 68 // Peel another layer 69 pingpong(); // switch pointer between rendertextures 70 71 rtNew->BeginCapture(); 72 { 73 if (rtNew->IsDoubleBuffered()) 74 glDrawBuffer(GL_BACK); 75 76 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 77 78 cgGLBindProgram(fragmentProgram); 79 cgGLSetTextureParameter(input1, rtOld->GetDepthTextureID()); 80 cgGLEnableTextureParameter(input1); 81 82 glColor3f(0,0.0,0.0); 83 DrawGeometry(); 84 cgGLDisableTextureParameter(input1); 85 } 86 rtNew->EndCapture(); 87 }*/ 88 } 33 89 34 90 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/GlobalLinesRenderer.h
r1939 r1940 7 7 class Beam; 8 8 class Intersectable; 9 class QGLPixelBuffer; 10 9 11 struct VssRayContainer; 10 12 … … 14 16 class __declspec(dllexport) GlobalLinesRenderer 15 17 { 16 GlobalLinesRenderer();//(QtGlPixelBuffer *buffer1, QtGlPixelBuffer *buffer2); 17 18 GlobalLinesRenderer(QGLPixelBuffer *buffer1, QGLPixelBuffer *buffer2); 18 19 ~GlobalLinesRenderer(); 19 20 20 21 void CastGlobalLines(Beam &beam, const int samples); 21 22 22 23 23 void InitGL(); … … 33 33 private: 34 34 35 /** Draws the geometry for one pass. 36 */ 37 void DrawGeometry(); 38 35 39 void ApplyDepthPeeling(Beam &beam, const int samples); 36 40 … … 38 42 const Beam &beam); 39 43 44 QGLPixelBuffer *mNewBuffer; 45 QGLPixelBuffer *mOldBuffer; 40 46 }; 41 47 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r1935 r1940 786 786 up.x, up.y, up.z); 787 787 } 788 789 790 void QtGlRendererBuffer::CastGlobalLine(Beam &beam, const int samples)791 {792 // bind pixel shader implementing the front depth buffer functionality793 cgGLBindProgram(sCgFragmentProgram);794 cgGLEnableProfile(sCgFragmentProfile);795 796 DepthPeeling(beam, samples);797 }798 799 800 void QtGlRendererBuffer::DepthPeeling(Beam &beam, const int samples)801 {802 /* if (rtNew->IsDoubleBuffered())803 glDrawBuffer(GL_BACK);804 805 rtNew->BeginCapture();806 {807 cgGLBindProgram(passthru);808 glColor3f(0,0.0,0.0);809 DrawGeometry(); //just random geomerty810 }811 rtNew->EndCapture();812 813 for(int l = 0; l < mCurrentDepth; l++)814 {815 // Peel another layer816 pingpong(); // switch pointer between rendertextures817 818 rtNew->BeginCapture();819 {820 if (rtNew->IsDoubleBuffered())821 glDrawBuffer(GL_BACK);822 823 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);824 825 cgGLBindProgram(fragmentProgram);826 cgGLSetTextureParameter(input1, rtOld->GetDepthTextureID());827 cgGLEnableTextureParameter(input1);828 829 glColor3f(0,0.0,0.0);830 DrawGeometry();831 cgGLDisableTextureParameter(input1);832 }833 rtNew->EndCapture();834 }*/835 }836 788 837 789 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r1935 r1940 94 94 ); 95 95 96 void CastGlobalLine(Beam &beam,97 const int samples);98 99 void DepthPeeling(Beam &beam, const int samples);100 101 96 void InitGL(); 102 97 -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r1936 r1940 193 193 OptimizeForProcessor="3" 194 194 OptimizeForWindowsApplication="TRUE" 195 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(QTDIR)\include\QtOpenGl";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtCore";"$(QTDIR)\include" "196 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT "195 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(QTDIR)\include\QtOpenGl";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtCore";"$(QTDIR)\include";QtInterface" 196 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;TRY_GLOBAL_LINES" 197 197 RuntimeLibrary="2" 198 198 RuntimeTypeInfo="TRUE" … … 205 205 <Tool 206 206 Name="VCLinkerTool" 207 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib"207 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib cg.lib cgGL.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtInterface.lib" 208 208 OutputFile="../bin/release/Preprocessor.exe" 209 209 LinkIncremental="1" 210 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;"$(QTDIR)\lib";.\Qt GlRenderer\Release"210 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;"$(QTDIR)\lib";.\QtInterface\Release;"$(CG_LIB_PATH)"" 211 211 GenerateDebugInformation="FALSE" 212 212 SubSystem="1" -
GTP/trunk/Lib/Vis/Preprocessing/src/depth_peeling.cg
r1935 r1940 2 2 float3 main(in float4 col : COL0, 3 3 in float3 pos : WPOS, 4 uniform samplerRECT curentDepth) : COLOR4 uniform samplerRECT depthTex) : COLOR 5 5 { 6 float zold = texRECT( currentDepth, pos.xy);6 float zold = texRECT(depthTex, pos.xy); 7 7 if(pos.z < (zold + .000001)) 8 8 discard; -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1933 r1940 28 28 #include "ObjExporter.h" 29 29 #include "SceneGraph.h" 30 #include "GlobalLinesRenderer.h" 30 31 31 32 #include "ViewCellsManager.h" … … 52 53 //Preprocessor *preprocessor = NULL; 53 54 GlRendererWidget *rendererWidget = NULL; 55 //GlobalLinesRenderer *globalLinesRenderer = NULL; 56 54 57 55 58 // DLL function signature … … 258 261 PreprocessorThread *pt = NULL; 259 262 263 #ifdef TRY_GLOBAL_LINES 264 GlRenderer *renderer = new GlRenderer(preprocessor->mSceneGraph, 265 preprocessor->mViewCellsManager, 266 preprocessor->mKdTree); 267 268 globalLinesRenderer = new GlobalLinesRenderer(preprocessor, renderer); 269 globalLinesRenderer->InitGl(); 270 globalLinesRenderer->Run(); 271 272 #else 273 260 274 #ifdef USE_QT 261 275 … … 334 348 if (!guiSupported) 335 349 { 336 cout << "warning: gui not supported!" << endl; 350 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 351 cout << "warning: gui not supported!" << endl; 337 352 338 353 preprocessor->mUseGlRenderer = false; … … 346 361 pt->Main(); 347 362 } 348 363 #endif 349 364 // release memory 350 365 Cleanup();
Note: See TracChangeset
for help on using the changeset viewer.