diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-02 05:55:30 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-02 05:55:30 +0400 |
commit | 699da2fb0d9012cef5e45cc1b547a01fd92dbc1c (patch) | |
tree | eb6e3de1f90387af1a2628bbc79d51327e3ac248 /source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h | |
parent | 520ab93465d8056bf6d4a4115743daaee4c2fd66 (diff) |
Yet another big style clean-up patch by Bastien Montagne, thanks a lot!
Now the code style is acceptable for the merge now, according to Bastien.
Thanks again Bastien for having this done! :)
Diffstat (limited to 'source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h')
-rw-r--r-- | source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h | 318 |
1 files changed, 152 insertions, 166 deletions
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h index 972d67355d2..cf32c1191b2 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h @@ -1,171 +1,157 @@ -// -// Filename : WingedEdgeBuilder.h -// Author(s) : Stephane Grabli -// Purpose : Class to render a WingedEdge data structure -// from a polyhedral data structure organized in -// nodes of a scene graph -// Date of creation : 28/05/03 -// -/////////////////////////////////////////////////////////////////////////////// - - -// -// Copyright (C) : Please refer to the COPYRIGHT file distributed -// with this source distribution. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef WINGED_EDGE_BUILDER_H -# define WINGED_EDGE_BUILDER_H - -# include "../system/FreestyleConfig.h" -# include "../system/RenderMonitor.h" -# include "../scene_graph/SceneVisitor.h" -# include "WEdge.h" -# include "../scene_graph/IndexedFaceSet.h" -# include "../scene_graph/NodeTransform.h" +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2010 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __FREESTYLE_WINGED_EDGE_BUILDER_H__ +#define __FREESTYLE_WINGED_EDGE_BUILDER_H__ + +/** \file blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h + * \ingroup freestyle + * \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in nodes + * of a scene graph + * \author Stephane Grabli + * \date 28/05/2003 + */ + +#include "WEdge.h" + +#include "../scene_graph/IndexedFaceSet.h" +#include "../scene_graph/NodeTransform.h" +#include "../scene_graph/SceneVisitor.h" + +#include "../system/FreestyleConfig.h" +#include "../system/RenderMonitor.h" class LIB_WINGED_EDGE_EXPORT WingedEdgeBuilder : public SceneVisitor { - public: - - inline WingedEdgeBuilder() : SceneVisitor() { - _current_wshape = NULL; - _current_frs_material = NULL; - _current_matrix = NULL; - _winged_edge = new WingedEdge; // Not deleted by the destructor - _pRenderMonitor = NULL; - } - - virtual ~WingedEdgeBuilder() { - for (vector<Matrix44r*>::iterator it = _matrices_stack.begin(); - it != _matrices_stack.end(); - it++) - delete *it; - _matrices_stack.clear(); - } - - VISIT_DECL(IndexedFaceSet) - VISIT_DECL(NodeShape) - VISIT_DECL(NodeTransform) - - virtual void visitNodeTransformAfter(NodeTransform&); - - // - // Accessors - // - ///////////////////////////////////////////////////////////////////////////// - - inline WingedEdge* getWingedEdge() { - return _winged_edge; - } - - inline WShape* getCurrentWShape() { - return _current_wshape; - } - - inline FrsMaterial* getCurrentFrsMaterial() { - return _current_frs_material; - } - - inline Matrix44r* getCurrentMatrix() { - return _current_matrix; - } - - // - // Modifiers - // - ///////////////////////////////////////////////////////////////////////////// - - inline void setCurrentWShape(WShape* wshape) { - _current_wshape = wshape; - } - - inline void setCurrentFrsMaterial(FrsMaterial* mat) { - _current_frs_material = mat; - } - - // inline void setCurrentMatrix(Matrix44r* matrix) { - // _current_matrix = matrix; - // } - - inline void setRenderMonitor(RenderMonitor *iRenderMonitor) { - _pRenderMonitor = iRenderMonitor; - } - - protected: - - virtual void buildWShape(WShape& shape, IndexedFaceSet& ifs); - virtual void buildWVertices(WShape& shape, - const real *vertices, - unsigned vsize); - - RenderMonitor *_pRenderMonitor; - - private: - - void buildTriangleStrip(const real *vertices, - const real *normals, - vector<FrsMaterial>& iMaterials, - const real *texCoords, - const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, - const unsigned *vindices, - const unsigned *nindices, - const unsigned *mindices, - const unsigned *tindices, - const unsigned nvertices); - - void buildTriangleFan(const real *vertices, - const real *normals, - vector<FrsMaterial>& iMaterials, - const real *texCoords, - const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, - const unsigned *vindices, - const unsigned *nindices, - const unsigned *mindices, - const unsigned *tindices, - const unsigned nvertices); - - void buildTriangles(const real *vertices, - const real *normals, - vector<FrsMaterial>& iMaterials, - const real *texCoords, - const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, - const unsigned *vindices, - const unsigned *nindices, - const unsigned *mindices, - const unsigned *tindices, - const unsigned nvertices); - - void transformVertices(const real *vertices, - unsigned vsize, - const Matrix44r& transform, - real *res); - - void transformNormals(const real *normals, - unsigned nsize, - const Matrix44r& transform, - real *res); - - WShape* _current_wshape; - FrsMaterial* _current_frs_material; - WingedEdge* _winged_edge; - Matrix44r* _current_matrix; - vector<Matrix44r*> _matrices_stack; +public: + inline WingedEdgeBuilder() : SceneVisitor() + { + _current_wshape = NULL; + _current_frs_material = NULL; + _current_matrix = NULL; + _winged_edge = new WingedEdge; // Not deleted by the destructor + _pRenderMonitor = NULL; + } + + virtual ~WingedEdgeBuilder() + { + for (vector<Matrix44r*>::iterator it = _matrices_stack.begin(); it != _matrices_stack.end(); ++it) + delete *it; + _matrices_stack.clear(); + } + + VISIT_DECL(IndexedFaceSet) + VISIT_DECL(NodeShape) + VISIT_DECL(NodeTransform) + + virtual void visitNodeTransformAfter(NodeTransform&); + + // + // Accessors + // + ///////////////////////////////////////////////////////////////////////////// + + inline WingedEdge *getWingedEdge() + { + return _winged_edge; + } + + inline WShape *getCurrentWShape() + { + return _current_wshape; + } + + inline FrsMaterial *getCurrentFrsMaterial() + { + return _current_frs_material; + } + + inline Matrix44r *getCurrentMatrix() + { + return _current_matrix; + } + + // + // Modifiers + // + ///////////////////////////////////////////////////////////////////////////// + + inline void setCurrentWShape(WShape *wshape) + { + _current_wshape = wshape; + } + + inline void setCurrentFrsMaterial(FrsMaterial *mat) + { + _current_frs_material = mat; + } + +#if 0 + inline void setCurrentMatrix(Matrix44r *matrix) + { + _current_matrix = matrix; + } +#endif + + inline void setRenderMonitor(RenderMonitor *iRenderMonitor) { + _pRenderMonitor = iRenderMonitor; + } + +protected: + virtual void buildWShape(WShape& shape, IndexedFaceSet& ifs); + virtual void buildWVertices(WShape& shape, const real *vertices, unsigned vsize); + + RenderMonitor *_pRenderMonitor; + +private: + void buildTriangleStrip(const real *vertices, const real *normals, vector<FrsMaterial>& iMaterials, + const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, + const unsigned *vindices, const unsigned *nindices, const unsigned *mindices, + const unsigned *tindices, const unsigned nvertices); + + void buildTriangleFan(const real *vertices, const real *normals, vector<FrsMaterial>& iMaterials, + const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, + const unsigned *vindices, const unsigned *nindices, const unsigned *mindices, + const unsigned *tindices, const unsigned nvertices); + + void buildTriangles(const real *vertices, const real *normals, vector<FrsMaterial>& iMaterials, + const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, + const unsigned *vindices, const unsigned *nindices, const unsigned *mindices, + const unsigned *tindices, const unsigned nvertices); + + void transformVertices(const real *vertices, unsigned vsize, const Matrix44r& transform, real *res); + + void transformNormals(const real *normals, unsigned nsize, const Matrix44r& transform, real *res); + + WShape *_current_wshape; + FrsMaterial *_current_frs_material; + WingedEdge *_winged_edge; + Matrix44r *_current_matrix; + vector<Matrix44r *> _matrices_stack; }; -#endif // WINGED_EDGE_BUILDER_H +#endif // __FREESTYLE_WINGED_EDGE_BUILDER_H__
\ No newline at end of file |