Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
C3DParser Class Reference

Class for reading / writing a specific file format. If is called by C3DIo when extension has been recognized to belong to the parser recognized extension. More...

Detailed Description

Class for reading / writing a specific file format. If is called by C3DIo when extension has been recognized to belong to the parser recognized extension.

Cf. #3DPARSER if you intend to implement your own 3D parser

#include <Io3dmgr.h>

Inheritance diagram for C3DParser:
CFileParser

Public Member Functions

 C3DParser (CFileIo &io)
 
void SetScene (C3DScene *scene)
 This is the scene to save. When update or save is called, this scene has been prepared accordingly to the CSceneExportOptions. Before that (ie. when the options dialog is called, the scene is the original input scene to save). Parser should not release this scene.
 
C3DSceneGetScene ()
 When reading, this is the read scene, when saving, this is the input scene or the scene prepared with InitExport.
 
Reading a 3D file related methods
virtual void LoadDefaultOptions (CSceneImportOptions &options) const
 
virtual C3DSceneRead (const CXString &filename, CSceneImportOptions &options)
 
Writing a 3D scene related methods
virtual void SaveDefaultOptions (CSceneExportOptions &options) const
 
virtual void CheckSaveOptions (C3DScene *scene, CSceneExportOptions &options) const
 
virtual bool Save (const CXString &filename, C3DScene *scene, CSceneExportOptions &options)
 Last way to check possible mutual exclusive flags considering the scene before export (ie embed media and copy textures)
 
Update mechanism.

if parserClass != UNKNOWN_CLASS we are testing if the parser has update ability for the given format.
It is the class of the parser that generate parserData. Some parser might register several class, ie for binary and ascii version of the same format.
CanUpdate must verify that the parserClass is one of the recognized class and if so it can return true, so Update method is allowed to be called.
if parserData = NULL && parserClass == UNKNOWN_CLASS, returns true if the parser is able to update, false if not.
if parserData != NULL => parserClass != UNKNOWN_CLASS, parserData MUST HAVE BEEN generated by the parser itself, to correctly cast the content of the data.
In this case, the parser checks that provided data allows to perform the update.
Some parser stores data, but these data does not contains the information needed to perform the update.
Ie. Jt parser can contains both temporary texture path to delete once scene closed but also contains data for updating.

virtual bool CanUpdate (unsigned int parserClass=UNKNOWN_CLASS, void *parserData=NULL) const
 
virtual bool Update (const CXString &filename, C3DScene *scene, void *parserScene, CSceneExportOptions &options)
 
Parser specific information

Some specific information might be attached to the scene using an opaque pointer and C3DScene::SetParserData.
When the scene is destroyed, the C3DParser::ReleaseParser is called with the opaque pointer, so some clean up can be done.
For example the information can contain some information about where embed textures were extracted and give a chance to delete the texture file.
This can be a pointer to an internal scene for the update mechanism (Collada)
This can be some information to release once the scene is destroyed (Kmz)
In most of case, this mechanism is used when reading, rarely when saving...

virtual bool ReleaseParser (bool readingParser, void *parserScene)
 
- Public Member Functions inherited from CFileParser
 CFileParser (CFileIo &io)
 
CFileIoGetIoMgr ()
 
bool IsSilentMode () const
 
bool IsFlagSet (FILE_PARSER_FLAGS flag) const
 
IoShowDialog MustShowDialog ()
 

Member Function Documentation

◆ Read()

virtual C3DScene * C3DParser::Read ( const CXString filename,
CSceneImportOptions options 
)
inlinevirtual
Parameters
optionsoptions might be modified by the parser to specify some CheckoutImport specific requirements (ie. SCENE_IMPORT_KEEP_GUID might be set if GUID are found)

◆ Save()

virtual bool C3DParser::Save ( const CXString filename,
C3DScene scene,
CSceneExportOptions options 
)
inlinevirtual

Last way to check possible mutual exclusive flags considering the scene before export (ie embed media and copy textures)

Parameters
optionsoptions might be modified by the parser (futur usage)

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