示例#1
0
 public FVec3 TransformNormal(FMat4 matrix)
 {
     return(new FVec3
            (
                this.x * matrix.x.x + this.y * matrix.y.x + this.z * matrix.z.x,
                this.x * matrix.x.y + this.y * matrix.y.y + this.z * matrix.z.y,
                this.x * matrix.x.z + this.y * matrix.y.z + this.z * matrix.z.z
            ));
 }
示例#2
0
文件: FVec4.cs 项目: niuniuzhu/RC
 public FVec4 Multiply(FMat4 matrix)
 {
     return(new FVec4
            (
                matrix.x.x * this.x + matrix.x.y * this.y + matrix.x.z * this.z + matrix.x.w * this.w,
                matrix.y.x * this.x + matrix.y.y * this.y + matrix.y.z * this.z + matrix.y.w * this.w,
                matrix.z.x * this.x + matrix.z.y * this.y + matrix.z.z * this.z + matrix.z.w * this.w,
                matrix.w.x * this.x + matrix.w.y * this.y + matrix.w.z * this.z + matrix.w.w * this.w
            ));
 }
示例#3
0
文件: FVec4.cs 项目: niuniuzhu/RC
        public FVec4 UnProject(FMat4 viewProjInverse, Fix64 viewX, Fix64 viewY, Fix64 viewWidth, Fix64 viewHeight)
        {
            FVec4 result = this;

            result.x = (result.x - viewX) / viewWidth;
            result.y = (result.y - viewY) / viewHeight;
            result   = result * Fix64.Two - Fix64.One;

            result = result.Transform(viewProjInverse);
            Fix64 wDelta = Fix64.One / result.w;

            result.x *= wDelta;
            result.y *= wDelta;
            result.z *= wDelta;

            return(result);
        }
示例#4
0
文件: FVec4.cs 项目: niuniuzhu/RC
        public FVec4 Project(FMat4 projectionMatrix, FMat4 viewMatrix, Fix64 viewX, Fix64 viewY, Fix64 viewWidth, Fix64 viewHeight)
        {
            FVec4 result = this;

            result = result.Multiply(viewMatrix);
            result = result.Multiply(projectionMatrix);

            Fix64 wDelta = Fix64.One / result.w;

            result.x *= wDelta;
            result.y *= wDelta;
            result.z *= wDelta;

            result.x = result.x * Fix64.Half + Fix64.Half;
            result.y = result.y * Fix64.Half + Fix64.Half;
            result.z = result.z * Fix64.Half + Fix64.Half;

            result.x = result.x * viewWidth + viewX;
            result.y = result.y * viewHeight + viewY;

            return(result);
        }
示例#5
0
文件: FVec4.cs 项目: niuniuzhu/RC
 public FVec4 Transform(FMat4 matrix)
 {
     return(matrix.x * this.x + matrix.y * this.y + matrix.z * this.z + matrix.w * this.w);
 }