Beispiel #1
0
    def __init__(self, parent_world, name='default', \
            position=(0., 0., 0.), scale=(1., 1., 1.),\
            rotation=(0., 0., 0.), color=None,
            texture=None, animation=None, shadow=False, debug=False):

        self.debug = debug

        Model.__init__(self, parent_world, name, position, \
                    scale, rotation)

        self.animation = animation
        self.color = color
        self.texture = texture
        self.environment_mapping = False
        self.shadow = shadow
        self.material = soya.Material()

        if self.texture:
            self.material.texture = soya.Image.get(self.texture)

        if self.color:
            self.material.diffuse = self.color

        if self.environment_mapping:
            self.material.environment_mapping = True

        # create a world for the model:
        world = soya.World()

        face = soya.Face(world, [
            soya.Vertex(world, 1.0, 1.0, 0.0, 1.0, 0.0),
            soya.Vertex(world, -1.0, 1.0, 0.0, 0.0, 0.0),
            soya.Vertex(world, -1.0, -1.0, 0.0, 0.0, 1.0),
            soya.Vertex(world, 1.0, -1.0, 0.0, 1.0, 1.0)
        ])

        # set the color of the face:
        face.material = self.material

        # set face double sided:
        face.double_sided = 1

        # create a model from the world:
        model = world.to_model()

        # create a body from the model:
        if self.animation is not None:
            self.body = RotatingBody(self.parent_world,
                                     model,
                                     rotation=self.animation)
        else:
            self.body = soya.Body(self.parent_world, model)

        # position, scale and rotate the body:
        self.set_position(self.position)
        self.set_scale(self.scale)
        self.set_rotation(self.rotation)

        # set name of the body:
        self.body.name = self.name
Beispiel #2
0
    def __init__(self, parent_world, theme_dir, theme_cfg_file, debug=0):
        self.debug = debug
        self.theme_dir = theme_dir
        self.parent_world = parent_world

        self.theme_file = ThemeFile(self.debug)
        path = os.path.join(self.theme_dir, theme_cfg_file)
        self.theme_file.store_theme(path)

        self.items = {}

        self.fonts = {}
        self.fonts['p'] = {}
        self.fonts['h1'] = {}
        self.fonts['lyrics'] = {}
        self.fonts['button'] = {}

        self.box = {}
        self.box['border'] = {}
        self.box['background'] = {}

        self.bar = self.theme_file.bar

        self.world = soya.World()

        self.create_fonts()
        self.box = self.theme_file.box
        self.button = self.theme_file.button

        self.create_atmosphere()
        self.create_models()
        self.create_animodels()
        self.create_panels()

        self.world.atmosphere = self.items['atmosphere']
Beispiel #3
0
def PointSecondDerivative(x):
    "Return model for evaluation of second derivatives at given point."

    info("Plotting dof: point derivative at x = %s" % str(x))

    # Make sure point is 3D
    x = to3d(x)

    # Create separate scene (since we will extract a model, not render)
    scene = soya.World()

    # Define material (color) for the sphere
    material = soya.Material()
    material.diffuse = (0.0, 0.0, 0.0, 0.05)

    # Create sphere
    sphere = Sphere(scene, material=material)

    # Scale and moveand move to coordinate
    sphere.scale(0.15, 0.15, 0.15)
    p = sphere.position()
    p.set_xyz(x[0], x[1], x[2])
    sphere.move(p)

    # Extract model
    model = scene.to_model()

    return model
Beispiel #4
0
def UnitTriangle(color=(0.0, 1.0, 0.0, 0.5)):
    "Return model for unit tetrahedron."

    info("Plotting unit triangle")

    # Create separate scene (since we will extract a model, not render)
    scene = soya.World()

    # Create vertice
    v0 = soya.Vertex(scene, 0.0, 0.0, 0.0, diffuse=color)
    v1 = soya.Vertex(scene, 1.0, 0.0, 0.0, diffuse=color)
    v2 = soya.Vertex(scene, 0.0, 1.0, 0.0, diffuse=color)

    # Create edges
    e0 = Cylinder(scene, v0, v1, 0.007)
    e1 = Cylinder(scene, v0, v2, 0.007)
    e2 = Cylinder(scene, v1, v2, 0.007)

    # Create face
    f = soya.Face(scene, (v0, v1, v2))

    # Make face double sided
    f.double_sided = 1

    # Extract model
    model = scene.to_model()

    return model
