Commit Graph

23 Commits

Author SHA1 Message Date
Loïc Blot 9dd0f952e0 Modernize client code (#6250)
* Various code style fixes
* Use range based for loops
* Use empty instead of empty objects
* Use C++11 default keyword for trivial constructors and destructors
* Drop some useless casts
* Use emplace_back instead of push_back to improve performance of some vectors push
2017-08-15 20:30:30 +02:00
Loïc Blot 3e50850260 TileLayer: use shared_ptr for FrameSpec vector (#6171)
* TileLayer: use shared_ptr for vector framespec
This reduce memory copy of TileLayer from (4 to 16) * FrameSpec where FrameSpec = (sizeof(int) + 3 * sizeof(ptr)) to int + sizeof(ptr)

Callgrind difference

Before: https://lut.im/RGkiJqQb8T/LeQIEXpAuRzfl7gd.png
After: https://lut.im/bcqmwee1xu/cTwtptY5tRuS9lp0.png

* Fix one push_back to use vector::emplace_back & optimize inclusions
2017-07-26 20:12:48 +02:00
Loïc Blot 94c294bfdc Irrlicht cleanup: cleanup various object to use RenderingEngine (#6088)
* Irrlicht cleanup: cleanup various object to use RenderingEngine

* CAO doesn't need scenemanager in addToScene
* Camera doesn't need VideoDriver pointer or SceneManager in constructor
* Hud doesn't need driver & scene manager in constructor
* Hud doesn't need scenemanager pointer
* Tile.h doesn't need IrrlichtDevice header (just SMaterial)
* WieldMeshSceneNode: only take scene, we always use scene root node as parent
2017-07-02 20:29:58 +02:00
stujones11 6e5588c8e1 Tile material: Add 'TILE_MATERIAL_OPAQUE', use for drawtype 'NDT_NORMAL'
Prevents normal drawtype nodes having transparency.
Avoids clients cheating by using 'x-ray' texture packs with transparent textures.
2017-07-01 04:43:55 +01:00
Loïc Blot b3a36f7378 Isolate irrlicht references and use a singleton (#6041)
* Add Device3D class which will contain IrrlichtDevice interface

move getSupportedVideoDrivers to Device3D

Add Device3D singleton & use it in various places

Rename Device3D to Rendering engine & add helper functions to various device pointers

More singleton work

RenderingEngine owns draw_load_screen

move draw functions to RenderingEngine

Reduce IrrlichtDevice exposure and guienvironment

RenderingEngine: Expose get_timer_time() to remove device from guiEngine

Make irrlichtdevice & scene manager less exposed

* Code style fixes

* Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine

Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly

* enum paralax => enum parallax
2017-06-26 20:11:17 +02:00
Vincent Glize af3badf7a9 C++11 cleanup on constructors dir client (#6012)
* C++11 cleanup on constructors dir client
2017-06-21 08:04:45 +02:00
ShadowNinja 6c5e5e2023 Remove threads.h and replace its definitions with their C++11 equivalents (#5957)
This also changes threadProc's signature, since C++11 supports arbitrary
thread function signatures.
2017-06-11 09:43:05 +02:00
Auke Kok 1ecc8756bc Reorder TileLayer. (#5638)
Despite the split of TileSpec into TileDef and TileLayer, the
TileLayer struct is still 66 bytes large, and doesn't fit in
a single cacheline.

I'm moving the color member to cacheline 2, in the hope that it
is less used and the compiler loads all the hot members in a single
cacheline instead. Only color sits now in cacheline 2, all the
other members are in cacheline 1.

Note: is_color is probably rarely set, most nodes will likely
not use hardware coloring, but this may change in the future.
Ideally, this class is shrunk to 64 bytes.
2017-04-29 09:16:32 +02:00
Dániel Juhász 1ffb180868 Soft node overlay (#5186)
This commit adds node overlays, which are tiles that are drawn on top of
other tiles.
2017-04-21 23:34:59 +10:00
Auke Kok 93c1d511e3 Reorder TileSpec. (#5591)
Put accessed members that are needed by updateFastFaceRow()
all in the same cacheline.
2017-04-18 07:48:17 +02:00
Dániel Juhász 58d83a7bb2 Hardware coloring for itemstacks
Adds the possibility to colorize item stacks based on their metadata.

In the item/node definition you can specify palette (an image file)
and color (fallback color if the item has no palette or metadata).
Then you can add palette_index to the metadata.

Dropped itemstacks with different colors do not merge.
2017-04-08 18:39:15 -07:00
Dániel Juhász d04d8aba70 Add hardware node coloring. Includes:
- Increase ContentFeatures serialization version
- Color property and palettes for nodes
- paramtype2 = "color", "colored facedir" or "colored wallmounted"
2017-01-23 07:27:12 +01:00
sfan5 523f0e8c5b Move TileAnimation code to seperate file 2017-01-02 15:28:06 +01:00
nerzhul fefa148d69 v2d & aabbox3d<f32> & sky cleanups
* Sky: rename Box => m_box and inline getBoundingBox
* Uniformize aabbox3d<f32> to aabb3f
2016-02-11 16:55:15 +01:00
RealBadAngel 980d095e32 tileable flags are needed also without shaders because of filters 2015-08-20 03:42:22 +02:00
RealBadAngel 8b8d17b22b Remove use of engine sent texture tiling flags - theyre no longer needed 2015-08-20 02:41:40 +02:00
RealBadAngel 3295f3c401 Fix tiling issues for PLANTLIKE and FIRELIKE with FSAA 2015-08-05 22:52:32 +02:00
RealBadAngel 60350699c7 Add wielded (and CAOs) shader 2015-07-21 23:56:41 +02:00
RealBadAngel 655fc6010f Fix relief mapping issues 2015-07-16 15:36:48 +02:00
RealBadAngel ffd16e3fec Add minimap feature 2015-06-27 03:42:01 +02:00
Aaron Suen 6d61375cc7 Clean scaling pre-filter for formspec/HUD. 2015-04-01 00:01:05 -04:00
Aaron Suen db32e6c5aa Move texture_min_size even further down the pipe. Now, textures are JIT-upscaled using an image transformation, right at the time they're added to a mesh or particle; images used in 2D elements are left unscaled. This should fix any remaining issues with HUD elements. 2015-03-31 16:56:33 +10:00
Loic Blot 0d1eedcccc Replace std::list to std::vector into tile.cpp (m_texture_trash) and move tile.hpp to src/client/ 2015-03-05 11:59:40 +01:00