Ejemplo n.º 1
0
        private IMatrix4x4 CreateViewMatrix(Camera camera)
        {
            Matrix <double> objectToWorldTransform = camera.GetObjectToWorldTransform();
            IModelMatrix    modelMat      = new ModelMatrixDouble(objectToWorldTransform.AsColumnMajorArray() ?? objectToWorldTransform.ToColumnMajorArray());
            Vector <double> worldPosition = objectToWorldTransform.Multiply(Vector <double> .Build.Dense(new double[] { 0, 0, 0, 1 }));

            IModelMatrix viewMat = new ModelMatrix();

            viewMat.Rotate(modelMat.Rotation);
            viewMat.Translate(-worldPosition[0], -worldPosition[1], -worldPosition[2]);
            return(viewMat);
        }