Beispiel #5
0
def main():
    soya.init()
    #soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))

    # Creates the scene.
    scene = soya.World()

    # Creates a camera.
    camera = soya.Camera(scene)
    camera.set_xyz(0.0, 0.0, 4.0)
    camera.fov = 100.0

    # Creates a dragdrop world.
    world = Editor(scene, camera)

    # Adds some bodys with different models, at different positions.
    red   = soya.Material(); red  .diffuse = (1.0, 0.0, 0.0, 1.0)
    green = soya.Material(); green.diffuse = (0.0, 1.0, 0.0, 1.0)
    blue  = soya.Material(); blue .diffuse = (0.0, 0.0, 1.0, 1.0)

    soya.Body(world, soya.cube.Cube(None, red  ).to_model()).set_xyz(-1.0, -1.0, 1.0)
    soya.Body(world, soya.cube.Cube(None, green).to_model()).set_xyz( 0.0, -1.0, 0.0)
    soya.Body(world, soya.cube.Cube(None, blue ).to_model()).set_xyz( 1.0, -1.0, -1.0)

    soya.Body(world, soya.sphere.Sphere().to_model()).set_xyz(1.0, 1.0, 0.0)

    # Adds a light.
    light = soya.Light(scene)
    light.set_xyz(0.0, 0.2, 1.0)

    soya.set_root_widget(camera)

    # Main loop

    soya.MainLoop(scene).main_loop()
Beispiel #6
0
def DirectionalEvaluation(x, n, flip=False, center=False):
    "Return model for directional evaluation at given point in given direction."

    info("Plotting dof: directional evaluation at x = %s in direction n = %s" % (str(x), str(n)))

    # Make sure points are 3D
    x = to3d(x)
    n = to3d(n)

    # Create separate scene (since we will extract a model, not render)
    scene = soya.World()

    # Normalize
    n = array(n)
    n = 0.75 * n / norm(n)

    # Flip normal if necessary
    if flip and not pointing_outwards(x, n):
        info("Flipping direction of arrow so it points outward.")
        n = -n

    # Create arrow
    arrow = Arrow(scene, x, n, center)

    # Extract model
    model = scene.to_model()

    return model
Beispiel #7
0
    def __init__(self, widget_properties, menu_list, song=None, \
            use_pil=False, game=None, debug=False):

        self.l_main_menu = _(u'main menu')
        self.l_choose = _(u'choose another song')
        self.l_quit = _(u'quit')
        #self.separator = ' - '
        self.l_points = {}
        self.l_points['normal'] = _(u'normal points')
        self.l_points['freestyle'] = _(u'freestyle points')
        self.l_points['bonus'] = _(u'bonus points')
        self.l_points['sum'] = _(u'points')
        self.l_score = _(u'SCORE')

        ContentMenu.__init__(self, widget_properties)
        # heading, nav and box container inherited from Menu:

        self.widget_properties = widget_properties
        self.menu_list = menu_list
        self.song = song
        self.use_pil = use_pil
        self.theme_mgr = self.widget_properties['theme_mgr']
        self.debug = debug

        self.world = soya.World()
        self.parent_world.add(self.world)

        self.main_theme_name = self.widget_properties['theme']['main']
        self.song_theme_name = self.widget_properties['theme']['song']

        self.values = []
        self.pos = None
        self.game = game
Beispiel #8
0
 def __init__(self, parent_world, position=(0., 5., 2.0), scale=(9.6, 1.2, 1.2)):
     self.parent_world = parent_world
     self.world = soya.World()
     self.parent_world.add(self.world)
     self.scale = scale
     self.position = position
     self.panel = None
