protected BufferObject assembleVertexPoints(RenderContext rc, int numLat, int numLon, float altitude) { int count = numLat * numLon; float[] altitudes = new float[count]; Arrays.fill(altitudes, altitude); float[] points = new float[count * 3]; rc.globe.geographicToCartesianGrid(this.fullSphereSector, numLat, numLon, altitudes, 1.0f, null, points, 0, 0); int size = points.length * 4; FloatBuffer buffer = ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()).asFloatBuffer(); buffer.put(points).rewind(); return new BufferObject(GLES20.GL_ARRAY_BUFFER, size, buffer); }
globe.geographicToCartesianGrid(sector, numLat, numLon, heights, 1.0f, null, points, 0, 0);
rc.globe.geographicToCartesianGrid(tile.sector, tileWidth, tileHeight, heights, (float) verticalExaggeration, origin, points, rowStride + 3, rowStride); rc.globe.geographicToCartesianBorder(tile.sector, tileWidth + 2, tileHeight + 2, borderHeight, origin, points); tile.setOrigin(origin);
@Before public void setUp() { // Mock all the static methods in Logger PowerMockito.mockStatic(Logger.class); // Create the globe object used by the test this.globe = new Globe(WorldWind.WGS84_ELLIPSOID, new ProjectionWgs84()); // Create the terrain object used by the test this.terrain = new BasicTerrain(); // Add a terrain tile used to the mocked terrain LevelSet levelSet = new LevelSet(new Sector().setFullSphere(), 1.0, 1, 5, 5); // tiles with 5x5 vertices TerrainTile tile = new TerrainTile(new Sector(0, 0, 1, 1), levelSet.firstLevel(), 90, 180); ((BasicTerrain) this.terrain).addTile(tile); // Populate the terrain tile's geometry int tileWidth = tile.level.tileWidth; int tileHeight = tile.level.tileHeight; int rowStride = (tileWidth + 2) * 3; float[] points = new float[(tileWidth + 2) * (tileHeight + 2) * 3]; Vec3 tileOrigin = this.globe.geographicToCartesian(0.5, 0.5, 0.0, new Vec3()); this.globe.geographicToCartesianGrid(tile.sector, tileWidth, tileHeight, null, 1.0f, tileOrigin, points, rowStride + 3, rowStride); this.globe.geographicToCartesianBorder(tile.sector, tileWidth + 2, tileHeight + 2, 0.0f, tileOrigin, points); tile.setOrigin(tileOrigin); tile.setPoints(points); }