Changeset 502


Ignore:
Timestamp:
01/05/06 16:06:31 (18 years ago)
Author:
bittner
Message:

bsp viewcell location

Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp

    r497 r502  
    2626  //  timerId = startTimer(10); 
    2727  mFrame = 0; 
     28  mWireFrame = false; 
    2829} 
    2930 
     
    8182   
    8283  for (i=0; i < mesh->mFaces.size(); i++) { 
    83         glBegin(GL_POLYGON); 
     84        if (mWireFrame) 
     85          glBegin(GL_POLYGON); 
     86        else 
     87          glBegin(GL_LINE_LOOP); 
     88 
    8489        Face *face = mesh->mFaces[i]; 
    8590        for (int j = 0; j < face->mVertexIndices.size(); j++) { 
     
    309314  // now render im1 
    310315  if (viewcell) { 
     316        if (mTopView) { 
     317          mWireFrame = true; 
     318          RenderMeshInstance(viewcell); 
     319          mWireFrame = false; 
     320        } 
     321         
    311322        // init ortographic projection 
    312323        glMatrixMode(GL_PROJECTION); 
     
    388399 
    389400  makeCurrent(); 
    390  
    391401  SetupProjection(GetWidth(), GetHeight()); 
    392402   
     
    481491  mFrame++; 
    482492} 
     493 
     494 
     495void 
     496GlRendererWidget::SetupCamera() 
     497{ 
     498  if (!mTopView) 
     499        GlRenderer::SetupCamera(); 
     500  else { 
     501        float dist = Magnitude(mSceneGraph->GetBox().Diagonal())*0.05; 
     502        Vector3 pos = mViewPoint - dist*Vector3(mViewDirection.x, 
     503                                                                                        1, 
     504                                                                                        mViewDirection.y); 
     505         
     506        Vector3 target = mViewPoint + dist*mViewDirection; 
     507        Vector3 up(0,1,0); 
     508         
     509        glLoadIdentity(); 
     510        gluLookAt(mViewPoint.x, mViewPoint.y, mViewPoint.z, 
     511                          target.x, target.y, target.z, 
     512                          up.x, up.y, up.z); 
     513  } 
     514 
     515} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h

    r500 r502  
    2424  int frames; 
    2525  int errorFreeFrames; 
    26    
     26 
    2727  PvsRenderStatistics() { Reset(); } 
    2828   
     
    6161   
    6262  int mFrame; 
    63    
     63  bool mWireFrame; 
     64 
    6465  QWaitCondition mRenderingFinished; 
    6566   
     
    7677  void RenderMesh(Mesh *m); 
    7778  void SetupMaterial(Material *m); 
    78   void SetupCamera(); 
     79  virtual void SetupCamera(); 
    7980  void RandomViewPoint(); 
    8081   
     
    119120        makeCurrent(); 
    120121        InitGL(); 
    121          
     122        doneCurrent(); 
     123 
    122124  } 
    123125   
     
    142144public: 
    143145 
     146  // point of the last mouse click used for movement in the scene 
     147  Vector3 mousePoint; 
     148 
     149  bool mTopView; 
     150   
    144151  GlRendererWidget(SceneGraph *sceneGraph, 
    145152                                   ViewCellsManager *viewcells, 
     
    147154                                   ): 
    148155        GlRenderer(sceneGraph, viewcells), QGLWidget(parent, shareWidget, f) 
    149   {} 
     156  { 
     157        mTopView = false; 
     158  } 
    150159 
    151   Vector3 mousePoint; 
    152    
     160  virtual void SetupCamera(); 
     161 
    153162  void initializeGL() { 
    154163        InitGL(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Makefile

    r499 r502  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.0) on: st 4. I 19:53:26 2006 
     3# Generated by qmake (2.00a) (Qt 4.1.0) on: ?t 5. I 09:42:49 2006 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp

    r501 r502  
    610610                "#RssSamples\n" <<rssSamples<<endl; 
    611611           
    612         ComputeRenderError(); 
    613  
    614         mVssRays.PrintStatistics(mStats); 
    615         mViewCellsManager->PrintPvsStatistics(mStats); 
    616  
    617         VssRayContainer selectedRays; 
    618         int desired = Max( 
    619                                           mViewCellsManager->GetPostProcessSamples(), 
    620                                           mViewCellsManager->GetVisualizationSamples()); 
    621  
    622         mVssRays.SelectRays(desired, selectedRays); 
    623          
    624         //-- post process view cells 
    625         mViewCellsManager->PostProcess(mObjects, selectedRays); 
    626          
    627         //-- several visualizations and statistics 
    628         Debug << "view cells after post processing: " << endl; 
    629         mViewCellsManager->PrintStatistics(Debug); 
    630          
    631         if (1)  
    632           mViewCellsManager->Visualize(mObjects, selectedRays); 
    633   } 
     612 
     613          mVssRays.PrintStatistics(mStats); 
     614          mViewCellsManager->PrintPvsStatistics(mStats); 
     615           
     616          VssRayContainer selectedRays; 
     617          int desired = Max( 
     618                                                mViewCellsManager->GetPostProcessSamples(), 
     619                                                mViewCellsManager->GetVisualizationSamples()); 
     620           
     621          mVssRays.SelectRays(desired, selectedRays); 
     622           
     623          //-- post process view cells 
     624          mViewCellsManager->PostProcess(mObjects, selectedRays); 
     625           
     626          //-- several visualizations and statistics 
     627          Debug << "view cells after post processing: " << endl; 
     628          mViewCellsManager->PrintStatistics(Debug); 
     629           
     630          if (1)  
     631                mViewCellsManager->Visualize(mObjects, selectedRays); 
     632 
     633          ComputeRenderError(); 
     634           
     635        } 
    634636 
    635637 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r495 r502  
    26762676BspTree::GetViewCell(const Vector3 &point) 
    26772677{ 
     2678  if (mRoot == NULL) 
     2679        return NULL; 
     2680   
     2681 
    26782682  stack<BspNode *> nodeStack; 
    26792683  nodeStack.push(mRoot); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r501 r502  
    10351035                exporter->ExportPolygons(cell); 
    10361036        } 
     1037} 
     1038 
     1039ViewCell * 
     1040BspViewCellsManager::GetViewCell(const Vector3 &point) 
     1041{ 
     1042  if (!mBspTree) 
     1043        return NULL; 
     1044  return mBspTree->GetViewCell(point); 
    10371045} 
    10381046 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h

    r492 r502  
    344344 
    345345  /** Get a viewcell containing the specified point */ 
    346   ViewCell *GetViewCell(const Vector3 &point) { return NULL; } 
     346  ViewCell *GetViewCell(const Vector3 &point); 
    347347 
    348348protected: 
  • trunk/VUT/GtpVisibilityPreprocessor/src/default.env

    r497 r502  
    2323        useGlRenderer true 
    2424#       type sampling 
    25         type vss 
    26 #       type rss 
     25#       type vss 
     26        type rss 
    2727} 
    2828 
     
    169169        #type kdTree 
    170170        #type vspKdTree 
    171          type bspTree 
    172         # type vspBspTree 
     171        type bspTree 
     172        #type vspBspTree 
    173173         
    174174        #type sceneDependent 
Note: See TracChangeset for help on using the changeset viewer.