Ejemplo n.º 1
0
 def CreateComponent(self, name, state):
     component = LoadedLightClientComponent()
     component.resPath = state['resPath']
     component.renderObject = blue.resMan.LoadObject(component.resPath)
     component.renderObject.name = self.GetName(state['_spawnID'])
     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'])
         component.renderObject.boundingBox = trinity.Tr2InteriorOrientedBoundingBox(
         )
     return component
Ejemplo n.º 2
0
 def CreateComponent(self, name, state):
     component = SpotLightClientComponent()
     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.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.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)
     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
Ejemplo n.º 3
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