コード例 #1
0
def create_geometry_by_type(geometry_type):
    if geometry_type == GeometryType.box:
        return rtx.BoxGeometry(width=0.75, height=0.75, depth=0.75), 0.375

    if geometry_type == GeometryType.shpere:
        return rtx.SphereGeometry(radius=0.375), 0.375

    if geometry_type == GeometryType.cylinder:
        return rtx.CylinderGeometry(radius=0.25, height=1), 0.5

    if geometry_type == GeometryType.cone:
        return rtx.ConeGeometry(radius=0.375, height=1), 0.375

    raise NotImplementedError
コード例 #2
0
def build_geometry_by_type(geometry_type):
    if geometry_type == GeometryType.box:
        return rtx.BoxGeometry(width=1, height=1, depth=1)

    if geometry_type == GeometryType.shpere:
        return rtx.SphereGeometry(radius=0.5)

    if geometry_type == GeometryType.cylinder:
        return rtx.CylinderGeometry(radius=0.5, height=1)

    if geometry_type == GeometryType.cone:
        return rtx.ConeGeometry(radius=0.5, height=1)

    raise NotImplementedError
コード例 #3
0
ファイル: room.py プロジェクト: sxcgc/python-rtx
geometry.set_position((0, -wall_height / 2, 0))
material = rtx.LambertMaterial(0.95)
texture = load_texture_image(
    "/home/musyoku/sandbox/gqn-dataset-renderer/textures/pink dust.png")
uv_coordinates = np.array([
    [0, 1],
    [1, 1],
    [0, 0],
    [1, 0],
], dtype=np.float32)
mapping = rtx.TextureMapping(texture, uv_coordinates)
floor = rtx.Object(geometry, material, mapping)
scene.add(floor)

# place cylinder
geometry = rtx.CylinderGeometry(1, 1)
geometry.set_position((0, -1, 2))
material = rtx.LambertMaterial(0.4)
mapping = rtx.SolidColorMapping((0, 1, 0))
cylinder = rtx.Object(geometry, material, mapping)
scene.add(cylinder)

# place cone
geometry = rtx.ConeGeometry(0.5, 1)
geometry.set_position((2, -1, 0))
material = rtx.LambertMaterial(0.4)
mapping = rtx.SolidColorMapping((1, 0, 0))
cone = rtx.Object(geometry, material, mapping)
scene.add(cone)

# Place lights