Changeset 3270


Ignore:
Timestamp:
01/12/09 03:36:41 (15 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3269 r3270  
    99#filename=vienna_full_hp 
    1010#filename=procedural_pompeii_area6_hires/pompeii_full 
    11 filename=procedural_pompeii_area6_hires/pompeii_part 
     11filename=procedural_pompeii_area6_hires/pompeii_part1 
    1212#filename=city 
    1313useLODs=1 
     
    5050# initial camera position 
    5151#camPosition=483.398f 242.364f 186.078f 
     52# pompeii view point 
    5253camPosition=1300.0f -2500.0f 10.0f 
    5354 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp

    r3269 r3270  
    761761        { 
    762762                BvhNode *node = *lit; 
    763  
    764763                Vector3 v; 
    765764 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3247 r3270  
    270270        string textures[] = {"flare4.tga", "lens2.jpg", "lens3.jpg", "lens4.jpg", "lens1.jpg"}; 
    271271 
     272        // todo: delete halo textures 
    272273        for (int i = 0; i < 5; ++ i) 
    273274        { 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp

    r3259 r3270  
    33#include "Geometry.h" 
    44#include "Shape.h" 
    5  
     5#include "Plane3.h" 
    66 
    77using namespace std; 
     
    5353 
    5454 
     55SceneEntity *SceneEntityConverter::ConvertSphere(float radius, 
     56                                                                                                 float xspans, 
     57                                                                                                 float yspans, 
     58                                                                                                 Material *mat,  
     59                                                                                                 Transform3 *trafo) 
     60{ 
     61        // todo 
     62        return NULL; 
    5563} 
     64 
     65 
     66SceneEntity *SceneEntityConverter::ConvertPlane(const Plane3 &plane,  
     67                                                                                                float xsize,  
     68                                                                                                float ysize, 
     69                                                                                                float xspans, 
     70                                                                                                float yspans, 
     71                                                                                                Material *mat, 
     72                                                                                                Transform3 *trafo) 
     73{ 
     74        SceneEntity *ent = new SceneEntity(trafo); 
     75 
     76        vector<Triangle3> triangles; 
     77 
     78        Vector3 x1, x2, x3, x4; 
     79        float xsize_h = xsize * 0.5f; 
     80        float ysize_h = xsize * 0.5f; 
     81 
     82        x1 = Vector3(xsize_h, ysize_h, 0); 
     83        x2 = Vector3(xsize_h, -ysize_h, 0); 
     84        x3 = Vector3(-xsize_h, -ysize_h, 0); 
     85        x4 = Vector3(-xsize_h, ysize_h, 0); 
     86         
     87        triangles.push_back(Triangle3(x3, x2, x1)); 
     88        triangles.push_back(Triangle3(x3, x1, x4)); 
     89 
     90        Vector3 *vertices = new Vector3[6]; 
     91        Vector3 *normals = new Vector3[6]; 
     92        Texcoord2 *tex = new Texcoord2[6]; 
     93 
     94        tex[0].first = 0; tex[0].second = 0; 
     95        tex[1].first = 1; tex[1].second = 0; 
     96        tex[2].first = 1; tex[2].second = 1; 
     97 
     98        tex[3].first = 0; tex[3].second = 0; 
     99        tex[4].first = 1; tex[4].second = 1; 
     100        tex[5].first = 0; tex[5].second = 1; 
     101 
     102        for (size_t i = 0; i < triangles.size(); ++ i) 
     103        { 
     104                Triangle3 tri = triangles[i]; 
     105 
     106                vertices[i * 3 + 0] = tri.mVertices[0]; 
     107                vertices[i * 3 + 1] = tri.mVertices[1]; 
     108                vertices[i * 3 + 2] = tri.mVertices[2]; 
     109 
     110                Vector3 normal = tri.GetNormal(); 
     111 
     112                normals[i * 3 + 0] = normal; 
     113                normals[i * 3 + 1] = normal; 
     114                normals[i * 3 + 2] = normal; 
     115        } 
     116 
     117        Geometry *geom = new Geometry(vertices, normals, tex, 6, true, NULL); 
     118 
     119        Shape *shape = new Shape(geom, mat); 
     120        ent->AddShape(shape); 
     121 
     122        LODLevel lodLevel(0); 
     123 
     124        lodLevel.AddShape(shape); 
     125        ent->AddLODLevel(lodLevel); 
     126 
     127        return ent; 
     128} 
     129 
     130} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.h

    r3216 r3270  
    1313class Camera; 
    1414class SceneEntity; 
     15class Plane3; 
     16 
    1517 
    1618/** Class that converts geometric objects to scene entities 
     
    1921{ 
    2022public: 
    21          
    2223        /** Creates a scene entity. 
    2324        */ 
    2425        SceneEntityConverter() {}; 
    25         /** Converts this box to a scene entity 
     26        /** Converts a box to a scene entity 
    2627        */ 
    2728        SceneEntity *ConvertBox(const AxisAlignedBox3 &box, Material *mat, Transform3 *trafo);   
    28         /** Converts the box to a scene entity 
     29        /** Converts a sphere to a scene entity 
    2930        */ 
    3031        SceneEntity *ConvertSphere(float radius, float xspans, float yspans, Material *mat, Transform3 *trafo);  
     32        /** Converts a plane to a scene entity 
     33        */ 
     34        SceneEntity *ConvertPlane(const Plane3 &plane,  
     35                                      float xsize,  
     36                                                          float ysize, 
     37                                                          float xspans,  
     38                                                          float yspans, 
     39                                                          Material *mat,  
     40                                                          Transform3 *trafo); 
    3141}; 
    3242 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3269 r3270  
    587587        //LoadModel("sibenik.dem", dynamicObjects); 
    588588 
    589         //LoadModel("procedural_pompeii_area6_hires/pompeii.dem", dynamicObjects); 
    590 /* 
    591         AxisAlignedBox3 box; 
    592         box.Initialize(); 
    593  
    594         const Vector3 offs(.0f, 3000.0f, 180); 
    595         //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
     589        // todo: dispose texture 
     590        Texture *floorTex = new Texture(model_path + "stairs.c.01.tif"); 
     591 
     592        floorTex->SetBoundaryModeS(Texture::REPEAT); 
     593        floorTex->SetBoundaryModeT(Texture::REPEAT); 
     594 
     595        floorTex->Create(); 
     596 
     597 
     598        Material *mymat = resourceManager->CreateMaterial(); 
     599 
     600        mymat->GetTechnique(0)->SetDiffuse(RgbaColor(1, 1, 1, 1)); 
     601        mymat->GetTechnique(0)->SetTexture(floorTex); 
     602 
     603        const Vector3 offs(1300.0f, -2500.0f, .0f); 
    596604        Matrix4x4 moffs = TranslationMatrix(offs); 
    597605 
    598         for (size_t i = 0; i < dynamicObjects.size(); ++ i) 
    599         { 
    600                 dynamicObjects[i]->GetTransform()->SetMatrix(moffs); 
    601                 box.Include(dynamicObjects[i]->GetWorldBoundingBox()); 
    602         } 
    603  
    604         cout << "pompeii bb:\n" << box << endl; 
    605 */ 
     606        Plane3 plane; 
     607        Transform3 *mytrafo = resourceManager->CreateTransform(moffs); 
     608 
     609        SceneEntity *myplane =  
     610                SceneEntityConverter().ConvertPlane(plane,  
     611                                                    500,  
     612                                                                                        500, 
     613                                                                                        5,  
     614                                                                                        5, 
     615                                                                                        mymat,  
     616                                                                                        mytrafo); 
     617 
     618        resourceManager->AddSceneEntity(myplane); 
     619        staticObjects.push_back(myplane); 
     620        /*const float side = 400.0f; 
     621        AxisAlignedBox3 mybox(Vector3(-side, -side, -side), Vector3(side, side, side)); 
     622 
     623        Transform3 *mytrafo2 = resourceManager->CreateTransform(moffs); 
     624 
     625        SceneEntity *myboxEnt =  
     626                SceneEntityConverter().ConvertBox(mybox, mymat, mytrafo2); 
     627 
     628        staticObjects.push_back(myboxEnt); 
     629        resourceManager->AddSceneEntity(myboxEnt);*/ 
     630 
    606631#if 0 
    607632        const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 
     
    698723        //-- occlusion query for sun 
    699724 
    700         // todo: clean up material 
    701725        Material *mat = resourceManager->CreateMaterial(); 
    702726 
Note: See TracChangeset for help on using the changeset viewer.