version 3.3

VRS::ThreeDSReader Class Reference

reader for 3d studio files More...

#include <vrs/io/threedsreader.h>

Inheritance diagram for VRS::ThreeDSReader:

VRS::ObjectReader VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  TextureMode { NO_TEXTURES, FORCE_TEXTURES, TRY_TEXTURES }
enum  TextureModulationMode { MODULATE_TEXTURES_BY_MATERIAL, MODULATE_TEXTURES_BY_WHITE }
enum  ReadMode { READ_SCENE, READ_OBJECT }
enum  MaterialMode { NO_MATERIAL, COLORS_ONLY, ALL_BUT_CULLING_MATERIAL, COMPLETE_MATERIAL }
enum  OptimizationMode { NO_OPTIMIZATIONS = 0, DISCARD_UNUSED_DATA = 1, EXCLUSIVE_OPENGL = 2 }

Public Member Functions

 ThreeDSReader ()
virtual SO< SharedObjread (DataResource *data, const ID &targetType) const
 standard reader method: reads a .3ds file with globally set properties and returns a scenegraph (SceneThing)
const char * objectFormatName () const
const char * objectFileSuffix () const
virtual bool canProduce (const ID &targetType) const
 VRS_SERIALIZABLE_CLASS_ENUM (TextureMode)
 VRS_SERIALIZABLE_CLASS_ENUM (TextureModulationMode)
 VRS_SERIALIZABLE_CLASS_ENUM (ReadMode)
 VRS_SERIALIZABLE_CLASS_ENUM (MaterialMode)
 VRS_SERIALIZABLE_CLASS_ENUM (OptimizationMode)
 VRS_TYPEINFO (ThreeDSReader, ObjectReader)

Static Public Member Functions

static std::string noCamera ()
 parameter for readScene: read no camera at all
static std::string firstCamera ()
 parameter for readScene: read first camera and abort if found none
static std::string firstCameraIfPossible ()
 parameter for readScene(): read first camera if possible
static void setTextureMode (TextureMode textureMode)
 sets the use of textures (refer to TextureMode)
static void setTextureModulationMode (TextureModulationMode textureModulationMode)
 defines how the texture is modulated (refer to TextureModulationMode);
static void setCreateNormals (bool normals)
 enables/disables creation of normals (default: true)
static void setCollapse (bool collapse)
 enables/disables reading of hierarchy (default: false)
static void setMetaInfo (bool metaInfo)
 enables/disables specification of object names in scene graph (default: false)
static void setContextDataInsertion (bool yesNo)
 has only effect if metaInfo is true.
static void setMaterialMode (MaterialMode materialMode)
 sets material use (refer to MaterialMode)
static void setReadMode (ReadMode readMode)
 sets behavior of read(), ignored by readScene() and readObject()
static void setOptimizations (unsigned int optimizationMode)
 sets optimizations to use (refer to OptimizationMode). Options are ORed together.
static void setMaxTextureSize (unsigned int maxSize)
 set a maximum width and height for textures to load. Disable this option by setting a huge value (e.g. 65536) default: 65536
static void setCopyTexturesToPow2 (bool pow2)
 if set to true, all textures are blown up to next power of 2 (via resampling!) default: true
static TextureMode textureMode ()
static TextureModulationMode textureModulationMode ()
static bool collapse ()
static bool metainfo ()
static bool contextDataInsertion ()
static MaterialMode materialMode ()
static ReadMode readMode ()
static unsigned int optimizationMode ()
static unsigned int maxTextureSize ()
static bool copyTexturesToPow2 ()
 current properties
static SO< SceneThingreadScene (const std::string &fileName, const std::string &cameraName, bool lights, bool environment)
static SO< SceneThingreadScene (SO< DataResource > data, const std::string &cameraName, bool lights, bool environment)
 read whole scene of a given 3ds file
static SO< SceneThingreadObject (const std::string &fileName, const std::string &objectName="")
static SO< SceneThingreadObject (SO< DataResource > data, const std::string &objectName="")
 read one complete object including subobjects of a given 3ds file
static NonPersistentDictionary
< std::string, SO
< NonPersistentDictionary
< std::string, std::string > > > * 
readNames (const std::string &fileName)
 returns all names and hierarchy hints used in 3ds file


Detailed Description

