Exemplo n.º 1
0
 static void lib3ds_io_read_vector(Lib3dsIo io, Lib3dsVertex v)
 {
     Debug.Assert(io != null);
     v.x = lib3ds_io_read_float(io);
     v.y = lib3ds_io_read_float(io);
     v.z = lib3ds_io_read_float(io);
 }
Exemplo n.º 2
0
 public static void lib3ds_vector_max(float[] c, Lib3dsVertex a)
 {
     if (a.x > c[0])
     {
         c[0] = a.x;
     }
     if (a.y > c[1])
     {
         c[1] = a.y;
     }
     if (a.z > c[2])
     {
         c[2] = a.z;
     }
 }
Exemplo n.º 3
0
 public static void lib3ds_vector_min(float[] c, Lib3dsVertex a)
 {
     if (a.x < c[0])
     {
         c[0] = a.x;
     }
     if (a.y < c[1])
     {
         c[1] = a.y;
     }
     if (a.z < c[2])
     {
         c[2] = a.z;
     }
 }
Exemplo n.º 4
0
		public static void lib3ds_vector_make(Lib3dsVertex c, float x, float y, float z)
		{
			c.x=x;
			c.y=y;
			c.z=z;
		}
Exemplo n.º 5
0
		public static void lib3ds_vector_normal(float[] n, Lib3dsVertex a, Lib3dsVertex b, Lib3dsVertex c)
		{
			lib3ds_vector_normal(n, a.ToArray(), b.ToArray(), c.ToArray());
		}
Exemplo n.º 6
0
 static void lib3ds_io_write_vector(Lib3dsIo io, Lib3dsVertex v)
 {
     lib3ds_io_write_float(io, v.x);
     lib3ds_io_write_float(io, v.y);
     lib3ds_io_write_float(io, v.z);
 }
Exemplo n.º 7
0
 public static void lib3ds_vector_make(Lib3dsVertex c, float x, float y, float z)
 {
     c.x = x;
     c.y = y;
     c.z = z;
 }
            private Lib3dsVertex CreateNormalize(Lib3dsVertex p1, Lib3dsVertex p2, Lib3dsVertex p3)
            {
                Lib3dsVertex v1 = new Lib3dsVertex();
                Lib3dsVertex v2 = new Lib3dsVertex();
                Lib3dsVertex rnt = new Lib3dsVertex();

                v1.x = (p1.x - p3.x);
                v1.y = (p1.y - p3.y);
                v1.z = (p1.z - p3.z);

                v2.x = (p3.x - p2.x);
                v2.y = (p3.y - p2.y);
                v2.z = (p3.z - p2.z);

                rnt.x = v1.y * v2.z - v1.z * v2.y;
                rnt.y = v1.z * v2.x - v1.x * v2.z;
                rnt.z = v1.x * v2.y - v1.y * v2.x;

                return rnt;
            }
Exemplo n.º 9
0
		public static void lib3ds_vector_copy(Lib3dsVertex dst, Lib3dsVertex src)
		{
			dst.x=src.x;
			dst.y=src.y;
			dst.z=src.z;
		}
Exemplo n.º 10
0
		public static void lib3ds_vector_max(float[] c, Lib3dsVertex a)
		{
			if(a.x>c[0]) c[0]=a.x;
			if(a.y>c[1]) c[1]=a.y;
			if(a.z>c[2]) c[2]=a.z;
		}
Exemplo n.º 11
0
		public Lib3dsVertex(Lib3dsVertex v)
		{
			x=v.x;
			y=v.y;
			z=v.z;
		}
Exemplo n.º 12
0
 public static void lib3ds_vector_sub(float[] c, Lib3dsVertex a, Lib3dsVertex b)
 {
     lib3ds_vector_sub(c, a.ToArray(), b.ToArray());
 }
Exemplo n.º 13
0
 public static void lib3ds_vector_copy(Lib3dsVertex dst, Lib3dsVertex src)
 {
     dst.x = src.x;
     dst.y = src.y;
     dst.z = src.z;
 }
Exemplo n.º 14
0
 public static void lib3ds_vector_copy(Lib3dsVertex dst, float[] src)
 {
     dst.x = src[0];
     dst.y = src[1];
     dst.z = src[2];
 }
