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
Exemplo n.º 2
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
Exemplo n.º 3
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
size = 50
group = rtx.ObjectGroup()
geometry = rtx.PlainGeometry(size, size)
geometry.set_rotation((0, math.pi / 2, 0))
geometry.set_position((-10, 0, 0))
material = rtx.EmissiveMaterial(3, visible=False)
mapping = rtx.SolidColorMapping((1, 1, 1))
light = rtx.Object(geometry, material, mapping)
Exemplo n.º 4
0
geometry.set_position((0, 5, 0))
material = rtx.EmissiveMaterial(1, visible=True)
mapping = rtx.SolidColorMapping((1, 1, 1))
light = rtx.Object(geometry, material, mapping)
# scene.add(light)

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

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

# place bunny
group = rtx.ObjectGroup()
faces, vertices = gm.load("../geometries/bunny")
bottom = np.amin(vertices, axis=0)

geometry = rtx.StandardGeometry(faces, vertices, 25)
geometry.set_position((0, 0, 0.5))
material = rtx.LambertMaterial(0.95)
mapping = rtx.SolidColorMapping((1, 1, 1))