/** * Indicates whether this tile should be subdivided based on the current navigation state and a specified detail * factor. * * @param rc the current render context * @param detailFactor the detail factor to consider * * @return true if the tile should be subdivided, otherwise false */ public boolean mustSubdivide(RenderContext rc, double detailFactor) { this.distanceToCamera = this.distanceToCamera(rc); double texelSize = this.texelSizeFactor * rc.globe.getEquatorialRadius(); double pixelSize = rc.pixelSizeAtDistance(this.distanceToCamera); double densityFactor = 1.0; // Adjust the subdivision factory when the display density is low. Values of detailFactor have been calibrated // against high density devices. Low density devices need roughly half the detailFactor. if (rc.resources.getDisplayMetrics().densityDpi <= DisplayMetrics.DENSITY_MEDIUM) { densityFactor = 0.5; } return texelSize > (pixelSize * detailFactor * densityFactor); }
/** * Calculate the number of times to split the edges of the shape for geometry assembly. * * @param rc current RenderContext * * @return an even number of intervals */ protected int computeIntervals(RenderContext rc) { int intervals = MIN_INTERVALS; if (intervals >= this.maximumIntervals) { return intervals; // use at least the minimum number of intervals } Vec3 centerPoint = rc.geographicToCartesian(this.center.latitude, this.center.longitude, this.center.altitude, this.altitudeMode, scratchPoint); double maxRadius = Math.max(this.majorRadius, this.minorRadius); double cameraDistance = centerPoint.distanceTo(rc.cameraPoint) - maxRadius; if (cameraDistance <= 0) { return this.maximumIntervals; // use the maximum number of intervals when the camera is very close } double metersPerPixel = rc.pixelSizeAtDistance(cameraDistance); double circumferencePixels = this.computeCircumference() / metersPerPixel; double circumferenceIntervals = circumferencePixels / this.maximumPixelsPerInterval; double subdivisions = Math.log(circumferenceIntervals / intervals) / Math.log(2); int subdivisionCount = Math.max(0, (int) Math.ceil(subdivisions)); intervals <<= subdivisionCount; // subdivide the base intervals to achieve the desired number of intervals return Math.min(intervals, this.maximumIntervals); // don't exceed the maximum number of intervals }
protected boolean isVisible(RenderContext rc) { double cameraDistance = this.centerPoint.distanceTo(rc.cameraPoint); double pixelSizeMeters = rc.pixelSizeAtDistance(cameraDistance); if (this.range < pixelSizeMeters) { return false; // The range is zero, or is less than one screen pixel } return this.boundingSphere.set(this.centerPoint, this.range).intersectsFrustum(rc.frustum); }
double metersPerPixel = rc.pixelSizeAtDistance(this.cameraDistance); this.computeRepeatingTexCoordTransform(texture, metersPerPixel, this.texCoordMatrix); drawState.texture(texture);
double metersPerPixel = rc.pixelSizeAtDistance(this.cameraDistance); this.computeRepeatingTexCoordTransform(texture, metersPerPixel, this.texCoordMatrix); drawState.texture(texture);
double metersPerPixel = rc.pixelSizeAtDistance(cameraDistance); this.computeRepeatingTexCoordTransform(texture, metersPerPixel, this.texCoordMatrix); drawState.texture(texture);
double metersPerPixel = rc.pixelSizeAtDistance(this.cameraDistance); this.computeRepeatingTexCoordTransform(texture, metersPerPixel, this.texCoordMatrix); drawState.texture(texture);
double metersPerPixel = rc.pixelSizeAtDistance(this.cameraDistance); this.computeRepeatingTexCoordTransform(texture, metersPerPixel, this.texCoordMatrix); drawState.texture(texture);