protected Vector3f worldCoordinateToLocal(Vector3f loc) { Vector3f translated = new Vector3f(); translated.x = loc.x/getWorldScale().x - getWorldTranslation().x; translated.y = loc.y/getWorldScale().y - getWorldTranslation().y; translated.z = loc.z/getWorldScale().z - getWorldTranslation().z; return translated; }
/** * Get the triangle of this geometry at the specified local coordinate. * @param x local to the terrain patch * @param z local to the terrain patch * @return the triangle in world coordinates, or null if the point does intersect this patch on the XZ axis */ public Triangle getTriangle(float x, float z) { return geomap.getTriangleAtPoint(x, z, getWorldScale() , getWorldTranslation()); }
/** * Get the triangles at the specified grid point. Probably only 2 triangles * @param x local to the terrain patch * @param z local to the terrain patch * @return the triangles in world coordinates, or null if the point does intersect this patch on the XZ axis */ public Triangle[] getGridTriangles(float x, float z) { return geomap.getGridTrianglesAtPoint(x, z, getWorldScale() , getWorldTranslation()); }
public Vector3f getCenterLocation(TerrainPatch patch) { Vector3f loc = patch.getWorldTranslation().clone(); loc.x += patch.getSize() / 2; loc.z += patch.getSize() / 2; return loc; }
/** * Caches the transforms (except rotation) so the LOD calculator, * which runs on a separate thread, can access them safely. */ protected void cacheTerrainTransforms() { this.worldScaleCached = getWorldScale().clone(); this.worldTranslationCached = getWorldTranslation().clone(); }
tracer.setGridOrigin(patch.getWorldTranslation());
protected Vector3f worldCoordinateToLocal(Vector3f loc) { Vector3f translated = new Vector3f(); translated.x = loc.x/getWorldScale().x - getWorldTranslation().x; translated.y = loc.y/getWorldScale().y - getWorldTranslation().y; translated.z = loc.z/getWorldScale().z - getWorldTranslation().z; return translated; }
/** * Get the triangle of this geometry at the specified local coordinate. * @param x local to the terrain patch * @param z local to the terrain patch * @return the triangle in world coordinates, or null if the point does intersect this patch on the XZ axis */ public Triangle getTriangle(float x, float z) { return geomap.getTriangleAtPoint(x, z, getWorldScale() , getWorldTranslation()); }
/** * Get the triangles at the specified grid point. Probably only 2 triangles * @param x local to the terrain patch * @param z local to the terrain patch * @return the triangles in world coordinates, or null if the point does intersect this patch on the XZ axis */ public Triangle[] getGridTriangles(float x, float z) { return geomap.getGridTrianglesAtPoint(x, z, getWorldScale() , getWorldTranslation()); }
/** * Caches the transforms (except rotation) so the LOD calculator, * which runs on a separate thread, can access them safely. */ protected void cacheTerrainTransforms() { this.worldScaleCached = getWorldScale().clone(); this.worldTranslationCached = getWorldTranslation().clone(); }
public Vector3f getCenterLocation(TerrainPatch patch) { Vector3f loc = patch.getWorldTranslation().clone(); loc.x += patch.getSize() / 2; loc.z += patch.getSize() / 2; return loc; }
tracer.setGridOrigin(patch.getWorldTranslation());