Пример #1
0
        private void _setProgramConstants_Matrix(geom.Matrix3D matrix3D, int startindex, bool transpose)
        {
            if (transpose)
            {
                matrix3D.transpose();
            }

            programConstants.registers[startindex]     = new float4(matrix3D.M00, matrix3D.M01, matrix3D.M02, matrix3D.M03);
            programConstants.registers[startindex + 1] = new float4(matrix3D.M10, matrix3D.M11, matrix3D.M12, matrix3D.M13);
            programConstants.registers[startindex + 2] = new float4(matrix3D.M20, matrix3D.M21, matrix3D.M22, matrix3D.M23);
            programConstants.registers[startindex + 3] = new float4(matrix3D.M30, matrix3D.M31, matrix3D.M32, matrix3D.M33);
        }
Пример #2
0
        public void setProgramConstantsFromMatrix(geom.Matrix3D matrix3D, int startindex, bool transpose)
        {
            if (startindex < ProgramConstants.USERDEFINE_STARTIDX)
            {
                throw new ArgumentException("之前行被保留");
            }

            if (transpose)
            {
                matrix3D.transpose();
            }

            programConstants.registers[startindex]     = new float4(matrix3D.M00, matrix3D.M01, matrix3D.M02, matrix3D.M03);
            programConstants.registers[startindex + 1] = new float4(matrix3D.M10, matrix3D.M11, matrix3D.M12, matrix3D.M13);
            programConstants.registers[startindex + 2] = new float4(matrix3D.M20, matrix3D.M21, matrix3D.M22, matrix3D.M23);
            programConstants.registers[startindex + 3] = new float4(matrix3D.M30, matrix3D.M31, matrix3D.M32, matrix3D.M33);
        }
Пример #3
0
        /// <summary>
        /// 设置预定义矩阵
        /// </summary>
        /// <param name="_ObjectToWorld"></param>
        /// <param name="_WorldToObject"></param>
        /// <param name="_MatrixV"></param>
        /// <param name="_matrix_projection"></param>
        /// <param name="_MatrixVP"></param>
        /// <param name="_MatrixInvV"></param>
        /// <param name="transpose"></param>
        public void setProgramConstants_Matrices(
            geom.Matrix3D _ObjectToWorld,
            geom.Matrix3D _WorldToObject,
            geom.Matrix3D _MatrixV,
            geom.Matrix3D _matrix_projection,
            geom.Matrix3D _MatrixVP,
            geom.Matrix3D _MatrixInvV,

            bool transpose

            )
        {
            _setProgramConstants_Matrix(_ObjectToWorld, ProgramConstants._ObjectToWorld_ROW0, transpose);
            _setProgramConstants_Matrix(_WorldToObject, ProgramConstants._WorldToObject_ROW0, transpose);
            _setProgramConstants_Matrix(_MatrixV, ProgramConstants._MatrixV_ROW0, transpose);
            _setProgramConstants_Matrix(_matrix_projection, ProgramConstants._matrix_projection_ROW0, transpose);
            _setProgramConstants_Matrix(_MatrixVP, ProgramConstants._MatrixVP_ROW0, transpose);
            _setProgramConstants_Matrix(_MatrixInvV, ProgramConstants._MatrixInvV_ROW0, transpose);
        }