From dd36699ad2785b9dd5e5417c4d08ea3f18b349b5 Mon Sep 17 00:00:00 2001 From: cutealien Date: Tue, 19 Apr 2022 21:44:50 +0000 Subject: [PATCH] Set default for MeshLoader IndexTypeHint to EITH_OPTIMAL. Did some tests and the overhead speed cost on loading and rendering where both not really measurable even in a pretty huge scene. While some Irrlicht parts might still have a problem with 32-bit meshes (octree for example, also some meshmanipulator functions), it's probably still less of a problem than having broken meshes and just a nicer default. Also the troubling parts in Irrlicht can be improved over time. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6343 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 1 + include/IMeshLoader.h | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/changes.txt b/changes.txt index cab876bc..a14daf2c 100644 --- a/changes.txt +++ b/changes.txt @@ -8,6 +8,7 @@ Changes in 1.9 (not yet released) It's 16 bit meshes use now also an IDynamicMeshbuffer instead of an SMeshBuffer. Thanks @Wol101 for original patch proposal (https://irrlicht.sourceforge.io/forum/viewtopic.php?f=9&t=51441) - Add IMeshLoader::setIndexTypeHint and getIndexTypeHint to allow setting hints for the loaders if users prefer 16 or 32 bit meshbuffers. + Default is now to use optimal meshbuffer depending on number of vertices (if the loader supports it). - Add IMeshBuffer::getType to allow finding out which class type a meshbuffer has (similar to ISceneNode::getType). - Add IGUIImage::flip to flip/mirror images - IBillboardSceneNode got functions to access meshbuffers. So uv-coordinates can now be modified directly (previously only possible via texture matrix). diff --git a/include/IMeshLoader.h b/include/IMeshLoader.h index de0ffa6c..cd81adb7 100644 --- a/include/IMeshLoader.h +++ b/include/IMeshLoader.h @@ -30,7 +30,7 @@ class IMeshLoader : public virtual IReferenceCounted public: //! Constructor - IMeshLoader() : TextureLoader(0), IndexTypeHint(EITH_16BIT) {} + IMeshLoader() : TextureLoader(0), IndexTypeHint(EITH_OPTIMAL) {} //! Destructor virtual ~IMeshLoader() @@ -82,21 +82,24 @@ public: enum E_INDEX_TYPE_HINT { //! Prefer to use 16-bit index buffers even if it breaks the mesh + //! The default (and only option) before Irrlicht 1.9 EITH_16BIT, //! Allow using 32-bit index buffers EITH_32BIT, //! Allow 32-bit, but copy back to 16-bit when 32 is not needed. - //! So tiny overhead on loading, but meshes are later more optimal + //! So tiny overhead (sometimes extra allocation+copying) on loading, + //! but meshes are later more optimal. + //! Default since Irrlicht 1.9 EITH_OPTIMAL }; //! Give loader a hint if you would prefer 16 or 32 bit meshbuffers. /** - Generally Irrlicht works with 16-bit meshbuffers so far. - Rendering 32-bit meshbuffers works, other functions like + Before Irrlicht 1.9 Irrlicht worked mostly with 16-bit meshbuffers. + Rendering 32-bit meshbuffers works, but some functions like mesh-writing and mesh manipulation might not work yet. NOTE: Most loaders will ignore this hint so far, but hopefully will care about it in the future.