Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ===============================================================================
- File: ASEModel.h
- Author: Clinton Freeman
- Created: May 8, 2011
- ===============================================================================
- */
- #ifndef ASEMODEL_H_
- #define ASEMODEL_H_
- #include <headers/Common.h>
- #include <headers/Vector3.h>
- #include <ostream>
- #include <vector>
- using std::vector;
- using std::string;
- using std::iterator;
- namespace E3D
- {
- struct Parsable
- {
- virtual ~Parsable() {}
- virtual void parse(vector<string>::iterator& tokenItr) = 0;
- };
- struct ASEVertex : public Parsable
- {
- unsigned int id;
- Vector3 coords;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEVertex& v);
- };
- // these are all exactly the same
- typedef ASEVertex ASETVertex;
- typedef ASEVertex ASECVertex;
- typedef ASEVertex ASENormal;
- struct ASEFace : public Parsable
- {
- unsigned int id;
- unsigned int A, B, C, AB, BC, CA, meshMtlID;
- int meshSmoothing; // this can be empty, so we need -1 as a flag for that
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEFace& f);
- };
- struct ASETFace : public Parsable
- {
- unsigned int id;
- unsigned int A, B, C;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASETFace& tf);
- };
- // these are the same, just arbitrarily chose one to be the struct and one
- // to be the typedef
- typedef ASETFace ASECFace;
- struct ASEMesh : public Parsable
- {
- unsigned int timeValue;
- unsigned int numVertex, numFaces, numTVertex, numTVFaces, numCVertex,
- numCVFaces;
- vector<ASEVertex> vertexList;
- vector<ASEFace> faceList;
- vector<ASECVertex> cVertexList;
- vector<ASECFace> cFaceList;
- vector<ASETVertex> tVertexList;
- vector<ASETFace> tFaceList;
- vector<ASENormal> faceNormals;
- vector<ASENormal> vertexNormals;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEMesh& m);
- };
- struct ASENodeTM : public Parsable
- {
- string nodeName;
- Vector3 inheritPos, inheritRot, inheritScl;
- Vector3 tmRow0, tmRow1, tmRow2, tmRow3, tmPos, tmRotAxis;
- float tmRotAngle;
- Vector3 tmScale, tmScaleAxis;
- float tmScaleAxisAng;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASENodeTM& n);
- };
- struct ASEGeomObject : public Parsable
- {
- string nodeName;
- ASENodeTM nodeTM;
- ASEMesh mesh;
- unsigned int propMotionBlur, propCastShadow, propRecvShadow;
- unsigned int materialRef;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEGeomObject& go);
- };
- struct ASEMap : public Parsable
- {
- typedef enum // supposedly this is the same as just doing enum NAME {};
- {
- MAP_DIFFUSE,
- MAP_SPECULAR,
- MAP_SHINE,
- MAP_SHINESTRENGTH,
- MAP_SELFILLUM,
- MAP_OPACITY,
- MAP_FILTERCOLOR,
- MAP_BUMP,
- MAP_REFLECT,
- MAP_REFRACT
- }
- ASEMapFunc; // named this one func because type and class were taken!
- ASEMapFunc mapFunc;
- string name, mapClass;
- unsigned int subno;
- float amount;
- string bitmap;
- string type; // TODO: enum this bad boy
- float uvwUOffset, uvwVOffset, uvwUTiling, uvwVTiling, uvwAngle, uvwBlur,
- uvwBlurOffset, uvwNoiseAmt, uvwNoiseSize, uvwNoisePhase;
- // !IMPORTANT! typo in exporter, "uvwNouseAmt"
- int uvwNoiseLevel;
- string bitmapFilter; // TODO: enum again
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEMap& m);
- };
- struct ASEMaterial : public Parsable
- {
- string name;
- string matClass;
- RGB ambient, diffuse, specular;
- float shine, shineStrength, transparency, wireSize;
- unsigned int numSubMtls; // this will only be there if there are actually
- // submtls?
- vector<ASEMaterial> subMaterials;
- // the following could be missing if submaterials are present?
- string shading; // TODO: probably make this into an enum
- float xpFalloff, selfIllum;
- string falloff; // TODO: this one too..
- string xpType; // TODO: ...and this one
- vector<ASEMap> maps;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEMaterial& m);
- };
- struct ASEMaterialList : public Parsable
- {
- unsigned int materialCount;
- vector<ASEMaterial> materials;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEMaterialList& m);
- };
- struct ASEScene : public Parsable
- {
- string filename;
- unsigned int firstFrame, lastFrame, frameSpeed, ticksPerFrame;
- RGB backgroundStatic, ambientStatic;
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEScene& s);
- };
- struct ASEModel : public Parsable
- {
- unsigned int exportVersion;
- string comment;
- ASEScene scene;
- ASEMaterialList materialList;
- vector<ASEGeomObject> geomObjects;
- vector<string>::iterator lastToken;
- ASEModel(string filename);
- virtual void parse(vector<string>::iterator& tokenItr);
- friend std::ostream& operator <<(std::ostream& o, const ASEModel& m);
- };
- }
- #endif /* ASEMODEL_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement