コード例 #1
0
ファイル: boxLightClient.py プロジェクト: connoryang/1v1dec
 def CreateComponent(self, name, state):
     component = BoxLightClientComponent()
     renderObject = trinity.Tr2InteriorBoxLight()
     component.renderObject = renderObject
     graphicWrappers.Wrap(renderObject)
     component.originalPrimaryLighting = bool(state['primaryLighting'])
     component.performanceLevel = state['performanceLevel']
     renderObject.SetColor((state['red'], state['green'], state['blue']))
     renderObject.SetScaling((state['scaleX'], state['scaleY'], state['scaleZ']))
     renderObject.SetFalloff(state['falloff'])
     renderObject.shadowImportance = state['shadowImportance']
     renderObject.primaryLighting = bool(state['primaryLighting'])
     renderObject.affectTransparentObjects = bool(state['affectTransparentObjects'])
     renderObject.shadowResolution = int(state['shadowResolution'])
     renderObject.shadowCasterTypes = int(state['shadowCasterTypes'])
     renderObject.projectedTexturePath = state['projectedTexturePath'].encode()
     renderObject.importanceScale = state['importanceScale']
     renderObject.importanceBias = state['importanceBias']
     renderObject.enableShadowLOD = bool(state['enableShadowLOD'])
     renderObject.specularIntensity = float(state.get('specularIntensity', '1'))
     renderObject.useKelvinColor = bool(state['useKelvinColor'])
     if renderObject.useKelvinColor:
         renderObject.kelvinColor.temperature = state['temperature']
         renderObject.kelvinColor.tint = state['tint']
         renderObject.kelvinColor.whiteBalance = int(state['whiteBalance'])
     component.originalShadowCasterTypes = renderObject.shadowCasterTypes
     if '_spawnID' in state:
         component.renderObject.name = self.GetName(state['_spawnID'])
     return component
コード例 #2
0
 def CreateComponent(self, name, state):
     component = OccluderClientComponent()
     component.cellName = state.get('cellName', '')
     renderObject = trinity.Tr2InteriorOccluder()
     component.renderObject = renderObject
     graphicWrappers.Wrap(renderObject)
     renderObject.SetScale(
         (state.get('scaleX', 1), state.get('scaleY',
                                            1), state.get('scaleZ', 1)))
     return component
コード例 #3
0
ファイル: graphicClient.py プロジェクト: connoryang/1v1dec
 def CreateScene(self, sceneID, sceneType):
     if sceneID in self.scenes:
         raise RuntimeError('Trinity Scene Already Exists %d' % sceneID)
     if sceneType == const.world.INTERIOR_SCENE:
         self.scenes[sceneID] = trinity.Tr2InteriorScene()
     else:
         raise RuntimeError('Trying to create a nonexistent type of scene')
     graphicWrappers.Wrap(self.scenes[sceneID], convertSceneType=False)
     if hasattr(self.scenes[sceneID], 'SetID'):
         worldSpaceTypeID = self.worldSpaceClient.GetWorldSpaceTypeIDFromWorldSpaceID(sceneID)
         self.scenes[sceneID].SetID(worldSpaceTypeID)
コード例 #4
0
 def CreateComponent(self, name, state):
     component = PhysicalPortalClientComponent()
     renderObject = trinity.Tr2InteriorPhysicalPortal()
     component.renderObject = renderObject
     graphicWrappers.Wrap(renderObject)
     renderObject.maxBounds = (state['scaleX'], state['scaleY'],
                               state['scaleZ'])
     renderObject.minBounds = (-state['scaleX'], -state['scaleY'],
                               -state['scaleZ'])
     component.cellA = state['cellA']
     component.cellB = state['cellB']
     return component
コード例 #5
0
 def CreateComponent(self, name, state):
     component = PointLightClientComponent()
     renderObject = trinity.Tr2InteriorLightSource()
     component.renderObject = renderObject
     graphicWrappers.Wrap(renderObject)
     component.originalPrimaryLighting = bool(state['primaryLighting'])
     component.originalSecondaryLighting = bool(state['secondaryLighting'])
     component.performanceLevel = state['performanceLevel']
     renderObject.SetColor((state['red'], state['green'], state['blue']))
     renderObject.SetRadius(state['radius'])
     renderObject.SetFalloff(state['falloff'])
     renderObject.shadowImportance = state['shadowImportance']
     renderObject.primaryLighting = bool(state['primaryLighting'])
     renderObject.secondaryLighting = bool(state['secondaryLighting'])
     renderObject.secondaryLightingMultiplier = state[
         'secondaryLightingMultiplier']
     renderObject.affectTransparentObjects = bool(
         state['affectTransparentObjects'])
     renderObject.shadowResolution = int(state['shadowResolution'])
     renderObject.shadowCasterTypes = int(state['shadowCasterTypes'])
     renderObject.projectedTexturePath = state[
         'projectedTexturePath'].encode()
     renderObject.isStatic = bool(state['isStatic'])
     renderObject.importanceScale = state['importanceScale']
     renderObject.importanceBias = state['importanceBias']
     renderObject.enableShadowLOD = bool(state['enableShadowLOD'])
     renderObject.specularIntensity = float(
         state.get('specularIntensity', '1'))
     renderObject.useKelvinColor = bool(state['useKelvinColor'])
     customMaterialResPath = state.get('customMaterialPath', '')
     if customMaterialResPath != '':
         renderObject.customMaterial = trinity.Load(customMaterialResPath)
     renderObject.useKelvinColor = bool(state['useKelvinColor'])
     if renderObject.useKelvinColor:
         renderObject.kelvinColor.temperature = state['temperature']
         renderObject.kelvinColor.tint = state['tint']
         renderObject.kelvinColor.whiteBalance = int(state['whiteBalance'])
     component.originalShadowCasterTypes = renderObject.shadowCasterTypes
     component.useBoundingBox = bool(state['useBoundingBox'])
     if component.useBoundingBox:
         component.bbPos = util.UnpackStringToTuple(state['bbPos'])
         component.bbRot = util.UnpackStringToTuple(state['bbRot'])
         component.bbScale = util.UnpackStringToTuple(state['bbScale'])
         renderObject.boundingBox = trinity.Tr2InteriorOrientedBoundingBox()
     component.renderObject.name = self.GetName(state['_spawnID'])
     return component
コード例 #6
0
 def CreateComponent(self, name, state):
     """
     Creates a new component and trinity light source.
     """
     component = CylinderLightClientComponent()
     renderObject = trinity.Tr2InteriorCylinderLight()
     component.renderObject = renderObject
     graphicWrappers.Wrap(renderObject)
     component.originalPrimaryLighting = bool(state['primaryLighting'])
     component.originalSecondaryLighting = bool(state['secondaryLighting'])
     component.performanceLevel = state['performanceLevel']
     renderObject.SetColor((state['red'], state['green'], state['blue']))
     renderObject.SetRadius(state['radius'])
     renderObject.SetLength(state['length'])
     renderObject.SetFalloff(state['falloff'])
     if 'sectorAngleOuter' in state:
         renderObject.sectorAngleOuter = float(state['sectorAngleOuter'])
     if 'sectorAngleInner' in state:
         renderObject.sectorAngleInner = float(state['sectorAngleInner'])
     renderObject.primaryLighting = bool(state['primaryLighting'])
     renderObject.secondaryLighting = bool(state['secondaryLighting'])
     renderObject.secondaryLightingMultiplier = state[
         'secondaryLightingMultiplier']
     renderObject.projectedTexturePath = state[
         'projectedTexturePath'].encode()
     renderObject.isStatic = bool(state['isStatic'])
     renderObject.specularIntensity = float(
         state.get('specularIntensity', '1'))
     renderObject.useKelvinColor = bool(state['useKelvinColor'])
     if renderObject.useKelvinColor:
         renderObject.kelvinColor.temperature = state['temperature']
         renderObject.kelvinColor.tint = state['tint']
         renderObject.kelvinColor.whiteBalance = int(state['whiteBalance'])
     component.useBoundingBox = bool(state['useBoundingBox'])
     if component.useBoundingBox:
         component.bbPos = util.UnpackStringToTuple(state['bbPos'])
         component.bbRot = util.UnpackStringToTuple(state['bbRot'])
         component.bbScale = util.UnpackStringToTuple(state['bbScale'])
         renderObject.boundingBox = trinity.Tr2InteriorOrientedBoundingBox()
     if '_spawnID' in state:
         component.renderObject.name = self.GetName(state['_spawnID'])
     return component
コード例 #7
0
 def CreateComponent(self, name, state):
     component = SpotLightClientComponent()
     renderObject = trinity.Tr2InteriorLightSource()
     component.renderObject = renderObject
     graphicWrappers.Wrap(renderObject)
     component.originalPrimaryLighting = bool(state['primaryLighting'])
     component.performanceLevel = state['performanceLevel']
     renderObject.SetColor((state['red'], state['green'], state['blue']))
     renderObject.SetRadius(state['radius'])
     renderObject.coneDirection = (state['coneDirectionX'],
                                   state['coneDirectionY'],
                                   state['coneDirectionZ'])
     renderObject.coneAlphaInner = state['coneAlphaInner']
     renderObject.coneAlphaOuter = state['coneAlphaOuter']
     renderObject.SetFalloff(state['falloff'])
     renderObject.shadowImportance = state['shadowImportance']
     renderObject.primaryLighting = bool(state['primaryLighting'])
     renderObject.affectTransparentObjects = bool(
         state['affectTransparentObjects'])
     renderObject.shadowResolution = int(state['shadowResolution'])
     renderObject.shadowCasterTypes = int(state['shadowCasterTypes'])
     renderObject.projectedTexturePath = state[
         'projectedTexturePath'].encode()
     renderObject.importanceScale = state['importanceScale']
     renderObject.importanceBias = state['importanceBias']
     renderObject.enableShadowLOD = bool(state['enableShadowLOD'])
     renderObject.specularIntensity = float(
         state.get('specularIntensity', '1'))
     renderObject.useKelvinColor = bool(state['useKelvinColor'])
     customMaterialResPath = state.get('customMaterialPath', '')
     if customMaterialResPath != '':
         renderObject.customMaterial = trinity.Load(customMaterialResPath)
     if renderObject.useKelvinColor:
         renderObject.kelvinColor.temperature = state['temperature']
         renderObject.kelvinColor.tint = state['tint']
         renderObject.kelvinColor.whiteBalance = int(state['whiteBalance'])
     component.originalShadowCasterTypes = renderObject.shadowCasterTypes
     component.renderObject.name = self.GetName(state['_spawnID'])
     return component