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/view_map | |
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/view_map')
8 files changed, 75 insertions, 75 deletions
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index c868510624c..1bd6d6f46f1 100755 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -288,17 +288,17 @@ namespace Functions0D { return n; } - Material MaterialF0D::operator()(Interface0DIterator& iter) { + FrsMaterial MaterialF0D::operator()(Interface0DIterator& iter) { FEdge *fe1, *fe2; getFEdges(iter,fe1,fe2); if(fe1 == 0) getFEdges(iter, fe1, fe2); - Material mat; + FrsMaterial mat; if(fe1->isSmooth()) - mat = ((FEdgeSmooth*)fe1)->material(); + mat = ((FEdgeSmooth*)fe1)->frs_material(); else - mat = ((FEdgeSharp*)fe1)->bMaterial(); + mat = ((FEdgeSharp*)fe1)->bFrsMaterial(); // const SShape * sshape = getShapeF0D(iter); // return sshape->material(); return mat; diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h index 9543e8c34a6..24d2edac094 100755 --- a/source/blender/freestyle/intern/view_map/Functions0D.h +++ b/source/blender/freestyle/intern/view_map/Functions0D.h @@ -34,7 +34,7 @@ # include "Interface0D.h" # include "../geometry/Geom.h" # include "../system/Exception.h" -# include "../scene_graph/Material.h" +# include "../scene_graph/FrsMaterial.h" # include <set> # include <vector> class FEdge; @@ -350,7 +350,7 @@ namespace Functions0D { * to deal with this cases in a specific way should implement * its own getMaterial functor. */ - class LIB_VIEW_MAP_EXPORT MaterialF0D : public UnaryFunction0D<Material> + class LIB_VIEW_MAP_EXPORT MaterialF0D : public UnaryFunction0D<FrsMaterial> { public: /*! Returns the string "MaterialF0D"*/ @@ -358,7 +358,7 @@ namespace Functions0D { return "MaterialF0D"; } /*! the () operator.*/ - Material operator()(Interface0DIterator& iter); + FrsMaterial operator()(Interface0DIterator& iter); }; // ShapeIdF0D diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp index db4f82d369e..7a7d0a51d4b 100755 --- a/source/blender/freestyle/intern/view_map/Silhouette.cpp +++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp @@ -349,12 +349,12 @@ real FEdge::z_discontinuity() const //{ // return _VertexA->shape()->material(); //} -const Material& FEdgeSharp::aMaterial() const { - return _VertexA->shape()->material(_aMaterialIndex); +const FrsMaterial& FEdgeSharp::aFrsMaterial() const { + return _VertexA->shape()->frs_material(_aFrsMaterialIndex); } -const Material& FEdgeSharp::bMaterial() const { - return _VertexA->shape()->material(_bMaterialIndex); +const FrsMaterial& FEdgeSharp::bFrsMaterial() const { + return _VertexA->shape()->frs_material(_bFrsMaterialIndex); } /**********************************/ @@ -365,6 +365,6 @@ const Material& FEdgeSharp::bMaterial() const { /* */ /**********************************/ -const Material& FEdgeSmooth::material() const { - return _VertexA->shape()->material(_MaterialIndex); +const FrsMaterial& FEdgeSmooth::frs_material() const { + return _VertexA->shape()->frs_material(_FrsMaterialIndex); } diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index 14d934c6791..6b9ebde5707 100755 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -38,7 +38,7 @@ # include "../system/FreestyleConfig.h" # include "../geometry/Geom.h" # include "../geometry/BBox.h" -# include "../scene_graph/Material.h" +# include "../scene_graph/FrsMaterial.h" # include "../geometry/Polygon.h" # include "../system/Exception.h" # include "Interface0D.h" @@ -785,24 +785,24 @@ class LIB_VIEW_MAP_EXPORT FEdgeSharp : public FEdge protected: Vec3r _aNormal; // When following the edge, normal of the right face Vec3r _bNormal; // When following the edge, normal of the left face - unsigned _aMaterialIndex; - unsigned _bMaterialIndex; + unsigned _aFrsMaterialIndex; + unsigned _bFrsMaterialIndex; public: /*! Default constructor. */ inline FEdgeSharp() : FEdge(){ - _aMaterialIndex = _bMaterialIndex = 0; + _aFrsMaterialIndex = _bFrsMaterialIndex = 0; } /*! Builds an FEdgeSharp going from vA to vB. */ inline FEdgeSharp(SVertex *vA, SVertex *vB) : FEdge(vA, vB){ - _aMaterialIndex = _bMaterialIndex = 0; + _aFrsMaterialIndex = _bFrsMaterialIndex = 0; } /*! Copy constructor. */ inline FEdgeSharp(FEdgeSharp& iBrother) : FEdge(iBrother){ _aNormal = iBrother._aNormal; _bNormal = iBrother._bNormal; - _aMaterialIndex = iBrother._aMaterialIndex; - _bMaterialIndex = iBrother._bMaterialIndex; + _aFrsMaterialIndex = iBrother._aFrsMaterialIndex; + _bFrsMaterialIndex = iBrother._bFrsMaterialIndex; } /*! Destructor. */ virtual ~FEdgeSharp() {} @@ -824,29 +824,29 @@ public: * right of the FEdge. If this FEdge is a border, * it has no Face on its right and therefore, no material. */ - inline unsigned aMaterialIndex() const {return _aMaterialIndex;} + inline unsigned aFrsMaterialIndex() const {return _aFrsMaterialIndex;} /*! Returns the material of the face lying on the * right of the FEdge. If this FEdge is a border, * it has no Face on its right and therefore, no material. */ - const Material& aMaterial() const ; + const FrsMaterial& aFrsMaterial() const ; /*! Returns the index of the material of the face lying on the * left of the FEdge. */ - inline unsigned bMaterialIndex() const {return _bMaterialIndex;} + inline unsigned bFrsMaterialIndex() const {return _bFrsMaterialIndex;} /*! Returns the material of the face lying on the * left of the FEdge. */ - const Material& bMaterial() const ; + const FrsMaterial& bFrsMaterial() const ; /*! Sets the normal to the face lying on the right of the FEdge. */ inline void setNormalA(const Vec3r& iNormal) {_aNormal = iNormal;} /*! Sets the normal to the face lying on the left of the FEdge. */ inline void setNormalB(const Vec3r& iNormal) {_bNormal = iNormal;} /*! Sets the index of the material lying on the right of the FEdge.*/ - inline void setaMaterialIndex(unsigned i) {_aMaterialIndex = i;} + inline void setaFrsMaterialIndex(unsigned i) {_aFrsMaterialIndex = i;} /*! Sets the index of the material lying on the left of the FEdge.*/ - inline void setbMaterialIndex(unsigned i) {_bMaterialIndex = i;} + inline void setbFrsMaterialIndex(unsigned i) {_bFrsMaterialIndex = i;} }; @@ -858,7 +858,7 @@ class LIB_VIEW_MAP_EXPORT FEdgeSmooth : public FEdge { protected: Vec3r _Normal; - unsigned _MaterialIndex; + unsigned _FrsMaterialIndex; // bool _hasVisibilityPoint; // Vec3r _VisibilityPointA; // The edge on which the visibility will be computed represented // Vec3r _VisibilityPointB; // using its 2 extremity points A and B @@ -868,13 +868,13 @@ public: /*! Default constructor. */ inline FEdgeSmooth() : FEdge(){ _Face=0; - _MaterialIndex = 0; + _FrsMaterialIndex = 0; _isSmooth = true; } /*! Builds an FEdgeSmooth going from vA to vB. */ inline FEdgeSmooth(SVertex *vA, SVertex *vB) : FEdge(vA, vB){ _Face=0; - _MaterialIndex = 0; + _FrsMaterialIndex = 0; _isSmooth = true; } @@ -882,7 +882,7 @@ public: inline FEdgeSmooth(FEdgeSmooth& iBrother) : FEdge(iBrother){ _Normal = iBrother._Normal; _Face = iBrother._Face; - _MaterialIndex = iBrother._MaterialIndex; + _FrsMaterialIndex = iBrother._FrsMaterialIndex; _isSmooth = true; } /*! Destructor. */ @@ -897,15 +897,15 @@ public: /*! Returns the normal to the Face it is running accross. */ inline const Vec3r& normal() {return _Normal;} /*! Returns the index of the material of the face it is running accross. */ - inline unsigned materialIndex() const {return _MaterialIndex;} + inline unsigned frs_materialIndex() const {return _FrsMaterialIndex;} /*! Returns the material of the face it is running accross. */ - const Material& material() const ; + const FrsMaterial& frs_material() const ; inline void setFace(void * iFace) {_Face = iFace;} /*! Sets the normal to the Face it is running accross. */ inline void setNormal(const Vec3r& iNormal) {_Normal = iNormal;} /*! Sets the index of the material of the face it is running accross. */ - inline void setMaterialIndex(unsigned i) {_MaterialIndex = i;} + inline void setFrsMaterialIndex(unsigned i) {_FrsMaterialIndex = i;} }; /**********************************/ /* */ @@ -927,7 +927,7 @@ private: vector<FEdge*> _edgesList; // list of all edges Id _Id; BBox<Vec3r> _BBox; - vector<Material> _Materials; + vector<FrsMaterial> _FrsMaterials; float _importance; @@ -952,7 +952,7 @@ public: userdata = 0; _Id = iBrother._Id; _BBox = iBrother.bbox(); - _Materials = iBrother._Materials; + _FrsMaterials = iBrother._FrsMaterials; _importance = iBrother._importance; @@ -1199,13 +1199,13 @@ public: newEdge = new FEdgeSmooth((*sv), svB); FEdgeSmooth * se = dynamic_cast<FEdgeSmooth*>(newEdge); FEdgeSmooth * fes = dynamic_cast<FEdgeSmooth*>(fe); - se->setMaterialIndex(fes->materialIndex()); + se->setFrsMaterialIndex(fes->frs_materialIndex()); }else{ newEdge = new FEdgeSharp((*sv), svB); FEdgeSharp * se = dynamic_cast<FEdgeSharp*>(newEdge); FEdgeSharp * fes = dynamic_cast<FEdgeSharp*>(fe); - se->setaMaterialIndex(fes->aMaterialIndex()); - se->setbMaterialIndex(fes->bMaterialIndex()); + se->setaFrsMaterialIndex(fes->aFrsMaterialIndex()); + se->setbFrsMaterialIndex(fes->bFrsMaterialIndex()); } newEdge->setNature((fe)->getNature()); @@ -1264,13 +1264,13 @@ public: newEdge = new FEdgeSmooth(ioNewVertex, B); FEdgeSmooth * se = dynamic_cast<FEdgeSmooth*>(newEdge); FEdgeSmooth * fes = dynamic_cast<FEdgeSmooth*>(ioEdge); - se->setMaterialIndex(fes->materialIndex()); + se->setFrsMaterialIndex(fes->frs_materialIndex()); }else{ newEdge = new FEdgeSharp(ioNewVertex, B); FEdgeSharp * se = dynamic_cast<FEdgeSharp*>(newEdge); FEdgeSharp * fes = dynamic_cast<FEdgeSharp*>(ioEdge); - se->setaMaterialIndex(fes->aMaterialIndex()); - se->setbMaterialIndex(fes->bMaterialIndex()); + se->setaFrsMaterialIndex(fes->aFrsMaterialIndex()); + se->setbFrsMaterialIndex(fes->bFrsMaterialIndex()); } newEdge->setNature(ioEdge->getNature()); @@ -1399,9 +1399,9 @@ public: /*! Returns the bounding box of the shape. */ inline const BBox<Vec3r>& bbox() {return _BBox;} /*! Returns the ith material of the shape. */ - inline const Material& material(unsigned i) const {return _Materials[i];} + inline const FrsMaterial& frs_material(unsigned i) const {return _FrsMaterials[i];} /*! Returns the list of materials of the Shape. */ - inline const vector<Material>& materials() const {return _Materials;} + inline const vector<FrsMaterial>& frs_materials() const {return _FrsMaterials;} inline ViewShape * viewShape() {return _ViewShape;} inline float importance() const {return _importance;} /*! Returns the Id of the Shape. */ @@ -1411,7 +1411,7 @@ public: /*! Sets the Id of the shape.*/ inline void setId(Id id) {_Id = id;} /*! Sets the list of materials for the shape */ - inline void setMaterials(const vector<Material>& iMaterials) {_Materials = iMaterials;} + inline void setFrsMaterials(const vector<FrsMaterial>& iMaterials) {_FrsMaterials = iMaterials;} inline void setViewShape(ViewShape *iShape) {_ViewShape = iShape;} inline void setImportance(float importance){_importance = importance;} }; diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 42c39d5795e..5f7b313aaf6 100755 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -470,7 +470,7 @@ FEdge * ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer fe = new FEdgeSmooth(va, vb); fe->setNature(ifl.fl->nature()); fe->setId(_currentFId); - fe->setMaterialIndex(ifl.fl->getFace()->materialIndex()); + fe->setFrsMaterialIndex(ifl.fl->getFace()->frs_materialIndex()); fe->setFace(ifl.fl->getFace()); fe->setNormal(normal); fe->setPreviousEdge(feprevious); @@ -587,17 +587,17 @@ FEdge * ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge& iwe) unsigned matA(0), matB(0); if(iwe.order){ normalB = (iwe.e->GetbFace()->GetNormal()); - matB = (iwe.e->GetbFace()->materialIndex()); + matB = (iwe.e->GetbFace()->frs_materialIndex()); if(!(iwe.e->nature() & Nature::BORDER)) { normalA = (iwe.e->GetaFace()->GetNormal()); - matA = (iwe.e->GetaFace()->materialIndex()); + matA = (iwe.e->GetaFace()->frs_materialIndex()); } }else{ normalA = (iwe.e->GetbFace()->GetNormal()); - matA = (iwe.e->GetbFace()->materialIndex()); + matA = (iwe.e->GetbFace()->frs_materialIndex()); if(!(iwe.e->nature() & Nature::BORDER)) { normalB = (iwe.e->GetaFace()->GetNormal()); - matB = (iwe.e->GetaFace()->materialIndex()); + matB = (iwe.e->GetaFace()->frs_materialIndex()); } } // Creates the corresponding feature edge @@ -605,8 +605,8 @@ FEdge * ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge& iwe) fe = new FEdgeSharp(va, vb); fe->setNature(iwe.e->nature()); fe->setId(_currentFId); - fe->setaMaterialIndex(matA); - fe->setbMaterialIndex(matB); + fe->setaFrsMaterialIndex(matA); + fe->setbFrsMaterialIndex(matB); fe->setNormalA(normalA); fe->setNormalB(normalB); fe->setPreviousEdge(feprevious); diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 89e91e4f2c8..3a4d86ea16f 100755 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -56,7 +56,7 @@ void ViewMapBuilder::computeInitialViewEdges(WingedEdge& we) // create the embedding psShape = new SShape; psShape->setId((*it)->GetId()); - psShape->setMaterials((*it)->materials()); // FIXME + psShape->setFrsMaterials((*it)->frs_materials()); // FIXME // create the view shape ViewShape * vshape = new ViewShape(psShape); diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp index e42a0df0422..f99a574766b 100755 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp @@ -91,7 +91,7 @@ namespace ViewMapIO { inline - int load(istream& in, Material& m) { + int load(istream& in, FrsMaterial& m) { float tmp_array[4]; int i; @@ -149,13 +149,13 @@ namespace ViewMapIO { // -> Material READ(size); - vector<Material> materials; - Material m; + vector<FrsMaterial> frs_materials; + FrsMaterial m; for(i=0; i<size; ++i){ load(in, m); - materials.push_back(m); + frs_materials.push_back(m); } - vs->sshape()->setMaterials(materials); + vs->sshape()->setFrsMaterials(frs_materials); @@ -252,7 +252,7 @@ namespace ViewMapIO { // Material READ(matindex); - fesmooth->setMaterialIndex(matindex); + fesmooth->setFrsMaterialIndex(matindex); }else{ // aNormal load(in, v); @@ -264,9 +264,9 @@ namespace ViewMapIO { // Materials READ(matindex); - fesharp->setaMaterialIndex(matindex); + fesharp->setaFrsMaterialIndex(matindex); READ(matindex); - fesharp->setbMaterialIndex(matindex); + fesharp->setbFrsMaterialIndex(matindex); } unsigned tmp; @@ -569,7 +569,7 @@ namespace ViewMapIO { inline - int save(ostream& out, const Material& m) { + int save(ostream& out, const FrsMaterial& m) { unsigned i; @@ -622,10 +622,10 @@ namespace ViewMapIO { // Not necessary (only used during view map computatiom) // -> Material - unsigned size = vs->sshape()->materials().size(); + unsigned size = vs->sshape()->frs_materials().size(); WRITE(size); for(unsigned i=0; i<size; ++i) - save(out, vs->sshape()->material(i)); + save(out, vs->sshape()->frs_material(i)); // -> VerticesList (List) tmp = vs->sshape()->getVertexList().size(); @@ -704,7 +704,7 @@ namespace ViewMapIO { // normal save(out, fesmooth->normal()); // material - index = fesmooth->materialIndex(); + index = fesmooth->frs_materialIndex(); WRITE(index); }else{ // aNormal @@ -712,10 +712,10 @@ namespace ViewMapIO { // bNormal save(out, fesharp->normalB()); // aMaterial - index = fesharp->aMaterialIndex(); + index = fesharp->aFrsMaterialIndex(); WRITE(index); // bMaterial - index = fesharp->bMaterialIndex(); + index = fesharp->bFrsMaterialIndex(); WRITE(index); } diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h index 2d054d8a067..630bfa561f2 100755 --- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h +++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h @@ -49,7 +49,7 @@ class LIB_VIEW_MAP_EXPORT ViewMapTesselator { public: - inline ViewMapTesselator() {_nature = Nature::SILHOUETTE | Nature::BORDER | Nature::CREASE;_Material.setDiffuse(0,0,0,1);_overloadMaterial=false;} + inline ViewMapTesselator() {_nature = Nature::SILHOUETTE | Nature::BORDER | Nature::CREASE;_FrsMaterial.setDiffuse(0,0,0,1);_overloadFrsMaterial=false;} virtual ~ViewMapTesselator() {} /*! Builds a set of lines rep contained under a @@ -71,17 +71,17 @@ public: inline void setNature(Nature::EdgeNature iNature) {_nature = iNature;} - inline void setMaterial(const Material& iMaterial) {_Material=iMaterial;_overloadMaterial=true;} + inline void setFrsMaterial(const FrsMaterial& iMaterial) {_FrsMaterial=iMaterial;_overloadFrsMaterial=true;} inline Nature::EdgeNature nature() {return _nature;} - inline const Material& material() const {return _Material;} + inline const FrsMaterial& frs_material() const {return _FrsMaterial;} protected: virtual void AddVertexToLine(LineRep *iLine, SVertex *v) = 0; private: Nature::EdgeNature _nature; - Material _Material; - bool _overloadMaterial; + FrsMaterial _FrsMaterial; + bool _overloadFrsMaterial; }; /*! Class to tesselate the 2D projected silhouette */ @@ -123,8 +123,8 @@ NodeGroup * ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesItera NodeGroup *group = new NodeGroup; NodeShape *tshape = new NodeShape; group->AddChild(tshape); - //tshape->material().setDiffuse(0.f, 0.f, 0.f, 1.f); - tshape->setMaterial(_Material); + //tshape->frs_material().setDiffuse(0.f, 0.f, 0.f, 1.f); + tshape->setFrsMaterial(_FrsMaterial); LineRep* line; @@ -152,8 +152,8 @@ NodeGroup * ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesItera // continue; line = new OrientedLineRep(); - if(_overloadMaterial) - line->setMaterial(_Material); + if(_overloadFrsMaterial) + line->setFrsMaterial(_FrsMaterial); // there might be chains containing a single element if(0 == (firstEdge)->nextEdge()) |