Beispiel #9
0
    def _init_game_engine(self):
        """Initialize soya game engine, append our paths to soya's paths,
            create the scene and set up a camera.
        """

        # Hide window manager's resizability
        # features (maximise, resize, ...):
        RESIZEABLE = False

        soya.init(title=self.window_title, \
                width=self.config['screen'].as_int('resolution_x'),
                height=self.config['screen'].as_int('resolution_y'), \
                fullscreen=int(self.config['screen'].as_bool('fullscreen')), \
                resizeable=RESIZEABLE, sound=False)

        # Enable/disable soya's auto (blender model) importer:
        soya.AUTO_EXPORTERS_ENABLED = True

        # Append some paths:
        #	* themes/[selected theme name]/media
        #	TODO: append paths for all themes in themes/,
        #	so we can change the theme at runtime (?)...
        #	* songs/[song name]/media
        default_path = os.path.join(self.app_dir, 'media', 'themes', \
            'default', 'media')
        soya.path.append(default_path)
        theme_path = os.path.join(self.app_dir, 'media', 'themes', \
            self.widget_properties['theme']['main'], 'media')
        soya.path.append(theme_path)

        self.root_world = soya.World()
        self.widget_properties['root_world'] = self.root_world
        # set up a camera:
        self.camera = soya.Camera(self.root_world)

        ### CAMERA TESTS ###
        moveable = False
        rotating = False
        if moveable:
            from lib.cameras.movable_camera import MovableCamera
            self.camera = MovableCamera(self.app_dir, self.parent_world)
        if rotating:
            from lib.cameras.spinning_camera import SpinningCamera
            cube = soya.Body(self.root_world, soya.cube.Cube().to_model())
            cube.visible = 0
            self.camera = SpinningCamera(self.root_world, cube)
        ### END CAMERA TESTS ###

        self.camera.set_xyz(0.0, 0.0, 15.0)

        self.light = soya.Light(self.root_world)
        self.light.set_xyz(0.0, 7.7, 17.0)
Beispiel #10
0
    def _create_models(self):
        rhomb_world = soya.World()
        centerVerticesLeft = []
        centerVerticesRight = []
        for i in range(self.rhomb_n):
            l = soya.Vertex(
                rhomb_world,
                self.rhomb_radius * math.sin(2.0 * math.pi * i / self.rhomb_n),
                0.0,
                self.rhomb_radius * math.cos(2.0 * math.pi * i / self.rhomb_n))
            r = soya.Vertex(
                rhomb_world,
                self.rhomb_radius * math.sin(2.0 * math.pi * i / self.rhomb_n),
                0.0,
                self.rhomb_radius * math.cos(2.0 * math.pi * i / self.rhomb_n))
            l.diffuse = self.rhomb_color1
            r.diffuse = self.rhomb_color2
            centerVerticesLeft.append(l)
            centerVerticesRight.append(r)
        for i in range(self.rhomb_n):
            leftVertex = soya.Vertex(rhomb_world, 0.0, -self.rhomb_left_size,
                                     0.0)
            rightVertex = soya.Vertex(rhomb_world, 0.0, self.rhomb_right_size,
                                      0.0)
            leftVertex.diffuse = self.rhomb_color1
            rightVertex.diffuse = self.rhomb_color2
            f = soya.Face(rhomb_world, [
                leftVertex, centerVerticesLeft[(i + 1) % self.rhomb_n],
                centerVerticesLeft[i]
            ])
            f.smooth_lit = 1
            f = soya.Face(rhomb_world, [
                rightVertex, centerVerticesRight[i],
                centerVerticesRight[(i + 1) % self.rhomb_n]
            ])
            f.smooth_lit = 1
        model_builder = soya.SimpleModelBuilder()
        model_builder.shadow = 1
        rhomb_world.model_builder = model_builder

        self.rhomb_model = rhomb_world.to_model()
        self.rhomb = MovingRotatingBody(self.scene, self.rhomb_model)
        self.rhomb.rotate_z(90)
        self.rhomb.current = RIGHT
        self.rhomb.speed = soya.Vector(self.scene, *self.rhomb_speed_xyz)

        self.rhomb.angle_x = 0
        self.rhomb.angle_y = 0
        self.rhomb.angle_z = 0

        self.rhomb.rotating = 0
        self.rhomb.angle = 0
Beispiel #11
0
def main():
    DEBUG = 1

    import sys
    import os
    import soya.cube

    # init soya in resizable window:
    soya.init('MovableCamera Module', 1024, 768, 0)
    soya.path.append(
        os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'media',
                     'themes', 'kiddy', 'media'))
    # set the root scene:
    scene = soya.World()

    # set up the light:
    light = soya.Light(scene)
    light.set_xyz(0.0, 0.7, 1.0)

    # set up the camera:
    camera = MovableCamera(app_dir='.', parent_world=scene, debug=DEBUG)
    camera.set_xyz(0.0, 0, 10.0)

    # a test cube in the background:
    test_cube_world = soya.cube.Cube()
    test_cube_world.model_builder = soya.SolidModelBuilder()
    test_cube = soya.Body(scene, test_cube_world.to_model())
    test_cube.rotate_y(45.0)
    test_cube.rotate_x(45.0)

    atmosphere = soya.SkyAtmosphere()
    atmosphere.bg_color = (1.0, 0.0, 0.0, 1.0)
    atmosphere.ambient = (0.5, 0.5, 0.0, 1.0)
    atmosphere.skyplane = 1
    atmosphere.sky_color = (1.0, 1.0, 0.0, 1.0)
    atmosphere.cloud = soya.Material(soya.Image.get('cloud.png'))

    scene.atmosphere = atmosphere
    # set our root widget:
    soya.set_root_widget(camera)

    # start soya main loop:
    soya.MainLoop(scene).main_loop()
