mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Environment & IGameDef code refactoring (#4985)
* Environment code refactoring * Cleanup includes & class declarations in client & server environment to improve build speed * ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts. * Cleanup IGameDef * Move ITextureSource* IGameDef::getTextureSource() to Client only. * Also move ITextureSource *IGameDef::tsrc() helper * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call * drop unused emerge() call * cleanup server unused functions (mentionned before) * Drop one unused parameter from ContentFeatures::updateTextures * move checkLocalPrivilege to Client * Remove some unnecessary casts * create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it * Fix some comments * Change required IGameDef to Server/Client pointers * Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects * Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu * drop ClientMap::sectorWasDrawn which is unused
This commit is contained in:
parent
11df7e886a
commit
8e7449e092
49 changed files with 301 additions and 409 deletions
|
@ -59,7 +59,7 @@ class ITextureSource;
|
|||
|
||||
/*
|
||||
ClientMap
|
||||
|
||||
|
||||
This is the only map class that is able to render itself on screen.
|
||||
*/
|
||||
|
||||
|
@ -68,7 +68,6 @@ class ClientMap : public Map, public scene::ISceneNode
|
|||
public:
|
||||
ClientMap(
|
||||
Client *client,
|
||||
IGameDef *gamedef,
|
||||
MapDrawControl &control,
|
||||
scene::ISceneNode* parent,
|
||||
scene::ISceneManager* mgr,
|
||||
|
@ -114,13 +113,13 @@ public:
|
|||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
renderMap(driver, SceneManager->getSceneNodeRenderPass());
|
||||
}
|
||||
|
||||
|
||||
virtual const aabb3f &getBoundingBox() const
|
||||
{
|
||||
return m_box;
|
||||
}
|
||||
|
||||
void getBlocksInViewRange(v3s16 cam_pos_nodes,
|
||||
|
||||
void getBlocksInViewRange(v3s16 cam_pos_nodes,
|
||||
v3s16 *p_blocks_min, v3s16 *p_blocks_max);
|
||||
void updateDrawList(video::IVideoDriver* driver);
|
||||
void renderMap(video::IVideoDriver* driver, s32 pass);
|
||||
|
@ -132,20 +131,14 @@ public:
|
|||
|
||||
// For debug printing
|
||||
virtual void PrintInfo(std::ostream &out);
|
||||
|
||||
// Check if sector was drawn on last render()
|
||||
bool sectorWasDrawn(v2s16 p)
|
||||
{
|
||||
return (m_last_drawn_sectors.find(p) != m_last_drawn_sectors.end());
|
||||
}
|
||||
|
||||
const MapDrawControl & getControl() const { return m_control; }
|
||||
f32 getCameraFov() const { return m_camera_fov; }
|
||||
private:
|
||||
Client *m_client;
|
||||
|
||||
|
||||
aabb3f m_box;
|
||||
|
||||
|
||||
MapDrawControl &m_control;
|
||||
|
||||
v3f m_camera_position;
|
||||
|
@ -154,7 +147,7 @@ private:
|
|||
v3s16 m_camera_offset;
|
||||
|
||||
std::map<v3s16, MapBlock*> m_drawlist;
|
||||
|
||||
|
||||
std::set<v2s16> m_last_drawn_sectors;
|
||||
|
||||
bool m_cache_trilinear_filter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue