def __init__(self): ShowBase.__init__(self) self.models = [] self.base_textures = [] # window title props = WindowProperties() props.setTitle(pathlib.Path(args.project).name) base.win.requestProperties(props) # we would like an orthographic lens self.lens = OrthographicLens() self.lens.setFilmSize(20, 15) base.camNode.setLens(self.lens) self.cam_pos = [0.0, 0.0, 1000.0] self.camera.setPos(self.cam_pos[0], self.cam_pos[1], self.cam_pos[2]) self.camera.setHpr(0, -90.0, 0) self.view_size = 100.0 self.last_ysize = 0 self.top_image = 0 # modules self.surface = surface.Surface(proj.analysis_dir) self.annotations = annotations.Annotations(self.render, self.surface, args.project, ned_ref, tk_root) self.reticle = reticle.Reticle(self.render, self.surface, ned_ref) #self.messenger.toggleVerbose() # event handlers self.accept('arrow_left', self.cam_move, [-0.1, 0, 0]) self.accept('arrow_right', self.cam_move, [0.1, 0, 0]) self.accept('arrow_down', self.cam_move, [0, -0.1, 0]) self.accept('arrow_up', self.cam_move, [0, 0.1, 0]) self.accept('=', self.cam_zoom, [1.1]) self.accept('shift-=', self.cam_zoom, [1.1]) self.accept('-', self.cam_zoom, [1.0 / 1.1]) self.accept('wheel_up', self.cam_zoom, [1.1]) self.accept('wheel_down', self.cam_zoom, [1.0 / 1.1]) self.accept('mouse1', self.mouse_state, [0, 1]) self.accept('mouse1-up', self.mouse_state, [0, 0]) self.accept('0', self.image_select, [0]) self.accept('1', self.image_select, [1]) self.accept('2', self.image_select, [2]) self.accept('3', self.image_select, [3]) self.accept('4', self.image_select, [4]) self.accept('5', self.image_select, [5]) self.accept('6', self.image_select, [6]) self.accept('7', self.image_select, [7]) self.accept('8', self.image_select, [8]) self.accept('9', self.image_select, [9]) self.accept('f', self.toggle_filter) self.accept('m', self.toggle_view_mode) self.accept(',', self.update_sequential_num, [-1]) self.accept('.', self.update_sequential_num, [1]) self.accept('escape', self.quit) self.accept('mouse3', self.annotations.toggle, [self.cam_pos]) # mouse state self.last_mpos = [0, 0] self.mouse = [0, 0, 0] self.last_mouse = [0, 0, 0] # Add the tasks to the task manager. self.taskMgr.add(self.updateCameraTask, "updateCameraTask") # Shader (aka filter?) self.filter = 'none' # Set default view mode self.view_mode = 'best' # self.view_mode = 'sequential' self.sequential_num = 0 # dump a summary of supposed card capabilities self.query_capabilities(display=True) # test shader # self.shader = Shader.load(Shader.SL_GLSL, vertex="explore/myshader.vert", fragment="explore/myshader.frag", geometry="explore/myshader.geom") self.shader = Shader.load(Shader.SL_GLSL, vertex="explore/myshader.vert", fragment="explore/myshader.frag")
def __init__(self): ShowBase.__init__(self) # Load the environment model. # self.scene1 = self.loader.loadModel("models/environment") self.models = [] self.base_textures = [] # we would like an orthographic lens self.lens = OrthographicLens() self.lens.setFilmSize(20, 15) base.camNode.setLens(self.lens) self.cam_pos = [0.0, 0.0, 1000.0] self.camera.setPos(self.cam_pos[0], self.cam_pos[1], self.cam_pos[2]) self.camera.setHpr(0, -90.0, 0) self.view_size = 100.0 self.last_ysize = 0 self.top_image = 0 # modules self.annotations = annotations.Annotations(self.render, args.project, ned_ref) self.reticle = reticle.Reticle(self.render) #self.messenger.toggleVerbose() # event handlers self.accept('arrow_left', self.cam_move, [-0.1, 0, 0]) self.accept('arrow_right', self.cam_move, [0.1, 0, 0]) self.accept('arrow_down', self.cam_move, [0, -0.1, 0]) self.accept('arrow_up', self.cam_move, [0, 0.1, 0]) self.accept('=', self.cam_zoom, [1.1]) self.accept('shift-=', self.cam_zoom, [1.1]) self.accept('-', self.cam_zoom, [1.0 / 1.1]) self.accept('wheel_up', self.cam_zoom, [1.1]) self.accept('wheel_down', self.cam_zoom, [1.0 / 1.1]) self.accept('mouse1', self.mouse_state, [0, 1]) self.accept('mouse1-up', self.mouse_state, [0, 0]) self.accept('0', self.image_select, [0]) self.accept('1', self.image_select, [1]) self.accept('2', self.image_select, [2]) self.accept('3', self.image_select, [3]) self.accept('4', self.image_select, [4]) self.accept('5', self.image_select, [5]) self.accept('6', self.image_select, [6]) self.accept('7', self.image_select, [7]) self.accept('8', self.image_select, [8]) self.accept('9', self.image_select, [9]) self.accept('escape', self.quit) self.accept('mouse3', self.annotations.toggle, [self.cam_pos]) # mouse state self.last_mpos = [0, 0] self.mouse = [0, 0, 0] self.last_mouse = [0, 0, 0] # Add the tasks to the task manager. self.taskMgr.add(self.updateCameraTask, "updateCameraTask") self.query_capabilities(display=True)