Esempio n. 1
0
 def GetYawPitch(self):
     rotMatrix = geo2.MatrixTranspose(self.viewMatrix.transform)
     quat = geo2.QuaternionRotationMatrix(rotMatrix)
     yaw, pitch, roll = geo2.QuaternionRotationGetYawPitchRoll(quat)
     yaw = math.pi / 2 - yaw
     pitch = math.pi / 2 - pitch
     return (yaw, pitch)
 def UpdateViewProjForLight(self, stepView, stepProj, light, effectValue):
     """
     Renderstep callback to make sure the rendersteps that deal with view transform and
     projection, are still up to date with any changes to the lights.  Works out the values
     for this light and then delegates to the individual MeshData instances.
     """
     eye = light.position
     at = geo2.Add(eye, light.coneDirection)
     up = (0, 0, 1)
     if SkinSpotLightShadows.REUSE_ENGINE_MAPS:
         VP = light.GetViewProjMatrix()
     else:
         if effectValue:
             effectValue.value = (0,
              0,
              0,
              light.radius)
         viewmat = geo2.MatrixLookAtRH(eye, at, up)
         self.ComputeProjectionMatrix(stepProj.projection, light, viewmat)
         stepView.view.transform = viewmat
         VP1 = geo2.MatrixMultiply(viewmat, stepProj.projection.transform)
         VP = geo2.MatrixMultiply(VP1, self.uvAdjustMatrix)
     VPT = geo2.MatrixTranspose(VP)
     for meshData in self.meshes.itervalues():
         meshData.updateParams(light, VPT)
Esempio n. 3
0
 def GetTargetPlaneProjectionMatrix(self):
     trans = self.GetTranslation()
     adjusted_translation = ProjectPointTowardsFrontPlane(trans)
     rmat = geo2.MatrixRotationQuaternion(self.GetRotation())
     rmat = geo2.MatrixTranspose(rmat)
     mat = geo2.MatrixTranslation(adjusted_translation.x, adjusted_translation.y, adjusted_translation.z)
     self.frontPlaneTranslation = geo2.MatrixMultiply(rmat, mat)
     return self.frontPlaneTranslation
 def PointToYawPitchDist(self, pos):
     upVector = (0, 1, 0)
     if trinity.IsRightHanded():
         rotMatrix = geo2.MatrixLookAtRH(pos, self.poi, upVector)
     else:
         rotMatrix = geo2.MatrixLookAtLH(pos, self.poi, upVector)
     rotMatrix = geo2.MatrixTranspose(rotMatrix)
     quat = geo2.QuaternionRotationMatrix(rotMatrix)
     yaw, pitch, roll = geo2.QuaternionRotationGetYawPitchRoll(quat)
     yaw = math.pi / 2 - yaw
     pitch = math.pi / 2 - pitch
     return (yaw, pitch, geo2.Vec3Distance(pos, self.poi))
Esempio n. 5
0
 def UpdateViewProjForLight(self, stepView, stepProj, light, effectValue):
     eye = light.position
     at = geo2.Add(eye, light.coneDirection)
     up = (0, 0, 1)
     if SkinSpotLightShadows.REUSE_ENGINE_MAPS:
         VP = light.GetViewProjMatrix()
     else:
         if effectValue:
             effectValue.value = (0, 0, 0, light.radius)
         viewmat = geo2.MatrixLookAtRH(eye, at, up)
         self.ComputeProjectionMatrix(stepProj.projection, light, viewmat)
         stepView.view.transform = viewmat
         VP1 = geo2.MatrixMultiply(viewmat, stepProj.projection.transform)
         VP = geo2.MatrixMultiply(VP1, self.uvAdjustMatrix)
     VPT = geo2.MatrixTranspose(VP)
     for meshData in self.meshes.itervalues():
         meshData.updateParams(light, VPT)