Beispiel #12
0
def IntegralMoment(cellname, num_moments, x=None):
    "Return model for integral moment for given element."

    info("Plotting dof: integral moment")

    # Set position
    if x is None and cellname == "triangle":
        a = 1.0 / (2 + sqrt(2)) # this was a fun exercise
        x = (a, a, 0.0)
    elif x is None:
        a = 1.0 / (3 + sqrt(3)) # so was this
        x = (a, a, a)

    # Make sure point is 3D
    x = to3d(x)

    # Fancy scaling of radius and color
    r = 1.0 / (num_moments + 5)
    if num_moments % 2 == 0:
        c = 1.0
    else:
        c = 0.0

    # Create separate scene (since we will extract a model, not render)
    scene = soya.World()

    # Define material (color) for the sphere
    material = soya.Material()
    material.diffuse = (c, c, c, 0.7)

    # Create sphere
    sphere = Sphere(scene, material=material)

    # Scale and moveand move to coordinate
    sphere.scale(r, r, r)
    p = sphere.position()
    p.set_xyz(x[0], x[1], x[2])
    sphere.move(p)

    # Extract model
    model = scene.to_model()

    return model
Beispiel #13
0
def UnitTetrahedron(color=(0.0, 1.0, 0.0, 0.5)):
    "Return model for unit tetrahedron."

    info("Plotting unit tetrahedron")

    # Create separate scene (since we will extract a model, not render)
    scene = soya.World()

    # Create vertices
    v0 = soya.Vertex(scene, 0.0, 0.0, 0.0, diffuse=color)
    v1 = soya.Vertex(scene, 1.0, 0.0, 0.0, diffuse=color)
    v2 = soya.Vertex(scene, 0.0, 1.0, 0.0, diffuse=color)
    v3 = soya.Vertex(scene, 0.0, 0.0, 1.0, diffuse=color)

    # Create edges
    e0 = Cylinder(scene, v0, v1, 0.007)
    e1 = Cylinder(scene, v0, v2, 0.007)
    e2 = Cylinder(scene, v0, v3, 0.007)
    e3 = Cylinder(scene, v1, v2, 0.007)
    e4 = Cylinder(scene, v1, v3, 0.007)
    e5 = Cylinder(scene, v2, v3, 0.007)

    # Create faces
    f0 = soya.Face(scene, (v1, v2, v3))
    f1 = soya.Face(scene, (v0, v2, v3))
    f2 = soya.Face(scene, (v0, v1, v3))
    f3 = soya.Face(scene, (v0, v1, v2))

    # Make faces double sided
    f0.double_sided = 1
    f1.double_sided = 1
    f2.double_sided = 1
    f3.double_sided = 1

    # Extract model
    model = scene.to_model()

    return model
Beispiel #14
0
def DirectionalDerivative(x, n):
    "Return model for directional derivative at given point in given direction."

    info("Plotting dof: directional derivative at x = %s in direction n = %s" % (str(x), str(n)))

    # Make sure points are 3D
    x = to3d(x)
    n = to3d(n)

    # Create separate scene (since we will extract a model, not render)
    scene = soya.World()

    # Normalize
    n = array(n)
    n = 0.75 * n / norm(n)

    # Create line
    line = Cylinder(scene, x - 0.07*n, x + 0.07*n, 0.005)

    # Extract model
    model = scene.to_model()

    return model
Beispiel #15
0
    def __init__(self, parent_world, color, debug=0):
        #CubeList.__init__(self, parent_world, min, max, debug)
        CubeObserver.__init__(self, parent_world, debug)

        self.distance_from_side = 0  # could be problematic must be sync with the other observers
        self.debug = debug
        self.parent_world = parent_world
        self.world = soya.World()
        self.parent_world.add(self.world)

        self.model_builder = soya.SimpleModelBuilder()
        self.model_builder.shadow = 1

        self.material = soya.Material()
        self.material.environment_mapping = 1
        self.material.diffuse = color
        #(1.0, 1.0, 1.0, 0.3)

        ### SHINYNESS ^^ ###
        #self.material.texture = soya.Image.get("env_map.jpeg")
        ### END SHINYNESS ^^ ###

        self.size_of_window_x = 15

        self.range_x = 5

        # For the pos cube.
        self.size_x = 0.1
        bar = soya.cube.Cube(material=self.material)
        bar.scale(self.size_x, 1, 1)

        #bar.model_builder = self.model_builder

        model = bar.to_model()

        self.pos_cube = soya.Body(self.world, model)
Beispiel #16
0
def main():

    DEBUG = 1

    import sys
    import os
    #import MovableCamera

    # init soya in resizable window:
    soya.init('Canta', 1024, 768, 0)

    # append our data path:
    soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', 'data'))

    # disable soya's auto exporter:
    soya.AUTO_EXPORTERS_ENABLED = 0

    # set the root scene:
    scene = soya.World()

    # set up the light:
    light = soya.Light(scene)
    #light.set_xyz(1.0, 0.7, 1.0)
    light.set_xyz(0.0, 0.7, 1.0)

    # set up the camera:
    # (uncomment for static camera):
    camera = soya.Camera(scene)
    camera.set_xyz(0.0, 0, 10.0)

    # (uncomment for movable camera):
    #camera = MovableCamera.MovableCamera(scene)

    # create 5 animated objects (CANTA letters):
    # Letter 'C':
    name = 'Logo_0'
    position = (-4.0, 0.0, 0.0)
    scale = (4.0, 3.0, 3.0)
    rotation = (0.0, 0.0, 0.0)
    shadow = 1
    action = 'Logo_0Damping'
    test_animodel0 = AniModel(
                parent_world = scene,
                name = name,
                position = position,
                scale = scale,
                rotation = rotation,
                shadow = shadow,
                action = action,
                debug = DEBUG
                )
    # Letter 'A':
    name = 'Logo_1'
    position = (-3.0, -0.2, 0.0)
    scale = (1.0, 1.0, 1.0)
    rotation = (0.0, 0.0, 0.0)
    shadow = 1
    action = 'Logo_1Damping'
    test_animodel1 = AniModel(
                parent_world = scene,
                name = name,
                position = position,
                scale = scale,
                rotation = rotation,
                shadow = shadow,
                action = action,
                debug = DEBUG
                )

    # Letter 'N':
    name = 'Logo_2'
    position = (-1.5, 0.9, 0.0)
    scale = (1.0, 1.0, 1.0)
    rotation = (0.0, 0.0, 0.0)
    shadow = 1
    action = 'Logo_2Damping'
    test_animodel2 = AniModel(
                parent_world = scene,
                name = name,
                position = position,
                scale = scale,
                rotation = rotation,
                shadow = shadow,
                action = action,
                debug = DEBUG
                )
    # Letter 'T':
    name = 'Logo_3'
    position = (0.0, -0.5, 0.5)
    scale = (1.0, 1.0, 1.0)
    rotation = (0.0, 0.0, 0.0)
    shadow = 1
    action = 'Logo_3Damping'
    test_animodel3 = AniModel(
                parent_world = scene,
                name = name,
                position = position,
                scale = scale,
                rotation = rotation,
                shadow = shadow,
                action = action,
                debug = DEBUG
                )

    # Letter 'A':
    name = 'Logo_4'
    position = (2.0, 0.0, -0.3)
    scale = (1.5, 1.5, 1.5)
    rotation = (0.0, 0.0, 0.0)
    shadow = 1
    action = 'Logo_4Damping'
    test_animodel1 = AniModel(
                parent_world = scene,
                name = name,
                position = position,
                scale = scale,
                rotation = rotation,
                shadow = shadow,
                action = action,
                debug = DEBUG
                )

    # set our root widget:
    soya.set_root_widget(camera)

    # start soya main loop:
    soya.MainLoop(scene).main_loop()
Beispiel #17
0
if __name__ == '__main__':

    DEBUG = 1

    import sys
    import os
    import soya.cube

    # init soya in resizable window:
    soya.init('Canta', 1024, 768, 0)

    soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', 'data'))

    # set the root scene:
    scene = soya.World()

    # create the test object:
    # the name:
    name = 'testpanel'
    # position, scale and rotation with (x, y, z):
    position = (0.0, 0.0, 1.0)
    scale = (5.0, 2.0, 5.0)
    rotation = (0.5, 0.5, 0.5)
    # color:
    color = (0.8, 0.4, 0.2, 0.7)

    # instanciate:
    test_guipanel = GuiPanel(scene, name, position, scale, rotation, color,
                             DEBUG)
Beispiel #18
0
def render(models, title, num_moments, is3d, rotate):
    "Render given list of models."

    # Note that we view from the positive z-axis, and not from the
    # negative y-axis. This should make no difference since the
    # element dofs are symmetric anyway and it plays better with
    # the default camera settings in Soya.

    # Initialize Soya
    soya.init(title)

    # Create scene
    scene = soya.World()
    scene.atmosphere = soya.Atmosphere()
    if title == "Notation":
        scene.atmosphere.bg_color = (0.0, 1.0, 0.0, 1.0)
    else:
        scene.atmosphere.bg_color = (1.0, 1.0, 1.0, 1.0)

    # Not used, need to manually handle rotation
    #label = Label3D(scene, text=str(num_moments), size=0.005)
    #label.set_xyz(1.0, 1.0, 1.0)
    #label.set_color((0.0, 0.0, 0.0, 1.0))

    # Define rotation
    if is3d:
        class RotatingBody(soya.Body):
            def advance_time(self, proportion):
                self.rotate_y(2.0 * proportion)
    else:
        class RotatingBody(soya.Body):
            def advance_time(self, proportion):
                self.rotate_z(2.0 * proportion)

    # Select type of display, rotating or not
    if rotate:
        Body = RotatingBody
    else:
        Body = soya.Body

    # Add all models
    for model in models:
        body = Body(scene, model)

    # Set light
    light = soya.Light(scene)
    if is3d:
        light.set_xyz(1.0, 5.0, 5.0)
    else:
        light.set_xyz(0.0, 0.0, 1.0)
    light.cast_shadow = 1
    light.shadow_color = (0.0, 0.0, 0.0, 0.5)

    # Set camera
    camera = soya.Camera(scene)
    camera.ortho = 0
    p = camera.position()
    if is3d:
        if rotate:
            camera.set_xyz(-20, 10, 50.0)
            camera.fov = 2.1
            p.set_xyz(0.0, 0.4, 0.0)
        else:
            camera.set_xyz(-20, 10, 50.0)
            camera.fov = 1.6
            p.set_xyz(0.3, 0.42, 0.5)
    else:
        if rotate:
            camera.set_xyz(0, 10, 50.0)
            camera.fov = 2.6
            p.set_xyz(0.0, 0.0, 0.0)
        else:
            camera.set_xyz(0, 10, 50.0)
            camera.fov = 1.7
            p.set_xyz(0.5, 0.4, 0.0)
    camera.look_at(p)
    soya.set_root_widget(camera)

    # Handle exit
    class Idler(soya.Idler):
        def end_round(self):
            for event in self.events:
                if event[0] == QUIT:
                    print "Closing plot, bye bye"
                    sys.exit(0)

    # Main loop
    idler = Idler(scene)
    idler.idle()
Beispiel #19
0
 def _init_soya(self):
     soya.path.append("data")
     soya.init()
     self.scene = soya.World()
Beispiel #20
0
# Set up an atmosphere, so as the background is gray
scene.atmosphere = soya.Atmosphere()
scene.atmosphere.bg_color = (0.4, 0.4, 0.4, 1.0)

v_orig = Point(
    scene, 0, 0, 0
)  # this is better ?! Yes - the previous one w/ Vector does not refer to the right point!

GetMaterials()
GetMainCoordSystemLazers()
getCoordLazers()

# creating Models
m_ground = soya.cube.Cube(None, gnd_mat, size=78)

m_pole = soya.World()
m_pole1 = soya.cube.Cube(m_pole, wht_mat, size=1)
m_pole2 = soya.cube.Cube(m_pole, wht_mat, size=1)
m_pole1.scale(1, 10, 1)
m_pole2.scale(2, 1, 1)
m_pole1.set_xyz(0, 0, 0)
m_pole2.set_xyz(0.5, 4.5, 0)

m_ball = soya.sphere.Sphere(None, blue_mat)
m_ball.scale(0.6, 0.2, 1)  # flatten like ellipsoid a bit

m_pend = soya.World()
m_arm = soya.cube.Cube(m_pend, wht_mat, size=1)
m_arm.scale(0.2, 5, 0.2)

hsz = 0.2
Beispiel #21
0
 def __init__(self, parent_world):
     self.parent_world = parent_world
     self.world = soya.World()
     self.parent_world.add(self.world)