Changeset 3270
- Timestamp:
- 01/12/09 03:36:41 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3269 r3270 9 9 #filename=vienna_full_hp 10 10 #filename=procedural_pompeii_area6_hires/pompeii_full 11 filename=procedural_pompeii_area6_hires/pompeii_part 11 filename=procedural_pompeii_area6_hires/pompeii_part1 12 12 #filename=city 13 13 useLODs=1 … … 50 50 # initial camera position 51 51 #camPosition=483.398f 242.364f 186.078f 52 # pompeii view point 52 53 camPosition=1300.0f -2500.0f 10.0f 53 54 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3269 r3270 761 761 { 762 762 BvhNode *node = *lit; 763 764 763 Vector3 v; 765 764 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3247 r3270 270 270 string textures[] = {"flare4.tga", "lens2.jpg", "lens3.jpg", "lens4.jpg", "lens1.jpg"}; 271 271 272 // todo: delete halo textures 272 273 for (int i = 0; i < 5; ++ i) 273 274 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp
r3259 r3270 3 3 #include "Geometry.h" 4 4 #include "Shape.h" 5 5 #include "Plane3.h" 6 6 7 7 using namespace std; … … 53 53 54 54 55 SceneEntity *SceneEntityConverter::ConvertSphere(float radius, 56 float xspans, 57 float yspans, 58 Material *mat, 59 Transform3 *trafo) 60 { 61 // todo 62 return NULL; 55 63 } 64 65 66 SceneEntity *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 13 13 class Camera; 14 14 class SceneEntity; 15 class Plane3; 16 15 17 16 18 /** Class that converts geometric objects to scene entities … … 19 21 { 20 22 public: 21 22 23 /** Creates a scene entity. 23 24 */ 24 25 SceneEntityConverter() {}; 25 /** Converts thisbox to a scene entity26 /** Converts a box to a scene entity 26 27 */ 27 28 SceneEntity *ConvertBox(const AxisAlignedBox3 &box, Material *mat, Transform3 *trafo); 28 /** Converts the boxto a scene entity29 /** Converts a sphere to a scene entity 29 30 */ 30 31 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); 31 41 }; 32 42 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3269 r3270 587 587 //LoadModel("sibenik.dem", dynamicObjects); 588 588 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); 596 604 Matrix4x4 moffs = TranslationMatrix(offs); 597 605 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 606 631 #if 0 607 632 const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); … … 698 723 //-- occlusion query for sun 699 724 700 // todo: clean up material701 725 Material *mat = resourceManager->CreateMaterial(); 702 726
Note: See TracChangeset
for help on using the changeset viewer.