示例#1
0
 public Vertex(Float3 _Position, Float2 _UV, Float4 _Color)
 {
     Position = _Position;
     UV = _UV;
     R = G = B = A = 0;
     Color = _Color;
 }
示例#2
0
 public void SetParameter(string _FieldName, Float4 _Float4)
 {
     shader.Parameters[_FieldName].SetValue(new Vector4(_Float4.X, _Float4.Y, _Float4.Z, _Float4.W));
 }
示例#3
0
 public static Float4 Normalize(Float4 _A)
 {
     return _A / _A.Length();
 }
示例#4
0
 //Methods
 public static float Dot(Float4 _A, Float4 _B)
 {
     return _A.X * _B.X + _A.Y * _B.Y + _A.Z * _B.Z + _A.W * _B.W;
 }
示例#5
0
 public static void Clear(Float4 _Color)
 {
     device.Clear(ClearOptions.Target, new Color(_Color.X, _Color.Y, _Color.Z, _Color.W), 0, 0);
 }
示例#6
0
        public static void DrawLine(Float2 _A, Float2 _B, Float4 _ColorA, Float4 _ColorB, float _Thickness)
        {
            device.RenderState.DepthBufferEnable = false;

            VertexBuffer vbo = new VertexBuffer(Graphics.device, Marshal.SizeOf(typeof(Vertex)) * 2, BufferUsage.None);
            VertexPositionColor[] vertices = new VertexPositionColor[]
            {
                new VertexPositionColor(new Vector3(_A.X,_A.Y,0),new Color(new Vector4(_ColorA.X,_ColorA.Y,_ColorA.Z,_ColorA.W))),
                new VertexPositionColor(new Vector3(_B.X,_B.Y,0),new Color(new Vector4(_ColorB.X,_ColorB.Y,_ColorB.Z,_ColorB.W)))
            };
            vbo.SetData(vertices);
            device.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
            device.DrawUserPrimitives(PrimitiveType.LineStrip, vertices, 0, 1);
        }
示例#7
0
 public static Float4 operator *(Float4 _V, Float4x4 _M)
 {
     Float4 ret = new Float4(
         Float4.Dot(_V, _M.Row[0]),
         Float4.Dot(_V, _M.Row[1]),
         Float4.Dot(_V, _M.Row[2]),
         Float4.Dot(_V, _M.Row[3]));
     return ret;
 }
示例#8
0
 public Float4x4(Float4 _X, Float4 _Y, Float4 _Z, Float4 _T)
 {
     X = _X; Y = _Y; Z = _Z; T = _T;
 }
示例#9
0
 public Float4x4()
 {
     X = new Float4(1, 0, 0, 0); Y = new Float4(0, 1, 0, 0); Z = new Float4(0, 0, 1, 0); T = new Float4(0, 0, 0, 1);
 }