Пример #1
0
 public Vec3(Vec4 v)
 {
     X = v.X;
     Y = v.Y;
     Z = v.Z;
     W = 1;
 }
Пример #2
0
 /**
  * Prodotto matrice-vettore
  * @param v vettore
  * @return vettore risultante this*v
  */
 public Vec4 Dot(Vec4 v)
 {
     return(new Vec4(
                this.Row(0).Dot(v),
                this.Row(1).Dot(v),
                this.Row(2).Dot(v),
                this.Row(3).Dot(v)
                ));
 }
Пример #3
0
 public Vec4(Vec4 u)
 {
     v = new float[4];
     v[0] = u.X;
     v[1] = u.Y;
     v[2] = u.Z;
     v[3] = u.W;
     IsColliding = false;
 }
Пример #4
0
 public override bool Equals(Object o)
 {
     if (o is Vec4)
     {
         Vec4 v = (Vec4)o;
         if (v.X == X && v.Y == Y && v.Z == Z && v.W == W)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #5
0
 void init()
 {
     VertexConstatints = new List <VertexConstraint> ();
     VertexOld         = new List <Vec3> ();
     Force             = new Vec4(0, 0, 0, 1);
     Mass = 0;
     foreach (var v in VertexNow)
     {
         VertexOld.Add(v * 1);
     }
     GenerateVertexConstraintsFromFaces();
 }
Пример #6
0
 public Vec4 Sub(Vec4 v2)
 {
     return this.Add(v2.Mult(-1));
 }
Пример #7
0
 public float Dot(Vec4 v2)
 {
     return this.X * v2.X
             + this.Y * v2.Y
             + this.Z * v2.Z
             + this.W * v2.W;
 }
Пример #8
0
 public Vec4 Add(Vec4 v2)
 {
     return new Vec4(
             this.X + v2.X,
             this.Y + v2.Y,
             this.Z + v2.Z,
             this.W + v2.W
             );
 }
Пример #9
0
 public Vec4 Sub(Vec4 v2)
 {
     return(this.Add(v2.Mult(-1)));
 }
Пример #10
0
        public Vec3 Add(Vec3 v2)
        {
            Vec4 v = base.Add(v2);

            return(new Vec3(v.X, v.Y, v.Z));
        }
Пример #11
0
 public Capsule()
 {
     Radius = 2.0f;
     Color = new Vec4 (0.8f, 0.3f, 0.5f, 1.0f);
     Model = IMatrix.Identity ();
 }
Пример #12
0
 public void ApplyForce(Vec4 force)
 {
     Force = Force + force;
     Console.WriteLine("Applied force" + Force.ToString());
 }
Пример #13
0
 /**
  * Prodotto matrice-vettore
  * @param v vettore
  * @return vettore risultante this*v
  */
 public Vec4 Dot(Vec4 v)
 {
     return new Vec4(
             this.Row(0).Dot(v),
             this.Row(1).Dot(v),
             this.Row(2).Dot(v),
             this.Row(3).Dot(v)
             );
 }
Пример #14
0
        public new Vec3 Normalized()
        {
            Vec4 v = base.Normalized();

            return(new Vec3(v.X, v.Y, v.Z));
        }
Пример #15
0
        public new Vec3 Mult(float f)
        {
            Vec4 v = base.Mult(f);

            return(new Vec3(v.X, v.Y, v.Z));
        }
Пример #16
0
        public Vec3 Sub(Vec3 v2)
        {
            Vec4 v = base.Sub(v2);

            return(new Vec3(v.X, v.Y, v.Z));
        }
Пример #17
0
 void SendUniforms(Vec4 color)
 {
     var mv = view.Dot (model.Top ());
     var mvp = proj.Dot (mv);
     GL.UniformMatrix4 (mvpLocation, 1, false, mvp.Direct.ToFloatArray ());
     GL.UniformMatrix4 (modeViewLocation, 1, false, mv.Direct.ToFloatArray ());
     GL.Uniform1 (distanceLocation,trackball.distance);
     GL.Uniform1 (useColorLocation, useColor ? 1:0);
     GL.Uniform4 (colorLocation, 1, color.GetArray());
 }
 public void ApplyForce(Vec4 force)
 {
     Force = Force + force;
     Console.WriteLine ("Applied force" + Force.ToString ());
 }
Пример #19
0
 public Sphere()
 {
     Rings = 32;
     Radius = 4.0f;
     Segments = 16;
     Color = new Vec4 (1.0f, 0, 0, 0.5f);
     Animated = true;
 }
 void init()
 {
     VertexConstatints = new List<VertexConstraint> ();
     VertexOld = new List<Vec3> ();
     Force = new Vec4 (0, 0, 0, 1);
     Mass = 0;
     foreach (var v in VertexNow)
         VertexOld.Add (v * 1);
     GenerateVertexConstraintsFromFaces ();
 }