Changeset 540 for trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
- Timestamp:
- 01/15/06 04:23:51 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
r535 r540 1242 1242 void X3dExporter::ExportBeam(const Beam &beam, const AxisAlignedBox3 &box) 1243 1243 { 1244 if (beam.mMesh) 1245 { 1246 ExportMesh(beam.mMesh); 1247 return; 1248 } 1249 1244 1250 PolygonContainer polys; 1245 1251 //ExportBox(beam.mBox); 1246 1252 1247 for (int i = 0; i < beam.mPlanes.size(); ++ i) 1248 { 1249 Polygon3 *poly = box.CrossSection(beam.mPlanes[i]); 1253 const float zfar = 2.0f * Magnitude(box.Diagonal()); 1254 1255 // box should not never remove part of beam polygons 1256 Vector3 bmin = beam.mBox.Min() - Vector3(zfar * 2.0); 1257 Vector3 bmax = beam.mBox.Max() + Vector3(zfar * 2.0); 1258 1259 AxisAlignedBox3 bbox(bmin, bmax); 1260 Plane3 fplane; 1261 fplane.mNormal = -beam.mPlanes[0].mNormal; 1262 1263 fplane.mD = beam.mPlanes[0].mD - zfar - 1.0f; 1264 1265 vector<Plane3> planes = beam.mPlanes; 1266 planes.push_back(fplane); 1267 1268 for (int i = 0; i < planes.size(); ++ i) 1269 { 1270 Polygon3 *poly = bbox.CrossSection(planes[i]); 1271 if (!poly->Valid(Limits::Small)) 1272 DEL_PTR(poly); 1250 1273 1251 for (int j = 0; (j < beam.mPlanes.size()) && poly; ++ j)1274 for (int j = 0; (j < planes.size()) && poly; ++ j) 1252 1275 { 1253 1276 if (j != i) … … 1256 1279 Polygon3 *back = new Polygon3(); 1257 1280 1258 poly->Split( beam.mPlanes[j], *front, *back, Limits::Small);1281 poly->Split(planes[j], *front, *back, Limits::Small); 1259 1282 DEL_PTR(poly); 1260 1283 DEL_PTR(front); … … 1269 1292 } 1270 1293 1271 1272 1294 ExportPolygons(polys); 1273 1295 CLEAR_CONTAINER(polys);
Note: See TracChangeset
for help on using the changeset viewer.