Пример #1
0
 def SetYaw(self, yaw):
     rotMat = geo2.MatrixRotationY(yaw - math.pi)
     eyePos = geo2.Vec3Subtract(self._eyePosition, self._atPosition)
     x = math.sqrt(eyePos[0]**2 + eyePos[2]**2)
     vec = (0, eyePos[1], x)
     self._eyePosition = geo2.Vec3Add(geo2.Vec3Transform(vec, rotMat),
                                      self._atPosition)
Пример #2
0
 def render_cb(dev):
     global START_TIME
     current = time.clock()
     m = geo2.MatrixRotationY((current - START_TIME) * rad_per_sec)
     trinity.SetViewTransform(
         geo2.MatrixMultiply(m, trinity.GetViewTransform()))
     START_TIME = current
Пример #3
0
 def GenGeometry(self):
     """
     Generates the geometry for the rotation tool.
     """
     xCircleAreas = []
     yCircleAreas = []
     zCircleAreas = []
     if not trinity.IsRightHanded():
         effectPath = 'res:/Graphics/Effect/Managed/Utility/LinesRotationToolLH.fx'
     else:
         effectPath = 'res:/Graphics/Effect/Managed/Utility/LinesRotationTool.fx'
     unit_circle = dungeonEditorToolGeometry.GenCirclePoints(1.0, 60)
     mat = geo2.MatrixRotationY(math.pi / 2)
     x_circle = geo2.Vec3TransformCoordArray(unit_circle, mat)
     xRotationHandleCircle = dungeonEditorToolGeometry.area(
         'x', dungeonEditorToolGeometry.RED)
     xRotationHandleCircle.AddToLineSet(x_circle, True)
     xRotationHandleCircle._lineset.effect.effectFilePath = effectPath
     mat = geo2.MatrixRotationX(math.pi / 2)
     y_circle = geo2.Vec3TransformCoordArray(unit_circle, mat)
     yRotationHandleCircle = dungeonEditorToolGeometry.area(
         'y', dungeonEditorToolGeometry.GREEN)
     yRotationHandleCircle.AddToLineSet(y_circle, True)
     yRotationHandleCircle._lineset.effect.effectFilePath = effectPath
     zRotationHandleCircle = dungeonEditorToolGeometry.area(
         'z', dungeonEditorToolGeometry.BLUE)
     zRotationHandleCircle.AddToLineSet(unit_circle, True)
     zRotationHandleCircle._lineset.effect.effectFilePath = effectPath
     w_circle = dungeonEditorToolGeometry.GenCirclePoints(1.2, 60)
     wArea = dungeonEditorToolGeometry.area('w',
                                            dungeonEditorToolGeometry.CYAN)
     wArea.AddToLineSet(w_circle, True)
     wArea._lineset.viewOriented = True
     wwArea = dungeonEditorToolGeometry.area(
         'ww', dungeonEditorToolGeometry.LIGHT_GRAY)
     wwArea.AddToLineSet(dungeonEditorToolGeometry.GenCirclePoints(1.0, 60))
     wwArea._lineset.viewOriented = True
     picking_tris = dungeonEditorToolGeometry.GenCircleTriangles(1.0, 60)
     if not trinity.IsRightHanded():
         picking_tris.reverse()
     wwArea.AddToPickingSet(picking_tris)
     rotationGeo = dungeonEditorToolGeometry.geometry(self.primitiveScene)
     rotationGeo.AppendArea(xRotationHandleCircle)
     rotationGeo.AppendArea(yRotationHandleCircle)
     rotationGeo.AppendArea(zRotationHandleCircle)
     rotationGeo.AppendArea(wArea)
     rotationGeo.AppendArea(wwArea)
     return rotationGeo