public override void Flush()
        {
            base.Flush();

            PositionDown = Point2.Zero;
            PositionDownf = Vector2.Zero;
            PositionUp = Point2.Zero;
            PositionUpf = Vector2.Zero;
        }
        public void Update(bool on, Point2 position, Vector2 positionf)
        {
            base.Update(on);

            if (Down)
            {
                PositionDown = position;
                PositionDownf = positionf;
            }

            if (Up)
            {
                PositionUp = position;
                PositionUpf = positionf;
            }
        }
 public TriangleUVComponent(Vector2 uv1, Vector2 uv2, Vector2 uv3)
 {
     UVs = new Vector2[3] {uv1, uv2, uv3};
 }
        public VertexProcessor(SoftwareVertex vertex, Vector4[] colors, Vector3[] normals, Vector2[] uvs, HardwareMeshProcessor mesh)
        {
            Positions = new Vector3[mesh.positions.Count];
            for (int i = 0; i != Positions.Length; ++i)
            {
                Positions[i] = mesh.positions[i][vertex.Index];
            }

            Colors = colors;
            Normals = normals;
            UVs = uvs;

            mesh.Verticies.AddLast(this);
        }
        public TriangleProcessor(SoftwareTriangle triangle, HardwareMeshProcessor mesh, bool loadColors, bool loadUVs, bool loadNormals)
        {
            // get color components
            var colors = new Vector4[3][];
            if (loadColors)
            {
                int componentCount = mesh.colorComponents.Count;
                for (int i = 0; i != colors.Length; ++i)
                {
                    colors[i] = new Vector4[componentCount];
                }

                for (int i = 0; i != componentCount; ++i)
                {
                    var colorComponent = mesh.colorComponents[i][triangle.Index].Colors;
                    colors[0][i] = colorComponent[0];
                    colors[1][i] = colorComponent[1];
                    colors[2][i] = colorComponent[2];
                }
            }

            // get normal components
            var normals = new Vector3[3][];
            if (loadNormals)
            {
                int componentCount = mesh.normalComponents.Count;
                for (int i = 0; i != normals.Length; ++i)
                {
                    normals[i] = new Vector3[componentCount];
                }

                for (int i = 0; i != componentCount; ++i)
                {
                    var normalComponent = mesh.normalComponents[i][triangle.Index].Normals;
                    normals[0][i] = normalComponent[0];
                    normals[1][i] = normalComponent[1];
                    normals[2][i] = normalComponent[2];
                }
            }

            // get uv components
            var uvs = new Vector2[3][];
            if (loadUVs)
            {
                int componentCount = mesh.uvComponents.Count;
                for (int i = 0; i != uvs.Length; ++i)
                {
                    uvs[i] = new Vector2[componentCount];
                }

                for (int i = 0; i != componentCount; ++i)
                {
                    var normalComponent = mesh.uvComponents[i][triangle.Index].UVs;
                    uvs[0][i] = normalComponent[0];
                    uvs[1][i] = normalComponent[1];
                    uvs[2][i] = normalComponent[2];
                }
            }

            // add verticies
            var vertex1 = new VertexProcessor(triangle.Verticies[0], colors[0], normals[0], uvs[0], mesh);
            var vertex2 = new VertexProcessor(triangle.Verticies[1], colors[1], normals[1], uvs[1], mesh);
            var vertex3 = new VertexProcessor(triangle.Verticies[2], colors[2], normals[2], uvs[2], mesh);
            Verticies = new VertexProcessor[3] {vertex1, vertex2, vertex3};

            mesh.Triangles.Add(this);
        }
Beispiel #6
0
        public void Update()
        {
            if (scollWheelChanged)
            {
                ScrollWheelVelocity = scrollWheelVelocity / 120f;
                scollWheelChanged = false;
            }
            else
            {
                ScrollWheelVelocity = 0;
            }

            lastLocation = Position;
            Position = new Point2(currentPosition.X, input.application.FrameSize.Height - currentPosition.Y);
            Positionf = Position.ToVector2();

            Velocity = Position - lastLocation;
            Velocityf = Velocity.ToVector2();

            Left.Update(leftOn, Position, Positionf);
            Middle.Update(middleOn, Position, Positionf);
            Right.Update(rightOn, Position, Positionf);
        }
Beispiel #7
0
 public Line2(Vector2 p1, Vector2 p2)
 {
     P1 = p1;
     P2 = p2;
 }
Beispiel #8
0
 public Matrix2(Vector2 x, Vector2 y)
 {
     X = x;
     Y = y;
 }
Beispiel #9
0
 public static Matrix2 FromCross(Vector2 xVector)
 {
     return new Matrix2(xVector, new Vector2(-xVector.Y, xVector.X));
 }
Beispiel #10
0
 public static void FromCross(ref Vector2 xVector, out Matrix2 result)
 {
     result = new Matrix2(xVector, new Vector2(-xVector.Y, xVector.X));
 }
Beispiel #11
0
 public Matrix2(float value)
 {
     X = new Vector2(value);
     Y = new Vector2(value);
 }
Beispiel #12
0
 public Vector3 UnProjectNormalized(Vector2 screenPosition)
 {
     var pos = new Vector4(screenPosition, 0, 1);
     var near = pos.UnProject(TransformInverseMatrix, ViewPort.Position.X, ViewPort.Position.Y, ViewPort.Size.Width, ViewPort.Size.Height);
     pos.Z = 1;
     var far = pos.UnProject(TransformInverseMatrix, ViewPort.Position.X, ViewPort.Position.Y, ViewPort.Size.Width, ViewPort.Size.Height);
     return (far - near).ToVector3().Normalize();
 }
Beispiel #13
0
 public Vector4 UnProject(Vector2 screenPosition)
 {
     var pos = new Vector4(screenPosition, 0, 1);
     return pos.UnProject(TransformInverseMatrix, ViewPort.Position.X, ViewPort.Position.Y, ViewPort.Size.Width, ViewPort.Size.Height);
 }
Beispiel #14
0
 public void Update(bool on, Vector2 location)
 {
     base.Update(on);
     if (on) Location = location;
 }
 public BoundingSphere2(Vector2 center, float radius)
 {
     Center = center;
     Radius = radius;
 }