aboutsummaryrefslogtreecommitdiff
path: root/src/tile.cpp
Commit message (Expand)AuthorAge
* Some MSVC fixesPerttu Ahola2011-11-29
* Rename menu background to menubg.png, move unknown_block.png and unknown_obje...Perttu Ahola2011-11-29
* Improve luaentity sprite functionality (and add some random stuff)Perttu Ahola2011-11-29
* If available, use local textures instead of those sent by serverPerttu Ahola2011-11-29
* Add texture modifier [brighten and modify [toalpha to modify existing texture...Perttu Ahola2011-11-29
* Cut down TextureSource verbosityPerttu Ahola2011-11-29
* Completely generalized mesh generation; ContentFeatures serializationPerttu Ahola2011-11-29
* Properly update textures in node definitionsPerttu Ahola2011-11-29
* Sending of textures WIPPerttu Ahola2011-11-29
* Modify mod and texture directory hierarchiesPerttu Ahola2011-11-29
* GameDef compilesPerttu Ahola2011-11-29
* Move ContentFeatures to mapnode_contentfeatures.{h,cpp} and clean stuffPerttu Ahola2011-11-29
* Move images to data/textures and fix some path stuff; hope that installation ...Perttu Ahola2011-11-29
* Automate texture listing for texture atlas makingPerttu Ahola2011-10-18
* Fix to-transparend conversion of backgrounds of sprite image files that don't...Perttu Ahola2011-10-16
* Fix map delete on windows (concatenate paths correctly with / or \ depending ...Perttu Ahola2011-10-16
* Use the logger; also, default to not showing much crap in console. Use --info...Perttu Ahola2011-10-16
* mobv2Perttu Ahola2011-10-15
* Header file tweaking; mainly for speedPerttu Ahola2011-10-12
* Note about texture atlasPerttu Ahola2011-09-07
* Fix some texture stuff: remove item_fence.png, use fence.png, remove inexisti...Perttu Ahola2011-09-06
* Removed assert if creating texture atlas image fails; cancel creating image i...Perttu Ahola2011-08-12
* Updated the texture atlas a bitPerttu Ahola2011-07-24
* removed unnecessary verbosity from debug output of tile.cppPerttu Ahola2011-07-24
* New map generator added (and SQLite, messed up the commits at that time...) (...Perttu Ahola2011-06-25
* All textures are are now searched first from the directory specified by the t...Perttu Ahola2011-05-21
* Added glass, with rendering and furnace support.Ciaran Gultnieks2011-05-09
* added cobblestone to the texture atlasPerttu Ahola2011-04-29
* A third try on terrain generation. No trees yet.Perttu Ahola2011-02-28
* Set ambient light in inventory cube generationPerttu Ahola2011-02-18
* removed duplicate "bmp"Perttu Ahola2011-02-17
* Better texture handling. Textures are not added to atlas if they are big, and...Perttu Ahola2011-02-17
* fixed slight error in server buildPerttu Ahola2011-02-15
* might work good on cmake+msvc nowPerttu Ahola2011-02-15
* smgr->drop() is now used in tile.cppPerttu Ahola2011-02-15
* cube inventory texture rendering thing (not good yet)Perttu Ahola2011-02-14
* Use random-generated fallback textures when real textures are not foundPerttu Ahola2011-02-12
* more stuff...Perttu Ahola2011-02-11
* new texture stuff quite workingPerttu Ahola2011-02-11
* fixes toward mingw compatibilityPerttu Ahola2011-02-10
* some texture stuffPerttu Ahola2011-02-10
* work-in-progress texture atlas optimizationPerttu Ahola2011-02-10
* Reworked texture, material, mineral and whatever handlingPerttu Ahola2011-01-26
* removed alternative name "pressure" from param2Perttu Ahola2011-01-25
* Mainly some texture tweakingPerttu Ahola2011-01-24
* Added a more flexible path system (and fixed some minor stuff)Perttu Ahola2011-01-07
* minecraft-like craftingPerttu Ahola2010-12-25
* crafting system!Perttu Ahola2010-12-22
* organizing stuff.Perttu Ahola2010-12-21
* Cracking blocks while diggingPerttu Ahola2010-12-21
/// Returns a pointer to the area coresponding to the passed ID, /// or NULL if it doesn't exist. const Area *getArea(u32 id) const; /// Serializes the store's areas to a binary ostream. void serialize(std::ostream &is) const; /// Deserializes the Areas from a binary istream. /// This does not currently clear the AreaStore before adding the /// areas, making it possible to deserialize multiple serialized /// AreaStores. void deserialize(std::istream &is); protected: /// Invalidates the getAreasForPos cache. /// Call after adding or removing an area. void invalidateCache(); /// Implementation of getAreasForPos. /// getAreasForPos calls this if the cache is disabled. virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos) = 0; /// Returns the next area ID and increments it. u32 getNextId() { return m_next_id++; } // Note: This can't be an unordered_map, since all // references would be invalidated on rehash. typedef std::map<u32, Area> AreaMap; AreaMap areas_map; private: /// Called by the cache when a value isn't found in the cache. static void cacheMiss(void *data, const v3s16 &mpos, std::vector<Area *> *dest); bool m_cache_enabled; /// Range, in nodes, of the getAreasForPos cache. /// If you modify this, call invalidateCache() u8 m_cacheblock_radius; LRUCache<v3s16, std::vector<Area *> > m_res_cache; u32 m_next_id; }; class VectorAreaStore : public AreaStore { public: virtual void reserve(size_t count) { m_areas.reserve(count); } virtual bool insertArea(Area *a); virtual bool removeArea(u32 id); virtual void getAreasInArea(std::vector<Area *> *result, v3s16 minedge, v3s16 maxedge, bool accept_overlap); protected: virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos); private: std::vector<Area *> m_areas; }; #if USE_SPATIAL class SpatialAreaStore : public AreaStore { public: SpatialAreaStore(); virtual ~SpatialAreaStore(); virtual bool insertArea(Area *a); virtual bool removeArea(u32 id); virtual void getAreasInArea(std::vector<Area *> *result, v3s16 minedge, v3s16 maxedge, bool accept_overlap); protected: virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos); private: SpatialIndex::ISpatialIndex *m_tree; SpatialIndex::IStorageManager *m_storagemanager; class VectorResultVisitor : public SpatialIndex::IVisitor { public: VectorResultVisitor(std::vector<Area *> *result, SpatialAreaStore *store) : m_store(store), m_result(result) {} ~VectorResultVisitor() {} virtual void visitNode(const SpatialIndex::INode &in) {} virtual void visitData(const SpatialIndex::IData &in) { u32 id = in.getIdentifier(); std::map<u32, Area>::iterator itr = m_store->areas_map.find(id); assert(itr != m_store->areas_map.end()); m_result->push_back(&itr->second); } virtual void visitData(std::vector<const SpatialIndex::IData *> &v) { for (size_t i = 0; i < v.size(); i++) visitData(*(v[i])); } private: SpatialAreaStore *m_store; std::vector<Area *> *m_result; }; }; #endif // USE_SPATIAL #endif // AREA_STORE_H_