def GetMatrix(self, bRotationOnly = False):
        matrix = M3DMatrix44f()
        
        # Calculate the right side (x) vector, drop it right into the matrix
        vXAxis = m3dCrossProduct(self.vUp, self.vForward)
        
        # m3dSetMatrixColum44 does not fill in the fourth value...
        # X Column
        m3dSetMatrixColumn44(matrix, vXAxis, 0)
        matrix[3] = 0.0

        # Y Column
        m3dSetMatrixColumn44(matrix, self.vUp, 1)
        matrix[7] = 0.0

        # Z Column
        m3dSetMatrixColumn44(matrix, self.vForward, 2)
        matrix[11] = 0.0

        # Translation (already done)
        if(bRotationOnly == True):
            matrix[12] = 0.0
            matrix[13] = 0.0
            matrix[14] = 0.0
        else:
            m3dSetMatrixColumn44(matrix, self.vOrigin, 3)

        matrix[15] = 1.0
        return matrix
Beispiel #2
0
    def GetMatrix(self, bRotationOnly=False):
        matrix = M3DMatrix44f()

        # Calculate the right side (x) vector, drop it right into the matrix
        vXAxis = m3dCrossProduct(self.vUp, self.vForward)

        # m3dSetMatrixColum44 does not fill in the fourth value...
        # X Column
        m3dSetMatrixColumn44(matrix, vXAxis, 0)
        matrix[3] = 0.0

        # Y Column
        m3dSetMatrixColumn44(matrix, self.vUp, 1)
        matrix[7] = 0.0

        # Z Column
        m3dSetMatrixColumn44(matrix, self.vForward, 2)
        matrix[11] = 0.0

        # Translation (already done)
        if (bRotationOnly == True):
            matrix[12] = 0.0
            matrix[13] = 0.0
            matrix[14] = 0.0
        else:
            m3dSetMatrixColumn44(matrix, self.vOrigin, 3)

        matrix[15] = 1.0
        return matrix
    def GetCameraOrientation(self):
        m = M3DMatrix44f()
        x = M3DVector3f()
        z = M3DVector3f()
        # Make rotation matrix
        # Z vector is reversed
        z[0] = -self.vForward[0]
        z[1] = -self.vForward[1]
        z[2] = -self.vForward[2]

        # X vector = Y cross Z 
        x = m3dCrossProduct(self.vUp, z)

        # Matrix has no translation information and is
        # transposed.... (rows instead of columns)
        m[0] = x[0]
        m[1] = x[1]
        m[2] = x[2]
        m[3] = 0.0

        m[4] = self.vUp[0]
        m[5] = self.vUp[1]
        m[6] = self.vUp[2]
        m[7] = 0.0

        m[8] = z[0]
        m[9] = z[1]
        m[10] = z[2]
        m[11] = 0.0

        m[12] = 0.0
        m[13] = 0.0
        m[14] = 0.0
        m[15] = 1.0

        return m
Beispiel #4
0
    def GetCameraOrientation(self):
        m = M3DMatrix44f()
        x = M3DVector3f()
        z = M3DVector3f()
        # Make rotation matrix
        # Z vector is reversed
        z[0] = -self.vForward[0]
        z[1] = -self.vForward[1]
        z[2] = -self.vForward[2]

        # X vector = Y cross Z
        x = m3dCrossProduct(self.vUp, z)

        # Matrix has no translation information and is
        # transposed.... (rows instead of columns)
        m[0] = x[0]
        m[1] = x[1]
        m[2] = x[2]
        m[3] = 0.0

        m[4] = self.vUp[0]
        m[5] = self.vUp[1]
        m[6] = self.vUp[2]
        m[7] = 0.0

        m[8] = z[0]
        m[9] = z[1]
        m[10] = z[2]
        m[11] = 0.0

        m[12] = 0.0
        m[13] = 0.0
        m[14] = 0.0
        m[15] = 1.0

        return m