reader for 3d studio files

Member Enumeration Documentation

Enumerator:
NO_TEXTURES 
FORCE_TEXTURES 
TRY_TEXTURES 

Enumerator:
MODULATE_TEXTURES_BY_MATERIAL 
MODULATE_TEXTURES_BY_WHITE 

Enumerator:
READ_SCENE 
READ_OBJECT 

Enumerator:
NO_MATERIAL 
COLORS_ONLY 
ALL_BUT_CULLING_MATERIAL 
COMPLETE_MATERIAL 

Enumerator:
NO_OPTIMIZATIONS 
DISCARD_UNUSED_DATA 
EXCLUSIVE_OPENGL 


Constructor & Destructor Documentation

VRS::ThreeDSReader::ThreeDSReader (  ) 


Member Function Documentation

virtual SO<SharedObj> VRS::ThreeDSReader::read ( DataResource data,
const ID targetType 
) const [virtual]

standard reader method: reads a .3ds file with globally set properties and returns a scenegraph (SceneThing)

this method provides access to just a subset of whole functionality: In READ_SCENE mode all meshes, lights, and the environment as well as the first camera (if any) is read. The resulting scene graph can be used instantly. In READ_OBJECT mode only the first mesh found in file is read. To get more control use readScene() or readObject().

Implements VRS::ObjectReader.

const char* VRS::ThreeDSReader::objectFormatName ( void   )  const [inline, virtual]

Implements VRS::ObjectReader.

const char* VRS::ThreeDSReader::objectFileSuffix (  )  const [inline, virtual]

both methods provide meta information which is needed for any user interface programming. Multiple file suffixes are serapated by blanks, e.g. "mpg mpeg".

Implements VRS::ObjectReader.

virtual bool VRS::ThreeDSReader::canProduce ( const ID targetType  )  const [virtual]

Reimplemented from VRS::ObjectReader.

VRS::ThreeDSReader::VRS_SERIALIZABLE_CLASS_ENUM ( TextureMode   ) 

VRS::ThreeDSReader::VRS_SERIALIZABLE_CLASS_ENUM ( TextureModulationMode   ) 

VRS::ThreeDSReader::VRS_SERIALIZABLE_CLASS_ENUM ( ReadMode   ) 

VRS::ThreeDSReader::VRS_SERIALIZABLE_CLASS_ENUM ( MaterialMode   ) 

VRS::ThreeDSReader::VRS_SERIALIZABLE_CLASS_ENUM ( OptimizationMode   ) 

static std::string VRS::ThreeDSReader::noCamera (  )  [static]

parameter for readScene: read no camera at all

static std::string VRS::ThreeDSReader::firstCamera (  )  [static]

parameter for readScene: read first camera and abort if found none

static std::string VRS::ThreeDSReader::firstCameraIfPossible (  )  [static]

parameter for readScene(): read first camera if possible

static void VRS::ThreeDSReader::setTextureMode ( TextureMode  textureMode  )  [static]

sets the use of textures (refer to TextureMode)

static void VRS::ThreeDSReader::setTextureModulationMode ( TextureModulationMode  textureModulationMode  )  [static]

defines how the texture is modulated (refer to TextureModulationMode);

static void VRS::ThreeDSReader::setCreateNormals ( bool  normals  )  [static]

enables/disables creation of normals (default: true)

If the read model does not contain normals and this flag is set to true (default) normals are created automatically.

static void VRS::ThreeDSReader::setCollapse ( bool  collapse  )  [static]

enables/disables reading of hierarchy (default: false)

If collapse set to true, the 3ds hierachy gets flat. All objects are read regarding to the hierarchy (i.e. including subobjects) but are put into one SceneThing in a global coordinates system. If collapse is false, the 3ds hierarchie is mirrored in the scene graph with every object in its own SceneThing.

static void VRS::ThreeDSReader::setMetaInfo ( bool  metaInfo  )  [static]

enables/disables specification of object names in scene graph (default: false)

when enabled and collapse==false every SceneThing used in 3ds-scene graph gets a ContextData<std::string> with ID("3dsname") representing the original object name in 3ds file. Also, every scene node created by the reader gets an object name assigned: ShapeMaterialGL: material name + "SMGL" FaceStyle: material name + "STYLE" TexEnvGL: texture name + "ENV" ImageTexture2DGL: texture name Meshes: 3ds name + "." + material name (necessary, since one object can have multiple materials) A mesh can be a PolygonSet or MappedVertexAttributeShapeGL (depending on optimizations)

