def __init__(self, background): super(Renderer, self).__init__(background) glEnable(GL_DEPTH_TEST) glEnable(GL_MULTISAMPLE) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) self.visible = [False for _ in range(len(geodesic_grid.sections))] self.common_model_transform = opengl.Transform() self.last_render_quaternion = quaternion.Quaternion( self.common_model_transform.quaternion) vertices = [(p.x, p.y, p.z) for t in geodesic_grid.sections for p in t] self.sphere = opengl.Object(vertices, enable_alpha=True) self.sphere.local.scale(0.46) self.sphere.model = self.common_model_transform self.base_color = Vector3(0.08, 0.68, 0.706667) self.vehicle = None path = os.path.join(magical.datapath, 'arrow.obj') obj = wv.ObjParser(filename=path).parse() self.mag = opengl.WavefrontObject(obj) self.mag.local.scale(.88)
def __init__(self, conn): super(MagicalFrame, self).__init__(None, title='Magical') self.state = None self.grid = None self.conn = conn self.button_state = None self.ui_is_active = False self.countdown = 0 self.calibration_instruction_idx = 0 self.InitUI() self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer) self.timer.Start(60) self.loader_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnLoaderTimer, self.loader_timer) self.loader_timer.Start(50) self.countdown_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnCountdownTimer, self.countdown_timer) self.calibration_instructions_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnCalibrationInstructionsTimer, self.calibration_instructions_timer) self.SetState('idle') self.main_panel.GetSizer().Fit(self) p = os.path path = p.join(p.dirname(__file__), 'data', 'quadcopter.obj') self.vehicle_loader = wv.ParserWorker( wv.ObjParser(filename=path, enable_cache=True), complete_callback=self.VehicleLoadCompleteCallback, ) self.vehicle_loader.start()