[Bf-blender-cvs] [b9895df] master: Freestyle: internal switch from double to float in mesh loading and construction of winged edges.

Tamito Kajiyama noreply at git.blender.org
Mon Jul 20 01:11:51 CEST 2015


Commit: b9895df36f782b362180efe520adcfa8a4b4e35e
Author: Tamito Kajiyama
Date:   Sat Jun 27 22:07:51 2015 +0900
Branches: master
https://developer.blender.org/rBb9895df36f782b362180efe520adcfa8a4b4e35e

Freestyle: internal switch from double to float in mesh loading and construction of winged edges.

===================================================================

M	source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
M	source/blender/freestyle/intern/geometry/GeomCleaner.cpp
M	source/blender/freestyle/intern/geometry/GeomCleaner.h
M	source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
M	source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
M	source/blender/freestyle/intern/scene_graph/Rep.h
M	source/blender/freestyle/intern/scene_graph/SceneHash.cpp
M	source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
M	source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
M	source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
M	source/blender/freestyle/intern/winged_edge/WEdge.cpp
M	source/blender/freestyle/intern/winged_edge/WEdge.h
M	source/blender/freestyle/intern/winged_edge/WXEdge.cpp
M	source/blender/freestyle/intern/winged_edge/WXEdge.h
M	source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
M	source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
M	source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
M	source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h

===================================================================

diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index 7949a02..2b0d3b1 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -663,13 +663,13 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id)
 
 	// We might have several times the same vertex. We want a clean 
 	// shape with no real-vertex. Here, we are making a cleaning pass.
-	real *cleanVertices = NULL;
+	float *cleanVertices = NULL;
 	unsigned int cvSize;
 	unsigned int *cleanVIndices = NULL;
 
 	GeomCleaner::CleanIndexedVertexArray(vertices, vSize, VIndices, viSize, &cleanVertices, &cvSize, &cleanVIndices);
 
-	real *cleanNormals = NULL;
+	float *cleanNormals = NULL;
 	unsigned int cnSize;
 	unsigned int *cleanNIndices = NULL;
 
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
index acbc668..c5d1c8d 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
@@ -50,13 +50,13 @@ using namespace std;
 namespace Freestyle {
 
 void GeomCleaner::SortIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
-                                         unsigned iISize, real **oVertices, unsigned **oIndices)
+                                         unsigned iISize, float **oVertices, unsigned **oIndices)
 {
 	// First, we build a list of IndexVertex:
 	list<IndexedVertex> indexedVertices;
 	unsigned i;
 	for (i = 0; i < iVSize; i += 3) {
-		indexedVertices.push_back(IndexedVertex(Vec3r(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3));
+		indexedVertices.push_back(IndexedVertex(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3));
 	}
 
 	// q-sort
@@ -64,7 +64,7 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, unsigned iVSize
 
 	// build the indices mapping array:
 	unsigned *mapIndices = new unsigned[iVSize / 3];
-	*oVertices = new real[iVSize];
+	*oVertices = new float[iVSize];
 	list<IndexedVertex>::iterator iv;
 	unsigned newIndex = 0;
 	unsigned vIndex = 0;
@@ -88,26 +88,26 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, unsigned iVSize
 	delete [] mapIndices;
 }
 
-void GeomCleaner::CompressIndexedVertexArray(const real *iVertices, unsigned iVSize, const unsigned *iIndices,
-                                             unsigned iISize, real **oVertices, unsigned *oVSize, unsigned **oIndices)
+void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
+                                             unsigned iISize, float **oVertices, unsigned *oVSize, unsigned **oIndices)
 {
 	// First, we build a list of IndexVertex:
-	vector<Vec3r> vertices;
+	vector<Vec3f> vertices;
 	unsigned i;
 	for (i = 0; i < iVSize; i += 3) {
-		vertices.push_back(Vec3r(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
+		vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
 	}
 
 	unsigned *mapVertex = new unsigned[iVSize];
-	vector<Vec3r>::iterator v = vertices.begin();
+	vector<Vec3f>::iterator v = vertices.begin();
 
-	vector<Vec3r> compressedVertices;
-	Vec3r previous = *v;
+	vector<Vec3f> compressedVertices;
+	Vec3f previous = *v;
 	mapVertex[0] = 0;
 	compressedVertices.push_back(vertices.front());
 
 	v++;
-	Vec3r current;
+	Vec3f current;
 	i = 1;
 	for (; v != vertices.end(); v++) {
 		current = *v;
@@ -123,7 +123,7 @@ void GeomCleaner::CompressIndexedVertexArray(const real *iVertices, unsigned iVS
 
 	// Builds the resulting vertex array:
 	*oVSize = 3 * compressedVertices.size();
-	*oVertices = new real[*oVSize];
+	*oVertices = new float[*oVSize];
 	i = 0;
 	for (v = compressedVertices.begin(); v != compressedVertices.end(); v++) {
 		(*oVertices)[i] = (*v)[0];
@@ -142,11 +142,11 @@ void GeomCleaner::CompressIndexedVertexArray(const real *iVertices, unsigned iVS
 }
 
 void GeomCleaner::SortAndCompressIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
-                                                    unsigned iISize, real **oVertices, unsigned *oVSize,
+                                                    unsigned iISize, float **oVertices, unsigned *oVSize,
                                                     unsigned **oIndices)
 {
 	// tmp arrays used to store the sorted data:
-	real *tmpVertices;
+	float *tmpVertices;
 	unsigned *tmpIndices;
 
 	Chronometer chrono;
@@ -154,7 +154,7 @@ void GeomCleaner::SortAndCompressIndexedVertexArray(const float *iVertices, unsi
 	chrono.start();
 	GeomCleaner::SortIndexedVertexArray(iVertices, iVSize, iIndices, iISize, &tmpVertices, &tmpIndices);
 	if (G.debug & G_DEBUG_FREESTYLE) {
-		printf("Sorting: %lf\n", chrono.stop());
+		printf("Sorting: %lf sec.\n", chrono.stop());
 	}
 
 	// compress data
@@ -162,7 +162,7 @@ void GeomCleaner::SortAndCompressIndexedVertexArray(const float *iVertices, unsi
 	GeomCleaner::CompressIndexedVertexArray(tmpVertices, iVSize, tmpIndices, iISize, oVertices, oVSize, oIndices);
 	real duration = chrono.stop();
 	if (G.debug & G_DEBUG_FREESTYLE) {
-		printf("Merging: %lf\n", duration);
+		printf("Merging: %lf sec.\n", duration);
 	}
 
 	// deallocates memory:
@@ -185,22 +185,22 @@ struct GeomCleanerHasher {
 };
 
 void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
-                                          unsigned iISize, real **oVertices, unsigned *oVSize, unsigned **oIndices)
+                                          unsigned iISize, float **oVertices, unsigned *oVSize, unsigned **oIndices)
 {
-	typedef map<Vec3r, unsigned> cleanHashTable;
-	vector<Vec3r> vertices;
+	typedef map<Vec3f, unsigned> cleanHashTable;
+	vector<Vec3f> vertices;
 	unsigned i;
 	for (i = 0; i < iVSize; i += 3)
-		vertices.push_back(Vec3r(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
+		vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
 
 	cleanHashTable ht;
 	vector<unsigned> newIndices;
-	vector<Vec3r> newVertices;
+	vector<Vec3f> newVertices;
 
 	// elimination of needless points
 	unsigned currentIndex = 0;
-	vector<Vec3r>::const_iterator v = vertices.begin();
-	vector<Vec3r>::const_iterator end = vertices.end();
+	vector<Vec3f>::const_iterator v = vertices.begin();
+	vector<Vec3f>::const_iterator end = vertices.end();
 	cleanHashTable::const_iterator found;
 	for (; v != end; v++) {
 		found = ht.find(*v);
@@ -218,7 +218,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, unsigned iVSiz
 
 	// creation of oVertices array:
 	*oVSize = 3 * newVertices.size();
-	*oVertices = new real[*oVSize];
+	*oVertices = new float[*oVSize];
 	currentIndex = 0;
 	end = newVertices.end();
 	for (v = newVertices.begin(); v != end ; v++) {
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.h b/source/blender/freestyle/intern/geometry/GeomCleaner.h
index d516c56..aeca592 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.h
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.h
@@ -64,7 +64,7 @@ public:
 	 *      Output corresponding to the iIndices array but reorganized in order to match the sorted vertex array.
 	 */
 	static void SortIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
-	                                   unsigned iISize, real **oVertices, unsigned **oIndices);
+	                                   unsigned iISize, float **oVertices, unsigned **oIndices);
 
 	/*! Compress a SORTED indexed vertex array by eliminating multiple appearing occurences of a single vertex.
 	 *    iVertices
@@ -84,8 +84,8 @@ public:
 	 *    oIndices
 	 *      The indices array, reorganized to match the compressed oVertices array.
 	 */
-	static void CompressIndexedVertexArray(const real *iVertices, unsigned iVSize, const unsigned *iIndices,
-	                                       unsigned iISize, real **oVertices, unsigned *oVSize, unsigned **oIndices);
+	static void CompressIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
+	                                       unsigned iISize, float **oVertices, unsigned *oVSize, unsigned **oIndices);
 
 	/*! Sorts and compress an array of indexed vertices.
 	 *    iVertices
@@ -107,7 +107,7 @@ public:
 	 *      The indices array, reorganized to match the sorted and compressed oVertices array.
 	 */
 	static void SortAndCompressIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
-	                                              unsigned iISize, real **oVertices, unsigned *oVSize,
+	                                              unsigned iISize, float **oVertices, unsigned *oVSize,
 	                                              unsigned **oIndices);
 
 	/*! Cleans an indexed vertex array. (Identical to SortAndCompress except that we use here a hash table
@@ -131,7 +131,7 @@ public:
 	 *      The indices array, reorganized to match the sorted and compressed oVertices array.
 	 */
 	static void CleanIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
-	                                    unsigned iISize, real **oVertices, unsigned *oVSize, unsigned **oIndices);
+	                                    unsigned iISize, float **oVertices, unsigned *oVSize, unsigned **oIndices);
 
 #ifdef WITH_CXX_GUARDEDALLOC
 	MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:GeomCleaner")
@@ -146,20 +146,20 @@ public:
 class IndexedVertex
 {
 private:
-	Vec3r _Vector;
+	Vec3f _Vector;
 	unsigned _index;
 
 public:
 	inline IndexedVertex() {}
 
-	inline IndexedVertex(Vec3r iVector, unsigned iIndex)
+	inline IndexedVertex(Vec3f iVector, unsigned iIndex)
 	{
 		_Vector = iVector;
 		_index = iIndex;
 	}
 
 	/*! accessors */
-	inline const Vec3r& vector() const
+	inline const Vec3f& vector() const
 	{
 		return _Vector;
 	}
@@ -169,23 +169,23 @@ public:
 		return _index;
 	}
 
-	inline real x()
+	inline float x()
 	

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list