static void VRS::ThreeDSReader::setContextDataInsertion ( bool  yesNo  )  [static]

has only effect if metaInfo is true.

Default is 'true'. Setting it to false avoids the reader from inserting ContextData objects. In this case, object names are only stored as object names of the objects themselves. Todo: Consider removing ContextData insertion completely.

static void VRS::ThreeDSReader::setMaterialMode ( MaterialMode  materialMode  )  [static]

sets material use (refer to MaterialMode)

static void VRS::ThreeDSReader::setReadMode ( ReadMode  readMode  )  [static]

sets behavior of read(), ignored by readScene() and readObject()

if set to READ_SCENE, read() returns whole scene of the requested 3ds file with the first camera if possible, all lights and the environment. if set to READ_OBJECT, read() returns only the first mesh

static void VRS::ThreeDSReader::setOptimizations ( unsigned int  optimizationMode  )  [static]

sets optimizations to use (refer to OptimizationMode). Options are ORed together.

static void VRS::ThreeDSReader::setMaxTextureSize ( unsigned int  maxSize  )  [static]

set a maximum width and height for textures to load. Disable this option by setting a huge value (e.g. 65536) default: 65536

static void VRS::ThreeDSReader::setCopyTexturesToPow2 ( bool  pow2  )  [static]

if set to true, all textures are blown up to next power of 2 (via resampling!) default: true

static TextureMode VRS::ThreeDSReader::textureMode (  )  [static]

static TextureModulationMode VRS::ThreeDSReader::textureModulationMode (  )  [static]

static bool VRS::ThreeDSReader::collapse (  )  [static]

static bool VRS::ThreeDSReader::metainfo (  )  [static]

static bool VRS::ThreeDSReader::contextDataInsertion (  )  [static]

static MaterialMode VRS::ThreeDSReader::materialMode (  )  [static]

static ReadMode VRS::ThreeDSReader::readMode (  )  [static]

static unsigned int VRS::ThreeDSReader::optimizationMode (  )  [static]

static unsigned int VRS::ThreeDSReader::maxTextureSize (  )  [static]

static bool VRS::ThreeDSReader::copyTexturesToPow2 (  )  [static]

current properties

static SO<SceneThing> VRS::ThreeDSReader::readScene ( const std::string &  fileName,
const std::string &  cameraName,
bool  lights,
bool  environment 
) [static]

static SO<SceneThing> VRS::ThreeDSReader::readScene ( SO< DataResource data,
const std::string &  cameraName,
bool  lights,
bool  environment 
) [static]

read whole scene of a given 3ds file

Parameters: filename - name of file to read cameraName - name of the camera to read (or special names - see above) lights - read lights? environment - read environment? (background image, fog etc.)

camera name is the name given in 3D Studio

static SO<SceneThing> VRS::ThreeDSReader::readObject ( const std::string &  fileName,
const std::string &  objectName = "" 
) [static]

static SO<SceneThing> VRS::ThreeDSReader::readObject ( SO< DataResource data,
const std::string &  objectName = "" 
) [static]

read one complete object including subobjects of a given 3ds file

Parameters: filename - name of file to read objectName - name of the object to read (or "" to read first mesh in file)

object name is the name given in 3D Studio

static NonPersistentDictionary< std::string, SO< NonPersistentDictionary< std::string, std::string > > >* VRS::ThreeDSReader::readNames ( const std::string &  fileName  )  [static]

returns all names and hierarchy hints used in 3ds file

result dictionary contains following keys: "Materials" - dictionary with all material names as keys "Textures" - dictionary with all texture images as keys and type of texture (normal / opacity) as value "Lights" - dictionary with all names of lights as key and name of parent object as values (not necessarily a light) "Cameras" - dictionary with all names of cameras as key and name of parent object as values (not necessarily a camera) "Meshes" - dictionary with all names of meshes as key and name of parent object as values (not necessarily a mesh)

VRS::ThreeDSReader::VRS_TYPEINFO ( ThreeDSReader  ,
ObjectReader   
)


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

Generated on Wed May 23 06:00:19 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact