SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLImporter Class Referenceabstract

Interface for 3D file format importer implementations. More...

#include <SLImporter.h>

Public Member Functions

 SLImporter ()
 
 SLImporter (SLLogVerbosity consoleVerb)
 
 SLImporter (const SLstring &logFile, SLLogVerbosity logConsoleVerb=LV_normal, SLLogVerbosity logFileVerb=LV_diagnostic)
 
virtual ~SLImporter ()
 
void logConsoleVerbosity (SLLogVerbosity verb)
 
void logFileVerbosity (SLLogVerbosity verb)
 
virtual SLNodeload (SLAnimManager &aniMan, SLAssetManager *assetMgr, SLstring pathFilename, SLstring texturePath, SLSkybox *skybox=nullptr, SLbool deleteTexImgAfterBuild=false, SLbool loadMeshesOnly=true, SLMaterial *overrideMat=nullptr, float ambientFactor=0.0f, SLbool forceCookTorranceRM=false, SLProgressHandler *progressHandler=nullptr, SLuint flags=SLProcess_Triangulate|SLProcess_JoinIdenticalVertices|SLProcess_SplitLargeMeshes|SLProcess_RemoveRedundantMaterials|SLProcess_SortByPType|SLProcess_FindDegenerates|SLProcess_FindInvalidData)=0
 
SLNoderootNode ()
 
SLVMeshmeshes ()
 
SLAnimSkeletonskeleton ()
 
SLVAnimationnodeAnimations ()
 

Protected Member Functions

void logMessage (SLLogVerbosity verbosity, const char *msg,...)
 

Protected Attributes

std::ofstream _log
 log stream More...
 
SLstring _logFile
 name of the log file More...
 
SLLogVerbosity _logConsoleVerbosity
 verbosity level of log output to the console More...
 
SLLogVerbosity _logFileVerbosity
 verbosity level of log output to the file More...
 
SLNode_sceneRoot
 the root node of the scene More...
 
SLVMesh _meshes
 all imported meshes More...
 
SLAnimSkeleton_skeleton
 the imported skeleton for this file More...
 
SLVAnimation _animationNamesMap
 all imported node animations More...
 

Detailed Description

Interface for 3D file format importer implementations.

Definition at line 65 of file SLImporter.h.

Constructor & Destructor Documentation

◆ SLImporter() [1/3]

SLImporter::SLImporter ( )

Default constructor, doesn't log anything

Definition at line 17 of file SLImporter.cpp.

20  _sceneRoot(nullptr),
21  _skeleton(nullptr)
22 {
23 }
@ LV_quiet
Definition: SLEnums.h:245
SLAnimSkeleton * _skeleton
the imported skeleton for this file
Definition: SLImporter.h:132
SLLogVerbosity _logConsoleVerbosity
verbosity level of log output to the console
Definition: SLImporter.h:126
SLLogVerbosity _logFileVerbosity
verbosity level of log output to the file
Definition: SLImporter.h:127
SLNode * _sceneRoot
the root node of the scene
Definition: SLImporter.h:130

◆ SLImporter() [2/3]

SLImporter::SLImporter ( SLLogVerbosity  consoleVerb)
explicit

Constructor that only outputs console logs

Definition at line 27 of file SLImporter.cpp.

28  : _logConsoleVerbosity(consoleVerb),
30  _sceneRoot(nullptr),
31  _skeleton(nullptr)
32 {
33 }

◆ SLImporter() [3/3]

SLImporter::SLImporter ( const SLstring logFile,
SLLogVerbosity  logConsoleVerb = LV_normal,
SLLogVerbosity  logFileVerb = LV_diagnostic 
)
explicit

Constructor that allows logging to a file with different verbosity

Definition at line 37 of file SLImporter.cpp.

40  : _logConsoleVerbosity(logConsoleVerb),
41  _logFileVerbosity(logFileVerb),
42  _sceneRoot(nullptr),
43  _skeleton(nullptr)
44 {
46  _log.open(logFile.c_str());
47 }
std::ofstream _log
log stream
Definition: SLImporter.h:124

◆ ~SLImporter()

SLImporter::~SLImporter ( )
virtual

Destructor, closes the file stream if it was used

Definition at line 51 of file SLImporter.cpp.

52 {
53  if (_log.is_open())
54  _log.close();
55 }

Member Function Documentation

◆ load()

