Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/freestyle/intern/scene_graph
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/freestyle/intern/scene_graph')
-rw-r--r--source/blender/freestyle/intern/scene_graph/DrawingStyle.h169
-rw-r--r--source/blender/freestyle/intern/scene_graph/FrsMaterial.h759
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp545
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h537
-rw-r--r--source/blender/freestyle/intern/scene_graph/LineRep.cpp64
-rw-r--r--source/blender/freestyle/intern/scene_graph/LineRep.h221
-rw-r--r--source/blender/freestyle/intern/scene_graph/Node.h133
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeCamera.cpp140
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeCamera.h316
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp15
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h140
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeGroup.cpp121
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeGroup.h65
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeLight.cpp66
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeLight.h133
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeShape.cpp34
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeShape.h101
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeTransform.cpp216
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeTransform.h125
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp4
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeViewLayer.h43
-rw-r--r--source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/OrientedLineRep.h55
-rw-r--r--source/blender/freestyle/intern/scene_graph/Rep.h271
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneHash.cpp62
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneHash.h60
-rw-r--r--source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp63
-rw-r--r--source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h120
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneVisitor.h100
-rw-r--r--source/blender/freestyle/intern/scene_graph/TriangleRep.cpp60
-rw-r--r--source/blender/freestyle/intern/scene_graph/TriangleRep.h217
-rw-r--r--source/blender/freestyle/intern/scene_graph/VertexRep.cpp4
-rw-r--r--source/blender/freestyle/intern/scene_graph/VertexRep.h201
33 files changed, 2635 insertions, 2537 deletions
diff --git a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h
index 5ad16845327..631f4b99adc 100644
--- a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h
+++ b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h
@@ -23,105 +23,106 @@
*/
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class DrawingStyle
-{
-public:
- enum STYLE {
- FILLED,
- LINES,
- POINTS,
- INVISIBLE,
- };
-
- inline DrawingStyle()
- {
- Style = FILLED;
- LineWidth = 2.0f;
- PointSize = 2.0f;
- LightingEnabled = true;
- }
-
- inline explicit DrawingStyle(const DrawingStyle& iBrother);
-
- virtual ~DrawingStyle() {}
-
- /*! operators */
- inline DrawingStyle& operator=(const DrawingStyle& ds);
-
- inline void setStyle(const STYLE iStyle)
- {
- Style = iStyle;
- }
-
- inline void setLineWidth(const float iLineWidth)
- {
- LineWidth = iLineWidth;
- }
-
- inline void setPointSize(const float iPointSize)
- {
- PointSize = iPointSize;
- }
-
- inline void setLightingEnabled(const bool on)
- {
- LightingEnabled = on;
- }
-
- inline STYLE style() const
- {
- return Style;
- }
-
- inline float lineWidth() const
- {
- return LineWidth;
- }
-
- inline float pointSize() const
- {
- return PointSize;
- }
-
- inline bool lightingEnabled() const
- {
- return LightingEnabled;
- }
-
-private:
- STYLE Style;
- float LineWidth;
- float PointSize;
- bool LightingEnabled;
+class DrawingStyle {
+ public:
+ enum STYLE {
+ FILLED,
+ LINES,
+ POINTS,
+ INVISIBLE,
+ };
+
+ inline DrawingStyle()
+ {
+ Style = FILLED;
+ LineWidth = 2.0f;
+ PointSize = 2.0f;
+ LightingEnabled = true;
+ }
+
+ inline explicit DrawingStyle(const DrawingStyle &iBrother);
+
+ virtual ~DrawingStyle()
+ {
+ }
+
+ /*! operators */
+ inline DrawingStyle &operator=(const DrawingStyle &ds);
+
+ inline void setStyle(const STYLE iStyle)
+ {
+ Style = iStyle;
+ }
+
+ inline void setLineWidth(const float iLineWidth)
+ {
+ LineWidth = iLineWidth;
+ }
+
+ inline void setPointSize(const float iPointSize)
+ {
+ PointSize = iPointSize;
+ }
+
+ inline void setLightingEnabled(const bool on)
+ {
+ LightingEnabled = on;
+ }
+
+ inline STYLE style() const
+ {
+ return Style;
+ }
+
+ inline float lineWidth() const
+ {
+ return LineWidth;
+ }
+
+ inline float pointSize() const
+ {
+ return PointSize;
+ }
+
+ inline bool lightingEnabled() const
+ {
+ return LightingEnabled;
+ }
+
+ private:
+ STYLE Style;
+ float LineWidth;
+ float PointSize;
+ bool LightingEnabled;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:DrawingStyle")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:DrawingStyle")
#endif
};
-DrawingStyle::DrawingStyle(const DrawingStyle& iBrother)
+DrawingStyle::DrawingStyle(const DrawingStyle &iBrother)
{
- Style = iBrother.Style;
- LineWidth = iBrother.LineWidth;
- PointSize = iBrother.PointSize;
- LightingEnabled = iBrother.LightingEnabled;
+ Style = iBrother.Style;
+ LineWidth = iBrother.LineWidth;
+ PointSize = iBrother.PointSize;
+ LightingEnabled = iBrother.LightingEnabled;
}
-DrawingStyle& DrawingStyle::operator=(const DrawingStyle& ds)
+DrawingStyle &DrawingStyle::operator=(const DrawingStyle &ds)
{
- Style = ds.Style;
- LineWidth = ds.LineWidth;
- PointSize = ds.PointSize;
- LightingEnabled = ds.LightingEnabled;
+ Style = ds.Style;
+ LineWidth = ds.LineWidth;
+ PointSize = ds.PointSize;
+ LightingEnabled = ds.LightingEnabled;
- return *this;
+ return *this;
}
} /* namespace Freestyle */
-#endif // __FREESTYLE_DRAWING_STYLE_H__
+#endif // __FREESTYLE_DRAWING_STYLE_H__
diff --git a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
index 2a830a40da8..4176a558009 100644
--- a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
+++ b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
@@ -25,441 +25,452 @@
#include "../system/FreestyleConfig.h"
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
/*! Class defining a material */
-class FrsMaterial
-{
-public:
- /*! Default constructor */
- inline FrsMaterial();
-
- /*! Builds a Material from its line, diffuse, ambiant, specular, emissive
- * colors, a shininess coefficient and line color priority.
- * \param iLine:
- * A 4 element float-array containing the line color.
- * \param iDiffuse:
- * A 4 element float-array containing the diffuse color.
- * \param iAmbiant:
- * A 4 element float-array containing the ambiant color.
- * \param iSpecular:
- * A 4 element float-array containing the specular color.
- * \param iEmission:
- * A 4 element float-array containing the emissive color.
- * \param iShininess:
- * The shininess coefficient.
- * \param iPriority:
- * The line color priority.
- */
- inline FrsMaterial(const float *iLine, const float *iDiffuse, const float *iAmbiant, const float *iSpecular,
- const float *iEmission, const float iShininess, const int iPriority);
-
- /*! Copy constructor */
- inline FrsMaterial(const FrsMaterial& m);
-
- /*! Destructor */
- virtual ~FrsMaterial() {}
-
- /*! Returns the line color as a 4 float array */
- inline const float *line() const
- {
- return Line;
- }
-
- /*! Returns the red component of the line color */
- inline const float lineR() const
- {
- return Line[0];
- }
-
- /*! Returns the green component of the line color */
- inline const float lineG() const
- {
- return Line[1];
- }
-
- /*! Returns the blue component of the line color */
- inline const float lineB() const
- {
- return Line[2];
- }
-
- /*! Returns the alpha component of the line color */
- inline const float lineA() const
- {
- return Line[3];
- }
-
- /*! Returns the diffuse color as a 4 float array */
- inline const float *diffuse() const
- {
- return Diffuse;
- }
-
- /*! Returns the red component of the diffuse color */
- inline const float diffuseR() const
- {
- return Diffuse[0];
- }
-
- /*! Returns the green component of the diffuse color */
- inline const float diffuseG() const
- {
- return Diffuse[1];
- }
-
- /*! Returns the blue component of the diffuse color */
- inline const float diffuseB() const
- {
- return Diffuse[2];
- }
-
- /*! Returns the alpha component of the diffuse color */
- inline const float diffuseA() const
- {
- return Diffuse[3];
- }
-
- /*! Returns the specular color as a 4 float array */
- inline const float *specular() const
- {
- return Specular;
- }
-
- /*! Returns the red component of the specular color */
- inline const float specularR() const
- {
- return Specular[0];
- }
-
- /*! Returns the green component of the specular color */
- inline const float specularG() const
- {
- return Specular[1];
- }
-
- /*! Returns the blue component of the specular color */
- inline const float specularB() const
- {
- return Specular[2];
- }
-
- /*! Returns the alpha component of the specular color */
- inline const float specularA() const
- {
- return Specular[3];
- }
-
- /*! Returns the ambiant color as a 4 float array */
- inline const float *ambient() const
- {
- return Ambient;
- }
-
- /*! Returns the red component of the ambiant color */
- inline const float ambientR() const
- {
- return Ambient[0];
- }
-
- /*! Returns the green component of the ambiant color */
- inline const float ambientG() const
- {
- return Ambient[1];
- }
-
- /*! Returns the blue component of the ambiant color */
- inline const float ambientB() const
- {
- return Ambient[2];
- }
-
- /*! Returns the alpha component of the ambiant color */
- inline const float ambientA() const
- {
- return Ambient[3];
- }
-
- /*! Returns the emissive color as a 4 float array */
- inline const float *emission() const
- {
- return Emission;
- }
-
- /*! Returns the red component of the emissive color */
- inline const float emissionR() const
- {
- return Emission[0];
- }
-
- /*! Returns the green component of the emissive color */
- inline const float emissionG() const
- {
- return Emission[1];
- }
-
- /*! Returns the blue component of the emissive color */
- inline const float emissionB() const
- {
- return Emission[2];
- }
-
- /*! Returns the alpha component of the emissive color */
- inline const float emissionA() const
- {
- return Emission[3];
- }
-
- /*! Returns the shininess coefficient */
- inline const float shininess() const
- {
- return Shininess;
- }
-
- /*! Returns the line color priority */
- inline const int priority() const
- {
- return Priority;
- }
-
- /*! Sets the line color.
- * \param r:
- * Red component
- * \param g:
- * Green component
- * \param b:
- * Blue component
- * \param a:
- * Alpha component
- */
- inline void setLine(const float r, const float g, const float b, const float a);
-
- /*! Sets the diffuse color.
- * \param r:
- * Red component
- * \param g:
- * Green component
- * \param b:
- * Blue component
- * \param a:
- * Alpha component
- */
- inline void setDiffuse(const float r, const float g, const float b, const float a);
-
- /*! Sets the specular color.
- * \param r:
- * Red component
- * \param g:
- * Green component
- * \param b:
- * Blue component
- * \param a:
- * Alpha component
- */
- inline void setSpecular(const float r, const float g, const float b, const float a);
-
- /*! Sets the ambiant color.
- * \param r:
- * Red component
- * \param g:
- * Green component
- * \param b:
- * Blue component
- * \param a:
- * Alpha component
- */
- inline void setAmbient(const float r, const float g, const float b, const float a);
-
- /*! Sets the emissive color.
- * \param r:
- * Red component
- * \param g:
- * Green component
- * \param b:
- * Blue component
- * \param a:
- * Alpha component
- */
- inline void setEmission(const float r, const float g, const float b, const float a);
-
- /*! Sets the shininess.
- * \param s:
- * Shininess
- */
- inline void setShininess(const float s);
-
- /*! Sets the line color priority.
- * \param priority:
- * Priority
- */
- inline void setPriority(const int priority);
-
- /* operators */
- inline FrsMaterial& operator=(const FrsMaterial& m);
- inline bool operator!=(const FrsMaterial& m) const;
- inline bool operator==(const FrsMaterial& m) const;
-
-private:
- /*! Material properties */
- float Line[4];
- float Diffuse[4];
- float Specular[4];
- float Ambient[4];
- float Emission[4];
- float Shininess;
- int Priority;
+class FrsMaterial {
+ public:
+ /*! Default constructor */
+ inline FrsMaterial();
+
+ /*! Builds a Material from its line, diffuse, ambiant, specular, emissive
+ * colors, a shininess coefficient and line color priority.
+ * \param iLine:
+ * A 4 element float-array containing the line color.
+ * \param iDiffuse:
+ * A 4 element float-array containing the diffuse color.
+ * \param iAmbiant:
+ * A 4 element float-array containing the ambiant color.
+ * \param iSpecular:
+ * A 4 element float-array containing the specular color.
+ * \param iEmission:
+ * A 4 element float-array containing the emissive color.
+ * \param iShininess:
+ * The shininess coefficient.
+ * \param iPriority:
+ * The line color priority.
+ */
+ inline FrsMaterial(const float *iLine,
+ const float *iDiffuse,
+ const float *iAmbiant,
+ const float *iSpecular,
+ const float *iEmission,
+ const float iShininess,
+ const int iPriority);
+
+ /*! Copy constructor */
+ inline FrsMaterial(const FrsMaterial &m);
+
+ /*! Destructor */
+ virtual ~FrsMaterial()
+ {
+ }
+
+ /*! Returns the line color as a 4 float array */
+ inline const float *line() const
+ {
+ return Line;
+ }
+
+ /*! Returns the red component of the line color */
+ inline const float lineR() const
+ {
+ return Line[0];
+ }
+
+ /*! Returns the green component of the line color */
+ inline const float lineG() const
+ {
+ return Line[1];
+ }
+
+ /*! Returns the blue component of the line color */
+ inline const float lineB() const
+ {
+ return Line[2];
+ }
+
+ /*! Returns the alpha component of the line color */
+ inline const float lineA() const
+ {
+ return Line[3];
+ }
+
+ /*! Returns the diffuse color as a 4 float array */
+ inline const float *diffuse() const
+ {
+ return Diffuse;
+ }
+
+ /*! Returns the red component of the diffuse color */
+ inline const float diffuseR() const
+ {
+ return Diffuse[0];
+ }
+
+ /*! Returns the green component of the diffuse color */
+ inline const float diffuseG() const
+ {
+ return Diffuse[1];
+ }
+
+ /*! Returns the blue component of the diffuse color */
+ inline const float diffuseB() const
+ {
+ return Diffuse[2];
+ }
+
+ /*! Returns the alpha component of the diffuse color */
+ inline const float diffuseA() const
+ {
+ return Diffuse[3];
+ }
+
+ /*! Returns the specular color as a 4 float array */
+ inline const float *specular() const
+ {
+ return Specular;
+ }
+
+ /*! Returns the red component of the specular color */
+ inline const float specularR() const
+ {
+ return Specular[0];
+ }
+
+ /*! Returns the green component of the specular color */
+ inline const float specularG() const
+ {
+ return Specular[1];
+ }
+
+ /*! Returns the blue component of the specular color */
+ inline const float specularB() const
+ {
+ return Specular[2];
+ }
+
+ /*! Returns the alpha component of the specular color */
+ inline const float specularA() const
+ {
+ return Specular[3];
+ }
+
+ /*! Returns the ambiant color as a 4 float array */
+ inline const float *ambient() const
+ {
+ return Ambient;
+ }
+
+ /*! Returns the red component of the ambiant color */
+ inline const float ambientR() const
+ {
+ return Ambient[0];
+ }
+
+ /*! Returns the green component of the ambiant color */
+ inline const float ambientG() const
+ {
+ return Ambient[1];
+ }
+
+ /*! Returns the blue component of the ambiant color */
+ inline const float ambientB() const
+ {
+ return Ambient[2];
+ }
+
+ /*! Returns the alpha component of the ambiant color */
+ inline const float ambientA() const
+ {
+ return Ambient[3];
+ }
+
+ /*! Returns the emissive color as a 4 float array */
+ inline const float *emission() const
+ {
+ return Emission;
+ }
+
+ /*! Returns the red component of the emissive color */
+ inline const float emissionR() const
+ {
+ return Emission[0];
+ }
+
+ /*! Returns the green component of the emissive color */
+ inline const float emissionG() const
+ {
+ return Emission[1];
+ }
+
+ /*! Returns the blue component of the emissive color */
+ inline const float emissionB() const
+ {
+ return Emission[2];
+ }
+
+ /*! Returns the alpha component of the emissive color */
+ inline const float emissionA() const
+ {
+ return Emission[3];
+ }
+
+ /*! Returns the shininess coefficient */
+ inline const float shininess() const
+ {
+ return Shininess;
+ }
+
+ /*! Returns the line color priority */
+ inline const int priority() const
+ {
+ return Priority;
+ }
+
+ /*! Sets the line color.
+ * \param r:
+ * Red component
+ * \param g:
+ * Green component
+ * \param b:
+ * Blue component
+ * \param a:
+ * Alpha component
+ */
+ inline void setLine(const float r, const float g, const float b, const float a);
+
+ /*! Sets the diffuse color.
+ * \param r:
+ * Red component
+ * \param g:
+ * Green component
+ * \param b:
+ * Blue component
+ * \param a:
+ * Alpha component
+ */
+ inline void setDiffuse(const float r, const float g, const float b, const float a);
+
+ /*! Sets the specular color.
+ * \param r:
+ * Red component
+ * \param g:
+ * Green component
+ * \param b:
+ * Blue component
+ * \param a:
+ * Alpha component
+ */
+ inline void setSpecular(const float r, const float g, const float b, const float a);
+
+ /*! Sets the ambiant color.
+ * \param r:
+ * Red component
+ * \param g:
+ * Green component
+ * \param b:
+ * Blue component
+ * \param a:
+ * Alpha component
+ */
+ inline void setAmbient(const float r, const float g, const float b, const float a);
+
+ /*! Sets the emissive color.
+ * \param r:
+ * Red component
+ * \param g:
+ * Green component
+ * \param b:
+ * Blue component
+ * \param a:
+ * Alpha component
+ */
+ inline void setEmission(const float r, const float g, const float b, const float a);
+
+ /*! Sets the shininess.
+ * \param s:
+ * Shininess
+ */
+ inline void setShininess(const float s);
+
+ /*! Sets the line color priority.
+ * \param priority:
+ * Priority
+ */
+ inline void setPriority(const int priority);
+
+ /* operators */
+ inline FrsMaterial &operator=(const FrsMaterial &m);
+ inline bool operator!=(const FrsMaterial &m) const;
+ inline bool operator==(const FrsMaterial &m) const;
+
+ private:
+ /*! Material properties */
+ float Line[4];
+ float Diffuse[4];
+ float Specular[4];
+ float Ambient[4];
+ float Emission[4];
+ float Shininess;
+ int Priority;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FrsMaterial")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FrsMaterial")
#endif
};
FrsMaterial::FrsMaterial()
{
- Line[0] = Line[1] = Line[2] = 0.0f;
- Line[3] = 1.0f;
+ Line[0] = Line[1] = Line[2] = 0.0f;
+ Line[3] = 1.0f;
- Ambient[0] = Ambient[1] = Ambient[2] = 0.2f;
- Ambient[3] = 1.0f;
+ Ambient[0] = Ambient[1] = Ambient[2] = 0.2f;
+ Ambient[3] = 1.0f;
- Diffuse[0] = Diffuse[1] = Diffuse[2] = 0.8f;
- Diffuse[3] = 1.0f;
+ Diffuse[0] = Diffuse[1] = Diffuse[2] = 0.8f;
+ Diffuse[3] = 1.0f;
- Emission[0] = Emission[1] = Emission[2] = 0.0f;
- Emission[3] = 1.0f;
+ Emission[0] = Emission[1] = Emission[2] = 0.0f;
+ Emission[3] = 1.0f;
- Specular[0] = Specular[1] = Specular[2] = 0.0f;
- Specular[3] = 1.0f;
+ Specular[0] = Specular[1] = Specular[2] = 0.0f;
+ Specular[3] = 1.0f;
- Shininess = 0.0f;
- Priority = 0;
+ Shininess = 0.0f;
+ Priority = 0;
}
-FrsMaterial::FrsMaterial(const float *iLine, const float *iDiffuse, const float *iAmbiant, const float *iSpecular,
- const float *iEmission, const float iShininess, const int iPriority)
+FrsMaterial::FrsMaterial(const float *iLine,
+ const float *iDiffuse,
+ const float *iAmbiant,
+ const float *iSpecular,
+ const float *iEmission,
+ const float iShininess,
+ const int iPriority)
{
- for (int i = 0; i < 4; i++) {
- Line[i] = iLine[i];
- Diffuse[i] = iDiffuse[i];
- Specular[i] = iSpecular[i];
- Ambient[i] = iAmbiant[i];
- Emission[i] = iEmission[i];
- }
-
- Shininess = iShininess;
- Priority = iPriority;
+ for (int i = 0; i < 4; i++) {
+ Line[i] = iLine[i];
+ Diffuse[i] = iDiffuse[i];
+ Specular[i] = iSpecular[i];
+ Ambient[i] = iAmbiant[i];
+ Emission[i] = iEmission[i];
+ }
+
+ Shininess = iShininess;
+ Priority = iPriority;
}
-FrsMaterial::FrsMaterial(const FrsMaterial& m)
+FrsMaterial::FrsMaterial(const FrsMaterial &m)
{
- for (int i = 0; i < 4; i++) {
- Line[i] = m.line()[i];
- Diffuse[i] = m.diffuse()[i];
- Specular[i] = m.specular()[i];
- Ambient[i] = m.ambient()[i];
- Emission[i] = m.emission()[i];
- }
-
- Shininess = m.shininess();
- Priority = m.priority();
+ for (int i = 0; i < 4; i++) {
+ Line[i] = m.line()[i];
+ Diffuse[i] = m.diffuse()[i];
+ Specular[i] = m.specular()[i];
+ Ambient[i] = m.ambient()[i];
+ Emission[i] = m.emission()[i];
+ }
+
+ Shininess = m.shininess();
+ Priority = m.priority();
}
void FrsMaterial::setLine(const float r, const float g, const float b, const float a)
{
- Line[0] = r;
- Line[1] = g;
- Line[2] = b;
- Line[3] = a;
+ Line[0] = r;
+ Line[1] = g;
+ Line[2] = b;
+ Line[3] = a;
}
void FrsMaterial::setDiffuse(const float r, const float g, const float b, const float a)
{
- Diffuse[0] = r;
- Diffuse[1] = g;
- Diffuse[2] = b;
- Diffuse[3] = a;
+ Diffuse[0] = r;
+ Diffuse[1] = g;
+ Diffuse[2] = b;
+ Diffuse[3] = a;
}
void FrsMaterial::setSpecular(const float r, const float g, const float b, const float a)
{
- Specular[0] = r;
- Specular[1] = g;
- Specular[2] = b;
- Specular[3] = a;
+ Specular[0] = r;
+ Specular[1] = g;
+ Specular[2] = b;
+ Specular[3] = a;
}
void FrsMaterial::setAmbient(const float r, const float g, const float b, const float a)
{
- Ambient[0] = r;
- Ambient[1] = g;
- Ambient[2] = b;
- Ambient[3] = a;
+ Ambient[0] = r;
+ Ambient[1] = g;
+ Ambient[2] = b;
+ Ambient[3] = a;
}
void FrsMaterial::setEmission(const float r, const float g, const float b, const float a)
{
- Emission[0] = r;
- Emission[1] = g;
- Emission[2] = b;
- Emission[3] = a;
+ Emission[0] = r;
+ Emission[1] = g;
+ Emission[2] = b;
+ Emission[3] = a;
}
void FrsMaterial::setShininess(const float s)
{
- Shininess = s;
+ Shininess = s;
}
void FrsMaterial::setPriority(const int priority)
{
- Priority = priority;
+ Priority = priority;
}
-FrsMaterial& FrsMaterial::operator=(const FrsMaterial& m)
+FrsMaterial &FrsMaterial::operator=(const FrsMaterial &m)
{
- for (int i = 0; i < 4; i++) {
- Line[i] = m.line()[i];
- Diffuse[i] = m.diffuse()[i];
- Specular[i] = m.specular()[i];
- Ambient[i] = m.ambient()[i];
- Emission[i] = m.emission()[i];
- }
-
- Shininess = m.shininess();
- Priority = m.priority();
- return *this;
+ for (int i = 0; i < 4; i++) {
+ Line[i] = m.line()[i];
+ Diffuse[i] = m.diffuse()[i];
+ Specular[i] = m.specular()[i];
+ Ambient[i] = m.ambient()[i];
+ Emission[i] = m.emission()[i];
+ }
+
+ Shininess = m.shininess();
+ Priority = m.priority();
+ return *this;
}
-bool FrsMaterial::operator!=(const FrsMaterial& m) const
+bool FrsMaterial::operator!=(const FrsMaterial &m) const
{
- if (Shininess != m.shininess())
- return true;
- if (Priority != m.priority())
- return true;
-
- for (int i = 0; i < 4; i++) {
- if (Line[i] != m.line()[i])
- return true;
- if (Diffuse[i] != m.diffuse()[i])
- return true;
- if (Specular[i] != m.specular()[i])
- return true;
- if (Ambient[i] != m.ambient()[i])
- return true;
- if (Emission[i] != m.emission()[i])
- return true;
- }
-
- return false;
+ if (Shininess != m.shininess())
+ return true;
+ if (Priority != m.priority())
+ return true;
+
+ for (int i = 0; i < 4; i++) {
+ if (Line[i] != m.line()[i])
+ return true;
+ if (Diffuse[i] != m.diffuse()[i])
+ return true;
+ if (Specular[i] != m.specular()[i])
+ return true;
+ if (Ambient[i] != m.ambient()[i])
+ return true;
+ if (Emission[i] != m.emission()[i])
+ return true;
+ }
+
+ return false;
}
-bool FrsMaterial::operator==(const FrsMaterial& m) const
+bool FrsMaterial::operator==(const FrsMaterial &m) const
{
- return (!((*this) != m));
+ return (!((*this) != m));
}
} /* namespace Freestyle */
-#endif // __FREESTYLE_MATERIAL_H__
+#endif // __FREESTYLE_MATERIAL_H__
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
index d39f6fac75d..7a6b276bc44 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
@@ -25,288 +25,303 @@ namespace Freestyle {
IndexedFaceSet::IndexedFaceSet() : Rep()
{
- _Vertices = NULL;
- _Normals = NULL;
- _FrsMaterials = 0;
- _TexCoords = NULL;
- _FaceEdgeMarks = 0;
- _VSize = 0;
- _NSize = 0;
- _MSize = 0;
- _TSize = 0;
- _NumFaces = 0;
- _NumVertexPerFace = NULL;
- _FaceStyle = NULL;
- _VIndices = NULL;
- _VISize = 0;
- _NIndices = NULL;
- _NISize = 0;
- _MIndices = NULL;
- _MISize = 0;
- _TIndices = NULL;
- _TISize = 0;
+ _Vertices = NULL;
+ _Normals = NULL;
+ _FrsMaterials = 0;
+ _TexCoords = NULL;
+ _FaceEdgeMarks = 0;
+ _VSize = 0;
+ _NSize = 0;
+ _MSize = 0;
+ _TSize = 0;
+ _NumFaces = 0;
+ _NumVertexPerFace = NULL;
+ _FaceStyle = NULL;
+ _VIndices = NULL;
+ _VISize = 0;
+ _NIndices = NULL;
+ _NISize = 0;
+ _MIndices = NULL;
+ _MISize = 0;
+ _TIndices = NULL;
+ _TISize = 0;
}
-IndexedFaceSet::IndexedFaceSet(float *iVertices, unsigned iVSize, float *iNormals, unsigned iNSize,
- FrsMaterial **iMaterials, unsigned iMSize, float *iTexCoords, unsigned iTSize,
- unsigned iNumFaces, unsigned *iNumVertexPerFace, TRIANGLES_STYLE *iFaceStyle,
- FaceEdgeMark *iFaceEdgeMarks, unsigned *iVIndices, unsigned iVISize,
- unsigned *iNIndices, unsigned iNISize, unsigned *iMIndices, unsigned iMISize,
- unsigned *iTIndices, unsigned iTISize, unsigned iCopy)
-: Rep()
+IndexedFaceSet::IndexedFaceSet(float *iVertices,
+ unsigned iVSize,
+ float *iNormals,
+ unsigned iNSize,
+ FrsMaterial **iMaterials,
+ unsigned iMSize,
+ float *iTexCoords,
+ unsigned iTSize,
+ unsigned iNumFaces,
+ unsigned *iNumVertexPerFace,
+ TRIANGLES_STYLE *iFaceStyle,
+ FaceEdgeMark *iFaceEdgeMarks,
+ unsigned *iVIndices,
+ unsigned iVISize,
+ unsigned *iNIndices,
+ unsigned iNISize,
+ unsigned *iMIndices,
+ unsigned iMISize,
+ unsigned *iTIndices,
+ unsigned iTISize,
+ unsigned iCopy)
+ : Rep()
{
- if (1 == iCopy) {
- _VSize = iVSize;
- _Vertices = new float[_VSize];
- memcpy(_Vertices, iVertices, iVSize * sizeof(float));
-
- _NSize = iNSize;
- _Normals = new float[_NSize];
- memcpy(_Normals, iNormals, iNSize * sizeof(float));
-
- _MSize = iMSize;
- _FrsMaterials = 0;
- if (iMaterials) {
- _FrsMaterials = new FrsMaterial * [_MSize];
- for (unsigned int i = 0; i < _MSize; ++i)
- _FrsMaterials[i] = new FrsMaterial(*(iMaterials[i]));
- }
- _TSize = iTSize;
- _TexCoords = 0;
- if (_TSize) {
- _TexCoords = new float[_TSize];
- memcpy(_TexCoords, iTexCoords, iTSize * sizeof(float));
- }
-
- _NumFaces = iNumFaces;
- _NumVertexPerFace = new unsigned[_NumFaces];
- memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(unsigned));
-
- _FaceStyle = new TRIANGLES_STYLE[_NumFaces];
- memcpy(_FaceStyle, iFaceStyle, _NumFaces * sizeof(TRIANGLES_STYLE));
-
- _FaceEdgeMarks = new FaceEdgeMark[_NumFaces];
- memcpy(_FaceEdgeMarks, iFaceEdgeMarks, _NumFaces * sizeof(FaceEdgeMark));
-
- _VISize = iVISize;
- _VIndices = new unsigned[_VISize];
- memcpy(_VIndices, iVIndices, _VISize * sizeof(unsigned));
-
- _NISize = iNISize;
- _NIndices = new unsigned[_NISize];
- memcpy(_NIndices, iNIndices, _NISize * sizeof(unsigned));
-
- _MISize = iMISize;
- _MIndices = 0;
- if (iMIndices) {
- _MIndices = new unsigned[_MISize];
- memcpy(_MIndices, iMIndices, _MISize * sizeof(unsigned));
- }
- _TISize = iTISize;
- _TIndices = 0;
- if (_TISize) {
- _TIndices = new unsigned[_TISize];
- memcpy(_TIndices, iTIndices, _TISize * sizeof(unsigned));
- }
- }
- else {
- _VSize = iVSize;
- _Vertices = iVertices;
-
- _NSize = iNSize;
- _Normals = iNormals;
-
- _MSize = iMSize;
- _FrsMaterials = 0;
- if (iMaterials)
- _FrsMaterials = iMaterials;
-
- _TSize = iTSize;
- _TexCoords = iTexCoords;
-
- _NumFaces = iNumFaces;
- _NumVertexPerFace = iNumVertexPerFace;
- _FaceStyle = iFaceStyle;
- _FaceEdgeMarks = iFaceEdgeMarks;
-
- _VISize = iVISize;
- _VIndices = iVIndices;
-
- _NISize = iNISize;
- _NIndices = iNIndices;
-
- _MISize = iMISize;
- _MIndices = 0;
- if (iMISize)
- _MIndices = iMIndices;
-
- _TISize = iTISize;
- _TIndices = iTIndices;
- }
+ if (1 == iCopy) {
+ _VSize = iVSize;
+ _Vertices = new float[_VSize];
+ memcpy(_Vertices, iVertices, iVSize * sizeof(float));
+
+ _NSize = iNSize;
+ _Normals = new float[_NSize];
+ memcpy(_Normals, iNormals, iNSize * sizeof(float));
+
+ _MSize = iMSize;
+ _FrsMaterials = 0;
+ if (iMaterials) {
+ _FrsMaterials = new FrsMaterial *[_MSize];
+ for (unsigned int i = 0; i < _MSize; ++i)
+ _FrsMaterials[i] = new FrsMaterial(*(iMaterials[i]));
+ }
+ _TSize = iTSize;
+ _TexCoords = 0;
+ if (_TSize) {
+ _TexCoords = new float[_TSize];
+ memcpy(_TexCoords, iTexCoords, iTSize * sizeof(float));
+ }
+
+ _NumFaces = iNumFaces;
+ _NumVertexPerFace = new unsigned[_NumFaces];
+ memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(unsigned));
+
+ _FaceStyle = new TRIANGLES_STYLE[_NumFaces];
+ memcpy(_FaceStyle, iFaceStyle, _NumFaces * sizeof(TRIANGLES_STYLE));
+
+ _FaceEdgeMarks = new FaceEdgeMark[_NumFaces];
+ memcpy(_FaceEdgeMarks, iFaceEdgeMarks, _NumFaces * sizeof(FaceEdgeMark));
+
+ _VISize = iVISize;
+ _VIndices = new unsigned[_VISize];
+ memcpy(_VIndices, iVIndices, _VISize * sizeof(unsigned));
+
+ _NISize = iNISize;
+ _NIndices = new unsigned[_NISize];
+ memcpy(_NIndices, iNIndices, _NISize * sizeof(unsigned));
+
+ _MISize = iMISize;
+ _MIndices = 0;
+ if (iMIndices) {
+ _MIndices = new unsigned[_MISize];
+ memcpy(_MIndices, iMIndices, _MISize * sizeof(unsigned));
+ }
+ _TISize = iTISize;
+ _TIndices = 0;
+ if (_TISize) {
+ _TIndices = new unsigned[_TISize];
+ memcpy(_TIndices, iTIndices, _TISize * sizeof(unsigned));
+ }
+ }
+ else {
+ _VSize = iVSize;
+ _Vertices = iVertices;
+
+ _NSize = iNSize;
+ _Normals = iNormals;
+
+ _MSize = iMSize;
+ _FrsMaterials = 0;
+ if (iMaterials)
+ _FrsMaterials = iMaterials;
+
+ _TSize = iTSize;
+ _TexCoords = iTexCoords;
+
+ _NumFaces = iNumFaces;
+ _NumVertexPerFace = iNumVertexPerFace;
+ _FaceStyle = iFaceStyle;
+ _FaceEdgeMarks = iFaceEdgeMarks;
+
+ _VISize = iVISize;
+ _VIndices = iVIndices;
+
+ _NISize = iNISize;
+ _NIndices = iNIndices;
+
+ _MISize = iMISize;
+ _MIndices = 0;
+ if (iMISize)
+ _MIndices = iMIndices;
+
+ _TISize = iTISize;
+ _TIndices = iTIndices;
+ }
}
-IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet& iBrother) : Rep(iBrother)
+IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother)
{
- _VSize = iBrother.vsize();
- _Vertices = new float[_VSize];
- memcpy(_Vertices, iBrother.vertices(), _VSize * sizeof(float));
-
- _NSize = iBrother.nsize();
- _Normals = new float[_NSize];
- memcpy(_Normals, iBrother.normals(), _NSize * sizeof(float));
-
- _MSize = iBrother.msize();
- if (_MSize) {
- _FrsMaterials = new FrsMaterial * [_MSize];
- for (unsigned int i = 0; i < _MSize; ++i) {
- _FrsMaterials[i] = new FrsMaterial(*(iBrother._FrsMaterials[i]));
- }
- }
- else {
- _FrsMaterials = 0;
- }
-
- _TSize = iBrother.tsize();
- _TexCoords = 0;
- if (_TSize) {
- _TexCoords = new float[_TSize];
- memcpy(_TexCoords, iBrother.texCoords(), _TSize * sizeof(float));
- }
-
- _NumFaces = iBrother.numFaces();
- _NumVertexPerFace = new unsigned[_NumFaces];
- memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(unsigned));
-
- _FaceStyle = new TRIANGLES_STYLE[_NumFaces];
- memcpy(_FaceStyle, iBrother.trianglesStyle(), _NumFaces * sizeof(TRIANGLES_STYLE));
-
- _FaceEdgeMarks = new FaceEdgeMark[_NumFaces];
- memcpy(_FaceEdgeMarks, iBrother.faceEdgeMarks(), _NumFaces * sizeof(FaceEdgeMark));
-
- _VISize = iBrother.visize();
- _VIndices = new unsigned[_VISize];
- memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(unsigned));
-
- _NISize = iBrother.nisize();
- _NIndices = new unsigned[_NISize];
- memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(unsigned));
-
- _MISize = iBrother.misize();
- if (_MISize) {
- _MIndices = new unsigned[_MISize];
- memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(unsigned));
- }
- else {
- _MIndices = 0;
- }
-
- _TISize = iBrother.tisize();
- _TIndices = 0;
- if (_TISize) {
- _TIndices = new unsigned[_TISize];
- memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(unsigned));
- }
+ _VSize = iBrother.vsize();
+ _Vertices = new float[_VSize];
+ memcpy(_Vertices, iBrother.vertices(), _VSize * sizeof(float));
+
+ _NSize = iBrother.nsize();
+ _Normals = new float[_NSize];
+ memcpy(_Normals, iBrother.normals(), _NSize * sizeof(float));
+
+ _MSize = iBrother.msize();
+ if (_MSize) {
+ _FrsMaterials = new FrsMaterial *[_MSize];
+ for (unsigned int i = 0; i < _MSize; ++i) {
+ _FrsMaterials[i] = new FrsMaterial(*(iBrother._FrsMaterials[i]));
+ }
+ }
+ else {
+ _FrsMaterials = 0;
+ }
+
+ _TSize = iBrother.tsize();
+ _TexCoords = 0;
+ if (_TSize) {
+ _TexCoords = new float[_TSize];
+ memcpy(_TexCoords, iBrother.texCoords(), _TSize * sizeof(float));
+ }
+
+ _NumFaces = iBrother.numFaces();
+ _NumVertexPerFace = new unsigned[_NumFaces];
+ memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(unsigned));
+
+ _FaceStyle = new TRIANGLES_STYLE[_NumFaces];
+ memcpy(_FaceStyle, iBrother.trianglesStyle(), _NumFaces * sizeof(TRIANGLES_STYLE));
+
+ _FaceEdgeMarks = new FaceEdgeMark[_NumFaces];
+ memcpy(_FaceEdgeMarks, iBrother.faceEdgeMarks(), _NumFaces * sizeof(FaceEdgeMark));
+
+ _VISize = iBrother.visize();
+ _VIndices = new unsigned[_VISize];
+ memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(unsigned));
+
+ _NISize = iBrother.nisize();
+ _NIndices = new unsigned[_NISize];
+ memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(unsigned));
+
+ _MISize = iBrother.misize();
+ if (_MISize) {
+ _MIndices = new unsigned[_MISize];
+ memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(unsigned));
+ }
+ else {
+ _MIndices = 0;
+ }
+
+ _TISize = iBrother.tisize();
+ _TIndices = 0;
+ if (_TISize) {
+ _TIndices = new unsigned[_TISize];
+ memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(unsigned));
+ }
}
IndexedFaceSet::~IndexedFaceSet()
{
- if (NULL != _Vertices) {
- delete[] _Vertices;
- _Vertices = NULL;
- }
-
- if (NULL != _Normals) {
- delete[] _Normals;
- _Normals = NULL;
- }
-
- if (NULL != _FrsMaterials) {
- for (unsigned int i = 0; i < _MSize; ++i)
- delete _FrsMaterials[i];
- delete[] _FrsMaterials;
- _FrsMaterials = NULL;
- }
-
- if (NULL != _TexCoords) {
- delete[] _TexCoords;
- _TexCoords = NULL;
- }
-
- if (NULL != _NumVertexPerFace) {
- delete[] _NumVertexPerFace;
- _NumVertexPerFace = NULL;
- }
-
- if (NULL != _FaceStyle) {
- delete[] _FaceStyle;
- _FaceStyle = NULL;
- }
-
- if (NULL != _FaceEdgeMarks) {
- delete[] _FaceEdgeMarks;
- _FaceEdgeMarks = NULL;
- }
-
- if (NULL != _VIndices) {
- delete[] _VIndices;
- _VIndices = NULL;
- }
-
- if (NULL != _NIndices) {
- delete[] _NIndices;
- _NIndices = NULL;
- }
-
- if (NULL != _MIndices) {
- delete[] _MIndices;
- _MIndices = NULL;
- }
- if (NULL != _TIndices) {
- delete[] _TIndices;
- _TIndices = NULL;
- }
+ if (NULL != _Vertices) {
+ delete[] _Vertices;
+ _Vertices = NULL;
+ }
+
+ if (NULL != _Normals) {
+ delete[] _Normals;
+ _Normals = NULL;
+ }
+
+ if (NULL != _FrsMaterials) {
+ for (unsigned int i = 0; i < _MSize; ++i)
+ delete _FrsMaterials[i];
+ delete[] _FrsMaterials;
+ _FrsMaterials = NULL;
+ }
+
+ if (NULL != _TexCoords) {
+ delete[] _TexCoords;
+ _TexCoords = NULL;
+ }
+
+ if (NULL != _NumVertexPerFace) {
+ delete[] _NumVertexPerFace;
+ _NumVertexPerFace = NULL;
+ }
+
+ if (NULL != _FaceStyle) {
+ delete[] _FaceStyle;
+ _FaceStyle = NULL;
+ }
+
+ if (NULL != _FaceEdgeMarks) {
+ delete[] _FaceEdgeMarks;
+ _FaceEdgeMarks = NULL;
+ }
+
+ if (NULL != _VIndices) {
+ delete[] _VIndices;
+ _VIndices = NULL;
+ }
+
+ if (NULL != _NIndices) {
+ delete[] _NIndices;
+ _NIndices = NULL;
+ }
+
+ if (NULL != _MIndices) {
+ delete[] _MIndices;
+ _MIndices = NULL;
+ }
+ if (NULL != _TIndices) {
+ delete[] _TIndices;
+ _TIndices = NULL;
+ }
}
-void IndexedFaceSet::accept(SceneVisitor& v)
+void IndexedFaceSet::accept(SceneVisitor &v)
{
- Rep::accept(v);
- v.visitIndexedFaceSet(*this);
+ Rep::accept(v);
+ v.visitIndexedFaceSet(*this);
}
void IndexedFaceSet::ComputeBBox()
{
- float XMax = _Vertices[0];
- float YMax = _Vertices[1];
- float ZMax = _Vertices[2];
-
- float XMin = _Vertices[0];
- float YMin = _Vertices[1];
- float ZMin = _Vertices[2];
-
- // parse all the coordinates to find the Xmax, YMax, ZMax
- float *v = _Vertices;
-
- for (unsigned int i = 0; i < (_VSize / 3); ++i) {
- if (*v > XMax)
- XMax = *v;
- if (*v < XMin)
- XMin = *v;
- ++v;
-
- if (*v > YMax)
- YMax = *v;
- if (*v < YMin)
- YMin = *v;
- ++v;
-
- if (*v > ZMax)
- ZMax = *v;
- if (*v < ZMin)
- ZMin = *v;
- ++v;
- }
-
- setBBox(BBox<Vec3f>(Vec3f(XMin, YMin, ZMin), Vec3f(XMax, YMax, ZMax)));
+ float XMax = _Vertices[0];
+ float YMax = _Vertices[1];
+ float ZMax = _Vertices[2];
+
+ float XMin = _Vertices[0];
+ float YMin = _Vertices[1];
+ float ZMin = _Vertices[2];
+
+ // parse all the coordinates to find the Xmax, YMax, ZMax
+ float *v = _Vertices;
+
+ for (unsigned int i = 0; i < (_VSize / 3); ++i) {
+ if (*v > XMax)
+ XMax = *v;
+ if (*v < XMin)
+ XMin = *v;
+ ++v;
+
+ if (*v > YMax)
+ YMax = *v;
+ if (*v < YMin)
+ YMin = *v;
+ ++v;
+
+ if (*v > ZMax)
+ ZMax = *v;
+ if (*v < ZMin)
+ ZMin = *v;
+ ++v;
+ }
+
+ setBBox(BBox<Vec3f>(Vec3f(XMin, YMin, ZMin), Vec3f(XMax, YMax, ZMax)));
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
index b875be7200e..83672199e37 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
@@ -32,271 +32,286 @@
namespace Freestyle {
-class IndexedFaceSet : public Rep
-{
-public:
- /*! Triangles description style:*/
- enum TRIANGLES_STYLE {
- TRIANGLE_STRIP,
- TRIANGLE_FAN,
- TRIANGLES,
- };
-
- /*! User-specified face and edge marks for feature edge detection */
- /* XXX Why in hel not use an enum here too? */
- typedef unsigned char FaceEdgeMark;
- static const FaceEdgeMark FACE_MARK = 1 << 0;
- static const FaceEdgeMark EDGE_MARK_V1V2 = 1 << 1;
- static const FaceEdgeMark EDGE_MARK_V2V3 = 1 << 2;
- static const FaceEdgeMark EDGE_MARK_V3V1 = 1 << 3;
-
- /*! Builds an empty indexed face set */
- IndexedFaceSet();
-
- /*! Builds an indexed face set
- * iVertices
- * The array of object vertices 3D coordinates (for all faces).
- * If iCopy != 0, the array is copied; you must desallocate iVertices. Else you must not.
- * iVSize
- * The size of iVertices (must be a multiple of 3)
- * iNormals
- * The array of object normals 3D coordinates.
- * If iCopy != 0, the array is copied; you must desallocate iNormals. Else you must not.
- * iNSize
- * The size of iNormals
- * iMaterials
- * The array of materials
- * iMSize
- * The size of iMaterials
- * iTexCoords
- * The array of texture coordinates.
- * iTSize
- * The size of iTexCoords (must be multiple of 2)
- * iNumFaces
- * The number of faces
- * iNumVertexPerFace
- * Array containing the number of vertices per face.
- * iFaceStyle
- * Array containing the description style of each faces.
- * The style belongs to:
- * - TRIANGLE_STRIP: the face indices describe a triangle strip
- * - TRIANGLE_FAN : the face indices describe a triangle fan
- * - TRIANGLES : the face indices describe single triangles
- * If iCopy != 0, the array is copied; you must desallocate iFaceStyle. Else you must not.
- * iVIndices,
- * Array of vertices indices.
- * The integers contained in this array must be multiple of 3.
- * If iCopy != 0, the array is copied; you must desallocate iVIndices. Else you must not.
- * iVISize
- * The size of iVIndices.
- * iNIndices
- * Array of normals indices.
- * The integers contained in this array must be multiple of 3.
- * If iCopy != 0, the array is copied; you must desallocate iNIndices. Else you must not.
- * iNISize
- * The size of iNIndices
- * iMIndices
- * The Material indices (per vertex)
- * iMISize
- * The size of iMIndices
- * iTIndices
- * The Texture coordinates indices (per vertex). The integers contained in this array must be multiple of 2.
- * iTISize
- * The size of iMIndices
- * iCopy
- * 0 : the arrays are not copied. The pointers passed as arguments are used. IndexedFaceSet takes these
- * arrays desallocation in charge.
- * 1 : the arrays are copied. The caller is in charge of the arrays, passed as arguments desallocation.
- */
- IndexedFaceSet(float *iVertices, unsigned iVSize, float *iNormals, unsigned iNSize, FrsMaterial **iMaterials,
- unsigned iMSize, float *iTexCoords, unsigned iTSize, unsigned iNumFaces, unsigned *iNumVertexPerFace,
- TRIANGLES_STYLE *iFaceStyle, FaceEdgeMark *iFaceEdgeMarks, unsigned *iVIndices, unsigned iVISize,
- unsigned *iNIndices, unsigned iNISize, unsigned *iMIndices, unsigned iMISize, unsigned *iTIndices,
- unsigned iTISize, unsigned iCopy = 1);
-
- /*! Builds an indexed face set from an other indexed face set */
- IndexedFaceSet(const IndexedFaceSet& iBrother);
-
- void swap(IndexedFaceSet& ioOther)
- {
- std::swap(_Vertices, ioOther._Vertices);
- std::swap(_Normals, ioOther._Normals);
- std::swap(_FrsMaterials, ioOther._FrsMaterials);
- std::swap(_TexCoords, ioOther._TexCoords);
- std::swap(_FaceEdgeMarks, ioOther._FaceEdgeMarks);
-
- std::swap(_VSize, ioOther._VSize);
- std::swap(_NSize, ioOther._NSize);
- std::swap(_MSize, ioOther._MSize);
- std::swap(_TSize, ioOther._TSize);
-
- std::swap(_NumFaces, ioOther._NumFaces);
- std::swap(_NumVertexPerFace, ioOther._NumVertexPerFace);
- std::swap(_FaceStyle, ioOther._FaceStyle);
-
- std::swap(_VIndices, ioOther._VIndices);
- std::swap(_NIndices, ioOther._NIndices);
- std::swap(_MIndices, ioOther._MIndices); // Material Indices
- std::swap(_TIndices, ioOther._TIndices);
-
- std::swap(_VISize, ioOther._VISize);
- std::swap(_NISize, ioOther._NISize);
- std::swap(_MISize, ioOther._MISize);
- std::swap(_TISize, ioOther._TISize);
-
- Rep::swap(ioOther);
- }
-
- IndexedFaceSet& operator=(const IndexedFaceSet& iBrother)
- {
- IndexedFaceSet tmp(iBrother);
- swap(tmp);
- return *this;
- }
-
- /*! Desctructor
- * desallocates all the ressources
- */
- virtual ~IndexedFaceSet();
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
-
- /*! Compute the Bounding Box */
- virtual void ComputeBBox();
-
- /*! Accessors */
- virtual const float *vertices() const
- {
- return _Vertices;
- }
-
- virtual const float *normals() const
- {
- return _Normals;
- }
-
- virtual const FrsMaterial * const *frs_materials() const
- {
- return _FrsMaterials;
- }
-
- virtual const float *texCoords() const
- {
- return _TexCoords;
- }
-
- virtual const unsigned vsize() const
- {
- return _VSize;
- }
-
- virtual const unsigned nsize() const
- {
- return _NSize;
- }
-
- virtual const unsigned msize() const
- {
- return _MSize;
- }
-
- virtual const unsigned tsize() const
- {
- return _TSize;
- }
-
- virtual const unsigned numFaces() const
- {
- return _NumFaces;
- }
-
- virtual const unsigned *numVertexPerFaces() const
- {
- return _NumVertexPerFace;
- }
-
- virtual const TRIANGLES_STYLE *trianglesStyle() const
- {
- return _FaceStyle;
- }
-
- virtual const unsigned char *faceEdgeMarks() const
- {
- return _FaceEdgeMarks;
- }
-
- virtual const unsigned *vindices() const
- {
- return _VIndices;
- }
-
- virtual const unsigned *nindices() const
- {
- return _NIndices;
- }
-
- virtual const unsigned *mindices() const
- {
- return _MIndices;
- }
-
- virtual const unsigned *tindices() const
- {
- return _TIndices;
- }
-
- virtual const unsigned visize() const
- {
- return _VISize;
- }
-
- virtual const unsigned nisize() const
- {
- return _NISize;
- }
-
- virtual const unsigned misize() const
- {
- return _MISize;
- }
-
- virtual const unsigned tisize() const
- {
- return _TISize;
- }
-
-protected:
- float *_Vertices;
- float *_Normals;
- FrsMaterial **_FrsMaterials;
- float *_TexCoords;
-
- unsigned _VSize;
- unsigned _NSize;
- unsigned _MSize;
- unsigned _TSize;
-
- unsigned _NumFaces;
- unsigned *_NumVertexPerFace;
- TRIANGLES_STYLE *_FaceStyle;
- FaceEdgeMark *_FaceEdgeMarks;
-
- unsigned *_VIndices;
- unsigned *_NIndices;
- unsigned *_MIndices; // Material Indices
- unsigned *_TIndices; // Texture coordinates Indices
-
- unsigned _VISize;
- unsigned _NISize;
- unsigned _MISize;
- unsigned _TISize;
+class IndexedFaceSet : public Rep {
+ public:
+ /*! Triangles description style:*/
+ enum TRIANGLES_STYLE {
+ TRIANGLE_STRIP,
+ TRIANGLE_FAN,
+ TRIANGLES,
+ };
+
+ /*! User-specified face and edge marks for feature edge detection */
+ /* XXX Why in hel not use an enum here too? */
+ typedef unsigned char FaceEdgeMark;
+ static const FaceEdgeMark FACE_MARK = 1 << 0;
+ static const FaceEdgeMark EDGE_MARK_V1V2 = 1 << 1;
+ static const FaceEdgeMark EDGE_MARK_V2V3 = 1 << 2;
+ static const FaceEdgeMark EDGE_MARK_V3V1 = 1 << 3;
+
+ /*! Builds an empty indexed face set */
+ IndexedFaceSet();
+
+ /*! Builds an indexed face set
+ * iVertices
+ * The array of object vertices 3D coordinates (for all faces).
+ * If iCopy != 0, the array is copied; you must desallocate iVertices. Else you must not.
+ * iVSize
+ * The size of iVertices (must be a multiple of 3)
+ * iNormals
+ * The array of object normals 3D coordinates.
+ * If iCopy != 0, the array is copied; you must desallocate iNormals. Else you must not.
+ * iNSize
+ * The size of iNormals
+ * iMaterials
+ * The array of materials
+ * iMSize
+ * The size of iMaterials
+ * iTexCoords
+ * The array of texture coordinates.
+ * iTSize
+ * The size of iTexCoords (must be multiple of 2)
+ * iNumFaces
+ * The number of faces
+ * iNumVertexPerFace
+ * Array containing the number of vertices per face.
+ * iFaceStyle
+ * Array containing the description style of each faces.
+ * The style belongs to:
+ * - TRIANGLE_STRIP: the face indices describe a triangle strip
+ * - TRIANGLE_FAN : the face indices describe a triangle fan
+ * - TRIANGLES : the face indices describe single triangles
+ * If iCopy != 0, the array is copied; you must desallocate iFaceStyle. Else you must not.
+ * iVIndices,
+ * Array of vertices indices.
+ * The integers contained in this array must be multiple of 3.
+ * If iCopy != 0, the array is copied; you must desallocate iVIndices. Else you must not.
+ * iVISize
+ * The size of iVIndices.
+ * iNIndices
+ * Array of normals indices.
+ * The integers contained in this array must be multiple of 3.
+ * If iCopy != 0, the array is copied; you must desallocate iNIndices. Else you must not.
+ * iNISize
+ * The size of iNIndices
+ * iMIndices
+ * The Material indices (per vertex)
+ * iMISize
+ * The size of iMIndices
+ * iTIndices
+ * The Texture coordinates indices (per vertex). The integers contained in this array must be multiple of 2.
+ * iTISize
+ * The size of iMIndices
+ * iCopy
+ * 0 : the arrays are not copied. The pointers passed as arguments are used. IndexedFaceSet takes these
+ * arrays desallocation in charge.
+ * 1 : the arrays are copied. The caller is in charge of the arrays, passed as arguments desallocation.
+ */
+ IndexedFaceSet(float *iVertices,
+ unsigned iVSize,
+ float *iNormals,
+ unsigned iNSize,
+ FrsMaterial **iMaterials,
+ unsigned iMSize,
+ float *iTexCoords,
+ unsigned iTSize,
+ unsigned iNumFaces,
+ unsigned *iNumVertexPerFace,
+ TRIANGLES_STYLE *iFaceStyle,
+ FaceEdgeMark *iFaceEdgeMarks,
+ unsigned *iVIndices,
+ unsigned iVISize,
+ unsigned *iNIndices,
+ unsigned iNISize,
+ unsigned *iMIndices,
+ unsigned iMISize,
+ unsigned *iTIndices,
+ unsigned iTISize,
+ unsigned iCopy = 1);
+
+ /*! Builds an indexed face set from an other indexed face set */
+ IndexedFaceSet(const IndexedFaceSet &iBrother);
+
+ void swap(IndexedFaceSet &ioOther)
+ {
+ std::swap(_Vertices, ioOther._Vertices);
+ std::swap(_Normals, ioOther._Normals);
+ std::swap(_FrsMaterials, ioOther._FrsMaterials);
+ std::swap(_TexCoords, ioOther._TexCoords);
+ std::swap(_FaceEdgeMarks, ioOther._FaceEdgeMarks);
+
+ std::swap(_VSize, ioOther._VSize);
+ std::swap(_NSize, ioOther._NSize);
+ std::swap(_MSize, ioOther._MSize);
+ std::swap(_TSize, ioOther._TSize);
+
+ std::swap(_NumFaces, ioOther._NumFaces);
+ std::swap(_NumVertexPerFace, ioOther._NumVertexPerFace);
+ std::swap(_FaceStyle, ioOther._FaceStyle);
+
+ std::swap(_VIndices, ioOther._VIndices);
+ std::swap(_NIndices, ioOther._NIndices);
+ std::swap(_MIndices, ioOther._MIndices); // Material Indices
+ std::swap(_TIndices, ioOther._TIndices);
+
+ std::swap(_VISize, ioOther._VISize);
+ std::swap(_NISize, ioOther._NISize);
+ std::swap(_MISize, ioOther._MISize);
+ std::swap(_TISize, ioOther._TISize);
+
+ Rep::swap(ioOther);
+ }
+
+ IndexedFaceSet &operator=(const IndexedFaceSet &iBrother)
+ {
+ IndexedFaceSet tmp(iBrother);
+ swap(tmp);
+ return *this;
+ }
+
+ /*! Desctructor
+ * desallocates all the ressources
+ */
+ virtual ~IndexedFaceSet();
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
+
+ /*! Compute the Bounding Box */
+ virtual void ComputeBBox();
+
+ /*! Accessors */
+ virtual const float *vertices() const
+ {
+ return _Vertices;
+ }
+
+ virtual const float *normals() const
+ {
+ return _Normals;
+ }
+
+ virtual const FrsMaterial *const *frs_materials() const
+ {
+ return _FrsMaterials;
+ }
+
+ virtual const float *texCoords() const
+ {
+ return _TexCoords;
+ }
+
+ virtual const unsigned vsize() const
+ {
+ return _VSize;
+ }
+
+ virtual const unsigned nsize() const
+ {
+ return _NSize;
+ }
+
+ virtual const unsigned msize() const
+ {
+ return _MSize;
+ }
+
+ virtual const unsigned tsize() const
+ {
+ return _TSize;
+ }
+
+ virtual const unsigned numFaces() const
+ {
+ return _NumFaces;
+ }
+
+ virtual const unsigned *numVertexPerFaces() const
+ {
+ return _NumVertexPerFace;
+ }
+
+ virtual const TRIANGLES_STYLE *trianglesStyle() const
+ {
+ return _FaceStyle;
+ }
+
+ virtual const unsigned char *faceEdgeMarks() const
+ {
+ return _FaceEdgeMarks;
+ }
+
+ virtual const unsigned *vindices() const
+ {
+ return _VIndices;
+ }
+
+ virtual const unsigned *nindices() const
+ {
+ return _NIndices;
+ }
+
+ virtual const unsigned *mindices() const
+ {
+ return _MIndices;
+ }
+
+ virtual const unsigned *tindices() const
+ {
+ return _TIndices;
+ }
+
+ virtual const unsigned visize() const
+ {
+ return _VISize;
+ }
+
+ virtual const unsigned nisize() const
+ {
+ return _NISize;
+ }
+
+ virtual const unsigned misize() const
+ {
+ return _MISize;
+ }
+
+ virtual const unsigned tisize() const
+ {
+ return _TISize;
+ }
+
+ protected:
+ float *_Vertices;
+ float *_Normals;
+ FrsMaterial **_FrsMaterials;
+ float *_TexCoords;
+
+ unsigned _VSize;
+ unsigned _NSize;
+ unsigned _MSize;
+ unsigned _TSize;
+
+ unsigned _NumFaces;
+ unsigned *_NumVertexPerFace;
+ TRIANGLES_STYLE *_FaceStyle;
+ FaceEdgeMark *_FaceEdgeMarks;
+
+ unsigned *_VIndices;
+ unsigned *_NIndices;
+ unsigned *_MIndices; // Material Indices
+ unsigned *_TIndices; // Texture coordinates Indices
+
+ unsigned _VISize;
+ unsigned _NISize;
+ unsigned _MISize;
+ unsigned _TISize;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IndexedFaceSet")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IndexedFaceSet")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_INDEXED_FACE_SET_H__
+#endif // __FREESTYLE_INDEXED_FACE_SET_H__
diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.cpp b/source/blender/freestyle/intern/scene_graph/LineRep.cpp
index 8484aea0376..39be998cb90 100644
--- a/source/blender/freestyle/intern/scene_graph/LineRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/LineRep.cpp
@@ -25,38 +25,38 @@ namespace Freestyle {
void LineRep::ComputeBBox()
{
- real XMax = _vertices.front()[0];
- real YMax = _vertices.front()[1];
- real ZMax = _vertices.front()[2];
-
- real XMin = _vertices.front()[0];
- real YMin = _vertices.front()[1];
- real ZMin = _vertices.front()[2];
-
- // parse all the coordinates to find
- // the XMax, YMax, ZMax
- vector<Vec3r>::iterator v;
- for (v = _vertices.begin(); v != _vertices.end(); ++v) {
- // X
- if ((*v)[0] > XMax)
- XMax = (*v)[0];
- if ((*v)[0] < XMin)
- XMin = (*v)[0];
-
- // Y
- if ((*v)[1] > YMax)
- YMax = (*v)[1];
- if ((*v)[1] < YMin)
- YMin = (*v)[1];
-
- // Z
- if ((*v)[2] > ZMax)
- ZMax = (*v)[2];
- if ((*v)[2] < ZMin)
- ZMin = (*v)[2];
- }
-
- setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
+ real XMax = _vertices.front()[0];
+ real YMax = _vertices.front()[1];
+ real ZMax = _vertices.front()[2];
+
+ real XMin = _vertices.front()[0];
+ real YMin = _vertices.front()[1];
+ real ZMin = _vertices.front()[2];
+
+ // parse all the coordinates to find
+ // the XMax, YMax, ZMax
+ vector<Vec3r>::iterator v;
+ for (v = _vertices.begin(); v != _vertices.end(); ++v) {
+ // X
+ if ((*v)[0] > XMax)
+ XMax = (*v)[0];
+ if ((*v)[0] < XMin)
+ XMin = (*v)[0];
+
+ // Y
+ if ((*v)[1] > YMax)
+ YMax = (*v)[1];
+ if ((*v)[1] < YMin)
+ YMin = (*v)[1];
+
+ // Z
+ if ((*v)[2] > ZMax)
+ ZMax = (*v)[2];
+ if ((*v)[2] < ZMin)
+ ZMin = (*v)[2];
+ }
+
+ setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.h b/source/blender/freestyle/intern/scene_graph/LineRep.h
index a7349240e3b..e45a33d9fc4 100644
--- a/source/blender/freestyle/intern/scene_graph/LineRep.h
+++ b/source/blender/freestyle/intern/scene_graph/LineRep.h
@@ -34,121 +34,120 @@ using namespace std;
namespace Freestyle {
/*! Base class for all lines objects */
-class LineRep : public Rep
-{
-public:
- /*! Line description style */
- enum LINES_STYLE {
- LINES,
- LINE_STRIP,
- LINE_LOOP,
- };
-
- inline LineRep() : Rep()
- {
- _width = 0.0f;
- }
-
- /*! Builds a single line from 2 vertices
- * v1
- * first vertex
- * v2
- * second vertex
- */
- inline LineRep(const Vec3r& v1, const Vec3r& v2) : Rep()
- {
- setStyle(LINES);
- AddVertex(v1);
- AddVertex(v2);
- _width = 0.0f;
- }
-
- /*! Builds a line rep from a vertex chain */
- inline LineRep(const vector<Vec3r>& vertices) : Rep()
- {
- _vertices = vertices;
- setStyle(LINE_STRIP);
- _width = 0.0f;
- }
-
- /*! Builds a line rep from a vertex chain */
- inline LineRep(const list<Vec3r>& vertices) : Rep()
- {
- for (list<Vec3r>::const_iterator v = vertices.begin(), end = vertices.end(); v != end; ++v) {
- _vertices.push_back(*v);
- }
- setStyle(LINE_STRIP);
- _width = 0.0f;
- }
-
- virtual ~LineRep()
- {
- _vertices.clear();
- }
-
- /*! accessors */
- inline const LINES_STYLE style() const
- {
- return _Style;
- }
-
- inline const vector<Vec3r>& vertices() const
- {
- return _vertices;
- }
-
- inline float width() const
- {
- return _width;
- }
-
- /*! modifiers */
- inline void setStyle(const LINES_STYLE iStyle)
- {
- _Style = iStyle;
- }
-
- inline void AddVertex(const Vec3r& iVertex)
- {
- _vertices.push_back(iVertex);
- }
-
- inline void setVertices(const vector<Vec3r>& iVertices)
- {
- if (0 != _vertices.size()) {
- _vertices.clear();
- }
- for (vector<Vec3r>::const_iterator v = iVertices.begin(), end = iVertices.end(); v != end; ++v) {
- _vertices.push_back(*v);
- }
- }
-
- inline void setWidth(float iWidth)
- {
- _width = iWidth;
- }
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v)
- {
- Rep::accept(v);
- v.visitLineRep(*this);
- }
-
- /*! Computes the line bounding box.*/
- virtual void ComputeBBox();
-
-private:
- LINES_STYLE _Style;
- vector<Vec3r> _vertices;
- float _width;
+class LineRep : public Rep {
+ public:
+ /*! Line description style */
+ enum LINES_STYLE {
+ LINES,
+ LINE_STRIP,
+ LINE_LOOP,
+ };
+
+ inline LineRep() : Rep()
+ {
+ _width = 0.0f;
+ }
+
+ /*! Builds a single line from 2 vertices
+ * v1
+ * first vertex
+ * v2
+ * second vertex
+ */
+ inline LineRep(const Vec3r &v1, const Vec3r &v2) : Rep()
+ {
+ setStyle(LINES);
+ AddVertex(v1);
+ AddVertex(v2);
+ _width = 0.0f;
+ }
+
+ /*! Builds a line rep from a vertex chain */
+ inline LineRep(const vector<Vec3r> &vertices) : Rep()
+ {
+ _vertices = vertices;
+ setStyle(LINE_STRIP);
+ _width = 0.0f;
+ }
+
+ /*! Builds a line rep from a vertex chain */
+ inline LineRep(const list<Vec3r> &vertices) : Rep()
+ {
+ for (list<Vec3r>::const_iterator v = vertices.begin(), end = vertices.end(); v != end; ++v) {
+ _vertices.push_back(*v);
+ }
+ setStyle(LINE_STRIP);
+ _width = 0.0f;
+ }
+
+ virtual ~LineRep()
+ {
+ _vertices.clear();
+ }
+
+ /*! accessors */
+ inline const LINES_STYLE style() const
+ {
+ return _Style;
+ }
+
+ inline const vector<Vec3r> &vertices() const
+ {
+ return _vertices;
+ }
+
+ inline float width() const
+ {
+ return _width;
+ }
+
+ /*! modifiers */
+ inline void setStyle(const LINES_STYLE iStyle)
+ {
+ _Style = iStyle;
+ }
+
+ inline void AddVertex(const Vec3r &iVertex)
+ {
+ _vertices.push_back(iVertex);
+ }
+
+ inline void setVertices(const vector<Vec3r> &iVertices)
+ {
+ if (0 != _vertices.size()) {
+ _vertices.clear();
+ }
+ for (vector<Vec3r>::const_iterator v = iVertices.begin(), end = iVertices.end(); v != end;
+ ++v) {
+ _vertices.push_back(*v);
+ }
+ }
+
+ inline void setWidth(float iWidth)
+ {
+ _width = iWidth;
+ }
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v)
+ {
+ Rep::accept(v);
+ v.visitLineRep(*this);
+ }
+
+ /*! Computes the line bounding box.*/
+ virtual void ComputeBBox();
+
+ private:
+ LINES_STYLE _Style;
+ vector<Vec3r> _vertices;
+ float _width;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:LineRep")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:LineRep")
#endif
-
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_LINE_REP_H__
+#endif // __FREESTYLE_LINE_REP_H__
diff --git a/source/blender/freestyle/intern/scene_graph/Node.h b/source/blender/freestyle/intern/scene_graph/Node.h
index 5fbbc797ebf..a9424fe14d2 100644
--- a/source/blender/freestyle/intern/scene_graph/Node.h
+++ b/source/blender/freestyle/intern/scene_graph/Node.h
@@ -37,76 +37,77 @@ namespace Freestyle {
using namespace Geometry;
-class Node : public BaseObject
-{
-public:
- inline Node() : BaseObject() {}
-
- inline Node(const Node& iBrother) : BaseObject()
- {
- _BBox = iBrother.bbox();
- }
-
- virtual ~Node() {}
-
- /*! Accept the corresponding visitor
- * Each inherited node must overload this method
- */
- virtual void accept(SceneVisitor& v)
- {
- v.visitNode(*this);
- }
-
- /*! bounding box management */
- /*! Returns the node bounding box
- * If no bounding box exists, an empty bbox is returned
- */
- virtual const BBox<Vec3r>& bbox() const
- {
- return _BBox;
- }
-
- /*! Sets the Node bounding box */
- virtual void setBBox(const BBox<Vec3r>& iBox)
- {
- _BBox = iBox;
- }
-
- /*! Makes the union of _BBox and iBox */
- virtual void AddBBox(const BBox<Vec3r>& iBox)
- {
- if (iBox.empty())
- return;
-
- if (_BBox.empty())
- _BBox = iBox;
- else
- _BBox += iBox;
- }
-
- /*! Updates the BBox */
- virtual const BBox<Vec3r>& UpdateBBox()
- {
- return _BBox;
- }
-
- /*! Clears the bounding box */
- virtual void clearBBox()
- {
- _BBox.clear();
- }
-
-protected:
-
-private:
- BBox<Vec3r> _BBox;
+class Node : public BaseObject {
+ public:
+ inline Node() : BaseObject()
+ {
+ }
+
+ inline Node(const Node &iBrother) : BaseObject()
+ {
+ _BBox = iBrother.bbox();
+ }
+
+ virtual ~Node()
+ {
+ }
+
+ /*! Accept the corresponding visitor
+ * Each inherited node must overload this method
+ */
+ virtual void accept(SceneVisitor &v)
+ {
+ v.visitNode(*this);
+ }
+
+ /*! bounding box management */
+ /*! Returns the node bounding box
+ * If no bounding box exists, an empty bbox is returned
+ */
+ virtual const BBox<Vec3r> &bbox() const
+ {
+ return _BBox;
+ }
+
+ /*! Sets the Node bounding box */
+ virtual void setBBox(const BBox<Vec3r> &iBox)
+ {
+ _BBox = iBox;
+ }
+
+ /*! Makes the union of _BBox and iBox */
+ virtual void AddBBox(const BBox<Vec3r> &iBox)
+ {
+ if (iBox.empty())
+ return;
+
+ if (_BBox.empty())
+ _BBox = iBox;
+ else
+ _BBox += iBox;
+ }
+
+ /*! Updates the BBox */
+ virtual const BBox<Vec3r> &UpdateBBox()
+ {
+ return _BBox;
+ }
+
+ /*! Clears the bounding box */
+ virtual void clearBBox()
+ {
+ _BBox.clear();
+ }
+
+ protected:
+ private:
+ BBox<Vec3r> _BBox;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Node")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Node")
#endif
-
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_H__
+#endif // __FREESTYLE_NODE_H__
diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp b/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
index 3413cd125c7..30d05ee571c 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
@@ -20,81 +20,97 @@
*/
#include <math.h>
-#include <string.h> // for memcpy
+#include <string.h> // for memcpy
#include "NodeCamera.h"
namespace Freestyle {
-static void loadIdentity(double * matrix)
+static void loadIdentity(double *matrix)
{
- int i;
-
- // Build Identity matrix
- for (i = 0; i < 16; ++i) {
- double value ;
- if ((i % 5) == 0)
- value = 1.0;
- else
- value = 0;
- matrix[i] = value;
- }
+ int i;
+
+ // Build Identity matrix
+ for (i = 0; i < 16; ++i) {
+ double value;
+ if ((i % 5) == 0)
+ value = 1.0;
+ else
+ value = 0;
+ matrix[i] = value;
+ }
}
NodeCamera::NodeCamera(CameraType camera_type) : camera_type_(camera_type)
{
- loadIdentity(modelview_matrix_);
- loadIdentity(projection_matrix_);
+ loadIdentity(modelview_matrix_);
+ loadIdentity(projection_matrix_);
}
-#if 0 /* UNUSED, gives warning in gcc */
+#if 0 /* UNUSED, gives warning in gcc */
NodeCamera::NodeCamera(const NodeCamera& iBrother) : camera_type_(iBrother.camera_type_)
{
- memcpy(modelview_matrix_, iBrother.modelview_matrix_, 16 * sizeof(double));
- memcpy(projection_matrix_, iBrother.projection_matrix_, 16 * sizeof(double));
+ memcpy(modelview_matrix_, iBrother.modelview_matrix_, 16 * sizeof(double));
+ memcpy(projection_matrix_, iBrother.projection_matrix_, 16 * sizeof(double));
}
#endif
-void NodeCamera::accept(SceneVisitor& v)
+void NodeCamera::accept(SceneVisitor &v)
{
- v.visitNodeCamera(*this);
+ v.visitNodeCamera(*this);
}
void NodeCamera::setModelViewMatrix(double modelview_matrix[16])
{
- memcpy(modelview_matrix_, modelview_matrix, 16 * sizeof(double));
+ memcpy(modelview_matrix_, modelview_matrix, 16 * sizeof(double));
}
void NodeCamera::setProjectionMatrix(double projection_matrix[16])
{
- memcpy(projection_matrix_, projection_matrix, 16 * sizeof(double));
+ memcpy(projection_matrix_, projection_matrix, 16 * sizeof(double));
}
NodeOrthographicCamera::NodeOrthographicCamera()
-: NodeCamera(NodeCamera::ORTHOGRAPHIC), left_(0), right_(0), bottom_(0), top_(0), zNear_(0), zFar_(0)
+ : NodeCamera(NodeCamera::ORTHOGRAPHIC),
+ left_(0),
+ right_(0),
+ bottom_(0),
+ top_(0),
+ zNear_(0),
+ zFar_(0)
{
- loadIdentity(projection_matrix_);
- loadIdentity(modelview_matrix_);
+ loadIdentity(projection_matrix_);
+ loadIdentity(modelview_matrix_);
}
-NodeOrthographicCamera::NodeOrthographicCamera(double left, double right, double bottom, double top,
- double zNear, double zFar)
-: NodeCamera(NodeCamera::ORTHOGRAPHIC), left_(left), right_(right), bottom_(bottom), top_(top),
- zNear_(zNear), zFar_(zFar)
+NodeOrthographicCamera::NodeOrthographicCamera(
+ double left, double right, double bottom, double top, double zNear, double zFar)
+ : NodeCamera(NodeCamera::ORTHOGRAPHIC),
+ left_(left),
+ right_(right),
+ bottom_(bottom),
+ top_(top),
+ zNear_(zNear),
+ zFar_(zFar)
{
- loadIdentity(projection_matrix_);
-
- projection_matrix_[0] = 2.0 / (right - left);
- projection_matrix_[3] = -(right + left) / (right - left) ;
- projection_matrix_[5] = 2.0 / (top - bottom);
- projection_matrix_[7] = -(top + bottom) / (top - bottom) ;
- projection_matrix_[10] = -2.0 / (zFar - zNear);
- projection_matrix_[11] = -(zFar + zNear) / (zFar - zNear);
+ loadIdentity(projection_matrix_);
+
+ projection_matrix_[0] = 2.0 / (right - left);
+ projection_matrix_[3] = -(right + left) / (right - left);
+ projection_matrix_[5] = 2.0 / (top - bottom);
+ projection_matrix_[7] = -(top + bottom) / (top - bottom);
+ projection_matrix_[10] = -2.0 / (zFar - zNear);
+ projection_matrix_[11] = -(zFar + zNear) / (zFar - zNear);
}
-NodeOrthographicCamera::NodeOrthographicCamera(const NodeOrthographicCamera& iBrother)
-: NodeCamera(iBrother), left_(iBrother.left_), right_(iBrother.right_), bottom_(iBrother.bottom_), top_(iBrother.top_),
- zNear_(iBrother.zNear_), zFar_(iBrother.zFar_)
+NodeOrthographicCamera::NodeOrthographicCamera(const NodeOrthographicCamera &iBrother)
+ : NodeCamera(iBrother),
+ left_(iBrother.left_),
+ right_(iBrother.right_),
+ bottom_(iBrother.bottom_),
+ top_(iBrother.top_),
+ zNear_(iBrother.zNear_),
+ zFar_(iBrother.zFar_)
{
}
@@ -103,34 +119,34 @@ NodePerspectiveCamera::NodePerspectiveCamera() : NodeCamera(NodeCamera::PERSPECT
}
NodePerspectiveCamera::NodePerspectiveCamera(double fovy, double aspect, double zNear, double zFar)
-: NodeCamera(NodeCamera::PERSPECTIVE)
+ : NodeCamera(NodeCamera::PERSPECTIVE)
{
- loadIdentity(projection_matrix_);
+ loadIdentity(projection_matrix_);
- double f = cos(fovy / 2.0) / sin(fovy / 2.0); // cotangent
+ double f = cos(fovy / 2.0) / sin(fovy / 2.0); // cotangent
- projection_matrix_[0] = f / aspect;
- projection_matrix_[5] = f;
- projection_matrix_[10] = (zNear + zFar) / (zNear - zFar);
- projection_matrix_[11] = (2.0 * zNear * zFar) / (zNear - zFar);
- projection_matrix_[14] = -1.0;
- projection_matrix_[15] = 0;
+ projection_matrix_[0] = f / aspect;
+ projection_matrix_[5] = f;
+ projection_matrix_[10] = (zNear + zFar) / (zNear - zFar);
+ projection_matrix_[11] = (2.0 * zNear * zFar) / (zNear - zFar);
+ projection_matrix_[14] = -1.0;
+ projection_matrix_[15] = 0;
}
-NodePerspectiveCamera::NodePerspectiveCamera(double left, double right, double bottom, double top,
- double zNear, double zFar)
-: NodeCamera(NodeCamera::PERSPECTIVE)
+NodePerspectiveCamera::NodePerspectiveCamera(
+ double left, double right, double bottom, double top, double zNear, double zFar)
+ : NodeCamera(NodeCamera::PERSPECTIVE)
{
- loadIdentity(projection_matrix_);
-
- projection_matrix_[0] = (2.0 * zNear) / (right - left);
- projection_matrix_[2] = (right + left) / (right - left);
- projection_matrix_[5] = (2.0 * zNear) / (top - bottom);
- projection_matrix_[6] = (top + bottom) / (top - bottom);
- projection_matrix_[10] = -(zFar + zNear) / (zFar - zNear);
- projection_matrix_[11] = -(2.0 * zFar * zNear) / (zFar - zNear);
- projection_matrix_[14] = -1.0;
- projection_matrix_[15] = 0;
+ loadIdentity(projection_matrix_);
+
+ projection_matrix_[0] = (2.0 * zNear) / (right - left);
+ projection_matrix_[2] = (right + left) / (right - left);
+ projection_matrix_[5] = (2.0 * zNear) / (top - bottom);
+ projection_matrix_[6] = (top + bottom) / (top - bottom);
+ projection_matrix_[10] = -(zFar + zNear) / (zFar - zNear);
+ projection_matrix_[11] = -(2.0 * zFar * zNear) / (zFar - zNear);
+ projection_matrix_[14] = -1.0;
+ projection_matrix_[15] = 0;
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.h b/source/blender/freestyle/intern/scene_graph/NodeCamera.h
index cbff332849c..c3c93fa1f88 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeCamera.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.h
@@ -36,188 +36,186 @@ class NodeOrthographicCamera;
class NodePerspectiveCamera;
-class NodeCamera : public Node
-{
-public:
- typedef enum {
- PERSPECTIVE,
- ORTHOGRAPHIC,
- GENERIC,
- } CameraType;
-
- /*! Default matrices: Identity for both projection and modelview. */
- NodeCamera(CameraType camera_type = GENERIC);
-#if 0 /* UNUSED, gives warning in gcc */
- NodeCamera(const NodeCamera& iBrother);
+class NodeCamera : public Node {
+ public:
+ typedef enum {
+ PERSPECTIVE,
+ ORTHOGRAPHIC,
+ GENERIC,
+ } CameraType;
+
+ /*! Default matrices: Identity for both projection and modelview. */
+ NodeCamera(CameraType camera_type = GENERIC);
+#if 0 /* UNUSED, gives warning in gcc */
+ NodeCamera(const NodeCamera& iBrother);
#endif
- virtual ~NodeCamera() {}
+ virtual ~NodeCamera()
+ {
+ }
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
- /*! Matrix is copied */
- void setModelViewMatrix(double modelview_matrix[16]);
+ /*! Matrix is copied */
+ void setModelViewMatrix(double modelview_matrix[16]);
- /*! Matrix is copied */
- void setProjectionMatrix(double projection_matrix[16]);
+ /*! Matrix is copied */
+ void setProjectionMatrix(double projection_matrix[16]);
- double *modelViewMatrix()
- {
- return modelview_matrix_;
- }
+ double *modelViewMatrix()
+ {
+ return modelview_matrix_;
+ }
- double *projectionMatrix()
- {
- return projection_matrix_;
- }
+ double *projectionMatrix()
+ {
+ return projection_matrix_;
+ }
-protected:
- // row major right handed matrix
- double modelview_matrix_[16];
- // row major right handed matrix
- double projection_matrix_[16];
+ protected:
+ // row major right handed matrix
+ double modelview_matrix_[16];
+ // row major right handed matrix
+ double projection_matrix_[16];
- CameraType camera_type_;
+ CameraType camera_type_;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodeCamera")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodeCamera")
#endif
-
};
-class NodeOrthographicCamera : public NodeCamera
-{
-public:
- NodeOrthographicCamera();
-
- /*! Builds a parallel projection matrix a la glOrtho.
- * A 0 0 tx
- * 0 B 0 ty
- * 0 0 C tz
- * 0 0 0 1
- *
- * where
- * A = 2 / (right - left)
- * B = 2 / (top - bottom)
- * C = -2 / (far - near)
- * tx = -(right + left) / (right - left)
- * ty = -(top + bottom) / (top - bottom)
- * tz = -(zFar + zNear) / (zFar - zNear)
- */
- NodeOrthographicCamera(double left, double right, double bottom, double top, double zNear, double zFar);
-
- double left() const
- {
- return left_;
- }
-
- double right() const
- {
- return right_;
- }
-
- double bottom() const
- {
- return bottom_;
- }
-
- double top() const
- {
- return top_;
- }
-
- double zNear() const
- {
- return zNear_;
- }
-
- double zFar() const
- {
- return zFar_;
- }
-
- NodeOrthographicCamera(const NodeOrthographicCamera& iBrother);
-
-private:
- double left_;
- double right_;
- double bottom_;
- double top_;
- double zNear_;
- double zFar_;
+class NodeOrthographicCamera : public NodeCamera {
+ public:
+ NodeOrthographicCamera();
+
+ /*! Builds a parallel projection matrix a la glOrtho.
+ * A 0 0 tx
+ * 0 B 0 ty
+ * 0 0 C tz
+ * 0 0 0 1
+ *
+ * where
+ * A = 2 / (right - left)
+ * B = 2 / (top - bottom)
+ * C = -2 / (far - near)
+ * tx = -(right + left) / (right - left)
+ * ty = -(top + bottom) / (top - bottom)
+ * tz = -(zFar + zNear) / (zFar - zNear)
+ */
+ NodeOrthographicCamera(
+ double left, double right, double bottom, double top, double zNear, double zFar);
+
+ double left() const
+ {
+ return left_;
+ }
+
+ double right() const
+ {
+ return right_;
+ }
+
+ double bottom() const
+ {
+ return bottom_;
+ }
+
+ double top() const
+ {
+ return top_;
+ }
+
+ double zNear() const
+ {
+ return zNear_;
+ }
+
+ double zFar() const
+ {
+ return zFar_;
+ }
+
+ NodeOrthographicCamera(const NodeOrthographicCamera &iBrother);
+
+ private:
+ double left_;
+ double right_;
+ double bottom_;
+ double top_;
+ double zNear_;
+ double zFar_;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodeOrthographicCamera")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodeOrthographicCamera")
#endif
-
};
-class NodePerspectiveCamera : public NodeCamera
-{
-public:
- NodePerspectiveCamera();
-
- /*! Builds a perspective projection matrix a la gluPerspective.
- * Given f defined as follows:
- * fovy
- * f = cotangent(____)
- * 2
- * The generated matrix is
- * ( f )
- * | ______ 0 0 0 |
- * | aspect |
- * | |
- * | 0 f 0 0 |
- * | |
- * | zNear+zFar 2*zNear*zFar |
- * | 0 0 __________ ____________ |
- * | zNear-zFar zNear-zFar |
- * | |
- * ( 0 0 -1 0 )
- * \param fovy:
- * Field of View specified in radians.
- */
- NodePerspectiveCamera(double fovy, double aspect, double zNear, double zFar);
-
- /*! Builds a perspective projection matrix a la glFrustum.
- * ( 2*zNear )
- * | __________ 0 A 0 |
- * | right-left |
- * | |
- * | 2*zNear |
- * | 0 __________ B 0 |
- * | top-bottom |
- * | |
- * | 0 0 C D |
- * | |
- * | 0 0 -1 0 |
- * ( )
- *
- * right+left
- * A = __________
- * right-left
- *
- * top+bottom
- * B = __________
- * top-bottom
- *
- * zFar+zNear
- * C = - __________
- * zFar-zNear
- *
- * 2*zFar*zNear
- * D = - ____________
- * zFar-zNear
- */
- NodePerspectiveCamera(double left, double right, double bottom, double top, double zNear, double zFar);
+class NodePerspectiveCamera : public NodeCamera {
+ public:
+ NodePerspectiveCamera();
+
+ /*! Builds a perspective projection matrix a la gluPerspective.
+ * Given f defined as follows:
+ * fovy
+ * f = cotangent(____)
+ * 2
+ * The generated matrix is
+ * ( f )
+ * | ______ 0 0 0 |
+ * | aspect |
+ * | |
+ * | 0 f 0 0 |
+ * | |
+ * | zNear+zFar 2*zNear*zFar |
+ * | 0 0 __________ ____________ |
+ * | zNear-zFar zNear-zFar |
+ * | |
+ * ( 0 0 -1 0 )
+ * \param fovy:
+ * Field of View specified in radians.
+ */
+ NodePerspectiveCamera(double fovy, double aspect, double zNear, double zFar);
+
+ /*! Builds a perspective projection matrix a la glFrustum.
+ * ( 2*zNear )
+ * | __________ 0 A 0 |
+ * | right-left |
+ * | |
+ * | 2*zNear |
+ * | 0 __________ B 0 |
+ * | top-bottom |
+ * | |
+ * | 0 0 C D |
+ * | |
+ * | 0 0 -1 0 |
+ * ( )
+ *
+ * right+left
+ * A = __________
+ * right-left
+ *
+ * top+bottom
+ * B = __________
+ * top-bottom
+ *
+ * zFar+zNear
+ * C = - __________
+ * zFar-zNear
+ *
+ * 2*zFar*zNear
+ * D = - ____________
+ * zFar-zNear
+ */
+ NodePerspectiveCamera(
+ double left, double right, double bottom, double top, double zNear, double zFar);
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodePerspectiveCamera")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodePerspectiveCamera")
#endif
-
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_CAMERA_H__
+#endif // __FREESTYLE_NODE_CAMERA_H__
diff --git a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
index c94ee961881..2564a462407 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
@@ -23,15 +23,16 @@
namespace Freestyle {
-void NodeDrawingStyle::accept(SceneVisitor& v)
+void NodeDrawingStyle::accept(SceneVisitor &v)
{
- v.visitNodeDrawingStyle(*this);
+ v.visitNodeDrawingStyle(*this);
- v.visitNodeDrawingStyleBefore(*this);
- v.visitDrawingStyle(_DrawingStyle);
- for (vector<Node*>::iterator node = _Children.begin(), end = _Children.end(); node != end; ++node)
- (*node)->accept(v);
- v.visitNodeDrawingStyleAfter(*this);
+ v.visitNodeDrawingStyleBefore(*this);
+ v.visitDrawingStyle(_DrawingStyle);
+ for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end;
+ ++node)
+ (*node)->accept(v);
+ v.visitNodeDrawingStyleAfter(*this);
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h
index f7bef20bc8f..ea617a912f6 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h
@@ -29,79 +29,81 @@
namespace Freestyle {
-class NodeDrawingStyle : public NodeGroup
-{
-public:
- inline NodeDrawingStyle() : NodeGroup() {}
- virtual ~NodeDrawingStyle() {}
-
- inline const DrawingStyle& drawingStyle() const
- {
- return _DrawingStyle;
- }
-
- inline void setDrawingStyle(const DrawingStyle& iDrawingStyle)
- {
- _DrawingStyle = iDrawingStyle;
- }
-
- /*! Sets the style. Must be one of FILLED, LINES, POINTS, INVISIBLE. */
- inline void setStyle(const DrawingStyle::STYLE iStyle)
- {
- _DrawingStyle.setStyle(iStyle);
- }
-
- /*! Sets the line width in the LINES style case */
- inline void setLineWidth(const float iLineWidth)
- {
- _DrawingStyle.setLineWidth(iLineWidth);
- }
-
- /*! Sets the Point size in the POINTS style case */
- inline void setPointSize(const float iPointSize)
- {
- _DrawingStyle.setPointSize(iPointSize);
- }
-
- /*! Enables or disables the lighting. true = enable */
- inline void setLightingEnabled(const bool iEnableLighting)
- {
- _DrawingStyle.setLightingEnabled(iEnableLighting);
- }
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
-
- /*! accessors */
- inline DrawingStyle::STYLE style() const
- {
- return _DrawingStyle.style();
- }
-
- inline float lineWidth() const
- {
- return _DrawingStyle.lineWidth();
- }
-
- inline float pointSize() const
- {
- return _DrawingStyle.pointSize();
- }
-
- inline bool lightingEnabled() const
- {
- return _DrawingStyle.lightingEnabled();
- }
-
-private:
- DrawingStyle _DrawingStyle;
+class NodeDrawingStyle : public NodeGroup {
+ public:
+ inline NodeDrawingStyle() : NodeGroup()
+ {
+ }
+ virtual ~NodeDrawingStyle()
+ {
+ }
+
+ inline const DrawingStyle &drawingStyle() const
+ {
+ return _DrawingStyle;
+ }
+
+ inline void setDrawingStyle(const DrawingStyle &iDrawingStyle)
+ {
+ _DrawingStyle = iDrawingStyle;
+ }
+
+ /*! Sets the style. Must be one of FILLED, LINES, POINTS, INVISIBLE. */
+ inline void setStyle(const DrawingStyle::STYLE iStyle)
+ {
+ _DrawingStyle.setStyle(iStyle);
+ }
+
+ /*! Sets the line width in the LINES style case */
+ inline void setLineWidth(const float iLineWidth)
+ {
+ _DrawingStyle.setLineWidth(iLineWidth);
+ }
+
+ /*! Sets the Point size in the POINTS style case */
+ inline void setPointSize(const float iPointSize)
+ {
+ _DrawingStyle.setPointSize(iPointSize);
+ }
+
+ /*! Enables or disables the lighting. true = enable */
+ inline void setLightingEnabled(const bool iEnableLighting)
+ {
+ _DrawingStyle.setLightingEnabled(iEnableLighting);
+ }
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
+
+ /*! accessors */
+ inline DrawingStyle::STYLE style() const
+ {
+ return _DrawingStyle.style();
+ }
+
+ inline float lineWidth() const
+ {
+ return _DrawingStyle.lineWidth();
+ }
+
+ inline float pointSize() const
+ {
+ return _DrawingStyle.pointSize();
+ }
+
+ inline bool lightingEnabled() const
+ {
+ return _DrawingStyle.lightingEnabled();
+ }
+
+ private:
+ DrawingStyle _DrawingStyle;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodeDrawingStyle")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodeDrawingStyle")
#endif
-
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_DRAWING_STYLE_H__
+#endif // __FREESTYLE_NODE_DRAWING_STYLE_H__
diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
index ee1f0b71b20..204e5e1c60e 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
@@ -26,92 +26,93 @@ namespace Freestyle {
void NodeGroup::AddChild(Node *iChild)
{
- if (NULL == iChild)
- return;
+ if (NULL == iChild)
+ return;
- _Children.push_back(iChild);
- iChild->addRef();
+ _Children.push_back(iChild);
+ iChild->addRef();
}
int NodeGroup::destroy()
{
- /*! Node::destroy makes a release on the object and then returns the reference counter.
- * If the reference counter is equal to 0, that means that nobody else is linking this node group and
- * that we can destroy the whole underlying tree.
- * Else, one or several Node link this node group, and we only returns the reference counter
- * decremented by Node::destroy();
- */
- int refThis = Node::destroy();
-
- // if refThis != 0, we can't destroy the tree
- if (0 != refThis)
- return refThis;
-
- // If we are here, that means that nobody else needs our NodeGroup and we can destroy it.
- int refCount = 0;
- vector<Node *>::iterator node;
-
- for (node = _Children.begin(); node != _Children.end(); ++node) {
- refCount = (*node)->destroy();
- if (0 == refCount)
- delete (*node);
- }
-
- _Children.clear();
-
- return refThis;
+ /*! Node::destroy makes a release on the object and then returns the reference counter.
+ * If the reference counter is equal to 0, that means that nobody else is linking this node group and
+ * that we can destroy the whole underlying tree.
+ * Else, one or several Node link this node group, and we only returns the reference counter
+ * decremented by Node::destroy();
+ */
+ int refThis = Node::destroy();
+
+ // if refThis != 0, we can't destroy the tree
+ if (0 != refThis)
+ return refThis;
+
+ // If we are here, that means that nobody else needs our NodeGroup and we can destroy it.
+ int refCount = 0;
+ vector<Node *>::iterator node;
+
+ for (node = _Children.begin(); node != _Children.end(); ++node) {
+ refCount = (*node)->destroy();
+ if (0 == refCount)
+ delete (*node);
+ }
+
+ _Children.clear();
+
+ return refThis;
}
-void NodeGroup::accept(SceneVisitor& v)
+void NodeGroup::accept(SceneVisitor &v)
{
- v.visitNodeGroup(*this);
+ v.visitNodeGroup(*this);
- v.visitNodeGroupBefore(*this);
- for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end; ++node)
- (*node)->accept(v);
- v.visitNodeGroupAfter(*this);
+ v.visitNodeGroupBefore(*this);
+ for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end;
+ ++node)
+ (*node)->accept(v);
+ v.visitNodeGroupAfter(*this);
}
void NodeGroup::DetachChildren()
{
- vector<Node *>::iterator node;
+ vector<Node *>::iterator node;
- for (node = _Children.begin(); node != _Children.end(); ++node) {
- (*node)->release();
- }
+ for (node = _Children.begin(); node != _Children.end(); ++node) {
+ (*node)->release();
+ }
- _Children.clear();
+ _Children.clear();
}
void NodeGroup::DetachChild(Node *iChild)
{
- /* int found = 0; */ /* UNUSED */
- vector<Node*>::iterator node;
-
- for (node = _Children.begin(); node != _Children.end(); ++node) {
- if ((*node) == iChild) {
- (*node)->release();
- _Children.erase(node);
- /* found = 1; */ /* UNUSED */
- break;
- }
- }
+ /* int found = 0; */ /* UNUSED */
+ vector<Node *>::iterator node;
+
+ for (node = _Children.begin(); node != _Children.end(); ++node) {
+ if ((*node) == iChild) {
+ (*node)->release();
+ _Children.erase(node);
+ /* found = 1; */ /* UNUSED */
+ break;
+ }
+ }
}
-void NodeGroup::RetrieveChildren(vector<Node*>& oNodes)
+void NodeGroup::RetrieveChildren(vector<Node *> &oNodes)
{
- oNodes = _Children;
+ oNodes = _Children;
}
-const BBox<Vec3r>& NodeGroup::UpdateBBox()
+const BBox<Vec3r> &NodeGroup::UpdateBBox()
{
- vector<Node *>::iterator node;
- clearBBox();
- for (node = _Children.begin(); node != _Children.end(); ++node) {
- AddBBox((*node)->UpdateBBox());
- }
+ vector<Node *>::iterator node;
+ clearBBox();
+ for (node = _Children.begin(); node != _Children.end(); ++node) {
+ AddBBox((*node)->UpdateBBox());
+ }
- return Node::UpdateBBox();
+ return Node::UpdateBBox();
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.h b/source/blender/freestyle/intern/scene_graph/NodeGroup.h
index 23a168eba01..89f81cc2b13 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeGroup.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.h
@@ -33,48 +33,51 @@ using namespace std;
namespace Freestyle {
-class NodeGroup : public Node
-{
-public:
- inline NodeGroup(): Node() {}
- virtual ~NodeGroup() {}
+class NodeGroup : public Node {
+ public:
+ inline NodeGroup() : Node()
+ {
+ }
+ virtual ~NodeGroup()
+ {
+ }
- /*! Adds a child. Makes a addRef on the iChild reference counter */
- virtual void AddChild(Node *iChild);
+ /*! Adds a child. Makes a addRef on the iChild reference counter */
+ virtual void AddChild(Node *iChild);
- /*! destroys all the underlying nodes
- * Returns the reference counter after having done a release()
- */
- virtual int destroy();
+ /*! destroys all the underlying nodes
+ * Returns the reference counter after having done a release()
+ */
+ virtual int destroy();
- /*! Detaches all the children */
- virtual void DetachChildren();
+ /*! Detaches all the children */
+ virtual void DetachChildren();
- /*! Detached the sepcified child */
- virtual void DetachChild(Node *iChild);
+ /*! Detached the sepcified child */
+ virtual void DetachChild(Node *iChild);
- /*! Retrieve children */
- virtual void RetrieveChildren(vector<Node*>& oNodes);
+ /*! Retrieve children */
+ virtual void RetrieveChildren(vector<Node *> &oNodes);
- /*! Renders every children */
-// virtual void Render(Renderer *iRenderer);
+ /*! Renders every children */
+ // virtual void Render(Renderer *iRenderer);
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
- /*! Updates the BBox */
- virtual const BBox<Vec3r>& UpdateBBox();
+ /*! Updates the BBox */
+ virtual const BBox<Vec3r> &UpdateBBox();
- /*! Returns the number of children */
- virtual int numberOfChildren()
- {
- return _Children.size();
- }
+ /*! Returns the number of children */
+ virtual int numberOfChildren()
+ {
+ return _Children.size();
+ }
-protected:
- vector<Node*> _Children;
+ protected:
+ vector<Node *> _Children;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_GROUP_H__
+#endif // __FREESTYLE_NODE_GROUP_H__
diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.cpp b/source/blender/freestyle/intern/scene_graph/NodeLight.cpp
index 9e513f6a488..f6585d9f932 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeLight.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeLight.cpp
@@ -27,51 +27,51 @@ int NodeLight::numberOfLights = 0;
NodeLight::NodeLight() : Node()
{
- if (numberOfLights > 7) {
- _number = 7;
- }
- else {
- _number = numberOfLights;
- numberOfLights++;
- }
+ if (numberOfLights > 7) {
+ _number = 7;
+ }
+ else {
+ _number = numberOfLights;
+ numberOfLights++;
+ }
- Ambient[0] = Ambient[1] = Ambient[2] = 0.0f;
- Ambient[3] = 1.0f;
+ Ambient[0] = Ambient[1] = Ambient[2] = 0.0f;
+ Ambient[3] = 1.0f;
- for (int i = 0; i < 4; i++) {
- Diffuse[i] = 1.0f;
- Specular[i] = 1.0f;
- }
+ for (int i = 0; i < 4; i++) {
+ Diffuse[i] = 1.0f;
+ Specular[i] = 1.0f;
+ }
- Position[0] = Position[1] = Position[3] = 0.0f;
- Position[2] = 1.0f;
+ Position[0] = Position[1] = Position[3] = 0.0f;
+ Position[2] = 1.0f;
- on = true;
+ on = true;
}
-NodeLight::NodeLight(NodeLight& iBrother) : Node(iBrother)
+NodeLight::NodeLight(NodeLight &iBrother) : Node(iBrother)
{
- if (numberOfLights > 7) {
- _number = 7;
- }
- else {
- _number = numberOfLights;
- numberOfLights++;
- }
+ if (numberOfLights > 7) {
+ _number = 7;
+ }
+ else {
+ _number = numberOfLights;
+ numberOfLights++;
+ }
- for (int i = 0; i < 4; i++) {
- Ambient[i] = iBrother.ambient()[i];
- Diffuse[i] = iBrother.diffuse()[i];
- Specular[i] = iBrother.specular()[i];
- Position[i] = iBrother.position()[i];
- }
+ for (int i = 0; i < 4; i++) {
+ Ambient[i] = iBrother.ambient()[i];
+ Diffuse[i] = iBrother.diffuse()[i];
+ Specular[i] = iBrother.specular()[i];
+ Position[i] = iBrother.position()[i];
+ }
- on = iBrother.isOn();
+ on = iBrother.isOn();
}
-void NodeLight::accept(SceneVisitor& v)
+void NodeLight::accept(SceneVisitor &v)
{
- v.visitNodeLight(*this);
+ v.visitNodeLight(*this);
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.h b/source/blender/freestyle/intern/scene_graph/NodeLight.h
index 4381d047540..046b61beaf4 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeLight.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeLight.h
@@ -32,73 +32,74 @@ namespace Freestyle {
using namespace Geometry;
-class NodeLight : public Node
-{
-public:
- NodeLight();
- NodeLight(NodeLight& iBrother);
-
- virtual ~NodeLight() {}
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
-
- /*! Accessors for the light properties */
- inline const float * ambient() const
- {
- return Ambient;
- }
-
- inline const float * diffuse() const
- {
- return Diffuse;
- }
-
- inline const float * specular() const
- {
- return Specular;
- }
-
- inline const float * position() const
- {
- return Position;
- }
-
- inline bool isOn() const
- {
- return on;
- }
-
- inline int number() const
- {
- return _number;
- }
-
-private:
- // Data members
- // ============
-
- /*! on=true, the light is on */
- bool on;
-
- /*! The color definition */
- float Ambient[4];
- float Diffuse[4];
- float Specular[4];
-
- /*! Light position. if w = 0, the light is placed at infinite. */
- float Position[4];
-
- /*! used to manage the number of lights */
- /*! numberOfLights
- * the number of lights in the scene.
- * Initially, 0.
- */
- static int numberOfLights;
- /*! The current lignt number */
- int _number;
+class NodeLight : public Node {
+ public:
+ NodeLight();
+ NodeLight(NodeLight &iBrother);
+
+ virtual ~NodeLight()
+ {
+ }
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
+
+ /*! Accessors for the light properties */
+ inline const float *ambient() const
+ {
+ return Ambient;
+ }
+
+ inline const float *diffuse() const
+ {
+ return Diffuse;
+ }
+
+ inline const float *specular() const
+ {
+ return Specular;
+ }
+
+ inline const float *position() const
+ {
+ return Position;
+ }
+
+ inline bool isOn() const
+ {
+ return on;
+ }
+
+ inline int number() const
+ {
+ return _number;
+ }
+
+ private:
+ // Data members
+ // ============
+
+ /*! on=true, the light is on */
+ bool on;
+
+ /*! The color definition */
+ float Ambient[4];
+ float Diffuse[4];
+ float Specular[4];
+
+ /*! Light position. if w = 0, the light is placed at infinite. */
+ float Position[4];
+
+ /*! used to manage the number of lights */
+ /*! numberOfLights
+ * the number of lights in the scene.
+ * Initially, 0.
+ */
+ static int numberOfLights;
+ /*! The current lignt number */
+ int _number;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_LIGHT_H__
+#endif // __FREESTYLE_NODE_LIGHT_H__
diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.cpp b/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
index 56c8068ad62..b16ca3eda33 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
@@ -25,30 +25,30 @@ namespace Freestyle {
NodeShape::~NodeShape()
{
- vector<Rep *>::iterator rep;
+ vector<Rep *>::iterator rep;
- if (0 != _Shapes.size()) {
- for (rep = _Shapes.begin(); rep != _Shapes.end(); ++rep) {
- int refCount = (*rep)->destroy();
- if (0 == refCount)
- delete (*rep);
- }
+ if (0 != _Shapes.size()) {
+ for (rep = _Shapes.begin(); rep != _Shapes.end(); ++rep) {
+ int refCount = (*rep)->destroy();
+ if (0 == refCount)
+ delete (*rep);
+ }
- _Shapes.clear();
- }
+ _Shapes.clear();
+ }
}
-void NodeShape::accept(SceneVisitor& v)
+void NodeShape::accept(SceneVisitor &v)
{
- v.visitNodeShape(*this);
+ v.visitNodeShape(*this);
- v.visitFrsMaterial(_FrsMaterial);
+ v.visitFrsMaterial(_FrsMaterial);
- v.visitNodeShapeBefore(*this);
- vector<Rep *>::iterator rep;
- for (rep = _Shapes.begin(); rep != _Shapes.end(); ++rep)
- (*rep)->accept(v);
- v.visitNodeShapeAfter(*this);
+ v.visitNodeShapeBefore(*this);
+ vector<Rep *>::iterator rep;
+ for (rep = _Shapes.begin(); rep != _Shapes.end(); ++rep)
+ (*rep)->accept(v);
+ v.visitNodeShapeAfter(*this);
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.h b/source/blender/freestyle/intern/scene_graph/NodeShape.h
index f0dd24a9d14..ec7e09d6c88 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeShape.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeShape.h
@@ -39,57 +39,58 @@ namespace Freestyle {
using namespace Geometry;
-class NodeShape : public Node
-{
-public:
- inline NodeShape() : Node() {}
-
- virtual ~NodeShape();
-
- /*! Adds a Rep to the _Shapes list
- * The delete of the rep is done when it is not used any more by the Scene Manager.
- * So, it must not be deleted by the caller
- */
- virtual void AddRep(Rep *iRep)
- {
- if (NULL == iRep)
- return;
- _Shapes.push_back(iRep);
- iRep->addRef();
-
- // updates bbox:
- AddBBox(iRep->bbox());
- }
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
-
- /*! Sets the shape material */
- inline void setFrsMaterial(const FrsMaterial& iMaterial)
- {
- _FrsMaterial = iMaterial;
- }
-
- /*! accessors */
- /*! returns the shape's material */
- inline FrsMaterial& frs_material()
- {
- return _FrsMaterial;
- }
-
- inline const vector<Rep*>& shapes()
- {
- return _Shapes;
- }
-
-private:
- /*! list of shapes */
- vector<Rep*> _Shapes;
-
- /*! Shape Material */
- FrsMaterial _FrsMaterial;
+class NodeShape : public Node {
+ public:
+ inline NodeShape() : Node()
+ {
+ }
+
+ virtual ~NodeShape();
+
+ /*! Adds a Rep to the _Shapes list
+ * The delete of the rep is done when it is not used any more by the Scene Manager.
+ * So, it must not be deleted by the caller
+ */
+ virtual void AddRep(Rep *iRep)
+ {
+ if (NULL == iRep)
+ return;
+ _Shapes.push_back(iRep);
+ iRep->addRef();
+
+ // updates bbox:
+ AddBBox(iRep->bbox());
+ }
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
+
+ /*! Sets the shape material */
+ inline void setFrsMaterial(const FrsMaterial &iMaterial)
+ {
+ _FrsMaterial = iMaterial;
+ }
+
+ /*! accessors */
+ /*! returns the shape's material */
+ inline FrsMaterial &frs_material()
+ {
+ return _FrsMaterial;
+ }
+
+ inline const vector<Rep *> &shapes()
+ {
+ return _Shapes;
+ }
+
+ private:
+ /*! list of shapes */
+ vector<Rep *> _Shapes;
+
+ /*! Shape Material */
+ FrsMaterial _FrsMaterial;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_SHAPE_H__
+#endif // __FREESTYLE_NODE_SHAPE_H__
diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
index b4af715b3e4..69179eb6c84 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
@@ -28,142 +28,142 @@ namespace Freestyle {
void NodeTransform::Translate(real x, real y, real z)
{
- _Matrix(0, 3) += x;
- _Matrix(1, 3) += y;
- _Matrix(2, 3) += z;
+ _Matrix(0, 3) += x;
+ _Matrix(1, 3) += y;
+ _Matrix(2, 3) += z;
}
void NodeTransform::Rotate(real iAngle, real x, real y, real z)
{
- //Normalize the x,y,z vector;
- real norm = (real)sqrt(x * x + y * y + z * z);
- if (0 == norm)
- return;
-
- x /= norm;
- y /= norm;
- z /= norm;
-
- /* find the corresponding matrix with the Rodrigues formula:
- * R = I + sin(iAngle)*Ntilda + (1-cos(iAngle))*Ntilda*Ntilda
- */
- Matrix33r Ntilda;
- Ntilda(0, 0) = Ntilda(1, 1) = Ntilda(2, 2) = 0.0f;
- Ntilda(0, 1) = -z;
- Ntilda(0, 2) = y;
- Ntilda(1, 0) = z;
- Ntilda(1, 2) = -x;
- Ntilda(2, 0) = -y;
- Ntilda(2, 1) = x;
-
- const Matrix33r Ntilda2(Ntilda * Ntilda);
-
-
- const real sinAngle = (real)sin((iAngle / 180.0f) * M_PI);
- const real cosAngle = (real)cos((iAngle / 180.0f) * M_PI);
-
- Matrix33r NS(Ntilda * sinAngle);
- Matrix33r NC(Ntilda2 * (1.0f - cosAngle));
- Matrix33r R;
- R = Matrix33r::identity();
- R += NS + NC;
-
- // R4 is the corresponding 4x4 matrix
- Matrix44r R4;
- R4 = Matrix44r::identity();
-
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++)
- R4(i, j) = R(i, j);
- }
-
- // Finally, we multiply our current matrix by R4:
- Matrix44r mat_tmp(_Matrix);
- _Matrix = mat_tmp * R4;
+ //Normalize the x,y,z vector;
+ real norm = (real)sqrt(x * x + y * y + z * z);
+ if (0 == norm)
+ return;
+
+ x /= norm;
+ y /= norm;
+ z /= norm;
+
+ /* find the corresponding matrix with the Rodrigues formula:
+ * R = I + sin(iAngle)*Ntilda + (1-cos(iAngle))*Ntilda*Ntilda
+ */
+ Matrix33r Ntilda;
+ Ntilda(0, 0) = Ntilda(1, 1) = Ntilda(2, 2) = 0.0f;
+ Ntilda(0, 1) = -z;
+ Ntilda(0, 2) = y;
+ Ntilda(1, 0) = z;
+ Ntilda(1, 2) = -x;
+ Ntilda(2, 0) = -y;
+ Ntilda(2, 1) = x;
+
+ const Matrix33r Ntilda2(Ntilda * Ntilda);
+
+ const real sinAngle = (real)sin((iAngle / 180.0f) * M_PI);
+ const real cosAngle = (real)cos((iAngle / 180.0f) * M_PI);
+
+ Matrix33r NS(Ntilda * sinAngle);
+ Matrix33r NC(Ntilda2 * (1.0f - cosAngle));
+ Matrix33r R;
+ R = Matrix33r::identity();
+ R += NS + NC;
+
+ // R4 is the corresponding 4x4 matrix
+ Matrix44r R4;
+ R4 = Matrix44r::identity();
+
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 3; j++)
+ R4(i, j) = R(i, j);
+ }
+
+ // Finally, we multiply our current matrix by R4:
+ Matrix44r mat_tmp(_Matrix);
+ _Matrix = mat_tmp * R4;
}
void NodeTransform::Scale(real x, real y, real z)
{
- _Matrix(0, 0) *= x;
- _Matrix(1, 1) *= y;
- _Matrix(2, 2) *= z;
+ _Matrix(0, 0) *= x;
+ _Matrix(1, 1) *= y;
+ _Matrix(2, 2) *= z;
- _Scaled = true;
+ _Scaled = true;
}
void NodeTransform::MultiplyMatrix(const Matrix44r &iMatrix)
{
- Matrix44r mat_tmp(_Matrix);
- _Matrix = mat_tmp * iMatrix;
+ Matrix44r mat_tmp(_Matrix);
+ _Matrix = mat_tmp * iMatrix;
}
void NodeTransform::setMatrix(const Matrix44r &iMatrix)
{
- _Matrix = iMatrix;
- if (isScaled(iMatrix))
- _Scaled = true;
+ _Matrix = iMatrix;
+ if (isScaled(iMatrix))
+ _Scaled = true;
}
-void NodeTransform::accept(SceneVisitor& v)
+void NodeTransform::accept(SceneVisitor &v)
{
- v.visitNodeTransform(*this);
+ v.visitNodeTransform(*this);
- v.visitNodeTransformBefore(*this);
- for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end; ++node)
- (*node)->accept(v);
- v.visitNodeTransformAfter(*this);
+ v.visitNodeTransformBefore(*this);
+ for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end;
+ ++node)
+ (*node)->accept(v);
+ v.visitNodeTransformAfter(*this);
}
-void NodeTransform::AddBBox(const BBox<Vec3r>& iBBox)
+void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox)
{
- Vec3r oldMin(iBBox.getMin());
- Vec3r oldMax(iBBox.getMax());
-
- // compute the 8 corners of the bbox
- HVec3r box[8];
- box[0] = HVec3r(iBBox.getMin());
- box[1] = HVec3r(oldMax[0], oldMin[1], oldMin[2]);
- box[2] = HVec3r(oldMax[0], oldMax[1], oldMin[2]);
- box[3] = HVec3r(oldMin[0], oldMax[1], oldMin[2]);
- box[4] = HVec3r(oldMin[0], oldMin[1], oldMax[2]);
- box[5] = HVec3r(oldMax[0], oldMin[1], oldMax[2]);
- box[6] = HVec3r(oldMax[0], oldMax[1], oldMax[2]);
- box[7] = HVec3r(oldMin[0], oldMax[1], oldMax[2]);
-
- // Computes the transform iBBox
- HVec3r tbox[8];
- unsigned int i;
- for (i = 0; i < 8; i++)
- tbox[i] = _Matrix * box[i];
-
- Vec3r newMin(tbox[0]);
- Vec3r newMax(tbox[0]);
- for (i = 0; i < 8; i++) {
- for (unsigned int j = 0; j < 3; j++) {
- if (newMin[j] > tbox[i][j])
- newMin[j] = tbox[i][j];
- if (newMax[j] < tbox[i][j])
- newMax[j] = tbox[i][j];
- }
- }
-
- BBox<Vec3r> transformBox(newMin, newMax);
-
- Node::AddBBox(transformBox);
+ Vec3r oldMin(iBBox.getMin());
+ Vec3r oldMax(iBBox.getMax());
+
+ // compute the 8 corners of the bbox
+ HVec3r box[8];
+ box[0] = HVec3r(iBBox.getMin());
+ box[1] = HVec3r(oldMax[0], oldMin[1], oldMin[2]);
+ box[2] = HVec3r(oldMax[0], oldMax[1], oldMin[2]);
+ box[3] = HVec3r(oldMin[0], oldMax[1], oldMin[2]);
+ box[4] = HVec3r(oldMin[0], oldMin[1], oldMax[2]);
+ box[5] = HVec3r(oldMax[0], oldMin[1], oldMax[2]);
+ box[6] = HVec3r(oldMax[0], oldMax[1], oldMax[2]);
+ box[7] = HVec3r(oldMin[0], oldMax[1], oldMax[2]);
+
+ // Computes the transform iBBox
+ HVec3r tbox[8];
+ unsigned int i;
+ for (i = 0; i < 8; i++)
+ tbox[i] = _Matrix * box[i];
+
+ Vec3r newMin(tbox[0]);
+ Vec3r newMax(tbox[0]);
+ for (i = 0; i < 8; i++) {
+ for (unsigned int j = 0; j < 3; j++) {
+ if (newMin[j] > tbox[i][j])
+ newMin[j] = tbox[i][j];
+ if (newMax[j] < tbox[i][j])
+ newMax[j] = tbox[i][j];
+ }
+ }
+
+ BBox<Vec3r> transformBox(newMin, newMax);
+
+ Node::AddBBox(transformBox);
}
bool NodeTransform::isScaled(const Matrix44r &M)
{
- for (unsigned int j = 0; j < 3; j++) {
- real norm = 0;
- for (unsigned int i = 0; i < 3; i++) {
- norm += M(i, j) * M(i, j);
- }
- if ((norm > 1.01) || (norm < 0.99))
- return true;
- }
-
- return false;
+ for (unsigned int j = 0; j < 3; j++) {
+ real norm = 0;
+ for (unsigned int i = 0; i < 3; i++) {
+ norm += M(i, j) * M(i, j);
+ }
+ if ((norm > 1.01) || (norm < 0.99))
+ return true;
+ }
+
+ return false;
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.h b/source/blender/freestyle/intern/scene_graph/NodeTransform.h
index 29760cd1951..c816d30c03b 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeTransform.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.h
@@ -33,69 +33,70 @@ namespace Freestyle {
using namespace Geometry;
-class NodeTransform : public NodeGroup
-{
-public:
- inline NodeTransform() : NodeGroup()
- {
- _Matrix = Matrix44r::identity();
- _Scaled = false;
- }
-
- virtual ~NodeTransform() {}
-
- /*! multiplys the current matrix by the x, y, z translation matrix. */
- void Translate(real x, real y, real z);
-
- /*! multiplys the current matrix by a rotation matrix
- * iAngle
- * The rotation angle
- * x, y, z
- * The rotation axis
- */
- void Rotate(real iAngle, real x, real y, real z);
-
- /*! multiplys the current matrix by a scaling matrix.
- * x, y, z
- * The scaling coefficients with respect to the x,y,z axis
- */
- void Scale(real x, real y, real z);
-
- /*! Multiplys the current matrix by iMatrix */
- void MultiplyMatrix(const Matrix44r &iMatrix);
-
- /*! Sets the current matrix to iMatrix */
- void setMatrix(const Matrix44r &iMatrix);
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
-
- /*! Overloads the Node::AddBBox in order to take care about the transformation */
- virtual void AddBBox(const BBox<Vec3r>& iBBox);
-
- /*! Checks whether a matrix contains a scale factor or not.
- * Returns true if yes.
- * M
- * The matrix to check
- */
- bool isScaled(const Matrix44r &M);
-
- /*! accessors */
- inline const Matrix44r& matrix() const
- {
- return _Matrix;
- }
-
- inline bool scaled() const
- {
- return _Scaled;
- }
-
-private:
- Matrix44r _Matrix;
- bool _Scaled;
+class NodeTransform : public NodeGroup {
+ public:
+ inline NodeTransform() : NodeGroup()
+ {
+ _Matrix = Matrix44r::identity();
+ _Scaled = false;
+ }
+
+ virtual ~NodeTransform()
+ {
+ }
+
+ /*! multiplys the current matrix by the x, y, z translation matrix. */
+ void Translate(real x, real y, real z);
+
+ /*! multiplys the current matrix by a rotation matrix
+ * iAngle
+ * The rotation angle
+ * x, y, z
+ * The rotation axis
+ */
+ void Rotate(real iAngle, real x, real y, real z);
+
+ /*! multiplys the current matrix by a scaling matrix.
+ * x, y, z
+ * The scaling coefficients with respect to the x,y,z axis
+ */
+ void Scale(real x, real y, real z);
+
+ /*! Multiplys the current matrix by iMatrix */
+ void MultiplyMatrix(const Matrix44r &iMatrix);
+
+ /*! Sets the current matrix to iMatrix */
+ void setMatrix(const Matrix44r &iMatrix);
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
+
+ /*! Overloads the Node::AddBBox in order to take care about the transformation */
+ virtual void AddBBox(const BBox<Vec3r> &iBBox);
+
+ /*! Checks whether a matrix contains a scale factor or not.
+ * Returns true if yes.
+ * M
+ * The matrix to check
+ */
+ bool isScaled(const Matrix44r &M);
+
+ /*! accessors */
+ inline const Matrix44r &matrix() const
+ {
+ return _Matrix;
+ }
+
+ inline bool scaled() const
+ {
+ return _Scaled;
+ }
+
+ private:
+ Matrix44r _Matrix;
+ bool _Scaled;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_TRANSFORM_H__
+#endif // __FREESTYLE_NODE_TRANSFORM_H__
diff --git a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp
index 24e1e88afa0..6c64f8a53d9 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp
@@ -23,9 +23,9 @@
namespace Freestyle {
-void NodeViewLayer::accept(SceneVisitor& v)
+void NodeViewLayer::accept(SceneVisitor &v)
{
- v.visitNodeViewLayer(*this);
+ v.visitNodeViewLayer(*this);
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h
index 9a646208dec..f220bbfd6f1 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h
@@ -32,31 +32,34 @@ using namespace std;
namespace Freestyle {
-class NodeViewLayer : public Node
-{
-public:
- inline NodeViewLayer(Scene& scene, ViewLayer& view_layer) : Node(), _Scene(scene), _ViewLayer(view_layer) {}
- virtual ~NodeViewLayer() {}
+class NodeViewLayer : public Node {
+ public:
+ inline NodeViewLayer(Scene &scene, ViewLayer &view_layer)
+ : Node(), _Scene(scene), _ViewLayer(view_layer)
+ {
+ }
+ virtual ~NodeViewLayer()
+ {
+ }
- inline struct Scene& scene() const
- {
- return _Scene;
- }
+ inline struct Scene &scene() const
+ {
+ return _Scene;
+ }
- inline struct ViewLayer& sceneLayer() const
- {
- return _ViewLayer;
- }
+ inline struct ViewLayer &sceneLayer() const
+ {
+ return _ViewLayer;
+ }
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
-protected:
-
- Scene& _Scene;
- ViewLayer& _ViewLayer;
+ protected:
+ Scene &_Scene;
+ ViewLayer &_ViewLayer;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_NODE_VIEW_LAYER_H__
+#endif // __FREESTYLE_NODE_VIEW_LAYER_H__
diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
index ba1dfe7478e..60730528f1a 100644
--- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
@@ -25,13 +25,13 @@
namespace Freestyle {
-void OrientedLineRep::accept(SceneVisitor& v)
+void OrientedLineRep::accept(SceneVisitor &v)
{
- Rep::accept(v);
- if (!frs_material())
- v.visitOrientedLineRep(*this);
- else
- v.visitLineRep(*this);
+ Rep::accept(v);
+ if (!frs_material())
+ v.visitOrientedLineRep(*this);
+ else
+ v.visitLineRep(*this);
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h
index af06840419e..2e39259077e 100644
--- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h
+++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h
@@ -28,30 +28,39 @@
namespace Freestyle {
-class OrientedLineRep : public LineRep
-{
-public:
- OrientedLineRep() : LineRep() {}
- /*! Builds a single line from 2 vertices
- * v1
- * first vertex
- * v2
- * second vertex
- */
- inline OrientedLineRep(const Vec3r& v1, const Vec3r& v2) : LineRep(v1, v2) {}
-
- /*! Builds a line rep from a vertex chain */
- inline OrientedLineRep(const vector<Vec3r>& vertices) : LineRep(vertices) {}
-
- /*! Builds a line rep from a vertex chain */
- inline OrientedLineRep(const list<Vec3r>& vertices) : LineRep(vertices) {}
-
- virtual ~OrientedLineRep() {}
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v);
+class OrientedLineRep : public LineRep {
+ public:
+ OrientedLineRep() : LineRep()
+ {
+ }
+ /*! Builds a single line from 2 vertices
+ * v1
+ * first vertex
+ * v2
+ * second vertex
+ */
+ inline OrientedLineRep(const Vec3r &v1, const Vec3r &v2) : LineRep(v1, v2)
+ {
+ }
+
+ /*! Builds a line rep from a vertex chain */
+ inline OrientedLineRep(const vector<Vec3r> &vertices) : LineRep(vertices)
+ {
+ }
+
+ /*! Builds a line rep from a vertex chain */
+ inline OrientedLineRep(const list<Vec3r> &vertices) : LineRep(vertices)
+ {
+ }
+
+ virtual ~OrientedLineRep()
+ {
+ }
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v);
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_ORIENTED_LINE_REP_H__
+#endif // __FREESTYLE_ORIENTED_LINE_REP_H__
diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h
index db4e9e6782b..7b5e752ea07 100644
--- a/source/blender/freestyle/intern/scene_graph/Rep.h
+++ b/source/blender/freestyle/intern/scene_graph/Rep.h
@@ -40,143 +40,142 @@ namespace Freestyle {
using namespace Geometry;
-class Rep : public BaseObject
-{
-public:
- inline Rep() : BaseObject()
- {
- _Id = 0;
- _FrsMaterial = 0;
- }
-
- inline Rep(const Rep& iBrother) : BaseObject()
- {
- _Id = iBrother._Id;
- _Name = iBrother._Name;
- _LibraryPath = iBrother._LibraryPath;
- if (0 == iBrother._FrsMaterial)
- _FrsMaterial = 0;
- else
- _FrsMaterial = new FrsMaterial(*(iBrother._FrsMaterial));
-
- _BBox = iBrother.bbox();
- }
-
- inline void swap(Rep& ioOther)
- {
- std::swap(_BBox, ioOther._BBox);
- std::swap(_Id, ioOther._Id);
- std::swap(_Name, ioOther._Name);
- std::swap(_LibraryPath, ioOther._LibraryPath);
- std::swap(_FrsMaterial, ioOther._FrsMaterial);
- }
-
- Rep& operator=(const Rep& iBrother)
- {
- if (&iBrother != this) {
- _Id = iBrother._Id;
- _Name = iBrother._Name;
- _LibraryPath = iBrother._LibraryPath;
- if (0 == iBrother._FrsMaterial) {
- _FrsMaterial = 0;
- }
- else {
- if (_FrsMaterial == 0) {
- _FrsMaterial = new FrsMaterial(*iBrother._FrsMaterial);
- }
- else {
- (*_FrsMaterial) = (*(iBrother._FrsMaterial));
- }
- _BBox = iBrother.bbox();
- }
- }
- return *this;
- }
-
- virtual ~Rep()
- {
- if (0 != _FrsMaterial) {
- delete _FrsMaterial;
- _FrsMaterial = 0;
- }
- }
-
- /*! Accept the corresponding visitor
- * Must be overload by inherited classes
- */
- virtual void accept(SceneVisitor& v)
- {
- if (_FrsMaterial)
- v.visitFrsMaterial(*_FrsMaterial);
- v.visitRep(*this);
- }
-
- /*! Computes the rep bounding box.
- * Each Inherited rep must compute its bbox depending on the way the data are stored. So, each inherited class
- * must overload this method
- */
- virtual void ComputeBBox() = 0;
-
- /*! Returns the rep bounding box */
- virtual const BBox<Vec3f>& bbox() const
- {
- return _BBox;
- }
-
- inline Id getId() const
- {
- return _Id;
- }
-
- inline const string& getName() const
- {
- return _Name;
- }
-
- inline const string& getLibraryPath() const
- {
- return _LibraryPath;
- }
-
- inline const FrsMaterial *frs_material() const
- {
- return _FrsMaterial;
- }
-
- /*! Sets the Rep bounding box */
- virtual void setBBox(const BBox<Vec3f>& iBox)
- {
- _BBox = iBox;
- }
-
- inline void setId(const Id& id)
- {
- _Id = id;
- }
-
- inline void setName(const string& name)
- {
- _Name = name;
- }
-
- inline void setLibraryPath(const string& path)
- {
- _LibraryPath = path;
- }
-
- inline void setFrsMaterial(const FrsMaterial& iMaterial)
- {
- _FrsMaterial = new FrsMaterial(iMaterial);
- }
-
-private:
- BBox<Vec3f> _BBox;
- Id _Id;
- string _Name;
- string _LibraryPath;
- FrsMaterial *_FrsMaterial;
+class Rep : public BaseObject {
+ public:
+ inline Rep() : BaseObject()
+ {
+ _Id = 0;
+ _FrsMaterial = 0;
+ }
+
+ inline Rep(const Rep &iBrother) : BaseObject()
+ {
+ _Id = iBrother._Id;
+ _Name = iBrother._Name;
+ _LibraryPath = iBrother._LibraryPath;
+ if (0 == iBrother._FrsMaterial)
+ _FrsMaterial = 0;
+ else
+ _FrsMaterial = new FrsMaterial(*(iBrother._FrsMaterial));
+
+ _BBox = iBrother.bbox();
+ }
+
+ inline void swap(Rep &ioOther)
+ {
+ std::swap(_BBox, ioOther._BBox);
+ std::swap(_Id, ioOther._Id);
+ std::swap(_Name, ioOther._Name);
+ std::swap(_LibraryPath, ioOther._LibraryPath);
+ std::swap(_FrsMaterial, ioOther._FrsMaterial);
+ }
+
+ Rep &operator=(const Rep &iBrother)
+ {
+ if (&iBrother != this) {
+ _Id = iBrother._Id;
+ _Name = iBrother._Name;
+ _LibraryPath = iBrother._LibraryPath;
+ if (0 == iBrother._FrsMaterial) {
+ _FrsMaterial = 0;
+ }
+ else {
+ if (_FrsMaterial == 0) {
+ _FrsMaterial = new FrsMaterial(*iBrother._FrsMaterial);
+ }
+ else {
+ (*_FrsMaterial) = (*(iBrother._FrsMaterial));
+ }
+ _BBox = iBrother.bbox();
+ }
+ }
+ return *this;
+ }
+
+ virtual ~Rep()
+ {
+ if (0 != _FrsMaterial) {
+ delete _FrsMaterial;
+ _FrsMaterial = 0;
+ }
+ }
+
+ /*! Accept the corresponding visitor
+ * Must be overload by inherited classes
+ */
+ virtual void accept(SceneVisitor &v)
+ {
+ if (_FrsMaterial)
+ v.visitFrsMaterial(*_FrsMaterial);
+ v.visitRep(*this);
+ }
+
+ /*! Computes the rep bounding box.
+ * Each Inherited rep must compute its bbox depending on the way the data are stored. So, each inherited class
+ * must overload this method
+ */
+ virtual void ComputeBBox() = 0;
+
+ /*! Returns the rep bounding box */
+ virtual const BBox<Vec3f> &bbox() const
+ {
+ return _BBox;
+ }
+
+ inline Id getId() const
+ {
+ return _Id;
+ }
+
+ inline const string &getName() const
+ {
+ return _Name;
+ }
+
+ inline const string &getLibraryPath() const
+ {
+ return _LibraryPath;
+ }
+
+ inline const FrsMaterial *frs_material() const
+ {
+ return _FrsMaterial;
+ }
+
+ /*! Sets the Rep bounding box */
+ virtual void setBBox(const BBox<Vec3f> &iBox)
+ {
+ _BBox = iBox;
+ }
+
+ inline void setId(const Id &id)
+ {
+ _Id = id;
+ }
+
+ inline void setName(const string &name)
+ {
+ _Name = name;
+ }
+
+ inline void setLibraryPath(const string &path)
+ {
+ _LibraryPath = path;
+ }
+
+ inline void setFrsMaterial(const FrsMaterial &iMaterial)
+ {
+ _FrsMaterial = new FrsMaterial(iMaterial);
+ }
+
+ private:
+ BBox<Vec3f> _BBox;
+ Id _Id;
+ string _Name;
+ string _LibraryPath;
+ FrsMaterial *_FrsMaterial;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_REP_H__
+#endif // __FREESTYLE_REP_H__
diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
index fcecb67cae9..b5d954664e4 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
+++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
@@ -26,55 +26,55 @@ namespace Freestyle {
string SceneHash::toString()
{
- stringstream ss;
- ss << hex << _sum;
- return ss.str();
+ stringstream ss;
+ ss << hex << _sum;
+ return ss.str();
}
-void SceneHash::visitNodeViewLayer(NodeViewLayer& node)
+void SceneHash::visitNodeViewLayer(NodeViewLayer &node)
{
- struct RenderData *r = &node.scene().r;
- adler32((unsigned char *)&r->xsch, sizeof(r->xsch)); // resolution_x
- adler32((unsigned char *)&r->ysch, sizeof(r->ysch)); // resolution_y
- adler32((unsigned char *)&r->size, sizeof(r->size)); // resolution_percentage
+ struct RenderData *r = &node.scene().r;
+ adler32((unsigned char *)&r->xsch, sizeof(r->xsch)); // resolution_x
+ adler32((unsigned char *)&r->ysch, sizeof(r->ysch)); // resolution_y
+ adler32((unsigned char *)&r->size, sizeof(r->size)); // resolution_percentage
- struct FreestyleConfig *config = &node.sceneLayer().freestyle_config;
- adler32((unsigned char *)&config->flags, sizeof(config->flags));
- adler32((unsigned char *)&config->crease_angle, sizeof(config->crease_angle));
- adler32((unsigned char *)&config->sphere_radius, sizeof(config->sphere_radius));
- adler32((unsigned char *)&config->dkr_epsilon, sizeof(config->dkr_epsilon));
+ struct FreestyleConfig *config = &node.sceneLayer().freestyle_config;
+ adler32((unsigned char *)&config->flags, sizeof(config->flags));
+ adler32((unsigned char *)&config->crease_angle, sizeof(config->crease_angle));
+ adler32((unsigned char *)&config->sphere_radius, sizeof(config->sphere_radius));
+ adler32((unsigned char *)&config->dkr_epsilon, sizeof(config->dkr_epsilon));
}
-void SceneHash::visitNodeCamera(NodeCamera& cam)
+void SceneHash::visitNodeCamera(NodeCamera &cam)
{
- double *proj = cam.projectionMatrix();
- for (int i = 0; i < 16; i++) {
- adler32((unsigned char *)&proj[i], sizeof(double));
- }
+ double *proj = cam.projectionMatrix();
+ for (int i = 0; i < 16; i++) {
+ adler32((unsigned char *)&proj[i], sizeof(double));
+ }
}
-void SceneHash::visitIndexedFaceSet(IndexedFaceSet& ifs)
+void SceneHash::visitIndexedFaceSet(IndexedFaceSet &ifs)
{
- const float *v = ifs.vertices();
- const unsigned n = ifs.vsize();
+ const float *v = ifs.vertices();
+ const unsigned n = ifs.vsize();
- for (unsigned i = 0; i < n; i++) {
- adler32((unsigned char *)&v[i], sizeof(v[i]));
- }
+ for (unsigned i = 0; i < n; i++) {
+ adler32((unsigned char *)&v[i], sizeof(v[i]));
+ }
}
static const int MOD_ADLER = 65521;
void SceneHash::adler32(unsigned char *data, int size)
{
- uint32_t sum1 = _sum & 0xffff;
- uint32_t sum2 = (_sum >> 16) & 0xffff;
+ uint32_t sum1 = _sum & 0xffff;
+ uint32_t sum2 = (_sum >> 16) & 0xffff;
- for (int i = 0; i < size; i++) {
- sum1 = (sum1 + data[i]) % MOD_ADLER;
- sum2 = (sum1 + sum2) % MOD_ADLER;
- }
- _sum = sum1 | (sum2 << 16);
+ for (int i = 0; i < size; i++) {
+ sum1 = (sum1 + data[i]) % MOD_ADLER;
+ sum2 = (sum1 + sum2) % MOD_ADLER;
+ }
+ _sum = sum1 | (sum2 << 16);
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.h b/source/blender/freestyle/intern/scene_graph/SceneHash.h
index 4c6bd6216d0..05a8aadc8c5 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneHash.h
+++ b/source/blender/freestyle/intern/scene_graph/SceneHash.h
@@ -29,50 +29,54 @@
#include "BLI_sys_types.h"
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class SceneHash : public SceneVisitor
-{
-public:
- inline SceneHash() : SceneVisitor()
- {
- _sum = 1;
- }
+class SceneHash : public SceneVisitor {
+ public:
+ inline SceneHash() : SceneVisitor()
+ {
+ _sum = 1;
+ }
- virtual ~SceneHash() {}
+ virtual ~SceneHash()
+ {
+ }
- VISIT_DECL(NodeCamera)
- VISIT_DECL(NodeViewLayer)
- VISIT_DECL(IndexedFaceSet)
+ VISIT_DECL(NodeCamera)
+ VISIT_DECL(NodeViewLayer)
+ VISIT_DECL(IndexedFaceSet)
- string toString();
+ string toString();
- inline bool match() {
- return _sum == _prevSum;
- }
+ inline bool match()
+ {
+ return _sum == _prevSum;
+ }
- inline void store() {
- _prevSum = _sum;
- }
+ inline void store()
+ {
+ _prevSum = _sum;
+ }
- inline void reset() {
- _sum = 1;
- }
+ inline void reset()
+ {
+ _sum = 1;
+ }
-private:
- void adler32(unsigned char *data, int size);
+ private:
+ void adler32(unsigned char *data, int size);
- uint32_t _sum;
- uint32_t _prevSum;
+ uint32_t _sum;
+ uint32_t _prevSum;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SceneHash")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SceneHash")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_SCENE_HASH_H__
+#endif // __FREESTYLE_SCENE_HASH_H__
diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
index 29da69a37ee..0c533232179 100644
--- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
+++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
@@ -26,11 +26,11 @@
namespace Freestyle {
-#define VISIT(CLASS) \
- void ScenePrettyPrinter::visit##CLASS(CLASS&) \
- { \
- _ofs << _space << #CLASS << endl; \
- }
+#define VISIT(CLASS) \
+ void ScenePrettyPrinter::visit##CLASS(CLASS &) \
+ { \
+ _ofs << _space << #CLASS << endl; \
+ }
VISIT(Node)
VISIT(NodeShape)
@@ -39,44 +39,44 @@ VISIT(NodeLight)
VISIT(NodeDrawingStyle)
VISIT(NodeTransform)
-void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape&)
+void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape &)
{
- increaseSpace();
+ increaseSpace();
}
-void ScenePrettyPrinter::visitNodeShapeAfter(NodeShape&)
+void ScenePrettyPrinter::visitNodeShapeAfter(NodeShape &)
{
- decreaseSpace();
+ decreaseSpace();
}
-void ScenePrettyPrinter::visitNodeGroupBefore(NodeGroup&)
+void ScenePrettyPrinter::visitNodeGroupBefore(NodeGroup &)
{
- increaseSpace();
+ increaseSpace();
}
-void ScenePrettyPrinter::visitNodeGroupAfter(NodeGroup&)
+void ScenePrettyPrinter::visitNodeGroupAfter(NodeGroup &)
{
- decreaseSpace();
+ decreaseSpace();
}
-void ScenePrettyPrinter::visitNodeDrawingStyleBefore(NodeDrawingStyle&)
+void ScenePrettyPrinter::visitNodeDrawingStyleBefore(NodeDrawingStyle &)
{
- increaseSpace();
+ increaseSpace();
}
-void ScenePrettyPrinter::visitNodeDrawingStyleAfter(NodeDrawingStyle&)
+void ScenePrettyPrinter::visitNodeDrawingStyleAfter(NodeDrawingStyle &)
{
- decreaseSpace();
+ decreaseSpace();
}
-void ScenePrettyPrinter::visitNodeTransformBefore(NodeTransform&)
+void ScenePrettyPrinter::visitNodeTransformBefore(NodeTransform &)
{
- increaseSpace();
+ increaseSpace();
}
-void ScenePrettyPrinter::visitNodeTransformAfter(NodeTransform&)
+void ScenePrettyPrinter::visitNodeTransformAfter(NodeTransform &)
{
- decreaseSpace();
+ decreaseSpace();
}
VISIT(LineRep)
@@ -84,17 +84,18 @@ VISIT(OrientedLineRep)
VISIT(TriangleRep)
VISIT(VertexRep)
-void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet& ifs)
+void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs)
{
- const float *vertices = ifs.vertices();
- unsigned vsize = ifs.vsize();
-
- _ofs << _space << "IndexedFaceSet" << endl;
- const float *p = vertices;
- for (unsigned int i = 0; i < vsize / 3; i++) {
- _ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", " << p[2] << endl;
- p += 3;
- }
+ const float *vertices = ifs.vertices();
+ unsigned vsize = ifs.vsize();
+
+ _ofs << _space << "IndexedFaceSet" << endl;
+ const float *p = vertices;
+ for (unsigned int i = 0; i < vsize / 3; i++) {
+ _ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", "
+ << p[2] << endl;
+ p += 3;
+ }
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
index 715f78ab044..989e9e36faa 100644
--- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
+++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
@@ -32,68 +32,66 @@ using namespace std;
namespace Freestyle {
-class ScenePrettyPrinter : public SceneVisitor
-{
-public:
- ScenePrettyPrinter(const string filename = "SceneLog.txt") : SceneVisitor()
- {
- if (!filename.empty())
- _ofs.open(filename.c_str());
- if (!_ofs.is_open())
- cerr << "Warning, unable to open file \"" << filename << "\"" << endl;
- _space = "";
- }
-
- virtual ~ScenePrettyPrinter()
- {
- if (_ofs.is_open())
- _ofs.close();
- }
-
-
- //
- // visitClass methods
- //
- //////////////////////////////////////////////
-
- VISIT_DECL(Node);
- VISIT_DECL(NodeShape);
- VISIT_DECL(NodeGroup);
- VISIT_DECL(NodeLight);
- VISIT_DECL(NodeDrawingStyle);
- VISIT_DECL(NodeTransform);
-
- VISIT_DECL(LineRep);
- VISIT_DECL(OrientedLineRep);
- VISIT_DECL(TriangleRep);
- VISIT_DECL(VertexRep);
- VISIT_DECL(IndexedFaceSet);
-
- virtual void visitNodeShapeBefore(NodeShape&);
- virtual void visitNodeShapeAfter(NodeShape&);
- virtual void visitNodeGroupBefore(NodeGroup&);
- virtual void visitNodeGroupAfter(NodeGroup&);
- virtual void visitNodeDrawingStyleBefore(NodeDrawingStyle&);
- virtual void visitNodeDrawingStyleAfter(NodeDrawingStyle&);
- virtual void visitNodeTransformBefore(NodeTransform&);
- virtual void visitNodeTransformAfter(NodeTransform&);
-
-protected:
- void increaseSpace()
- {
- _space += " ";
- }
-
- void decreaseSpace()
- {
- _space.erase(0, 2);
- }
-
-private:
- ofstream _ofs;
- string _space;
+class ScenePrettyPrinter : public SceneVisitor {
+ public:
+ ScenePrettyPrinter(const string filename = "SceneLog.txt") : SceneVisitor()
+ {
+ if (!filename.empty())
+ _ofs.open(filename.c_str());
+ if (!_ofs.is_open())
+ cerr << "Warning, unable to open file \"" << filename << "\"" << endl;
+ _space = "";
+ }
+
+ virtual ~ScenePrettyPrinter()
+ {
+ if (_ofs.is_open())
+ _ofs.close();
+ }
+
+ //
+ // visitClass methods
+ //
+ //////////////////////////////////////////////
+
+ VISIT_DECL(Node);
+ VISIT_DECL(NodeShape);
+ VISIT_DECL(NodeGroup);
+ VISIT_DECL(NodeLight);
+ VISIT_DECL(NodeDrawingStyle);
+ VISIT_DECL(NodeTransform);
+
+ VISIT_DECL(LineRep);
+ VISIT_DECL(OrientedLineRep);
+ VISIT_DECL(TriangleRep);
+ VISIT_DECL(VertexRep);
+ VISIT_DECL(IndexedFaceSet);
+
+ virtual void visitNodeShapeBefore(NodeShape &);
+ virtual void visitNodeShapeAfter(NodeShape &);
+ virtual void visitNodeGroupBefore(NodeGroup &);
+ virtual void visitNodeGroupAfter(NodeGroup &);
+ virtual void visitNodeDrawingStyleBefore(NodeDrawingStyle &);
+ virtual void visitNodeDrawingStyleAfter(NodeDrawingStyle &);
+ virtual void visitNodeTransformBefore(NodeTransform &);
+ virtual void visitNodeTransformAfter(NodeTransform &);
+
+ protected:
+ void increaseSpace()
+ {
+ _space += " ";
+ }
+
+ void decreaseSpace()
+ {
+ _space.erase(0, 2);
+ }
+
+ private:
+ ofstream _ofs;
+ string _space;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_SCENE_PRETTY_PRINTER_H__
+#endif // __FREESTYLE_SCENE_PRETTY_PRINTER_H__
diff --git a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h
index 67b89f014cf..d1b64663ca9 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h
+++ b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h
@@ -25,23 +25,28 @@
#include "../system/FreestyleConfig.h"
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-#define VISIT_COMPLETE_DEF(type) \
- virtual void visit##type(type&) {} \
- virtual void visit##type##Before(type&) {} \
- virtual void visit##type##After(type&) {}
+#define VISIT_COMPLETE_DEF(type) \
+ virtual void visit##type(type &) \
+ { \
+ } \
+ virtual void visit##type##Before(type &) \
+ { \
+ } \
+ virtual void visit##type##After(type &) \
+ { \
+ }
-#define VISIT_DECL(type) \
- virtual void visit##type(type&);
+#define VISIT_DECL(type) virtual void visit##type(type &);
-#define VISIT_COMPLETE_DECL(type) \
- virtual void visit##type##Before(type&); \
- virtual void visit##type(type&); \
- virtual void visit##type##After(type&);
+#define VISIT_COMPLETE_DECL(type) \
+ virtual void visit##type##Before(type &); \
+ virtual void visit##type(type &); \
+ virtual void visit##type##After(type &);
class Node;
class NodeShape;
@@ -61,43 +66,50 @@ class IndexedFaceSet;
class DrawingStyle;
class FrsMaterial;
-class SceneVisitor
-{
-public:
- SceneVisitor() {}
- virtual ~SceneVisitor() {}
-
- virtual void beginScene() {}
- virtual void endScene() {}
-
- //
- // visitClass methods
- //
- //////////////////////////////////////////////
-
- VISIT_COMPLETE_DEF(Node)
- VISIT_COMPLETE_DEF(NodeShape)
- VISIT_COMPLETE_DEF(NodeGroup)
- VISIT_COMPLETE_DEF(NodeLight)
- VISIT_COMPLETE_DEF(NodeCamera)
- VISIT_COMPLETE_DEF(NodeDrawingStyle)
- VISIT_COMPLETE_DEF(NodeTransform)
- VISIT_COMPLETE_DEF(NodeViewLayer)
-
- VISIT_COMPLETE_DEF(Rep)
- VISIT_COMPLETE_DEF(LineRep)
- VISIT_COMPLETE_DEF(OrientedLineRep)
- VISIT_COMPLETE_DEF(TriangleRep)
- VISIT_COMPLETE_DEF(VertexRep)
- VISIT_COMPLETE_DEF(IndexedFaceSet)
- VISIT_COMPLETE_DEF(DrawingStyle)
- VISIT_COMPLETE_DEF(FrsMaterial)
+class SceneVisitor {
+ public:
+ SceneVisitor()
+ {
+ }
+ virtual ~SceneVisitor()
+ {
+ }
+
+ virtual void beginScene()
+ {
+ }
+ virtual void endScene()
+ {
+ }
+
+ //
+ // visitClass methods
+ //
+ //////////////////////////////////////////////
+
+ VISIT_COMPLETE_DEF(Node)
+ VISIT_COMPLETE_DEF(NodeShape)
+ VISIT_COMPLETE_DEF(NodeGroup)
+ VISIT_COMPLETE_DEF(NodeLight)
+ VISIT_COMPLETE_DEF(NodeCamera)
+ VISIT_COMPLETE_DEF(NodeDrawingStyle)
+ VISIT_COMPLETE_DEF(NodeTransform)
+ VISIT_COMPLETE_DEF(NodeViewLayer)
+
+ VISIT_COMPLETE_DEF(Rep)
+ VISIT_COMPLETE_DEF(LineRep)
+ VISIT_COMPLETE_DEF(OrientedLineRep)
+ VISIT_COMPLETE_DEF(TriangleRep)
+ VISIT_COMPLETE_DEF(VertexRep)
+ VISIT_COMPLETE_DEF(IndexedFaceSet)
+ VISIT_COMPLETE_DEF(DrawingStyle)
+ VISIT_COMPLETE_DEF(FrsMaterial)
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SceneVisitor")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SceneVisitor")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_SCENE_VISITOR_H__
+#endif // __FREESTYLE_SCENE_VISITOR_H__
diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
index dbd5efc65f5..ab8ee9e9bb6 100644
--- a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
@@ -25,36 +25,36 @@ namespace Freestyle {
void TriangleRep::ComputeBBox()
{
- real XMax = _vertices[0][0];
- real YMax = _vertices[0][1];
- real ZMax = _vertices[0][2];
-
- real XMin = _vertices[0][0];
- real YMin = _vertices[0][1];
- real ZMin = _vertices[0][2];
-
- // parse all the coordinates to find the XMax, YMax, ZMax
- for (int i = 0; i < 3; ++i) {
- // X
- if (_vertices[i][0] > XMax)
- XMax = _vertices[i][0];
- if (_vertices[i][0] < XMin)
- XMin = _vertices[i][0];
-
- // Y
- if (_vertices[i][1] > YMax)
- YMax = _vertices[i][1];
- if (_vertices[i][1] < YMin)
- YMin = _vertices[i][1];
-
- // Z
- if (_vertices[i][2] > ZMax)
- ZMax = _vertices[i][2];
- if (_vertices[i][2] < ZMin)
- ZMin = _vertices[i][2];
- }
-
- setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
+ real XMax = _vertices[0][0];
+ real YMax = _vertices[0][1];
+ real ZMax = _vertices[0][2];
+
+ real XMin = _vertices[0][0];
+ real YMin = _vertices[0][1];
+ real ZMin = _vertices[0][2];
+
+ // parse all the coordinates to find the XMax, YMax, ZMax
+ for (int i = 0; i < 3; ++i) {
+ // X
+ if (_vertices[i][0] > XMax)
+ XMax = _vertices[i][0];
+ if (_vertices[i][0] < XMin)
+ XMin = _vertices[i][0];
+
+ // Y
+ if (_vertices[i][1] > YMax)
+ YMax = _vertices[i][1];
+ if (_vertices[i][1] < YMin)
+ YMin = _vertices[i][1];
+
+ // Z
+ if (_vertices[i][2] > ZMax)
+ ZMax = _vertices[i][2];
+ if (_vertices[i][2] < ZMin)
+ ZMin = _vertices[i][2];
+ }
+
+ setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.h b/source/blender/freestyle/intern/scene_graph/TriangleRep.h
index 364943a14ba..5385ae941cd 100644
--- a/source/blender/freestyle/intern/scene_graph/TriangleRep.h
+++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.h
@@ -28,112 +28,117 @@
namespace Freestyle {
/*! Base class for all lines objects */
-class TriangleRep : public Rep
-{
-public:
- /*! Line description style */
- enum TRIANGLE_STYLE {
- FILL,
- LINES,
- };
-
-private:
- TRIANGLE_STYLE _Style;
- Vec3r _vertices[3];
- Vec3r _colors[3];
-
-public:
- inline TriangleRep() : Rep()
- {
- _Style = FILL;
- }
-
- /*! Builds a triangle from 3 vertices
- * v0
- * first vertex
- * v1
- * second vertex
- * v2
- * third vertex
- */
- inline TriangleRep(const Vec3r& v0, const Vec3r& v1, const Vec3r& v2) : Rep()
- {
- _vertices[0] = v0;
- _vertices[1] = v1;
- _vertices[2] = v2;
- _Style = FILL;
- }
-
- inline TriangleRep(const Vec3r& v0, const Vec3r& c0, const Vec3r& v1, const Vec3r& c1,
- const Vec3r& v2, const Vec3r& c2)
- : Rep()
- {
- _vertices[0] = v0;
- _vertices[1] = v1;
- _vertices[2] = v2;
- _colors[0] = c0;
- _colors[1] = c1;
- _colors[2] = c2;
- _Style = FILL;
- }
-
- virtual ~TriangleRep() {}
-
- /*! accessors */
- inline const TRIANGLE_STYLE style() const
- {
- return _Style;
- }
-
- inline const Vec3r& vertex(int index) const
- {
- return _vertices[index];
- }
-
- inline const Vec3r& color(int index) const
- {
- return _colors[index];
- }
-
- /*! modifiers */
- inline void setStyle(const TRIANGLE_STYLE iStyle)
- {
- _Style = iStyle;
- }
-
- inline void setVertex(int index, const Vec3r& iVertex)
- {
- _vertices[index] = iVertex;
- }
-
- inline void setColor(int index, const Vec3r& iColor)
- {
- _colors[index] = iColor;
- }
-
- inline void setVertices(const Vec3r& v0, const Vec3r& v1, const Vec3r& v2)
- {
- _vertices[0] = v0;
- _vertices[1] = v1;
- _vertices[2] = v2;
- }
-
- inline void setColors(const Vec3r& c0, const Vec3r& c1, const Vec3r& c2)
- {
- _colors[0] = c0;
- _colors[1] = c1;
- _colors[2] = c2;
- }
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v)
- {
- Rep::accept(v);
- v.visitTriangleRep(*this);
- }
-
- /*! Computes the triangle bounding box.*/
- virtual void ComputeBBox();
+class TriangleRep : public Rep {
+ public:
+ /*! Line description style */
+ enum TRIANGLE_STYLE {
+ FILL,
+ LINES,
+ };
+
+ private:
+ TRIANGLE_STYLE _Style;
+ Vec3r _vertices[3];
+ Vec3r _colors[3];
+
+ public:
+ inline TriangleRep() : Rep()
+ {
+ _Style = FILL;
+ }
+
+ /*! Builds a triangle from 3 vertices
+ * v0
+ * first vertex
+ * v1
+ * second vertex
+ * v2
+ * third vertex
+ */
+ inline TriangleRep(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2) : Rep()
+ {
+ _vertices[0] = v0;
+ _vertices[1] = v1;
+ _vertices[2] = v2;
+ _Style = FILL;
+ }
+
+ inline TriangleRep(const Vec3r &v0,
+ const Vec3r &c0,
+ const Vec3r &v1,
+ const Vec3r &c1,
+ const Vec3r &v2,
+ const Vec3r &c2)
+ : Rep()
+ {
+ _vertices[0] = v0;
+ _vertices[1] = v1;
+ _vertices[2] = v2;
+ _colors[0] = c0;
+ _colors[1] = c1;
+ _colors[2] = c2;
+ _Style = FILL;
+ }
+
+ virtual ~TriangleRep()
+ {
+ }
+
+ /*! accessors */
+ inline const TRIANGLE_STYLE style() const
+ {
+ return _Style;
+ }
+
+ inline const Vec3r &vertex(int index) const
+ {
+ return _vertices[index];
+ }
+
+ inline const Vec3r &color(int index) const
+ {
+ return _colors[index];
+ }
+
+ /*! modifiers */
+ inline void setStyle(const TRIANGLE_STYLE iStyle)
+ {
+ _Style = iStyle;
+ }
+
+ inline void setVertex(int index, const Vec3r &iVertex)
+ {
+ _vertices[index] = iVertex;
+ }
+
+ inline void setColor(int index, const Vec3r &iColor)
+ {
+ _colors[index] = iColor;
+ }
+
+ inline void setVertices(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2)
+ {
+ _vertices[0] = v0;
+ _vertices[1] = v1;
+ _vertices[2] = v2;
+ }
+
+ inline void setColors(const Vec3r &c0, const Vec3r &c1, const Vec3r &c2)
+ {
+ _colors[0] = c0;
+ _colors[1] = c1;
+ _colors[2] = c2;
+ }
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v)
+ {
+ Rep::accept(v);
+ v.visitTriangleRep(*this);
+ }
+
+ /*! Computes the triangle bounding box.*/
+ virtual void ComputeBBox();
};
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/VertexRep.cpp b/source/blender/freestyle/intern/scene_graph/VertexRep.cpp
index 47462d0f497..164b9af9ac7 100644
--- a/source/blender/freestyle/intern/scene_graph/VertexRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/VertexRep.cpp
@@ -25,8 +25,8 @@ namespace Freestyle {
void VertexRep::ComputeBBox()
{
- setBBox(BBox<Vec3r>(Vec3r(_coordinates[0], _coordinates[1], _coordinates[2]),
- Vec3r(_coordinates[0], _coordinates[1], _coordinates[2])));
+ setBBox(BBox<Vec3r>(Vec3r(_coordinates[0], _coordinates[1], _coordinates[2]),
+ Vec3r(_coordinates[0], _coordinates[1], _coordinates[2])));
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/VertexRep.h b/source/blender/freestyle/intern/scene_graph/VertexRep.h
index 8d3e66d7323..3831be3105a 100644
--- a/source/blender/freestyle/intern/scene_graph/VertexRep.h
+++ b/source/blender/freestyle/intern/scene_graph/VertexRep.h
@@ -26,107 +26,108 @@
namespace Freestyle {
-class VertexRep : public Rep
-{
-public:
- inline VertexRep() : Rep()
- {
- _vid = 0;
- _PointSize = 0.0f;
- }
-
- inline VertexRep(real x, real y, real z, int id = 0) : Rep()
- {
- _coordinates[0] = x;
- _coordinates[1] = y;
- _coordinates[2] = z;
-
- _vid = id;
- _PointSize = 0.0f;
- }
-
- inline ~VertexRep() {}
-
- /*! Accept the corresponding visitor */
- virtual void accept(SceneVisitor& v)
- {
- Rep::accept(v);
- v.visitVertexRep(*this);
- }
-
- /*! Computes the rep bounding box. */
- virtual void ComputeBBox();
-
- /*! accessors */
- inline const int vid() const
- {
- return _vid;
- }
-
- inline const real * coordinates() const
- {
- return _coordinates;
- }
-
- inline real x() const
- {
- return _coordinates[0];
- }
-
- inline real y() const
- {
- return _coordinates[1];
- }
-
- inline real z() const
- {
- return _coordinates[2];
- }
-
- inline float pointSize() const
- {
- return _PointSize;
- }
-
- /*! modifiers */
- inline void setVid(int id)
- {
- _vid = id;
- }
-
- inline void setX(real x)
- {
- _coordinates[0] = x;
- }
-
- inline void setY(real y)
- {
- _coordinates[1] = y;
- }
-
- inline void setZ(real z)
- {
- _coordinates[2] = z;
- }
-
- inline void setCoordinates(real x, real y, real z)
- {
- _coordinates[0] = x;
- _coordinates[1] = y;
- _coordinates[2] = z;
- }
-
- inline void setPointSize(float iPointSize)
- {
- _PointSize = iPointSize;
- }
-
-private:
- int _vid; // vertex id
- real _coordinates[3];
- float _PointSize;
+class VertexRep : public Rep {
+ public:
+ inline VertexRep() : Rep()
+ {
+ _vid = 0;
+ _PointSize = 0.0f;
+ }
+
+ inline VertexRep(real x, real y, real z, int id = 0) : Rep()
+ {
+ _coordinates[0] = x;
+ _coordinates[1] = y;
+ _coordinates[2] = z;
+
+ _vid = id;
+ _PointSize = 0.0f;
+ }
+
+ inline ~VertexRep()
+ {
+ }
+
+ /*! Accept the corresponding visitor */
+ virtual void accept(SceneVisitor &v)
+ {
+ Rep::accept(v);
+ v.visitVertexRep(*this);
+ }
+
+ /*! Computes the rep bounding box. */
+ virtual void ComputeBBox();
+
+ /*! accessors */
+ inline const int vid() const
+ {
+ return _vid;
+ }
+
+ inline const real *coordinates() const
+ {
+ return _coordinates;
+ }
+
+ inline real x() const
+ {
+ return _coordinates[0];
+ }
+
+ inline real y() const
+ {
+ return _coordinates[1];
+ }
+
+ inline real z() const
+ {
+ return _coordinates[2];
+ }
+
+ inline float pointSize() const
+ {
+ return _PointSize;
+ }
+
+ /*! modifiers */
+ inline void setVid(int id)
+ {
+ _vid = id;
+ }
+
+ inline void setX(real x)
+ {
+ _coordinates[0] = x;
+ }
+
+ inline void setY(real y)
+ {
+ _coordinates[1] = y;
+ }
+
+ inline void setZ(real z)
+ {
+ _coordinates[2] = z;
+ }
+
+ inline void setCoordinates(real x, real y, real z)
+ {
+ _coordinates[0] = x;
+ _coordinates[1] = y;
+ _coordinates[2] = z;
+ }
+
+ inline void setPointSize(float iPointSize)
+ {
+ _PointSize = iPointSize;
+ }
+
+ private:
+ int _vid; // vertex id
+ real _coordinates[3];
+ float _PointSize;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_VERTEX_REP_H__
+#endif // __FREESTYLE_VERTEX_REP_H__