def draw(pipe, index):
    materialIndex = rs.AddMaterialToObject(pipe)
    rs.MaterialColor(
        materialIndex,
        (random.uniform(0, 255), random.uniform(0, 255), 150 + index * 5))
    rs.MaterialShine(materialIndex, index * 0.1)
    rs.MaterialTransparency(materialIndex, random.uniform(0, 0.15 * index))
def draw(center, maxrad, minrad, index):
    torus = rs.AddTorus(center, maxrad, minrad)
    materialIndex = rs.AddMaterialToObject(torus)
    rs.MaterialColor(
        materialIndex,
        (random.uniform(0, 255), random.uniform(0, 255), 150 + index * 5))
    #    rs.MaterialShine(materialIndex,index*5 )
    rs.MaterialTransparency(materialIndex, random.uniform(0, 0.1 * index))
Beispiel #3
0
def SplitRecursive(surface, splitValue, direction, generation, index):
    if generation > 0:
        domain_u = rs.SurfaceDomain(surface, direction)
        domainRange = domain_u[1] - domain_u[0]
        split = domainRange * splitValue + domain_u[0]
        surface1 = rs.TrimSurface(surface, direction, (split, domain_u[1]))
        surface2 = rs.TrimSurface(surface, direction, (domain_u[0], split))
        rs.DeleteObject(surface)
        SplitRecursive(surface1, random.uniform(0.4, 0.6), 0, generation - 1,
                       index)
        SplitRecursive(surface2, random.uniform(0.4, 0.6), 1, generation - 1,
                       index)
    else:
        materialIndex = rs.AddMaterialToObject(surface)
        rs.MaterialColor(
            materialIndex,
            (random.uniform(0, 255), random.uniform(0, 255), 150 + index * 5))
        rs.MaterialShine(materialIndex, index * 0.1)
        rs.MaterialTransparency(materialIndex, random.uniform(0, 0.15 * index))
Beispiel #4
0
def AssignMaterial(object_id, Material):
    # Adds simple, pre-defined material surface property sets to objects. Note that
    # these are simply visual properties, they do not make the model suitable for
    # centre of gravity, etc. calculations.
    MatInd = rs.AddMaterialToObject(object_id)
    if Material == "White_composite_external":
        rs.MaterialColor(MatInd, (255, 255, 255))
        rs.MaterialShine(MatInd, 100)
        rs.MaterialTransparency(MatInd, 0)
        rs.MaterialReflectiveColor(MatInd, (255, 255, 255))
    elif Material == "Plexiglass":
        rs.MaterialColor(MatInd, (255, 255, 255))
        rs.MaterialShine(MatInd, 255)
        rs.MaterialTransparency(MatInd, 0.8)
    elif Material == "Skin":
        rs.MaterialColor(MatInd, (229, 184, 143))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "Panel":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "PropDisk":
        rs.MaterialColor(MatInd, (255, 255, 255))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0.9)
    elif Material == "Structure":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "ShinyBABlueMetal":
        rs.MaterialColor(MatInd, (0, 32, 91))
        rs.MaterialShine(MatInd, 150)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "ShinyBARedMetal":
        rs.MaterialColor(MatInd, (218, 41, 28))
        rs.MaterialShine(MatInd, 150)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "UnpaintedMetal":
        rs.MaterialColor(MatInd, (188, 198, 204))
        rs.MaterialShine(MatInd, 30)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "FanDisk":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 30)
        rs.MaterialTransparency(MatInd, 0.2)
    elif Material == "ShinyBlack":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 120)
        rs.MaterialTransparency(MatInd, 0)