![]() |
http://www.sim.no/ http://www.coin3d.org/ |
SoSTLFileKit is a class for using STL files with Coin. More...
#include <ForeignFiles/SoSTLFileKit.h>
Public Types | |
enum | Colorization { GREY, MATERIALISE, TNO_VISICAM } |
Public Member Functions | |
SoSTLFileKit (void) | |
virtual SbBool | canReadFile (const char *filename=NULL) const |
virtual SbBool | readFile (const char *filename) |
virtual SbBool | canReadScene (void) const |
virtual SbBool | readScene (SoNode *scene) |
virtual SbBool | canWriteFile (const char *filename=NULL) const |
virtual SbBool | writeFile (const char *filename) |
virtual SbBool | canWriteScene (const char *format=NULL) const |
virtual SbBool | writeScene (SoNode *&root, const char *format=NULL) |
Static Public Member Functions | |
static void | initClass (void) |
static SbBool | identify (const char *filename) |
Public Attributes | |
SoSFString | info |
SoSFBool | binary |
SoSFEnum | colorization |
Protected Member Functions | |
virtual | ~SoSTLFileKit (void) |
void | reset (void) |
SbBool | addFacet (const SbVec3f &v1, const SbVec3f &v2, const SbVec3f &v3, const SbVec3f &normal) |
void | organizeModel (void) |
SoSTLFileKit is a class for using STL files with Coin.
Class for using STL files with Coin. You can use it to read and write STL files, and convert back and forth between Open Inventor scene graphs and SoSTLFileKits.
STL files are 3D models intended for 3D printers, and is a format supported by a wide variety of computer-aided design programs. STL models are, because of their intended purpose, always representations of solid objects. STL is short for Stereolithography, the process used for 3D printing.
Ordinary STL models do not contain color information. There are, however, two extensions to the binary file format for specifying color. Currently neither extension is supported. This is caused by lack of sample models using the extensions and will be added as soon as such models are found. We have the specs on the extensions, and it should be pretty straight-forwards to implement, but we want to get it right at once since we have write support (we don't want to inadvertently create a third color extension ;).
When writing STL files, certain STL model criterias are not enforced by SoSTLFileKit. These are:
Since the color extensions are not supported yet, color information is not collected either when converting Open Inventor scene graphs to SoSTLFileKits.
Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
SoSTLFileKit::SoSTLFileKit | ( | void | ) |
Constructor.
SoSTLFileKit::~SoSTLFileKit | ( | void | ) | [protected, virtual] |
Destructor.
static void SoSTLFileKit::initClass | ( | void | ) | [static] |
Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.
Reimplemented from SoForeignFileKit.
SbBool SoSTLFileKit::identify | ( | const char * | filename | ) | [static] |
Returns wether or not filename is identified as an STL file.
SbBool SoSTLFileKit::readFile | ( | const char * | filename | ) | [virtual] |
Reads in an STL file. Both ascii and binary files are supported. For binary files, the color extensions are not implemented yet.
Returns FALSE if filename could not be opened or parsed correctly.
Reimplemented from SoForeignFileKit.
SbBool SoSTLFileKit::readScene | ( | SoNode * | scene | ) | [virtual] |
Converts a scene graph into an SoSTLFileKit. Useful for creating STL files.
Reimplemented from SoForeignFileKit.
SbBool SoSTLFileKit::writeFile | ( | const char * | filename | ) | [virtual] |
Writes the STL model to an STL file.
Reimplemented from SoForeignFileKit.
SbBool SoSTLFileKit::writeScene | ( | SoNode *& | root, |
const char * | format = NULL |
||
) | [virtual] |
Converts the STL model into a native scene graph.
Reimplemented from SoForeignFileKit.
void SoSTLFileKit::reset | ( | void | ) | [protected] |
Resets the STL model so it contains nothing.
SbBool SoSTLFileKit::addFacet | ( | const SbVec3f & | v1, |
const SbVec3f & | v2, | ||
const SbVec3f & | v3, | ||
const SbVec3f & | n | ||
) | [protected] |
Adds one triangle to the STL model.
void SoSTLFileKit::organizeModel | ( | void | ) | [protected] |
Should be called after the STL model is completely set up in the SoSTLFileKit through import from a file or from a scene graph. The model will then be optimized for fast rendering.
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Sun May 1 2011 02:58:36 for Coin by Doxygen 1.7.3.