Beispiel #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
Beispiel #2
0
 def render(self):
     anns = self.realm.sword.anns
     deps = [ann.visDeps() for ann in anns]
     grids = []
     for dep in deps:
         vals = dep
         vList = [e[1] for e in vals]
         vMean, vStd = np.mean(vList), np.std(vList) + 1e-3
         nStd, nTol = 4.0, 0.5
         grayVal = int(255 / nStd * nTol)
         grid = np.zeros((16, 16, 3))
         for v in vals:
             pos, mat = v
             r, c = pos
             mat = (mat - vMean) / vStd
             color = np.clip(mat, -nStd, nStd)
             color = int(color * 255.0 / nStd)
             if color > 0:
                 color = (0, color, 128)
             else:
                 color = (-color, 0, 128)
             grid[r, c] = color
         grids.append(grid)
     grids += 15 * [0 * grids[0]]
     grids = grids[:16]
     grids1 = np.vstack(grids[:4])
     grids2 = np.vstack(grids[4:8])
     grids3 = np.vstack(grids[8:12])
     grids4 = np.vstack(grids[12:16])
     grids = np.hstack((grids1, grids2, grids3, grids4))
     embyr.renderMap(self, grids, self.tileSz)
     return self.surf
Beispiel #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
Beispiel #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
Beispiel #5
0
    def render(self):
        ents = [e.server for e in self.realm.desciples.values()]
        self.updateMaps(ents)
        maps = self.maps
        maps = maps + 15 * [0 * maps[0]]
        maps = maps[:16]
        mapv1 = np.vstack(maps[:4])
        mapv2 = np.vstack(maps[4:8])
        mapv3 = np.vstack(maps[8:12])
        mapv4 = np.vstack(maps[12:16])
        maps = np.hstack((mapv1, mapv2, mapv3, mapv4))

        maps = maps.astype(np.uint8)
        #maps = pygame.pixelcopy.make_surface(maps)
        #valCrop, txSz = embyr.mapCrop(self, maps,
        #      self.tileSz, trans)
        #txSz = embyr.mipKey(txSz, self.mipLevels)
        embyr.renderMap(self, maps, int(1.7 * self.tileSz))
        return self.surf