diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-08-07 19:04:25 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-08-07 19:04:25 +0400 |
commit | 9a1217e55980f9b0a501fbe03ab2ea559638392d (patch) | |
tree | 28b4c5bcf547d2d9f63d7d687ff6f43064cc0dc5 /source/blender/freestyle/intern/winged_edge | |
parent | 1baf09110b2c3bd4a6eea128b61ca9a0017f81dd (diff) |
soc-2008-mxcurioni: first version of lib3ds code. It does NOT work yet and has to be debugged. It can be activate in app_blender/api.cpp by replacing the FRS_scene_3ds_export call in FRS_prepare, by FRS_load_mesh.
All of the reference to the original Material class were renamed to FrsMaterial to resolve a name collision with Blender. To keep the window context necessary to draw the strokes after RE_Database_FromScene has been called, the display_clear function is used.
Diffstat (limited to 'source/blender/freestyle/intern/winged_edge')
4 files changed, 40 insertions, 40 deletions
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index b480b67b3d8..95be5f55794 100755 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -254,7 +254,7 @@ WFace::WFace(WFace& iBrother) _VerticesNormals = iBrother._VerticesNormals; _VerticesTexCoords = iBrother._VerticesTexCoords; _Id = iBrother.GetId(); - _MaterialIndex = iBrother._MaterialIndex; + _FrsMaterialIndex = iBrother._FrsMaterialIndex; userdata = NULL; iBrother.userdata = new facedata; ((facedata*)(iBrother.userdata))->_copy = this; @@ -266,8 +266,8 @@ WFace * WFace::duplicate() return clone; } -const Material& WFace::material() { - return getShape()->material(_MaterialIndex); +const FrsMaterial& WFace::frs_material() { + return getShape()->frs_material(_FrsMaterialIndex); } WOEdge * WFace::MakeEdge(WVertex *v1, WVertex *v2) @@ -475,7 +475,7 @@ WShape * WShape::duplicate() WShape::WShape(WShape& iBrother) { _Id = iBrother.GetId(); - _Materials = iBrother._Materials; + _FrsMaterials = iBrother._FrsMaterials; _meanEdgeSize = iBrother._meanEdgeSize; iBrother.bbox(_min, _max); vector<WVertex*>& vertexList = iBrother.getVertexList(); @@ -650,7 +650,7 @@ WFace* WShape::MakeFace(vector<WVertex*>& iVertexList, unsigned iMaterial, WFace int id = _FaceList.size(); - face->setMaterialIndex(iMaterial); + face->setFrsMaterialIndex(iMaterial); // Check whether we have a degenerated face: diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h index ea6c793bdfe..9b05b4577a9 100755 --- a/source/blender/freestyle/intern/winged_edge/WEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WEdge.h @@ -34,7 +34,7 @@ # include <iterator> # include "../system/FreestyleConfig.h" # include "../geometry/Geom.h" -# include "../scene_graph/Material.h" +# include "../scene_graph/FrsMaterial.h" using namespace std; using namespace Geometry; @@ -495,11 +495,11 @@ protected: vector<Vec2r> _VerticesTexCoords; int _Id; - unsigned _MaterialIndex; + unsigned _FrsMaterialIndex; public: void *userdata; - inline WFace() {userdata = NULL;_MaterialIndex = 0;} + inline WFace() {userdata = NULL;_FrsMaterialIndex = 0;} /*! copy constructor */ WFace(WFace& iBrother); virtual WFace * duplicate(); @@ -510,8 +510,8 @@ public: inline WOEdge * GetOEdge(int i) {return _OEdgeList[i];} inline Vec3r& GetNormal() {return _Normal;} inline int GetId() {return _Id;} - inline unsigned materialIndex() const {return _MaterialIndex;} - const Material& material() ; + inline unsigned frs_materialIndex() const {return _FrsMaterialIndex;} + const FrsMaterial& frs_material() ; /*! The vertex of index i corresponds to the a vertex * of the edge of index i @@ -653,7 +653,7 @@ public: inline void setNormalList(const vector<Vec3r>& iNormalsList) {_VerticesNormals = iNormalsList;} inline void setTexCoordsList(const vector<Vec2r>& iTexCoordsList) {_VerticesTexCoords = iTexCoordsList;} inline void setId(int id) {_Id = id;} - inline void setMaterialIndex(unsigned iMaterialIndex) {_MaterialIndex = iMaterialIndex;} + inline void setFrsMaterialIndex(unsigned iMaterialIndex) {_FrsMaterialIndex = iMaterialIndex;} /*! designed to build a specialized WEdge * for use in MakeEdge @@ -702,7 +702,7 @@ protected: static unsigned _SceneCurrentId; Vec3r _min; Vec3r _max; - vector<Material> _Materials; + vector<FrsMaterial> _FrsMaterials; real _meanEdgeSize; public: @@ -749,8 +749,8 @@ public: inline vector<WFace*>& GetFaceList() {return _FaceList;} inline unsigned GetId() {return _Id;} inline void bbox(Vec3r& min, Vec3r& max) {min=_min; max=_max;} - inline const Material& material(unsigned i) const {return _Materials[i];} - inline const vector<Material>& materials() const {return _Materials;} + inline const FrsMaterial& frs_material(unsigned i) const {return _FrsMaterials[i];} + inline const vector<FrsMaterial>& frs_materials() const {return _FrsMaterials;} inline const real getMeanEdgeSize() const {return _meanEdgeSize;} /*! modifiers */ static inline void setCurrentId(const unsigned id) { _SceneCurrentId = id; } @@ -759,8 +759,8 @@ public: inline void setFaceList(const vector<WFace*>& iFaceList) {_FaceList = iFaceList;} inline void setId(int id) {_Id = id;} inline void setBBox(const Vec3r& min, const Vec3r& max) {_min = min; _max=max;} - inline void setMaterial(const Material& material, unsigned i) {_Materials[i]=material;} - inline void setMaterials(const vector<Material>& iMaterials) {_Materials = iMaterials;} + inline void setFrsMaterial(const FrsMaterial& frs_material, unsigned i) {_FrsMaterials[i]=frs_material;} + inline void setFrsMaterials(const vector<FrsMaterial>& iMaterials) {_FrsMaterials = iMaterials;} /*! designed to build a specialized WFace * for use in MakeFace diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index cccf876db8b..9f3da4707e3 100755 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -34,7 +34,7 @@ void WingedEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet& ifs) { void WingedEdgeBuilder::visitNodeShape(NodeShape& ns) { //Sets the current material to iShapeode->material: - _current_material = &(ns.material()); + _current_frs_material = &(ns.frs_material()); } void WingedEdgeBuilder::visitNodeTransform(NodeTransform& tn) { @@ -88,19 +88,19 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { const IndexedFaceSet::TRIANGLES_STYLE* faceStyle = ifs.trianglesStyle(); - vector<Material> materials; + vector<FrsMaterial> frs_materials; if(ifs.msize()){ - const Material*const* mats = ifs.materials(); + const FrsMaterial*const* mats = ifs.frs_materials(); for(unsigned i=0; i<ifs.msize(); ++i) - materials.push_back(*(mats[i])); - shape.setMaterials(materials); + frs_materials.push_back(*(mats[i])); + shape.setFrsMaterials(frs_materials); } - // const Material * mat = (ifs.material()); + // const FrsMaterial * mat = (ifs.frs_material()); // if (mat) - // shape.setMaterial(*mat); - // else if(_current_material) - // shape.setMaterial(*_current_material); + // shape.setFrsMaterial(*mat); + // else if(_current_frs_material) + // shape.setFrsMaterial(*_current_frs_material); // sets the current WShape to shape _current_wshape = &shape; @@ -126,7 +126,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { case IndexedFaceSet::TRIANGLE_STRIP: buildTriangleStrip(new_vertices, new_normals, - materials, + frs_materials, texCoords, vindices, nindices, @@ -137,7 +137,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { case IndexedFaceSet::TRIANGLE_FAN: buildTriangleFan(new_vertices, new_normals, - materials, + frs_materials, texCoords, vindices, nindices, @@ -148,7 +148,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { case IndexedFaceSet::TRIANGLES: buildTriangles(new_vertices, new_normals, - materials, + frs_materials, texCoords, vindices, nindices, @@ -215,7 +215,7 @@ void WingedEdgeBuilder::buildWVertices(WShape& shape, void WingedEdgeBuilder::buildTriangleStrip( const real *vertices, const real *normals, - vector<Material>& iMaterials, + vector<FrsMaterial>& iMaterials, const real *texCoords, const unsigned *vindices, const unsigned *nindices, @@ -279,7 +279,7 @@ void WingedEdgeBuilder::buildTriangleStrip( const real *vertices, void WingedEdgeBuilder::buildTriangleFan( const real *vertices, const real *normals, - vector<Material>& iMaterials, + vector<FrsMaterial>& iMaterials, const real *texCoords, const unsigned *vindices, const unsigned *nindices, @@ -291,7 +291,7 @@ void WingedEdgeBuilder::buildTriangleFan( const real *vertices, void WingedEdgeBuilder::buildTriangles(const real *vertices, const real *normals, - vector<Material>& iMaterials, + vector<FrsMaterial>& iMaterials, const real *texCoords, const unsigned *vindices, const unsigned *nindices, diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h index fe033f2ea0b..6bd515aef0b 100755 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h @@ -44,7 +44,7 @@ class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor inline WingedEdgeBuilder() : SceneVisitor() { _current_wshape = NULL; - _current_material = NULL; + _current_frs_material = NULL; _current_matrix = NULL; _winged_edge = new WingedEdge; // Not deleted by the destructor } @@ -76,8 +76,8 @@ class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor return _current_wshape; } - inline Material* getCurrentMaterial() { - return _current_material; + inline FrsMaterial* getCurrentFrsMaterial() { + return _current_frs_material; } inline Matrix44r* getCurrentMatrix() { @@ -93,8 +93,8 @@ class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor _current_wshape = wshape; } - inline void setCurrentMaterial(Material* mat) { - _current_material = mat; + inline void setCurrentFrsMaterial(FrsMaterial* mat) { + _current_frs_material = mat; } // inline void setCurrentMatrix(Matrix44r* matrix) { @@ -112,7 +112,7 @@ class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor void buildTriangleStrip(const real *vertices, const real *normals, - vector<Material>& iMaterials, + vector<FrsMaterial>& iMaterials, const real *texCoords, const unsigned *vindices, const unsigned *nindices, @@ -122,7 +122,7 @@ class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor void buildTriangleFan(const real *vertices, const real *normals, - vector<Material>& iMaterials, + vector<FrsMaterial>& iMaterials, const real *texCoords, const unsigned *vindices, const unsigned *nindices, @@ -132,7 +132,7 @@ class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor void buildTriangles(const real *vertices, const real *normals, - vector<Material>& iMaterials, + vector<FrsMaterial>& iMaterials, const real *texCoords, const unsigned *vindices, const unsigned *nindices, @@ -151,7 +151,7 @@ class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor real *res); WShape* _current_wshape; - Material* _current_material; + FrsMaterial* _current_frs_material; WingedEdge* _winged_edge; Matrix44r* _current_matrix; vector<Matrix44r*> _matrices_stack; |