Пример #1
0
        private void ReceiveCharacterMove(BinaryReader reader)
        {
            WalkDirection dir       = (WalkDirection)reader.ReadByte();
            ulong         startTime = reader.ReadUInt64();

            OpenTK.Vector2d startPos = new OpenTK.Vector2d(reader.ReadDouble(), reader.ReadDouble());

            PlayerEntity.StartWalking(dir, startTime, startPos);
        }
Пример #2
0
 public TetrahedronFace(ref Vector3d apos, ref OpenTK.Vector2d atc,
                            ref Vector3d bpos, ref OpenTK.Vector2d btc,
                            ref Vector3d cpos, ref OpenTK.Vector2d ctc,
                            ref Vector3d dpos,
                            ref Vector3d normal )
 {
     APosition = apos; ATexCoord = atc;
     BPosition = bpos; BTexCoord = btc;
     CPosition = cpos; CTexCoord = ctc;
     DPosition = dpos;
     Normal = normal;
 }
Пример #3
0
 public TetrahedronFace(ref Vector3d apos, ref OpenTK.Vector2d atc,
                        ref Vector3d bpos, ref OpenTK.Vector2d btc,
                        ref Vector3d cpos, ref OpenTK.Vector2d ctc,
                        ref Vector3d dpos,
                        ref Vector3d normal)
 {
     APosition = apos; ATexCoord = atc;
     BPosition = bpos; BTexCoord = btc;
     CPosition = cpos; CTexCoord = ctc;
     DPosition = dpos;
     Normal    = normal;
 }
Пример #4
0
        /// <summary>Generates the lowest subdivision mesh, which consists of 4 Triangles.</summary>
        internal static void CreateDefaultTetrahedron(double scale, out TetrahedronFace[] array)
        {
            Vector3d[] Points = new Vector3d[4];
            Points[0] = new Vector3d(0.0 * scale, 0.0 * scale, 1.0 * scale);
            Points[1] = new Vector3d(-0.816 * scale, 0.471 * scale, -0.333 * scale);
            Points[2] = new Vector3d(0.816 * scale, 0.471 * scale, -0.333 * scale);
            Points[3] = new Vector3d(0.0 * scale, -0.943 * scale, -0.333 * scale);

            OpenTK.Vector2d[] TexCoords = new OpenTK.Vector2d[4];
            TexCoords[0] = new OpenTK.Vector2d(0.0, 0.0);
            TexCoords[1] = new OpenTK.Vector2d(1.0, 0.0);
            TexCoords[2] = new OpenTK.Vector2d(0.0, 1.0);
            TexCoords[3] = new OpenTK.Vector2d(1.0, 1.0);

            Vector3d Normal;

            array = new TetrahedronFace[4];

            FindNormal(ref Points[0], ref Points[2], ref Points[1], ref Points[3], out Normal);
            array[0] = new TetrahedronFace(ref Points[0], ref TexCoords[2],
                                           ref Points[2], ref TexCoords[0],
                                           ref Points[1], ref TexCoords[1],
                                           ref Points[3],
                                           ref Normal);

            FindNormal(ref Points[0], ref Points[3], ref Points[2], ref Points[1], out Normal);
            array[1] = new TetrahedronFace(ref Points[0], ref TexCoords[0],
                                           ref Points[3], ref TexCoords[1],
                                           ref Points[2], ref TexCoords[2],
                                           ref Points[1],
                                           ref Normal);

            FindNormal(ref Points[0], ref Points[1], ref Points[3], ref Points[2], out Normal);
            array[2] = new TetrahedronFace(ref Points[0], ref TexCoords[2],
                                           ref Points[1], ref TexCoords[1],
                                           ref Points[3], ref TexCoords[3],
                                           ref Points[2],
                                           ref Normal);

            FindNormal(ref Points[1], ref Points[2], ref Points[3], ref Points[0], out Normal);
            array[3] = new TetrahedronFace(ref Points[1], ref TexCoords[3],
                                           ref Points[2], ref TexCoords[2],
                                           ref Points[3], ref TexCoords[1],
                                           ref Points[0],
                                           ref Normal);
        }
Пример #5
0
 public VertexT2dN3dV3d(OpenTK.Vector2d texcoord, Vector3d normal, Vector3d position)
 {
     TexCoord = texcoord;
     Normal = normal;
     Position = position;
 }
