Made obj group support optional via SceneParameter.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1264 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2008-02-26 17:15:13 +00:00
parent 96a5c452cd
commit fb9366b41d
2 changed files with 14 additions and 2 deletions

View File

@ -95,13 +95,22 @@ namespace scene
/** Use it like this: /** Use it like this:
\code \code
//this way you'll choose to flip alpha textures //this way you'll choose to flip alpha textures
SceneManager->()->setAttribute( SceneManager->getParameters()->setAttribute(
scene::DMF_FLIP_ALPHA_TEXTURES, true); scene::DMF_FLIP_ALPHA_TEXTURES, true);
\endcode \endcode
**/ **/
const c8* const DMF_FLIP_ALPHA_TEXTURES = "DMF_FlipAlpha"; const c8* const DMF_FLIP_ALPHA_TEXTURES = "DMF_FlipAlpha";
//! Flag to avoid loading group structures in .obj files
/** Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_GROUPS, true);
\endcode
**/
const c8* const OBJ_LOADER_IGNORE_GROUPS = "OBJ_IgnoreGroups";
//! Flag set as parameter when the scene manager is used as editor //! Flag set as parameter when the scene manager is used as editor
/** In this way special animators like deletion animators can be stopped from /** In this way special animators like deletion animators can be stopped from
deleting scene nodes for example */ deleting scene nodes for example */

View File

@ -12,6 +12,7 @@
#include "SMeshBuffer.h" #include "SMeshBuffer.h"
#include "SAnimatedMesh.h" #include "SAnimatedMesh.h"
#include "IReadFile.h" #include "IReadFile.h"
#include "IAttributes.h"
#include "fast_atof.h" #include "fast_atof.h"
#include "coreutil.h" #include "coreutil.h"
#include "irrMap.h" #include "irrMap.h"
@ -94,6 +95,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
// Process obj information // Process obj information
const c8* bufPtr = buf; const c8* bufPtr = buf;
core::stringc grpName; core::stringc grpName;
bool useGroups = !SceneManager->getParameters()->getAttributeAsBool(OBJ_LOADER_IGNORE_GROUPS);
while(bufPtr != bufEnd) while(bufPtr != bufEnd)
{ {
switch(bufPtr[0]) switch(bufPtr[0])
@ -139,6 +141,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
{ {
c8 grp[WORD_BUFFER_LENGTH]; c8 grp[WORD_BUFFER_LENGTH];
bufPtr = goAndCopyNextWord(grp, bufPtr, WORD_BUFFER_LENGTH, bufEnd); bufPtr = goAndCopyNextWord(grp, bufPtr, WORD_BUFFER_LENGTH, bufEnd);
if (useGroups)
grpName = grp; grpName = grp;
} }
break; break;