[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15888] trunk/blender/intern/boolop/intern : Tools
Ken Hughes
khughes at pacific.edu
Wed Jul 30 23:52:14 CEST 2008
Revision: 15888
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15888
Author: khughes
Date: 2008-07-30 23:52:02 +0200 (Wed, 30 Jul 2008)
Log Message:
-----------
Tools
-----
Minor changes to boolean code; add an new include file to gather various
#defines global to the boolean system. Currently, this just allows control
of whether some debugging code is compiled or not.
This is a precursor commit for some other boolean optimizations/cleanups.
But in case that commit is later reverted, this code should still remain.
Modified Paths:
--------------
trunk/blender/intern/boolop/intern/BOP_Edge.cpp
trunk/blender/intern/boolop/intern/BOP_Edge.h
trunk/blender/intern/boolop/intern/BOP_Face.cpp
trunk/blender/intern/boolop/intern/BOP_Face.h
trunk/blender/intern/boolop/intern/BOP_Mesh.cpp
trunk/blender/intern/boolop/intern/BOP_Mesh.h
trunk/blender/intern/boolop/intern/BOP_Vertex.cpp
trunk/blender/intern/boolop/intern/BOP_Vertex.h
Added Paths:
-----------
trunk/blender/intern/boolop/intern/BOP_Misc.h
Modified: trunk/blender/intern/boolop/intern/BOP_Edge.cpp
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Edge.cpp 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Edge.cpp 2008-07-30 21:52:02 UTC (rev 15888)
@@ -75,4 +75,19 @@
else if (m_vertexs[1] == oldIndex) m_vertexs[1] = newIndex;
}
+#ifdef BOP_DEBUG
+#include <iostream>
+using namespace std;
+
+/**
+ * Implements operator <<.
+ */
+ostream &operator<<(ostream &stream, BOP_Edge *e)
+{
+ stream << "Edge[" << e->getVertex1() << "," << e->getVertex2();
+ return stream;
+}
+#endif
+
+
Modified: trunk/blender/intern/boolop/intern/BOP_Edge.h
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Edge.h 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Edge.h 2008-07-30 21:52:02 UTC (rev 15888)
@@ -29,6 +29,7 @@
#define BOP_EDGE_H
#include "BOP_Indexs.h"
+#include "BOP_Misc.h"
class BOP_Edge
{
@@ -47,6 +48,10 @@
inline unsigned int getNumFaces(){return m_faces.size();};
inline BOP_Indexs &getFaces(){return m_faces;};
void addFace(BOP_Index face);
+#ifdef BOP_DEBUG
+ friend ostream &operator<<(ostream &stream, BOP_Edge *e);
+#endif
+
};
#endif
Modified: trunk/blender/intern/boolop/intern/BOP_Face.cpp
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Face.cpp 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Face.cpp 2008-07-30 21:52:02 UTC (rev 15888)
@@ -402,6 +402,7 @@
return true;
}
+#ifdef BOP_DEBUG
/**
* Implements operator <<.
*/
@@ -421,3 +422,4 @@
return stream;
}
+#endif
Modified: trunk/blender/intern/boolop/intern/BOP_Face.h
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Face.h 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Face.h 2008-07-30 21:52:02 UTC (rev 15888)
@@ -32,6 +32,7 @@
#include "MT_Plane3.h"
#include "BOP_Indexs.h"
#include "BOP_BBox.h"
+#include "BOP_Misc.h"
#include <iostream>
#include <vector>
using namespace std;
@@ -80,7 +81,9 @@
virtual void replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex) = 0;
virtual bool containsVertex(BOP_Index v) = 0;
+#ifdef BOP_DEBUG
friend ostream &operator<<(ostream &stream, BOP_Face *f);
+#endif
};
class BOP_Face3: public BOP_Face
Modified: trunk/blender/intern/boolop/intern/BOP_Mesh.cpp
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Mesh.cpp 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Mesh.cpp 2008-07-30 21:52:02 UTC (rev 15888)
@@ -794,7 +794,8 @@
}
-/** ***************************************************************************
+#ifdef BOP_DEBUG
+/******************************************************************************
* DEBUG METHODS *
* This functions are used to test the mesh state and debug program errors. *
******************************************************************************/
@@ -1075,3 +1076,4 @@
}
}
+#endif
Modified: trunk/blender/intern/boolop/intern/BOP_Mesh.h
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Mesh.h 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Mesh.h 2008-07-30 21:52:02 UTC (rev 15888)
@@ -1,10 +1,3 @@
-/*
- * TEMPORARY defines to enable hashing support
- */
-
-#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */
-// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */
-
/**
*
* $Id$
Added: trunk/blender/intern/boolop/intern/BOP_Misc.h
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Misc.h (rev 0)
+++ trunk/blender/intern/boolop/intern/BOP_Misc.h 2008-07-30 21:52:02 UTC (rev 15888)
@@ -0,0 +1,43 @@
+/**
+ *
+ * $Id: BOP_Misc.h 14444 2008-04-16 22:40:48Z khughes $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Ken Hughes
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/*
+ * This file contains various definitions used across the modules
+ */
+
+/*
+ * define operator>> for faces, edges and vertices, and also add some
+ * debugging functions for displaying various internal data structures
+ */
+
+// #define BOP_DEBUG
+
+#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */
+// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */
Modified: trunk/blender/intern/boolop/intern/BOP_Vertex.cpp
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Vertex.cpp 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Vertex.cpp 2008-07-30 21:52:02 UTC (rev 15888)
@@ -89,3 +89,22 @@
return false;
}
+
+#ifdef BOP_DEBUG
+/**
+ * Implements operator <<.
+ */
+#include <iomanip>
+
+ostream &operator<<(ostream &stream, BOP_Vertex *v)
+{
+ char aux[20];
+ BOP_stringTAG(v->m_tag,aux);
+ MT_Point3 point = v->getPoint();
+ stream << setprecision(6) << showpoint << fixed;
+ stream << "Vertex[" << point[0] << "," << point[1] << ",";
+ stream << point[2] << "] (" << aux << ")";
+ return stream;
+}
+#endif
+
Modified: trunk/blender/intern/boolop/intern/BOP_Vertex.h
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_Vertex.h 2008-07-30 21:31:52 UTC (rev 15887)
+++ trunk/blender/intern/boolop/intern/BOP_Vertex.h 2008-07-30 21:52:02 UTC (rev 15888)
@@ -31,6 +31,7 @@
#include "BOP_Tag.h"
#include "BOP_Indexs.h"
#include "MT_Point3.h"
+#include "BOP_Misc.h"
class BOP_Vertex
{
@@ -52,6 +53,10 @@
inline MT_Point3 getPoint() const { return m_point;};
inline BOP_TAG getTAG() { return m_tag;};
inline void setTAG(BOP_TAG t) { m_tag = t;};
+#ifdef BOP_DEBUG
+ friend ostream &operator<<(ostream &stream, BOP_Vertex *v);
+#endif
+
};
#endif
More information about the Bf-blender-cvs
mailing list