def CreateComponent(self, name, state):
     component = DirectionalLightClientComponent()
     renderObject = trinity.Tr2InteriorDirectionalLight()
     component.renderObject = renderObject
     renderObject.color = (state['red'], state['green'], state['blue'])
     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'])
     component.originalShadowCasterTypes = int(state['shadowCasterTypes'])
     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'])
     renderObject.useExplicitBounds = bool(state['useExplicitBounds'])
     if renderObject.useExplicitBounds:
         renderObject.explicitBoundsMin = util.UnpackStringToTuple(state['explicitBoundsMin'])
         renderObject.explicitBoundsMax = util.UnpackStringToTuple(state['explicitBoundsMax'])
     renderObject.LODDistribution = state['LODDistribution']
     renderObject.shadowLODs = state['shadowLODs']
     renderObject.LODBlendRegion = state['LODBlendRegion']
     renderObject.direction = util.UnpackStringToTuple(state['direction'])
     component.renderObject.name = self.GetName(state['_spawnID'])
     return component
Beispiel #2
0
 def CreateComponent(self, name, state):
     component = ShipHologramComponent()
     if 'positionOffset' in state:
         component.positionOffset = util.UnpackStringToTuple(state['positionOffset'])
     if 'spotlightOrigin' in state:
         component.spotlightOrigin = util.UnpackStringToTuple(state['spotlightOrigin'])
     if 'color' in state:
         component.color = util.UnpackStringToTuple(state['color'])
     if 'shipTargetSize' in state:
         component.shipTargetSize = state['shipTargetSize']
     return component
Beispiel #3
0
 def CreateComponent(self, name, state):
     component = LensFlareComponent()
     if 'redFile' in state:
         component.redFile = state['redFile']
     if 'positionOffset' in state:
         component.positionOffset = util.UnpackStringToTuple(
             state['positionOffset'])
     if 'color' in state:
         component.color = util.UnpackStringToTuple(state['color'])
     if 'occluderSize' in state:
         component.occluderSize = state['occluderSize']
     return component
Beispiel #4
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
Beispiel #5
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
Beispiel #6
0
    def CreateComponent(self, name, state):
        c = GameWorld.BoundingVolumeComponent()
        try:
            if isinstance(state['min'], str):
                c.minExtends = util.UnpackStringToTuple(state['min'])
            else:
                c.minExtends = state['min']
            if isinstance(state['max'], str):
                c.maxExtends = util.UnpackStringToTuple(state['max'])
            else:
                c.maxExtends = state['max']
        except KeyError:
            sys.exc_clear()

        return c
 def CreateComponent(self, name, state):
     component = InteriorPlaceableClientComponent()
     if 'graphicID' in state:
         component.graphicID = state['graphicID']
     else:
         self.LogError(
             'interiorPlaceable Component requires graphicID in its state')
         component.graphicID = 0
     if 'overrideMetaMaterialPath' in state:
         component.overrideMetaMaterialPath = state[
             'overrideMetaMaterialPath']
     else:
         component.overrideMetaMaterialPath = None
     if 'minSpecOverideMetaMaterialPath' in state:
         component.minSpecOverideMetaMaterialPath = state[
             'minSpecOverideMetaMaterialPath']
     else:
         component.minSpecOverideMetaMaterialPath = None
     if 'probeOffsetX' in state and 'probeOffsetY' in state and 'probeOffsetZ' in state:
         component.probeOffset = (float(state['probeOffsetX']),
                                  float(state['probeOffsetY']),
                                  float(state['probeOffsetZ']))
     else:
         component.probeOffset = (0, 0, 0)
     component.depthOffset = float(state.get('depthOffset', 0))
     component.scale = util.UnpackStringToTuple(state['scale'])
     return component
 def CreateComponent(self, name, state):
     component = ParticleObjectComponent()
     if 'redFile' in state:
         component.redFile = state['redFile']
     if 'positionOffset' in state:
         component.positionOffset = util.UnpackStringToTuple(
             state['positionOffset'])
     if 'shBoundsMin' in state:
         component.shBoundsMin = util.UnpackStringToTuple(
             state['shBoundsMin'])
     if 'shBoundsMax' in state:
         component.shBoundsMax = util.UnpackStringToTuple(
             state['shBoundsMax'])
     component.depthOffset = float(state.get('depthOffset', 0))
     component.maxParticleRadius = float(state.get('maxParticleRadius', 0))
     return component
Beispiel #9
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
Beispiel #10
0
 def CreateComponent(self, name, state):
     component = ProximityTriggerComponent()
     if 'radius' in state:
         component.radius = state['radius']
     elif 'dimensions' in state:
         if type(state['dimensions']) == type(str()):
             component.dimensions = util.UnpackStringToTuple(state['dimensions'], float)
         else:
             component.dimensions = state['dimensions']
     else:
         self.LogError('Unknown trigger shape')
         return None
     if 'relativepos' in state:
         if type(state['relativepos']) == type(str()):
             component.relativePosition = util.UnpackStringToTuple(state['relativepos'], float)
         else:
             component.relativePosition = state['relativepos']
     else:
         component.relativePosition = (0, 0, 0)
     return component