示例#1
0
 def SetActiveCamera(self, camera = None, view = None, projection = None):
     if camera is None and view is None and projection is None:
         self.RemoveStep('SET_VIEW')
         self.RemoveStep('SET_PROJECTION')
         return
     if camera is not None:
         self.AddStep('SET_VIEW', trinity.TriStepSetView(None, camera))
         self.AddStep('SET_PROJECTION', trinity.TriStepSetProjection(camera.projectionMatrix))
     if view is not None:
         self.AddStep('SET_VIEW', trinity.TriStepSetView(view))
     if projection is not None:
         self.AddStep('SET_PROJECTION', trinity.TriStepSetProjection(projection))
    def RunSimulation(self):
        trinity.settings.SetValue('frustumCullingDisabled', 1)
        trinity.settings.SetValue('eveSpaceSceneVisibilityThreshold', 0)
        trinity.settings.SetValue('eveSpaceSceneLowDetailThreshold', 0)
        trinity.settings.SetValue('eveSpaceSceneMediumDetailThreshold', 0)
        ut.StartTasklet(self._PumpBlue)
        import sceneutils
        scene = sceneutils.GetOrCreateScene()
        scene.objects.append(self.redNodeMutated)
        self._UpdateBoundingBox(True)
        rj = trinity.CreateRenderJob('CallbackJob')
        projection = trinity.TriProjection()
        projection.PerspectiveFov(1, 1, 1, 10000000)
        rj.steps.append(trinity.TriStepSetProjection(projection))
        view = trinity.TriView()
        view.SetLookAtPosition((50000, 0, 0), (0, 0, 0), (0, 1, 0))
        rj.steps.append(trinity.TriStepSetView(view))
        rj.steps.append(trinity.TriStepUpdate(scene))
        rj.steps.append(trinity.TriStepRenderScene(scene))
        rj.steps.append(trinity.TriStepPythonCB(self.AccumulateBounds))
        rj.ScheduleRecurring()
        for i in range(self._passes):
            self.activeIndex[0] = i
            for cs in self.curveSets:
                cs.Play()

            for sys in self.systems:
                sys.ClearParticles()

            self.started[0] = True
            ut.SleepSim(self._time)

        rj.UnscheduleRecurring()
        self._pumpBlue = False
 def SetActiveCamera(self, camera):
     if camera is None:
         self.RemoveStep('SET_VIEW')
         self.RemoveStep('SET_PROJECTION')
     else:
         self.AddStep('SET_VIEW', trinity.TriStepSetView(camera.viewMatrix))
         self.AddStep('SET_PROJECTION',
                      trinity.TriStepSetProjection(camera.projectionMatrix))
示例#4
0
 def SetCameraProjection(self, proj):
     if proj is None:
         self.RemoveStep('SET_PROJECTION')
         self.projection = None
     else:
         self.AddStep('SET_PROJECTION', trinity.TriStepSetProjection(proj))
         if self.stereoEnabled:
             self.originalProjection = blue.BluePythonWeakRef(proj)
         else:
             self.projection = blue.BluePythonWeakRef(proj)
示例#5
0
def SetProjection(rj, newProj):
    if hasattr(rj, 'CallMethodOnChildren'):
        rj.CallMethodOnChildren('SetCameraProjection', newProj)
        rj.CallMethodOnChildren('AddStep', 'SET_PROJECTION', trinity.TriStepSetProjection(newProj))
        return
    if hasattr(rj, 'SetCameraProjection'):
        rj.SetCameraProjection(newProj)
        return
    if hasattr(rj, 'GetStep'):
        projStep = rj.GetStep('SET_PROJECTION')
        if projStep is not None:
            projStep.projection = newProj
示例#6
0
def SetProjection(rj, newProj):
    """
    Tries several methods to set the projection matrix on the renderjob.
    """
    if hasattr(rj, 'CallMethodOnChildren'):
        rj.CallMethodOnChildren('SetCameraProjection', newProj)
        rj.CallMethodOnChildren('AddStep', 'SET_PROJECTION',
                                trinity.TriStepSetProjection(newProj))
        return
    if hasattr(rj, 'SetCameraProjection'):
        rj.SetCameraProjection(newProj)
        return
    if hasattr(rj, 'GetStep'):
        projStep = rj.GetStep('SET_PROJECTION')
        if projStep is not None:
            projStep.projection = newProj