virtual SLNode* SLImporter::load ( SLAnimManager aniMan,
SLAssetManager assetMgr,
SLstring  pathFilename,
SLstring  texturePath,
SLSkybox skybox = nullptr,
SLbool  deleteTexImgAfterBuild = false,
SLbool  loadMeshesOnly = true,
SLMaterial overrideMat = nullptr,
float  ambientFactor = 0.0f,
SLbool  forceCookTorranceRM = false,
SLProgressHandler *  progressHandler = nullptr,
SLuint  flags = SLProcess_Triangulate|SLProcess_JoinIdenticalVertices|SLProcess_SplitLargeMeshes|SLProcess_RemoveRedundantMaterials|SLProcess_SortByPType|SLProcess_FindDegenerates|SLProcess_FindInvalidData 
)
pure virtual

◆ logConsoleVerbosity()

void SLImporter::logConsoleVerbosity ( SLLogVerbosity  verb)
inline

Definition at line 75 of file SLImporter.h.

75 { _logConsoleVerbosity = verb; }

◆ logFileVerbosity()

void SLImporter::logFileVerbosity ( SLLogVerbosity  verb)
inline

Definition at line 76 of file SLImporter.h.

76 { _logFileVerbosity = verb; }

◆ logMessage()

void SLImporter::logMessage ( SLLogVerbosity  verbosity,
const char *  msg,
  ... 
)
protected

Logs messages to the importer logfile and the console

Parameters
msgthe message to add to the log
verbositythe verbosity of the message
Todo:
Build a dedicated log class that can be instantiated (so the importer can have its own) Let this log class write to file etc. Don't use printf anymore, its c. (c++11 has to_str, else we have to work with ss (ugh...)) I only used printf here because it allows me to combine a string with different variables in only one line and I don't have an easy way to do this in c++0x. Again c++11 would be easy.

Definition at line 66 of file SLImporter.cpp.

67 {
68 #if defined(SL_OS_ANDROID)
69  SL_LOG(msg) ;
70 #else
71  // write message to a buffer
72  char buffer[4096];
73  std::va_list arg;
74  va_start(arg, msg);
75  std::vsnprintf(buffer, 4096, msg, arg);
76  va_end(arg);
77 
78  if (_logConsoleVerbosity >= verbosity)
79  SL_LOG("%s", buffer);
80  if (_logFileVerbosity >= verbosity)
81  {
82  _log << buffer;
83  _log.flush();
84  }
85 #endif
86 }
#define SL_LOG(...)
Definition: SL.h:233

◆ meshes()

SLVMesh& SLImporter::meshes ( )
inline

Definition at line 119 of file SLImporter.h.

119 { return _meshes; }
SLVMesh _meshes
all imported meshes
Definition: SLImporter.h:131

◆ nodeAnimations()

SLVAnimation& SLImporter::nodeAnimations ( )
inline

Definition at line 121 of file SLImporter.h.

121 { return _animationNamesMap; }
SLVAnimation _animationNamesMap
all imported node animations
Definition: SLImporter.h:133

◆ rootNode()

SLNode* SLImporter::rootNode ( )
inline

Definition at line 118 of file SLImporter.h.

118 { return _sceneRoot; }

◆ skeleton()

SLAnimSkeleton* SLImporter::skeleton ( )
inline

Definition at line 120 of file SLImporter.h.

120 { return _skeleton; }

Member Data Documentation

◆ _animationNamesMap

SLVAnimation SLImporter::_animationNamesMap
protected

all imported node animations

Definition at line 133 of file SLImporter.h.

◆ _log

std::ofstream SLImporter::_log
protected

log stream

Definition at line 124 of file SLImporter.h.

◆ _logConsoleVerbosity

SLLogVerbosity SLImporter::_logConsoleVerbosity
protected

verbosity level of log output to the console

Definition at line 126 of file SLImporter.h.

◆ _logFile

SLstring SLImporter::_logFile
protected

name of the log file

Definition at line 125 of file SLImporter.h.

◆ _logFileVerbosity

SLLogVerbosity SLImporter::_logFileVerbosity
protected

verbosity level of log output to the file

Definition at line 127 of file SLImporter.h.

◆ _meshes

SLVMesh SLImporter::_meshes
protected

all imported meshes

Definition at line 131 of file SLImporter.h.

◆ _sceneRoot

SLNode* SLImporter::_sceneRoot
protected

the root node of the scene

Definition at line 130 of file SLImporter.h.

◆ _skeleton

SLAnimSkeleton* SLImporter::_skeleton
protected

the imported skeleton for this file

Definition at line 132 of file SLImporter.h.


The documentation for this class was generated from the following files: