This is possible to add custom format to the SDK. Custom format can support read / write / update.We have some 3d models in our custom format. The models are not in obj or Sketchup format. We want to optimize these models by using Polygon Cruncher.
So, we want you to guide us on how can we import the custom model data in Polygon Cruncher.
and do the optimization.
Here a the few steps to add custom format:
- Implement a C3DParser class.
This class is called automatically by C3DIo when you require some file to be reading or writing.
You need to implement C3DParser::Read and/or C3DParser::Write and/or C3DParser::Update.
Update is only possible if you support read and write. We will see in another entry the way it works. - Add the extension and make it recognized. This is done using fileRegisterFile in FileInfo.h
Let's suppose the file extension is .abc and .cde
Code: Select all
CFileExt ext; ext.description = "My custom files"; ext.ext = ".abc|.cde"; ext.fileclass = MAKE_CUSTOM_ID('C', 'T', 'F', 'T'); // This is an internal identifier that allow to give a class to the file format. ext.properties = IMPORT_FILE|EXPORT_FILE|OBJECT_FILE|COMMON_EXTENSION_FILE|SAVE_HAS_DIALOG|LOAD_HAS_DIALOG; // The format support reading / writing, is related to 3D and will have a some dialogs ext.loader = DEI_PARSER; // use PLUGIN_PARSER is you intend to read / write the format through a dll. ext.saver = DEI_PARSER; // Cf. above fileRegisterFile(ext);
Code: Select all
C3DIo dstfile(_T("myfile.abc"), FILE_PARSER_READING | FILE_PARSER_SILENT_MODE);
C3DScene* scene = file.Read();
if (!scene)
return false;