示例#1
0
        public float AngleBetweenTwoPlanes(Plane3 anotherPlane)
        {
            float num = this.Normal.Dot(anotherPlane.Normal);

            if (num > 1f)
            {
                num = 1f;
            }
            else if (num < -1f)
            {
                num = -1f;
            }
            return(Mathf.Acos(num));
        }
示例#2
0
        public static void CreateShadow(Plane3 shadowPlane, Vector4 lightData, out Matrix4x4 result)
        {
            Vector3 normal   = shadowPlane.Normal;
            float   constant = shadowPlane.Constant;
            float   num      = normal.x * lightData.x + normal.y * lightData.y + normal.z * lightData.z;

            result.m00 = num + lightData.x * normal.x - constant * lightData.w;
            result.m01 = -lightData.x * normal.y;
            result.m02 = -lightData.x * normal.z;
            result.m03 = lightData.x * constant;
            result.m10 = -lightData.y * normal.x;
            result.m11 = num - lightData.y * normal.y - constant * lightData.w;
            result.m12 = -lightData.y * normal.z;
            result.m13 = lightData.y * constant;
            result.m20 = -lightData.z * normal.x;
            result.m21 = -lightData.z * normal.y;
            result.m22 = num - lightData.z * normal.z - constant * lightData.w;
            result.m23 = lightData.z * constant;
            result.m30 = -normal.x * lightData.w;
            result.m31 = -normal.y * lightData.w;
            result.m32 = -normal.z * lightData.w;
            result.m33 = num;
        }
示例#3
0
        public static void CreateShadowDirectional(ref Plane3 shadowPlane, ref Vector3 dirLightOppositeDirection, out Matrix4x4 result)
        {
            Vector3 normal   = shadowPlane.Normal;
            float   constant = shadowPlane.Constant;
            float   num      = normal.x * dirLightOppositeDirection.x + normal.y * dirLightOppositeDirection.y + normal.z * dirLightOppositeDirection.z;

            result.m00 = num - dirLightOppositeDirection.x * normal.x;
            result.m01 = -dirLightOppositeDirection.x * normal.y;
            result.m02 = -dirLightOppositeDirection.x * normal.z;
            result.m03 = dirLightOppositeDirection.x * constant;
            result.m10 = -dirLightOppositeDirection.y * normal.x;
            result.m11 = num - dirLightOppositeDirection.y * normal.y;
            result.m12 = -dirLightOppositeDirection.y * normal.z;
            result.m13 = dirLightOppositeDirection.y * constant;
            result.m20 = -dirLightOppositeDirection.z * normal.x;
            result.m21 = -dirLightOppositeDirection.z * normal.y;
            result.m22 = num - dirLightOppositeDirection.z * normal.z;
            result.m23 = dirLightOppositeDirection.z * constant;
            result.m33 = num;
            result.m30 = 0f;
            result.m31 = 0f;
            result.m32 = 0f;
        }
示例#4
0
        public static void CreateShadowPoint(ref Plane3 shadowPlane, ref Vector3 pointLightPosition, out Matrix4x4 result)
        {
            Vector3 normal   = shadowPlane.Normal;
            float   constant = shadowPlane.Constant;
            float   num      = normal.x * pointLightPosition.x + normal.y * pointLightPosition.y + normal.z * pointLightPosition.z;

            result.m00 = num + pointLightPosition.x * normal.x - constant;
            result.m01 = -pointLightPosition.x * normal.y;
            result.m02 = -pointLightPosition.x * normal.z;
            result.m03 = pointLightPosition.x * constant;
            result.m10 = -pointLightPosition.y * normal.x;
            result.m11 = num - pointLightPosition.y * normal.y - constant;
            result.m12 = -pointLightPosition.y * normal.z;
            result.m13 = pointLightPosition.y * constant;
            result.m20 = -pointLightPosition.z * normal.x;
            result.m21 = -pointLightPosition.z * normal.y;
            result.m22 = num - pointLightPosition.z * normal.z - constant;
            result.m23 = pointLightPosition.z * constant;
            result.m30 = -normal.x;
            result.m31 = -normal.y;
            result.m32 = -normal.z;
            result.m33 = num;
        }
 public Polygon3(int vertexCount, Plane3 plane)
 {
     this._vertices = new Vector3[vertexCount];
     this._edges    = new Edge3[vertexCount];
     this._plane    = plane;
 }