예제 #1
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
예제 #2
0
 def renderEnts(self, trans):
     self.reset()
     R, C = self.env.shape
     offs, txSz = embyr.offsets(self, R, C, self.tileSz, trans)
     txSz = embyr.mipKey(txSz, self.mipLevels)
     minH, _, minW, _ = offs
     self.sprites.render(self, (minH, minW), txSz, self.iso)
     return self.surf
예제 #3
0
    def render(self, trans, update):
        self.reset()
        if update:
            self.update()

        valCrop, txSz = embyr.mapCrop(self, self.vals, self.tileSz, trans)
        txSz = embyr.mipKey(txSz, self.mipLevels)
        embyr.renderMap(self, valCrop, txSz)
        return self.surf
예제 #4
0
 def render(self, trans):
     self.reset()
     envCrop, txSz = embyr.mapCrop(self, self.realm.world.env.inds(),
                                   self.tileSz, trans)
     txSz = embyr.mipKey(txSz, self.mipLevels)
     embyr.renderMap(self, envCrop, txSz, self.textures.material[txSz],
                     self.iso)
     self.flip()
     return self.surf