Assimp
v4.1. (December 2018)
|
Class that holding scene graph which include: groups, geometry, metadata etc. More...
Inherits Assimp::BaseImporter.
Public Member Functions | |
bool | CanRead (const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const |
Returns whether the class can handle the format of the given file. More... | |
void | GetExtensionList (std::set< std::string > &pExtensionList) |
const aiImporterDesc * | GetInfo () const |
Called by #Importer::GetImporterInfo to get a description of some loader features. More... | |
void | InternReadFile (const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) |
Imports the given file into the given scene structure. More... | |
void | ParseFile (const std::string &pFile, IOSystem *pIOHandler) |
Parse X3D file and fill scene graph. More... | |
X3DImporter () | |
Default constructor. More... | |
~X3DImporter () | |
Default destructor. More... | |
![]() | |
BaseImporter () AI_NO_EXCEPT | |
Constructor to be privately used by Importer. More... | |
virtual const ImporterUnits & | GetApplicationUnits () |
const std::string & | GetErrorText () const |
Returns the error description of the last error that occurred. More... | |
void | GetExtensionList (std::set< std::string > &extensions) |
Called by #Importer::GetExtensionList for each loaded importer. More... | |
virtual double | GetFileScale () const |
aiScene * | ReadFile (Importer *pImp, const std::string &pFile, IOSystem *pIOHandler) |
Imports the given file and returns the imported data. More... | |
virtual void | SetApplicationUnits (const ImporterUnits &unit) |
virtual void | SetFileScale (double scale) |
Will be called only by scale process when scaling is requested. More... | |
virtual void | SetupProperties (const Importer *pImp) |
Called prior to ReadFile(). More... | |
virtual | ~BaseImporter () |
Destructor, private as well. More... | |
Public Attributes | |
std::list< CX3DImporter_NodeElement * > | NodeElement_List |
All elements of scene graph. More... | |
![]() | |
std::map< ImporterUnits, double > | importerUnits |
Assimp Importer unit conversions available if you need another measurment unit add it below. More... | |
Additional Inherited Members | |
![]() | |
enum | ImporterUnits { M, MM, CM, INCHES, FEET } |
enum | TextFileMode { ALLOW_EMPTY, FORBID_EMPTY } |
Enum to define, if empty files are ok or not. More... | |
![]() | |
static bool | CheckMagicToken (IOSystem *pIOHandler, const std::string &pFile, const void *magic, unsigned int num, unsigned int offset=0, unsigned int size=4) |
Check whether a file starts with one or more magic tokens. More... | |
static void | ConvertToUTF8 (std::vector< char > &data) |
An utility for all text file loaders. More... | |
static void | ConvertUTF8toISO8859_1 (std::string &data) |
An utility for all text file loaders. More... | |
template<typename T > | |
static AI_FORCE_INLINE void | CopyVector (std::vector< T > &vec, T *&out, unsigned int &outLength) |
Utility function to move a std::vector into a aiScene array. More... | |
static std::string | GetExtension (const std::string &pFile) |
Extract file extension from a string. More... | |
static bool | SearchFileHeaderForToken (IOSystem *pIOSystem, const std::string &file, const char **tokens, unsigned int numTokens, unsigned int searchBytes=200, bool tokensSol=false, bool noAlphaBeforeTokens=false) |
A utility for CanRead(). More... | |
static bool | SimpleExtensionCheck (const std::string &pFile, const char *ext0, const char *ext1=NULL, const char *ext2=NULL) |
Check whether a file has a specific file extension. More... | |
static void | TextFileToBuffer (IOStream *stream, std::vector< char > &data, TextFileMode mode=FORBID_EMPTY) |
Utility for text file loaders which copies the contents of the file into a memory buffer and converts it to our UTF8 representation. More... | |
![]() | |
ImporterUnits | applicationUnits = ImporterUnits::M |
double | fileScale = 1.0 |
double | importerScale = 1.0 |
std::string | m_ErrorText |
Error description in case there was one. More... | |
ProgressHandler * | m_progress |
Currently set progress handler. More... | |
Class that holding scene graph which include: groups, geometry, metadata etc.
Limitations.
Pay attention that X3D is format for interactive graphic and simulations for web browsers. So not all features can be imported using Assimp.
Unsupported nodes: CAD geometry component: "CADAssembly", "CADFace", "CADLayer", "CADPart", "IndexedQuadSet", "QuadSet" Core component: "ROUTE", "ExternProtoDeclare", "ProtoDeclare", "ProtoInstance", "ProtoInterface", "WorldInfo" Distributed interactive simulation (DIS) component: "DISEntityManager", "DISEntityTypeMapping", "EspduTransform", "ReceiverPdu", "SignalPdu", "TransmitterPdu" Cube map environmental texturing component: "ComposedCubeMapTexture", "GeneratedCubeMapTexture", "ImageCubeMapTexture" Environmental effects component: "Background", "Fog", "FogCoordinate", "LocalFog", "TextureBackground" Environmental sensor component: "ProximitySensor", "TransformSensor", "VisibilitySensor" Followers component: "ColorChaser", "ColorDamper", "CoordinateChaser", "CoordinateDamper", "OrientationChaser", "OrientationDamper", "PositionChaser", "PositionChaser2D", "PositionDamper", "PositionDamper2D", "ScalarChaser", "ScalarDamper", "TexCoordChaser2D", "TexCoordDamper2D" Geospatial component: "GeoCoordinate", "GeoElevationGrid", "GeoLocation", "GeoLOD", "GeoMetadata", "GeoOrigin", "GeoPositionInterpolator", "GeoProximitySensor", "GeoTouchSensor", "GeoTransform", "GeoViewpoint" Humanoid Animation (H-Anim) component: "HAnimDisplacer", "HAnimHumanoid", "HAnimJoint", "HAnimSegment", "HAnimSite" Interpolation component: "ColorInterpolator", "CoordinateInterpolator", "CoordinateInterpolator2D", "EaseInEaseOut", "NormalInterpolator", "OrientationInterpolator", "PositionInterpolator", "PositionInterpolator2D", "ScalarInterpolator", "SplinePositionInterpolator", "SplinePositionInterpolator2D", "SplineScalarInterpolator", "SquadOrientationInterpolator", Key device sensor component: "KeySensor", "StringSensor" Layering component: "Layer", "LayerSet", "Viewport" Layout component: "Layout", "LayoutGroup", "LayoutLayer", "ScreenFontStyle", "ScreenGroup" Navigation component: "Billboard", "Collision", "LOD", "NavigationInfo", "OrthoViewpoint", "Viewpoint", "ViewpointGroup" Networking component: "EXPORT", "IMPORT", "Anchor", "LoadSensor" NURBS component: "Contour2D", "ContourPolyline2D", "CoordinateDouble", "NurbsCurve", "NurbsCurve2D", "NurbsOrientationInterpolator", "NurbsPatchSurface", "NurbsPositionInterpolator", "NurbsSet", "NurbsSurfaceInterpolator", "NurbsSweptSurface", "NurbsSwungSurface", "NurbsTextureCoordinate", "NurbsTrimmedSurface" Particle systems component: "BoundedPhysicsModel", "ConeEmitter", "ExplosionEmitter", "ForcePhysicsModel", "ParticleSystem", "PointEmitter", "PolylineEmitter", "SurfaceEmitter", "VolumeEmitter", "WindPhysicsModel" Picking component: "LinePickSensor", "PickableGroup", "PointPickSensor", "PrimitivePickSensor", "VolumePickSensor" Pointing device sensor component: "CylinderSensor", "PlaneSensor", "SphereSensor", "TouchSensor" Rendering component: "ClipPlane" Rigid body physics: "BallJoint", "CollidableOffset", "CollidableShape", "CollisionCollection", "CollisionSensor", "CollisionSpace", "Contact", "DoubleAxisHingeJoint", "MotorJoint", "RigidBody", "RigidBodyCollection", "SingleAxisHingeJoint", "SliderJoint", "UniversalJoint" Scripting component: "Script" Programmable shaders component: "ComposedShader", "FloatVertexAttribute", "Matrix3VertexAttribute", "Matrix4VertexAttribute", "PackagedShader", "ProgramShader", "ShaderPart", "ShaderProgram", Shape component: "FillProperties", "LineProperties", "TwoSidedMaterial" Sound component: "AudioClip", "Sound" Text component: "FontStyle", "Text" Texturing3D Component: "ComposedTexture3D", "ImageTexture3D", "PixelTexture3D", "TextureCoordinate3D", "TextureCoordinate4D", "TextureTransformMatrix3D", "TextureTransform3D" Texturing component: "MovieTexture", "MultiTexture", "MultiTextureCoordinate", "MultiTextureTransform", "PixelTexture", "TextureCoordinateGenerator", "TextureProperties", Time component: "TimeSensor" Event Utilities component: "BooleanFilter", "BooleanSequencer", "BooleanToggle", "BooleanTrigger", "IntegerSequencer", "IntegerTrigger", "TimeTrigger", Volume rendering component: "BlendedVolumeStyle", "BoundaryEnhancementVolumeStyle", "CartoonVolumeStyle", "ComposedVolumeStyle", "EdgeEnhancementVolumeStyle", "IsoSurfaceVolumeData", "OpacityMapVolumeStyle", "ProjectionVolumeStyle", "SegmentedVolumeData", "ShadedVolumeStyle", "SilhouetteEnhancementVolumeStyle", "ToneMappedVolumeStyle", "VolumeData"
Supported nodes: Core component: "MetadataBoolean", "MetadataDouble", "MetadataFloat", "MetadataInteger", "MetadataSet", "MetadataString" Geometry2D component: "Arc2D", "ArcClose2D", "Circle2D", "Disk2D", "Polyline2D", "Polypoint2D", "Rectangle2D", "TriangleSet2D" Geometry3D component: "Box", "Cone", "Cylinder", "ElevationGrid", "Extrusion", "IndexedFaceSet", "Sphere" Grouping component: "Group", "StaticGroup", "Switch", "Transform" Lighting component: "DirectionalLight", "PointLight", "SpotLight" Networking component: "Inline" Rendering component: "Color", "ColorRGBA", "Coordinate", "IndexedLineSet", "IndexedTriangleFanSet", "IndexedTriangleSet", "IndexedTriangleStripSet", "LineSet", "PointSet", "TriangleFanSet", "TriangleSet", "TriangleStripSet", "Normal" Shape component: "Shape", "Appearance", "Material" Texturing component: "ImageTexture", "TextureCoordinate", "TextureTransform"
Limitations of attribute "USE". If "USE" is set then node must be empty, like that: <Node use="name"> not the <Node use="name"></Node>
Ignored attributes: "creaseAngle", "convex", "solid".
Texture coordinates generating: only for Sphere, Cone, Cylinder. In all other case used PLANE mapping. It's better that Assimp main code has powerful texture coordinates generator. Then is not needed to duplicate this code in every importer.
Lighting limitations. If light source placed in some group with "DEF" set. And after that some node is use it group with "USE" attribute then you will get error about duplicate light sources. That's happening because Assimp require names for lights but do not like duplicates of it )).
Color for faces. That's happening when attribute "colorPerVertex" is set to "false". But Assimp do not hold how many colors has mesh and require equal length for mVertices and mColors. You will see the colors but vertices will use call which last used in "colorIdx".
That's all for now. Enjoy
Assimp::X3DImporter::X3DImporter | ( | ) |
Default constructor.
Assimp::X3DImporter::~X3DImporter | ( | ) |
Default destructor.
|
virtual |
Returns whether the class can handle the format of the given file.
The implementation should be as quick as possible. A check for the file extension is enough. If no suitable loader is found with this strategy, CanRead() is called again, the 'checkSig' parameter set to true this time. Now the implementation is expected to perform a full check of the file structure, possibly searching the first bytes of the file for magic identifiers or keywords.
pFile | Path and file name of the file to be examined. |
pIOHandler | The IO handler to use for accessing any file. |
checkSig | Set to true if this method is called a second time. This time, the implementation may take more time to examine the contents of the file to be loaded for magic bytes, keywords, etc to be able to load files with unknown/not existent file extensions. |
Implements Assimp::BaseImporter.
void Assimp::X3DImporter::GetExtensionList | ( | std::set< std::string > & | pExtensionList | ) |
|
virtual |
Called by #Importer::GetImporterInfo to get a description of some loader features.
Importers must provide this information.
Implements Assimp::BaseImporter.
|
virtual |
Imports the given file into the given scene structure.
The function is expected to throw an ImportErrorException if there is an error. If it terminates normally, the data in aiScene is expected to be correct. Override this function to implement the actual importing.
The output scene must meet the following requirements:
If the AI_SCENE_FLAGS_INCOMPLETE-Flag is not set:
This won't be checked (except by the validation step): Assimp will crash if one of the conditions is not met!
pFile | Path of the file to be imported. |
pScene | The scene object to hold the imported data. NULL is not a valid parameter. |
pIOHandler | The IO handler to use for any file access. NULL is not a valid parameter. |
TODO: IME optimize tree
Implements Assimp::BaseImporter.
void Assimp::X3DImporter::ParseFile | ( | const std::string & | pFile, |
IOSystem * | pIOHandler | ||
) |
Parse X3D file and fill scene graph.
The function has no return value. Result can be found by analyzing the generated graph. Also exception can be thrown if trouble will found.
[in] | pFile | - name of file to be parsed. |
[in] | pIOHandler | - pointer to IO helper object. |
std::list<CX3DImporter_NodeElement*> Assimp::X3DImporter::NodeElement_List |
All elements of scene graph.