예제 #1
0
    def add_pencil():
        """

        Returns:

        """

        from tools import pencil
        draw_tool = pencil.Pencil()

        return draw_tool
예제 #2
0
    def __init__(self, maze_type, subject, show_avatar_hands=False):

        # call constructor of superclass
        super(VisualMazeScene, self).__init__(background_noise=True)

        if not maze_type == 'baseline':

            # create proximity manager for maze ground units and corner types
            self.poi_manager = super(VisualMazeScene,
                                     self).create_proximity_manager()
            vizact.onkeydown('p', self.poi_manager.setDebug, viz.TOGGLE)

            # init drawing tool
            self.draw_tool = pencil.Pencil()
            self.draw_sphere = VisualMazeScene.add_sphere(
                'draw_sphere', 0.1, viz.RED, [0, 0, 0], viz.OFF, False, None)

            # arrow for warning when head is leaving the maze path
            self.arrow = viz.add('resources/arrow.dae')
            self.arrow.visible(viz.OFF)
            self.arrow.setScale(2, 2, 2)
            self.arrow.color(viz.RED)

            # add draw frame 3D model
            self.drawing_frame = viz.add('resources/frame_model.osgb')
            self.drawing_frame.setScale(1.5, 1.5, 1.5)
            self.drawing_frame.visible(viz.OFF)

            # add local landmark (flash)
            self.flash_quad = screen_flash.Flasher(color=viz.WHITE)

            # reward feedback
            self.coin = viz.add('resources/model2.dae')
            self.coin.setScale(1, 1, 1)
            self.coin.visible(viz.OFF)

            # tracked 3D object for hand collision
            self.feedback_sphere_right = VisualMazeScene.add_sphere(
                'wall_touch', 0.001, viz.WHITE, [0, 0, 0], viz.ON, False, None)
            self.feedback_sphere_right.setScale([0.29 * 350, 0.29 * 350, 0.01])
            self.feedback_sphere_right.alpha(0)
예제 #3
0
    def __init__(self):

        super(ProbingNavigationScene, self).__init__()

        self.world = viz.add('ground.osgb')

        self.walls = []
        self.wall_names = ['left', 'right', 'front', 'back']
        self.wall_sizes = []
        self.wall_positions = [['']]
        self.wall_orientations = []

        # create pencil
        self.drawing_tool = pencil.Pencil()
        self.drawing_tool.setUpdateFunction(
            self.update_pencil(self.drawing_tool))

        for wall in range(4):

            wall = super(ProbingNavigationScene, self).add_wall(
                self.wall_names[wall],
                [4, 4, 4],
            )
            self.walls.append(wall)
예제 #4
0
import viz
import vizshape
import vizinfo

vizinfo.InfoPanel(align=viz.ALIGN_LEFT_BOTTOM)

viz.setMultiSample(4)
viz.fov(60)
viz.go()

piazza = viz.add('piazza.osgb')
arrow = vizshape.addArrow(length=0.2, color=viz.RED)

from tools import pencil

tool = pencil.Pencil()


# update code for pencil
def update(tool):

    state = viz.mouse.getState()
    if state & viz.MOUSEBUTTON_LEFT:
        tool.draw()
    if state & viz.MOUSEBUTTON_RIGHT:
        tool.clear()
    if state & viz.MOUSEBUTTON_MIDDLE:
        tool.cycleColor()


tool.setUpdateFunction(update)