print("#########################################################") print("press ESC to escape, S to go back, any key for next slide") print("#########################################################") LOGGER = pi3d.Log.logger(__name__) LOGGER.info("Log using this expression.") # Setup display and initialise pi3d DISPLAY = pi3d.Display.create(background=(0.0, 0.0, 0.0, 1.0), frames_per_second=20) shader = pi3d.Shader("2d_flat") #iFiles = glob.glob("/home/pi/slidemenu/testdir/*.*") iFiles = glob.glob("textures/*.*") nFi = len(iFiles) fileQ = queue.Queue() # queue for loading new texture files alpha_step = 0.025 nSli = 8 drawFlag = False def tex_load(): """ This function runs all the time in a background thread. It checks the fileQ for images to load that have been inserted by Carousel.next() or prev() here the images are scaled to fit the Display size, if they were to be rendered pixel for pixel as the original then the mipmap=False argument would be used, which is faster, and w and h values set to the Texture size i.e. tex = pi3d.Texture(f, mipmap=False) ...
s_item.last_drawn = time.time() self.draw_list.append(s_item) self.draw_list = sorted(self.draw_list, key=self._key_draw_list) cmap = self.scenery_list[cmap_id].shape return xm, zm, cmap #################### clear out unused scenery TODO clear unused textures too def clear_scenery(self, threshold): clear_list = sorted(self.scenery_list, key=self._key_age_list, reverse=True)[:-30] for key in clear_list: s_item = self.scenery_list[key] if s_item.last_drawn < threshold: s_item.status = 0 s_item.shape = None QDOWN = queue.Queue() ###################### function run in thread def load_scenery(): while True: item = QDOWN.get() #blocks for next available job if item[0] == 'STOP': break key = item[0] pickle_path = item[1] s_item = item[2] texture_list = item[3] draw_list = item[4] offsetx = item[5] offsetz = item[6]