Exemplo n.º 1
0
        protected RoamVertex AllocVertex()
        {
            var vertex = new RoamVertex();

            vertex.InsertBefore(ActiveVertexes);
            return(vertex);
        }
Exemplo n.º 2
0
        // public Vector3d Center;
        // public double TwoDivArea;      // 2/area
        // public double Radius;           // radius

        public void Init(RoamVertex v0, RoamVertex v1, RoamVertex v2, Vector2d tex0, Vector2d tex1, Vector2d tex2, ushort material)
        {
            Material = material;

            SetVertexes(v0, v1, v2);

            TextureCoords0 = tex0;
            TextureCoords1 = tex1;
            TextureCoords2 = tex2;
        }
Exemplo n.º 3
0
        public void Set(RoamTriangle parent, RoamVertex v0, RoamVertex v1, RoamVertex v2, Vector2d texCoord0, Vector2d texCoord1, Vector2d texCoord2)
        {
            SetVertexes(v0, v1, v2);

            TextureCoords0 = texCoord0;
            TextureCoords1 = texCoord1;
            TextureCoords2 = texCoord2;

            Parent = parent;

            Level    = (ushort)(parent.Level + 1);
            Flags    = RoamTriangleFlags.Modified;
            Material = parent.Material;
        }
Exemplo n.º 4
0
        void SetVertexes(RoamVertex v0, RoamVertex v1, RoamVertex v2)
        {
            Vertexes0 = v0;
            Vertexes1 = v1;
            Vertexes2 = v2;

            //Center = Vector3d.Center(v0.Position, v1.Position, v2.Position);

            // Compute plane and area
            // Vector3d n = Vector3d.CrossProduct(v2.Position - v1.Position, v0.Position - v1.Position);
            // _area = 1 / n.Abs();
            // plane.x = n.x  _area;
            // plane.y = n.y  _area;
            // plane.z = n.z  _area;
            // plane.w = -(plane.x  center.x + plane.y  center.y + plane.z  center.z);

            // double r = center.distance2(v0.position);
            // double rt = center.distance2(v1.position);
            // if (rt > r) r = rt;
            // rt = center.distance2(v2.position);
            // if (rt > r) r = rt;

            // radius = sqrt(r);
        }
Exemplo n.º 5
0
 public bool HasVertex(RoamVertex v)
 {
     return(Vertexes0 == v || Vertexes1 == v || Vertexes2 == v);
 }
Exemplo n.º 6
0
 protected void FreeVertex(RoamVertex vertex)
 {
     vertex.Remove();
 }
Exemplo n.º 7
0
 // {
 //     vertex.LinearPosition = normal;
 //     vertex.Normal = normal;
 //     vertex.Position = normal;
 // }
 protected abstract void ComputeVertexAltitude(RoamVertex vertex, RoamTriangle triangle);
Exemplo n.º 8
0
 protected abstract void ComputeVertexAltitude(RoamVertex vertex, Vector3d position);