Changeset 1583 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/08/06 14:41:41 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Camera.cpp
r1582 r1583 42 42 int y; 43 43 44 bool exportRays = true;44 bool exportRays = false; 45 45 46 46 … … 62 62 SetupRay(ray, mWidth - (x + 1), mHeight - (y + 1)); 63 63 64 bool debug = false;64 bool debug = true; 65 65 // (y == mHeight/2) && (x== mWidth/3); 66 66 // MeshDebug = debug; … … 71 71 ray.mFlags &= ~(Ray::STORE_TESTED_OBJECTS|Ray::STORE_KDLEAVES); 72 72 73 if (tree->CastRay(ray)) 73 if (tree->CastRay(ray)) { 74 // cout<<"I1"; 75 74 76 if (ray.intersections.size()) { 75 cout<<"I";76 77 sort(ray.intersections.begin(), ray.intersections.end()); 77 78 MeshInstance *mesh = (MeshInstance*)ray.intersections[0].mObject; … … 86 87 87 88 } 89 } 88 90 pbuffer+=components; 89 91 -
GTP/trunk/Lib/Vis/Preprocessing/src/Camera.h
r878 r1583 26 26 27 27 Camera() { 28 mWidth = 1 400;29 mHeight = 100 0;28 mWidth = 100; 29 mHeight = 100; 30 30 mFovy = 90.0f*(float)M_PI/180.0f; 31 31 } -
GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp
r1551 r1583 28 28 ) 29 29 { 30 31 32 33 34 35 36 37 38 30 //cout << "internal ray" << endl; 31 int hits = 0; 32 static Ray ray; 33 Intersection hitA(simpleRay.mOrigin), hitB(simpleRay.mOrigin); 34 35 mPreprocessor.SetupRay(ray, simpleRay.mOrigin, simpleRay.mDirection); 36 ray.mFlags &= ~Ray::CULL_BACKFACES; 37 38 if (mKdTree->CastRay(ray)) 39 39 { 40 41 42 43 // cout << "hita: " << hitA.mPoint << " !obj: " << hitA.mObject << endl;40 hitA.mObject = ray.intersections[0].mObject; 41 hitA.mPoint = ray.Extrap(ray.intersections[0].mT); 42 hitA.mNormal = ray.intersections[0].mNormal; 43 // cout << "hita: " << hitA.mPoint << " !obj: " << hitA.mObject << endl; 44 44 } 45 46 47 48 49 45 46 mPreprocessor.SetupRay(ray, simpleRay.mOrigin, -simpleRay.mDirection); 47 ray.mFlags &= ~Ray::CULL_BACKFACES; 48 49 if (castDoubleRay && mKdTree->CastRay(ray)) 50 50 { 51 52 53 51 hitB.mObject = ray.intersections[0].mObject; 52 hitB.mPoint = ray.Extrap(ray.intersections[0].mT); 53 hitB.mNormal = ray.intersections[0].mNormal; 54 54 } 55 56 57 simpleRay,58 hitA,59 hitB,60 61 box,62 castDoubleRay,63 pruneInvalidRays64 );55 56 return ProcessRay( 57 simpleRay, 58 hitA, 59 hitB, 60 vssRays, 61 box, 62 castDoubleRay, 63 pruneInvalidRays 64 ); 65 65 } 66 66 -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r1551 r1583 607 607 float maxt = 1e6; 608 608 float mint = 0; 609 609 610 ray.ComputeInvertedDir(); 611 610 612 Intersectable::NewMail(); 611 613 -
GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp
r1581 r1583 24 24 Camera camera; 25 25 26 if ( 1)26 if (0) 27 27 { 28 28 // camera.LookAtBox(mPreprocessor->mKdTree->GetBox()); … … 36 36 } 37 37 38 if ( 2) {38 if (0) { 39 39 camera.LookInBox(mPreprocessor->mKdTree->GetBox()); 40 40 camera.SetPosition(camera.mPosition + Vector3(-250,0,-550)); … … 42 42 } 43 43 44 if ( 3) {44 if (0) { 45 45 camera.SetPosition( mPreprocessor->mKdTree->GetBox().Center() - Vector3(0,-100,0) ); 46 46 camera.SetDirection(Vector3(1, 0, 0)); -
GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp
r1199 r1583 36 36 { 37 37 // initialize inverted dir 38 invDir.SetValue(0.0 );38 invDir.SetValue(0.0, 0.0, 0.0); 39 39 40 40 SetId(); -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
r1551 r1583 26 26 const bool castDoubleRay) 27 27 { 28 29 30 31 32 33 34 28 VssRayContainer rays; 29 CastRay(simpleRay, rays, box, castDoubleRay); 30 31 if (!rays.empty()) 32 return rays.back(); 33 else 34 return NULL; 35 35 } 36 36 … … 123 123 if (validSample) 124 124 { 125 125 if (!pruneInvalidRays || hitA.mObject) 126 126 { 127 128 hitB.mPoint,129 hitA.mPoint,130 hitB.mObject,131 hitA.mObject,132 mPreprocessor.mPass,133 simpleRay.mPdf134 );135 136 137 138 127 VssRay *vssRay = new VssRay( 128 hitB.mPoint, 129 hitA.mPoint, 130 hitB.mObject, 131 hitA.mObject, 132 mPreprocessor.mPass, 133 simpleRay.mPdf 134 ); 135 136 vssRays.push_back(vssRay); 137 ++ hits; 138 //cout << "vssray 1: " << *vssRay << " " << vssRay->mTermination - vssRay->mOrigin << endl; 139 139 } 140 141 140 141 if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 142 142 { 143 144 hitA.mPoint,145 hitB.mPoint,146 hitA.mObject,147 hitB.mObject,148 mPreprocessor.mPass,149 simpleRay.mPdf150 );151 152 153 154 143 VssRay *vssRay = new VssRay( 144 hitA.mPoint, 145 hitB.mPoint, 146 hitA.mObject, 147 hitB.mObject, 148 mPreprocessor.mPass, 149 simpleRay.mPdf 150 ); 151 152 vssRays.push_back(vssRay); 153 ++ hits; 154 //cout << "vssray 2: " << *vssRay << endl; 155 155 } 156 156 } 157 157 158 158 return hits; 159 159 } -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r1581 r1583 90 90 91 91 92 #if 0 //matt: this moved up into preprocessor93 int94 RssPreprocessor::CastRay(95 Vector3 &viewPoint,96 Vector3 &direction,97 const float probability,98 VssRayContainer &vssRays99 )100 {101 int hits = 0;102 static Ray ray;103 Intersectable *objectA, *objectB;104 Vector3 pointA, pointB;105 106 // AxisAlignedBox3 box = Union(mKdTree->GetBox(), mViewCellsManager->GetViewSpaceBox());107 108 AxisAlignedBox3 box = mViewCellsManager->GetViewSpaceBox();109 110 AxisAlignedBox3 sbox = box;111 sbox.Enlarge(Vector3(-Limits::Small));112 if (!sbox.IsInside(viewPoint))113 return 0;114 115 SetupRay(ray, viewPoint, direction);116 ray.mFlags &= ~Ray::CULL_BACKFACES;117 118 // cast ray to KD tree to find intersection with other objects119 float bsize = Magnitude(box.Size());120 121 122 if (mKdTree->CastRay(ray)) {123 objectA = ray.intersections[0].mObject;124 pointA = ray.Extrap(ray.intersections[0].mT);125 if (mDetectEmptyViewSpace)126 if (DotProd(ray.intersections[0].mNormal, direction) >= 0) {127 // discard the sample128 return 0;129 }130 131 } else {132 objectA = NULL;133 // compute intersection with the scene bounding box134 float tmin, tmax;135 if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax)136 pointA = ray.Extrap(tmax);137 else138 return 0;139 }140 141 142 SetupRay(ray, viewPoint, -direction);143 ray.mFlags &= ~Ray::CULL_BACKFACES;144 145 if (mKdTree->CastRay(ray)) {146 objectB = ray.intersections[0].mObject;147 pointB = ray.Extrap(ray.intersections[0].mT);148 if (mDetectEmptyViewSpace)149 if (DotProd(ray.intersections[0].mNormal, direction) <= 0) {150 // discard the sample151 return 0;152 }153 } else {154 objectB = NULL;155 float tmin, tmax;156 if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax)157 pointB = ray.Extrap(tmax);158 else159 return 0;160 }161 162 163 VssRay *vssRay = NULL;164 bool validSample = (objectA != objectB);165 if (validSample) {166 if (objectA) {167 vssRay = new VssRay(pointB,168 pointA,169 objectB,170 objectA,171 mPass,172 probability173 );174 vssRays.push_back(vssRay);175 hits ++;176 }177 178 if (objectB) {179 vssRay = new VssRay(pointA,180 pointB,181 objectA,182 objectB,183 mPass,184 probability185 );186 vssRays.push_back(vssRay);187 hits ++;188 }189 }190 191 return hits;192 }193 #endif194 92 195 93 void -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1581 r1583 44 44 type rss 45 45 # type render 46 detectEmptyViewSpace false46 detectEmptyViewSpace true 47 47 # pvsRenderErrorSamples 0 48 48 pvsRenderErrorSamples 5000 … … 53 53 visibilityFilterWidth 0.01 54 54 visibilityFile visibility.xml 55 loadMeshes true55 loadMeshes false 56 56 loadKdTree false 57 57 exportKdTree false 58 59 58 } 60 59 … … 344 343 # minGlobalCostRatio 0.0001 345 344 # $$MAXVIEWCELLS 346 maxViewCells 1000345 maxViewCells 5000 347 346 348 347
Note: See TracChangeset
for help on using the changeset viewer.