def render()

in jsuarez/extra/embyr_deprecated/embyr/modules.py [0:0]


   def render(self, trans, update):
      env = self.realm.world.env
      tiles = env.tiles
      R, C = tiles.shape
      counts = np.array([tile.counts for tile in tiles.ravel()])
      nCounts = counts.shape[1]
      counts = counts.reshape(R, C, counts.shape[1])
      counts = [counts[:, :, i] for i in range(counts.shape[2])]
      if nCounts <= 12:
         colors = Neon.color12()
      else:
         colors = Color256.colors[0::256//nCounts]
      for idx, count in enumerate(counts):
         counts[idx] = 20*counts[idx][:, :, np.newaxis]*np.array(colors[idx].value)/255.0
      sumCounts = sum(counts)

      R, C, _ = sumCounts.shape
      counts = np.clip(sumCounts, 0, 255).astype(np.uint8)
      counts = np.clip(counts, 0, 255).astype(np.uint8)

      valCrop, txSz = embyr.mapCrop(self, counts,
            self.tileSz, trans)
      txSz = embyr.mipKey(txSz, self.mipLevels)
      embyr.renderMap(self, valCrop, txSz)
      return self.surf