protected override void ComputeVertexAltitude(RoamVertex vertex, Vector3d normal) { var t = MathHelper.SphericalToTextureCoords(normal); double h = _elevationTexture.ReadBilinearPixel(t.x, t.y, true, false); double hAvg = _elevationTextureBlur.ReadBilinearPixel(t.x, t.y, true, false); double r = PlanetRadius + (h - hAvg) * ElevationScale + hAvg; vertex.Normal = normal; vertex.Position = Vector3d.Multiply(vertex.Normal, r); vertex.LinearPosition = vertex.Position; }
protected override void ComputeVertexAltitude(RoamVertex vertex, RoamTriangle triangle) { vertex.LinearPosition = Vector3d.MiddlePoint(triangle.Vertexes0.LinearPosition, triangle.Vertexes2.LinearPosition); vertex.Normal = Vector3d.Normalize(vertex.LinearPosition); var t = MathHelper.SphericalToTextureCoords(vertex.Normal); double h = _elevationTexture.ReadBilinearPixel(t.x, t.y, true, false); double hAvg = _elevationTextureBlur.ReadBilinearPixel(t.x, t.y, true, false); double r = PlanetRadius + (h - hAvg) * ElevationScale + hAvg; vertex.Position = Vector3d.Multiply(vertex.Normal, r); }
protected override void ComputeVertexAltitude(RoamVertex vertex, RoamTriangle triangle) { vertex.LinearPosition = Vector3d.MiddlePoint(triangle.Vertexes0.LinearPosition, triangle.Vertexes2.LinearPosition); //vertex.Normal = Vector3d.Normalize(vertex.LinearPosition); var tex = Vector2d.MiddlePoint(triangle.TextureCoords0, triangle.TextureCoords2); double z = vertex.LinearPosition.z; if (triangle.Material == 0) { z += 0.17 + 0.000030 * _topElevationBitmap.ReadBilinearPixel(tex.x, tex.y, false, false); } else if (triangle.Material == 1) { z -= 0.22 + 0.000034 * _bottomElevationBitmap.ReadBilinearPixel(tex.x, tex.y, false, false); } vertex.Position = new Vector3d(vertex.LinearPosition.x, vertex.LinearPosition.y, z); }
protected override void ComputeVertexAltitude(RoamVertex vertex, Vector3d position) { vertex.LinearPosition = position; //vertex.Normal = Vector3d.Normalize(position); vertex.Position = position; }