Пример #1
0
        range_lab.pos= (0,0,-range_x)
        mode_lab.SetLabel( 'scene.range:\n' + format( range_x, "9.3")) 
        if not qPy:  vss.range = range_x

    elif mode == 'v': # demonstrate altering scene.fov
        cam_dist = cam_dist + (mouse_change.x + mouse_change.y + mouse_change.z)*4
        if cam_dist <= 0:  cam_dist = 0.001  # allow only positive
        ray = (mouse_lab.pos - (cam_dist, 0,0)).norm()  
        reDrawLines()
        cam_box.pos = (cam_dist,0,0) 
        cam_lab.pos = (cam_dist,0,0) 
        fwd_arrow.pos = (cam_dist,0,0)
        mouse_arrow.pos = (cam_dist,0,0)
        mouse_arrow.axis = ray*2
        reDrawTri()  # redraw the camera triangle
        fov = 2*vs.arctan( range_x / cam_dist)
        mode_lab.SetLabel( 'scene.fov:\n{0:9.0f} deg'.format( vs.degrees(fov))) 
        if not qPy: vss.fov = fov  

    elif mode == 'm': # demonstrate moving the mouse.
        hit = vss.mouse.project( cam_frame.axis, cam_frame.pos)
        m_pos = cam_frame.world_to_frame(hit)
        if abs(m_pos.z) <= cent_plane.width/2.0 and \
           abs(m_pos.y) <= cent_plane.height/2.0 :   # not "off the screen" 
            ray = (m_pos - (cam_dist,0,0)).norm()
            reDrawLine( mouse_line, vs.vector(cam_dist,0,0), linelen, ray)
            mouse_lab.pos = m_pos
            mouse_arrow.axis = 2*ray
            rayout = cam_frame.frame_to_world(ray) - cam_frame.frame_to_world((0,0,0)) 
            mode_lab.SetLabel( 'scene.mouse.ray:\n' + str2( rayout))
            
Пример #2
0
        if not Q_PY:
            VSS.range = RANGE_X

    elif MODE == 'v': # demonstrate altering scene.fov
        CAM_DIST = CAM_DIST + (MOUSE_CHANGE.x + MOUSE_CHANGE.y + MOUSE_CHANGE.z)*4
        if CAM_DIST <= 0:
            CAM_DIST = 0.001  # allow only positive
        RAY = (MOUSE_LAB.pos - (CAM_DIST, 0, 0)).norm()
        redraw_lines()
        CAM_BOX.pos = (CAM_DIST, 0, 0)
        CAM_LAB.pos = (CAM_DIST, 0, 0)
        FWR_ARROW.pos = (CAM_DIST, 0, 0)
        MOUSE_ARROW.pos = (CAM_DIST, 0, 0)
        MOUSE_ARROW.axis = RAY*2
        redraw_tri()  # redraw the camera triangle
        FOV = 2*vs.arctan(RANGE_X / CAM_DIST)
        MODE_LAB.SetLabel('scene.fov:\n{0:9.0f} deg'.format(vs.degrees(FOV)))
        if not Q_PY:
            VSS.fov = FOV

    elif MODE == 'm': # demonstrate moving the mouse.
        HIT = VSS.mouse.project(CAM_FRAME.axis, CAM_FRAME.pos)
        M_POS = CAM_FRAME.world_to_frame(HIT)
        if abs(M_POS.z) <= CENT_PLANE.width/2.0 and \
           abs(M_POS.y) <= CENT_PLANE.height/2.0:   # not "off the screen"
            RAY = (M_POS - (CAM_DIST, 0, 0)).norm()
            redraw_line(MOUSE_LINE, vs.vector(CAM_DIST, 0, 0), LINELEN, RAY)
            MOUSE_LAB.pos = M_POS
            MOUSE_ARROW.axis = 2*RAY
            RAYOUT = CAM_FRAME.frame_to_world(RAY) - CAM_FRAME.frame_to_world((0, 0, 0))
            MODE_LAB.SetLabel('scene.mouse.ray:\n' + str2(RAYOUT))
Пример #3
0
        mode_lab.SetLabel('scene.range:\n' + format(range_x, "9.3"))
        if not qPy: vss.range = range_x

    elif mode == 'v':  # demonstrate altering scene.fov
        cam_dist = cam_dist + (mouse_change.x + mouse_change.y +
                               mouse_change.z) * 4
        if cam_dist <= 0: cam_dist = 0.001  # allow only positive
        ray = (mouse_lab.pos - (cam_dist, 0, 0)).norm()
        reDrawLines()
        cam_box.pos = (cam_dist, 0, 0)
        cam_lab.pos = (cam_dist, 0, 0)
        fwd_arrow.pos = (cam_dist, 0, 0)
        mouse_arrow.pos = (cam_dist, 0, 0)
        mouse_arrow.axis = ray * 2
        reDrawTri()  # redraw the camera triangle
        fov = 2 * vs.arctan(range_x / cam_dist)
        mode_lab.SetLabel('scene.fov:\n{0:9.0f} deg'.format(vs.degrees(fov)))
        if not qPy: vss.fov = fov

    elif mode == 'm':  # demonstrate moving the mouse.
        hit = vss.mouse.project(cam_frame.axis, cam_frame.pos)
        m_pos = cam_frame.world_to_frame(hit)
        if abs(m_pos.z) <= cent_plane.width/2.0 and \
           abs(m_pos.y) <= cent_plane.height/2.0 :   # not "off the screen"
            ray = (m_pos - (cam_dist, 0, 0)).norm()
            reDrawLine(mouse_line, vs.vector(cam_dist, 0, 0), linelen, ray)
            mouse_lab.pos = m_pos
            mouse_arrow.axis = 2 * ray
            rayout = cam_frame.frame_to_world(ray) - cam_frame.frame_to_world(
                (0, 0, 0))
            mode_lab.SetLabel('scene.mouse.ray:\n' + str2(rayout))