Пример #6
0
 public VertexT2dN3dV3d(OpenTK.Vector2d texcoord, Vector3d normal, Vector3d position)
 {
     TexCoord = texcoord;
     Normal   = normal;
     Position = position;
 }
Пример #7
0
        /// <summary>Generates the lowest subdivision mesh, which consists of 4 Triangles.</summary>
        internal static void CreateDefaultTetrahedron( double scale, out TetrahedronFace[] array )
        {
            Vector3d[] Points = new Vector3d[4];
            Points[0] = new Vector3d( 0.0 * scale, 0.0 * scale, 1.0 * scale );
            Points[1] = new Vector3d( -0.816 * scale, 0.471 * scale, -0.333 * scale );
            Points[2] = new Vector3d( 0.816 * scale, 0.471 * scale, -0.333 * scale );
            Points[3] = new Vector3d( 0.0 * scale, -0.943 * scale, -0.333 * scale );

            OpenTK.Vector2d[] TexCoords = new OpenTK.Vector2d[4];
            TexCoords[0] = new OpenTK.Vector2d(0.0, 0.0);
            TexCoords[1] = new OpenTK.Vector2d(1.0, 0.0);
            TexCoords[2] = new OpenTK.Vector2d(0.0, 1.0);
            TexCoords[3] = new OpenTK.Vector2d(1.0, 1.0);

            Vector3d Normal;
            array = new TetrahedronFace[4];

            FindNormal( ref Points[0], ref Points[2], ref Points[1], ref Points[3], out Normal );
            array[0] = new TetrahedronFace( ref Points[0], ref TexCoords[2],
                                                   ref Points[2], ref TexCoords[0],
                                                   ref Points[1], ref TexCoords[1],
                                                   ref Points[3],
                                                   ref Normal );

            FindNormal( ref Points[0], ref Points[3], ref Points[2], ref Points[1], out Normal );
            array[1] = new TetrahedronFace( ref Points[0], ref TexCoords[0],
                                                   ref Points[3], ref TexCoords[1],
                                                   ref Points[2], ref TexCoords[2],
                                                   ref Points[1],
                                                   ref Normal );

            FindNormal( ref Points[0], ref Points[1], ref Points[3], ref Points[2], out Normal );
            array[2] = new TetrahedronFace( ref Points[0], ref TexCoords[2],
                                                   ref Points[1], ref TexCoords[1],
                                                   ref Points[3], ref TexCoords[3],
                                                   ref Points[2],
                                                   ref Normal );

            FindNormal( ref Points[1], ref Points[2], ref Points[3], ref Points[0], out Normal );
            array[3] = new TetrahedronFace( ref Points[1], ref TexCoords[3],
                                                   ref Points[2], ref TexCoords[2],
                                                   ref Points[3], ref TexCoords[1],
                                                   ref Points[0],
                                                   ref Normal );
        }
Пример #8
0
 /// <summary>
 /// Creates a new Box2d with the specified dimensions.
 /// </summary>
 /// <param name="position">The position of the top left corner.</param>
 /// <param name="size">The size of the box.</param>
 /// <returns>A new OpenTK.Box2d with the specfied dimensions.</returns>
 public static Box2d FromDimensions(Vector2d position, Vector2d size)
 {
     return(FromDimensions(position.X, position.Y, size.X, size.Y));
 }
Пример #9
0
 /// <summary>
 /// Returns a Box2d translated by the given amount.
 /// </summary>
 public Box2d Translated(Vector2d point)
 {
     return(new Box2d(Left + point.X, Top + point.Y, Right + point.X, Bottom + point.Y));
 }
Пример #10
0
 /// <summary>
 /// Returns whether the box contains the specified point on the closed region described by this Box2.
 /// </summary>
 /// <param name="point">The point to query.</param>
 /// <returns>Whether this box contains the point.</returns>
 public bool Contains(Vector2d point)
 {
     return(Contains(point, true));
 }
Пример #11
0
 public Vector2h(ref Vector2d v, bool throwOnError)
 {
     X = new Half(v.X, throwOnError);
     Y = new Half(v.Y, throwOnError);
 }
Пример #12
0
 public Vector2h(ref Vector2d v)
 {
     X = new Half(v.X);
     Y = new Half(v.Y);
 }
Пример #13
0
 /// <summary>
 /// Constructs a new instance from the given Vector2d.
 /// </summary>
 /// <param name="v">The Vector2d to copy components from.</param>
 public Vector3d(Vector2d v)
 {
     X = v.X;
     Y = v.Y;
     Z = 0.0f;
 }