Ignore:
Timestamp:
06/19/08 18:07:09 (16 years ago)
Author:
mattausch
Message:

updated the camera model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/CHC_revisited/SceneQuery.cpp

    r2776 r2778  
    33#include "Vector3.h" 
    44#include "Camera.h" 
     5#include "SceneQuery.h" 
     6#include "RenderTraverser.h" 
    57 
    68 
     
    2022 
    2123 
    22 SceneQuery::SceneQuery(const AxisAlignedBox3 &sceneBox):  
     24SceneQuery::SceneQuery(const AxisAlignedBox3 &sceneBox, RenderTraverser *renderer):  
    2325mSceneBox(sceneBox) 
    2426{ 
    25         Prepare(); 
     27        Prepare(renderer); 
    2628} 
    2729 
     
    4547} 
    4648 
    47 void SceneQuery::Prepare() 
     49 
     50void SceneQuery::Prepare(RenderTraverser *renderer) 
    4851{ 
    4952        cout << "Preparing scene queries" << endl; 
     
    5659        pos.z = mSceneBox.Center(2); 
    5760 
    58         Camera *orthoCam = new Camera(); 
    59         //orthoCam->SetOrtho(true); 
    60  
    61         // contain match scene bounding box; 
    62  
    6361        // for ortho cam this is the width 
    6462        const Vector3 len = mSceneBox.Size(); 
    65 /* 
    66         orthoCam->SetFov(len.x); 
    67         orthoCam->SetAspect(len.x / len.y); 
     63 
     64        Camera *orthoCam = new Camera(len.x, len.y); 
     65        orthoCam->SetOrtho(true); 
    6866 
    6967        orthoCam->SetNear(0.0f); 
     
    7270        orthoCam->SetPosition(pos); 
    7371 
    74         OUT1("fov: " << orthoCam->GetFov()); 
    75         OUT1("near: " << orthoCam->GetNear()); 
    76         OUT1("far: " << orthoCam->GetFar()); 
    77         OUT1("aspect: " << orthoCam->GetAspect()); 
     72        cout << "fov: " << orthoCam->GetFov() << endl; 
     73        cout << "near: " << orthoCam->GetNear() << endl; 
     74        cout << "far: " << orthoCam->GetFar() << endl; 
     75        cout << "aspect: " << orthoCam->GetAspect() << endl; 
    7876 
    79         OUT1("pos: " << orthoCam->GetPosition()); 
    80         OUT1("view: " << orthoCam->GetViewDirection()); 
    81         OUT1("up: " << orthoCam->GetViewUpVector()); 
     77        cout << "pos: " << orthoCam->GetPosition() << endl; 
     78        cout << "view: " << orthoCam->GetDirection() << endl; 
     79        cout << "up: " << orthoCam->GetUpVector() << endl; 
    8280 
    83         const float pitch = 0; 
    84         const float yaw = YA_PI * 0.5f; 
     81        //orthoCam->SetDirection(Vector3(0, 1, 0)); 
     82        orthoCam->Yaw(M_PI * 0.5f); 
    8583         
    86         OffscreenRenderArea *of = new OffscreenRenderArea(); 
     84        renderer->SetCamera(orthoCam); 
    8785 
    88         of->Init(viewport[2], viewport[3]); 
    89         of->SetRenderAction(new GLRenderAction); 
    90          
    91         of->SetCamera(orthoCam); 
    92         of->SetSceneRoot(mSceneRoot); 
    93          
    94         of->Render(); 
     86        //OffscreenRenderArea *of = new OffscreenRenderArea(); 
     87        //of->Init(viewport[2], viewport[3]); 
    9588 
    96         sDepth = of->GetDepthFloat(); 
    97         */ 
     89        renderer->RenderScene(); 
     90        //sDepth = of->GetDepthFloat(); 
     91 
     92        delete orthoCam; 
    9893} 
    9994 
Note: See TracChangeset for help on using the changeset viewer.