def PrepareComponent(self, sceneID, entityID, component):
     if component.graphicID <= 0:
         component.renderObject = None
         return
     renderObject = trinity.Tr2InteriorPlaceable()
     self._LoadModel(component, renderObject)
     renderObject.isStatic = True
     renderObject.probeOffset = component.probeOffset
     renderObject.depthOffset = component.depthOffset
     renderObject.name = '%s: %s' % (self.graphicClient.GetGraphicName(
         component.graphicID) or 'BadAsset', entityID)
     component.renderObject = renderObject
Exemple #2
0
def CreateScene3d(tex):
    scene = trinity.Tr2InteriorScene()
    room = trinity.Load(
        'res:/Graphics/Interior/Unique/Test/Test1/Test1WodInteriorStatic.red')
    cell = trinity.Tr2InteriorCell()
    scene.cells.append(cell)
    room.rotation = (0.0, -0.44663557410240173, 0.0, 0.8947159647941589)
    scene.sunDirection = (0.4367, -0.3684, 0.8207)
    scene.shadowCubeMap.enabled = True
    lightSource = trinity.Tr2InteriorLightSource()
    lightSource.radius = 12.0
    lightSource.falloff = 0.6
    lightSource.position = (1.308, 1.7335, 1.4637)
    lightSource.color = (306.0 / 255.0, 238.79999999999998 / 255.0,
                         212.4 / 255.0)
    scene.AddLightSource(lightSource)
    lightSource = trinity.Tr2InteriorLightSource()
    lightSource.radius = 12.0
    lightSource.falloff = 0.6
    lightSource.position = (1.7305, 2.0731, -1.7867)
    lightSource.color = (266.4 / 255.0, 279.59999999999997 / 255.0,
                         306.0 / 255.0)
    scene.AddLightSource(lightSource)
    lightSource = trinity.Tr2InteriorLightSource()
    lightSource.radius = 12.0
    lightSource.falloff = 0.6
    lightSource.position = (-1.7793, 1.016, 0.1315)
    lightSource.color = (115.19999999999999 / 255.0, 147.6 / 255.0,
                         222.0 / 255.0)
    scene.AddLightSource(lightSource)
    scene.sunDiffuseColor = (44.0 / 255.0, 35.0 / 255.0, 35.0 / 255.0, 1.0)
    scene.ambientColor = (0.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0)
    screen = trinity.Tr2InteriorPlaceable()
    screen.placeableResPath = 'res:/Graphics/Placeable/UI/SimpleQuad/SimpleQuad.red'
    texParams = screen.placeableRes.Find('trinity.TriTexture2DParameter')
    diffuseMap = None
    for each in texParams:
        if each.name == 'DiffuseMap':
            diffuseMap = each
            break

    if diffuseMap:
        diffuseMap.SetResource(tex)
    screen.translation = (1, 2, 0)
    screen.rotation = geo2.QuaternionRotationSetYawPitchRoll(-0.6, 0.3, 0.1)
    scene.AddDynamic(screen)
    return (scene, screen)
 def PrepareComponent(self, sceneID, entityID, component):
     modelFile = self.graphicClient.GetModelFilePath(component.graphicID)
     renderObject = trinity.Tr2InteriorPlaceable()
     if modelFile is not None:
         renderObject.placeableResPath = modelFile
     self.WaitForGeometry(renderObject)
     if renderObject.placeableRes is None:
         self.LogWarn('!!! WARNING !!! Asset (', modelFile,
                      ') is missing !!! WARNING !!!')
         renderObject.placeableResPath = const.BAD_ASSET_PATH_AND_FILE
         self.WaitForGeometry(renderObject)
         if renderObject.placeableRes is None:
             self.LogError(
                 '!!! ERROR !!! The InteriorPlaceable bad asset is missing ',
                 const.BAD_ASSET_PATH_AND_FILE, '!!! ERROR !!!')
     renderObject.isStatic = True
     renderObject.probeOffset = component.probeOffset
     renderObject.depthOffset = component.depthOffset
     graphicName = self.graphicClient.GetGraphicName(
         component.graphicID) or 'BadAsset'
     renderObject.name = str(graphicName) + ': ' + str(entityID)
     component.renderObject = renderObject
     self.ApplyMaterials(entityID, component)
 def ConvertToInterior(triObject, resPath):
     returnObject = trinity.Tr2InteriorPlaceable()
     returnObject.placeableResPath = triObject.placeableResPath
     return returnObject