Changeset 207
- Timestamp:
- 12/31/09 06:32:55 (7 months ago)
- Location:
- pTolemy3DViewer/branches/refactor-0.1.1/src/org/ptolemy3d
- Files:
-
- 3 modified
-
plugin/CityGmlBuildingArea.java (modified) (2 diffs)
-
plugin/CityGmlPlugin.java (modified) (1 diff)
-
view/Camera.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pTolemy3DViewer/branches/refactor-0.1.1/src/org/ptolemy3d/plugin/CityGmlBuildingArea.java
r203 r207 11 11 import org.ptolemy3d.math.Math3D; 12 12 import org.ptolemy3d.math.Vector3d; 13 import org.ptolemy3d.scene.Landscape; 13 14 import org.ptolemy3d.view.Camera; 14 15 … … 74 75 } 75 76 77 public boolean isVisible(Camera camera) { 78 if((lod1Triangles == null) && (lod2Triangles == null)) { 79 return true; //Always visible if not initialized 80 } 81 return camera.isTileInView( 82 getMinLon(), getMaxLon(), 83 getMinLat(), getMaxLat(), 84 getMaxAlt(), getMaxAlt(), getMaxAlt(), getMaxAlt()); 85 } 86 87 public double getMinLat() { return minLat; } 88 public double getMaxLat() { return maxLat; } 89 90 public double getMinLon() { return minLon; } 91 public double getMaxLon() { return maxLon; } 92 93 public double getMinAlt() { return minAlt; } 94 public double getMaxAlt() { return maxAlt; } 95 76 96 /** 77 97 * Convert all building surfaces into vertex that can be rendered by the -
pTolemy3DViewer/branches/refactor-0.1.1/src/org/ptolemy3d/plugin/CityGmlPlugin.java
r203 r207 201 201 // altitude parameter. 202 202 for (CityGmlBuildingArea buildingArea : buildingAreas) { 203 if (!buildingArea.isVisible(camera)) { 204 continue; 205 } 206 207 double camAltitude = camera.getPosition().getAltitudeDD(); 208 209 // Decide if show LOD1 or LOD2 depending on the altitude 203 210 TriangleList cityTriangles = null; 204 // Decide if show LOD1 or LOD2 depending on the altitude205 double camAltitude = camera.getPosition().getAltitudeDD();206 211 if (camAltitude < altitude) { 207 212 cityTriangles = buildingArea.getLod1Geometry(); -
pTolemy3DViewer/branches/refactor-0.1.1/src/org/ptolemy3d/view/Camera.java
r174 r207 516 516 } 517 517 518 public boolean isTileInView(double leftLon, double rightLon, double upLat, double botLat, 519 double upLeftHeight, double botLeftHeight, double botRightHeight, double upRightHeight) { 520 /* 521 * FIXME At north pose for close view, the visibility goes wrong 522 */ 523 524 // Tile corners 525 Math3D.setSphericalCoord(leftLon, upLat, Unit.EARTH_RADIUS + upLeftHeight, _point1_); 526 Math3D.setSphericalCoord(leftLon, botLat, Unit.EARTH_RADIUS + botLeftHeight, _point2_); 527 Math3D.setSphericalCoord(rightLon, botLat, Unit.EARTH_RADIUS + botRightHeight, _point3_); 528 Math3D.setSphericalCoord(rightLon, upLat, Unit.EARTH_RADIUS + upRightHeight, _point4_); 529 530 if (isCartesianPointInVisibleSide(_point1_) || isCartesianPointInVisibleSide(_point2_) 531 || isCartesianPointInVisibleSide(_point3_) || isCartesianPointInVisibleSide(_point4_)) { 532 return frustum.insideFrustum(_point1_, _point2_, _point3_, _point4_); 533 } else { 534 return false; 535 } 536 } 537 518 538 public boolean realPointInView(double lon, double alt, double lat, int MAXANGLE) { 519 539 final Vector3d coord = new Vector3d();