Exemplo n.º 15
0
 // Multiply a point by a transformation matrix.
 //
 // Applies the given transformation matrix to the given point.  With some
 // transformation matrices, a vector may also be transformed.
 //
 // \param c Result.
 // \param m Transformation matrix.
 // \param a Input point.
 public static void lib3ds_vector_transform(float[] c, float[,] m, Lib3dsVertex a)
 {
     c[0] = m[0, 0] * a.x + m[1, 0] * a.y + m[2, 0] * a.z + m[3, 0];
     c[1] = m[0, 1] * a.x + m[1, 1] * a.y + m[2, 1] * a.z + m[3, 1];
     c[2] = m[0, 2] * a.x + m[1, 2] * a.y + m[2, 2] * a.z + m[3, 2];
 }
Exemplo n.º 16
0
		// Multiply a point by a transformation matrix.
		//
		// Applies the given transformation matrix to the given point.  With some
		// transformation matrices, a vector may also be transformed.
		//
		// \param c Result.
		// \param m Transformation matrix.
		// \param a Input point.
		public static void lib3ds_vector_transform(float[] c, float[,] m, Lib3dsVertex a)
		{
			c[0]=m[0, 0]*a.x+m[1, 0]*a.y+m[2, 0]*a.z+m[3, 0];
			c[1]=m[0, 1]*a.x+m[1, 1]*a.y+m[2, 1]*a.z+m[3, 1];
			c[2]=m[0, 2]*a.x+m[1, 2]*a.y+m[2, 2]*a.z+m[3, 2];
		}
Exemplo n.º 17
0
		public static void lib3ds_vector_min(float[] c, Lib3dsVertex a)
		{
			if(a.x<c[0]) c[0]=a.x;
			if(a.y<c[1]) c[1]=a.y;
			if(a.z<c[2]) c[2]=a.z;
		}
Exemplo n.º 18
0
		static void lib3ds_io_read_vector(Lib3dsIo io, Lib3dsVertex v)
		{
			Debug.Assert(io!=null);
			v.x=lib3ds_io_read_float(io);
			v.y=lib3ds_io_read_float(io);
			v.z=lib3ds_io_read_float(io);
		}
Exemplo n.º 19
0
		public static void lib3ds_vector_copy(Lib3dsVertex dst, float[] src)
		{
			dst.x=src[0];
			dst.y=src[1];
			dst.z=src[2];
		}
Exemplo n.º 20
0
		static void lib3ds_io_write_vector(Lib3dsIo io, Lib3dsVertex v)
		{
			lib3ds_io_write_float(io, v.x);
			lib3ds_io_write_float(io, v.y);
			lib3ds_io_write_float(io, v.z);
		}
Exemplo n.º 21
0
		public static void lib3ds_vector_sub(float[] c, Lib3dsVertex a, Lib3dsVertex b)
		{
			lib3ds_vector_sub(c, a.ToArray(), b.ToArray());
		}
Exemplo n.º 22
0
 public Lib3dsVertex(Lib3dsVertex v)
 {
     x = v.x;
     y = v.y;
     z = v.z;
 }
Exemplo n.º 23
0
		static void mesh_dump(Lib3dsMesh mesh)
		{
			Debug.Assert(mesh!=null);

			Console.WriteLine("  {0} vertices={1} faces={2}", mesh.name, mesh.nvertices, mesh.nfaces);
			Console.WriteLine("  matrix:");
			matrix_dump(mesh.matrix);

			Lib3dsVertex p=new Lib3dsVertex();
			Console.WriteLine("  vertices (x, y, z, u, v):");
			for(int i=0; i<mesh.nvertices; i++)
			{
				LIB3DS.lib3ds_vector_copy(p, mesh.vertices[i]);
				Console.Write("    {0,10:F5} {1,10:F5} {2,10:F5}", p.x, p.y, p.z);
				if(mesh.texcos!=null) Console.Write(" {0,10:F5} {1,10:F5}", mesh.texcos[i].s, mesh.texcos[i].t);
				Console.WriteLine();
			}

			Console.WriteLine("  facelist:");
			for(int i=0; i<mesh.nfaces; i++)
				Console.WriteLine("    {0,4} {1,4} {2,4}  flags:{3:X}  smoothing:{4:X}  material:\"{5}\"\n", mesh.faces[i].index[0], mesh.faces[i].index[1], mesh.faces[i].index[2], mesh.faces[i].flags, mesh.faces[i].smoothing_group, mesh.faces[i].material);
		}
Exemplo n.º 24
0
 public static void lib3ds_vector_normal(float[] n, Lib3dsVertex a, Lib3dsVertex b, Lib3dsVertex c)
 {
     lib3ds_vector_normal(n, a.ToArray(), b.ToArray(), c.ToArray());
 }