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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2015-06-27 16:07:51 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2015-07-20 00:17:55 +0300
commitb9895df36f782b362180efe520adcfa8a4b4e35e (patch)
treee29a8dac2c19e4b149efec5e1333a6a9b5b676a6 /source/blender
parent67057865405700572b29e1e3ba1f660c9be39152 (diff)
Freestyle: internal switch from double to float in mesh loading and construction of winged edges.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp4
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.cpp48
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.h26
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp44
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h17
-rw-r--r--source/blender/freestyle/intern/scene_graph/Rep.h6
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneHash.cpp2
-rw-r--r--source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp14
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.cpp22
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.h62
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.cpp52
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.h64
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp4
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h2
-rw-r--r--source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp88
-rw-r--r--source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h19
18 files changed, 241 insertions, 239 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index 7949a022566..2b0d3b14697 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 acbc668118e..c5d1c8df17b 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 d516c5623b9..aeca592a8c4 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()
{
return _Vector[0];
}
- inline real y()
+ inline float y()
{
return _Vector[1];
}
- inline real z()
+ inline float z()
{
return _Vector[2];
}
/*! modifiers */
- inline void setVector(const Vec3r& iVector)
+ inline void setVector(const Vec3f& iVector)
{
_Vector = iVector;
}
@@ -203,7 +203,7 @@ public:
return *this;
}
- inline real operator[](const unsigned i)
+ inline float operator[](const unsigned i)
{
return _Vector[i];
}
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
index 90bf388baa0..9c462bb6b2b 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
@@ -54,8 +54,8 @@ IndexedFaceSet::IndexedFaceSet() : Rep()
_displayList = 0;
}
-IndexedFaceSet::IndexedFaceSet(real *iVertices, unsigned iVSize, real *iNormals, unsigned iNSize,
- FrsMaterial **iMaterials, unsigned iMSize, real *iTexCoords, unsigned iTSize,
+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,
@@ -64,12 +64,12 @@ IndexedFaceSet::IndexedFaceSet(real *iVertices, unsigned iVSize, real *iNormals,
{
if (1 == iCopy) {
_VSize = iVSize;
- _Vertices = new real[_VSize];
- memcpy(_Vertices, iVertices, iVSize * sizeof(real));
+ _Vertices = new float[_VSize];
+ memcpy(_Vertices, iVertices, iVSize * sizeof(float));
_NSize = iNSize;
- _Normals = new real[_NSize];
- memcpy(_Normals, iNormals, iNSize * sizeof(real));
+ _Normals = new float[_NSize];
+ memcpy(_Normals, iNormals, iNSize * sizeof(float));
_MSize = iMSize;
_FrsMaterials = 0;
@@ -81,8 +81,8 @@ IndexedFaceSet::IndexedFaceSet(real *iVertices, unsigned iVSize, real *iNormals,
_TSize = iTSize;
_TexCoords = 0;
if (_TSize) {
- _TexCoords = new real[_TSize];
- memcpy(_TexCoords, iTexCoords, iTSize * sizeof(real));
+ _TexCoords = new float[_TSize];
+ memcpy(_TexCoords, iTexCoords, iTSize * sizeof(float));
}
_NumFaces = iNumFaces;
@@ -157,12 +157,12 @@ IndexedFaceSet::IndexedFaceSet(real *iVertices, unsigned iVSize, real *iNormals,
IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet& iBrother) : Rep(iBrother)
{
_VSize = iBrother.vsize();
- _Vertices = new real[_VSize];
- memcpy(_Vertices, iBrother.vertices(), _VSize * sizeof(real));
+ _Vertices = new float[_VSize];
+ memcpy(_Vertices, iBrother.vertices(), _VSize * sizeof(float));
_NSize = iBrother.nsize();
- _Normals = new real[_NSize];
- memcpy(_Normals, iBrother.normals(), _NSize * sizeof(real));
+ _Normals = new float[_NSize];
+ memcpy(_Normals, iBrother.normals(), _NSize * sizeof(float));
_MSize = iBrother.msize();
if (_MSize) {
@@ -178,8 +178,8 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet& iBrother) : Rep(iBrother)
_TSize = iBrother.tsize();
_TexCoords = 0;
if (_TSize) {
- _TexCoords = new real[_TSize];
- memcpy(_TexCoords, iBrother.texCoords(), _TSize * sizeof(real));
+ _TexCoords = new float[_TSize];
+ memcpy(_TexCoords, iBrother.texCoords(), _TSize * sizeof(float));
}
_NumFaces = iBrother.numFaces();
@@ -290,16 +290,16 @@ void IndexedFaceSet::accept(SceneVisitor& v)
void IndexedFaceSet::ComputeBBox()
{
- real XMax = _Vertices[0];
- real YMax = _Vertices[1];
- real ZMax = _Vertices[2];
+ float XMax = _Vertices[0];
+ float YMax = _Vertices[1];
+ float ZMax = _Vertices[2];
- real XMin = _Vertices[0];
- real YMin = _Vertices[1];
- real ZMin = _Vertices[2];
+ float XMin = _Vertices[0];
+ float YMin = _Vertices[1];
+ float ZMin = _Vertices[2];
// parse all the coordinates to find the Xmax, YMax, ZMax
- real *v = _Vertices;
+ float *v = _Vertices;
for (unsigned int i = 0; i < (_VSize / 3); ++i) {
if (*v > XMax)
@@ -321,7 +321,7 @@ void IndexedFaceSet::ComputeBBox()
++v;
}
- setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
+ 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 d3a10aab4dd..8d7bf986bde 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
@@ -114,8 +114,8 @@ public:
* arrays desallocation in charge.
* 1 : the arrays are copied. The caller is in charge of the arrays, passed as arguments desallocation.
*/
- IndexedFaceSet(real *iVertices, unsigned iVSize, real *iNormals, unsigned iNSize, FrsMaterial **iMaterials,
- unsigned iMSize, real *iTexCoords, unsigned iTSize, unsigned iNumFaces, unsigned *iNumVertexPerFace,
+ 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);
@@ -180,12 +180,12 @@ public:
}
/*! Accessors */
- virtual const real *vertices() const
+ virtual const float *vertices() const
{
return _Vertices;
}
- virtual const real *normals() const
+ virtual const float *normals() const
{
return _Normals;
}
@@ -195,7 +195,7 @@ public:
return _FrsMaterials;
}
- virtual const real *texCoords() const
+ virtual const float *texCoords() const
{
return _TexCoords;
}
@@ -286,10 +286,10 @@ public:
}
protected:
- real *_Vertices;
- real *_Normals;
+ float *_Vertices;
+ float *_Normals;
FrsMaterial **_FrsMaterials;
- real *_TexCoords;
+ float *_TexCoords;
unsigned _VSize;
unsigned _NSize;
@@ -316,7 +316,6 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IndexedFaceSet")
#endif
-
};
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h
index 9917af37aa4..c5036cdb153 100644
--- a/source/blender/freestyle/intern/scene_graph/Rep.h
+++ b/source/blender/freestyle/intern/scene_graph/Rep.h
@@ -117,7 +117,7 @@ public:
virtual void ComputeBBox() = 0;
/*! Returns the rep bounding box */
- virtual const BBox<Vec3r>& bbox() const
+ virtual const BBox<Vec3f>& bbox() const
{
return _BBox;
}
@@ -138,7 +138,7 @@ public:
}
/*! Sets the Rep bounding box */
- virtual void setBBox(const BBox<Vec3r>& iBox)
+ virtual void setBBox(const BBox<Vec3f>& iBox)
{
_BBox = iBox;
}
@@ -159,7 +159,7 @@ public:
}
private:
- BBox<Vec3r> _BBox;
+ BBox<Vec3f> _BBox;
Id _Id;
const char *_Name;
FrsMaterial *_FrsMaterial;
diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
index 22538736fbf..9d595c235c2 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
+++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
@@ -59,7 +59,7 @@ void SceneHash::visitNodeCamera(NodeCamera& cam)
void SceneHash::visitIndexedFaceSet(IndexedFaceSet& ifs)
{
- const real *v = ifs.vertices();
+ const float *v = ifs.vertices();
const unsigned n = ifs.vsize();
for (unsigned i = 0; i < n; i++) {
diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
index 4e87625f6f9..e7041f04cf0 100644
--- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
+++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
@@ -93,11 +93,11 @@ VISIT(VertexRep)
void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet& ifs)
{
- const real *vertices = ifs.vertices();
+ const float *vertices = ifs.vertices();
unsigned vsize = ifs.vsize();
_ofs << _space << "IndexedFaceSet" << endl;
- const real *p = vertices;
+ 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;
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index 5ec8b545b4c..f24d921c791 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -39,7 +39,9 @@ namespace Freestyle {
void FEdgeXDetector::processShapes(WingedEdge& we)
{
bool progressBarDisplay = false;
+#if 0
Vec3r Min, Max;
+#endif
vector<WShape*> wshapes = we.getWShapes();
WXShape *wxs;
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
index b5d73640c11..139502e8d5e 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
@@ -632,18 +632,18 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge& iwe)
{
SVertex *va, *vb;
FEdgeSharp *fe;
- WXVertex *wxVA, *wxVB;
+ Vec3r vA, vB;
if (iwe.order) {
- wxVA = (WXVertex *)iwe.e->GetaVertex();
- wxVB = (WXVertex *)iwe.e->GetbVertex();
+ vA = iwe.e->GetaVertex()->GetVertex();
+ vB = iwe.e->GetbVertex()->GetVertex();
}
else {
- wxVA = (WXVertex *)iwe.e->GetbVertex();
- wxVB = (WXVertex *)iwe.e->GetaVertex();
+ vA = iwe.e->GetbVertex()->GetVertex();
+ vB = iwe.e->GetaVertex()->GetVertex();
}
// Make the 2 SVertex
- va = MakeSVertex(wxVA->GetVertex(), true);
- vb = MakeSVertex(wxVB->GetVertex(), true);
+ va = MakeSVertex(vA, true);
+ vb = MakeSVertex(vB, true);
// get the faces normals and the material indices
Vec3r normalA, normalB;
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
index 261aac67c9d..87ca3a4235f 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
@@ -410,16 +410,16 @@ bool WFace::getOppositeEdge(const WVertex *v, WOEdge *&e)
return true;
}
-real WFace::getArea ()
+float WFace::getArea()
{
vector<WOEdge *>::iterator it;
- Vec3r origin = (*(_OEdgeList.begin()))->GetaVertex()->GetVertex();
+ Vec3f origin = (*(_OEdgeList.begin()))->GetaVertex()->GetVertex();
it = _OEdgeList.begin();
- real a = 0;
+ float a = 0;
for (it = it++; it != _OEdgeList.end(); it++) {
- Vec3r v1 = Vec3r((*it)->GetaVertex()->GetVertex() - origin);
- Vec3r v2 = Vec3r((*it)->GetbVertex()->GetVertex() - origin);
- a += (v1 ^ v2).norm() / 2.0;
+ Vec3f v1 = Vec3f((*it)->GetaVertex()->GetVertex() - origin);
+ Vec3f v2 = Vec3f((*it)->GetbVertex()->GetVertex() - origin);
+ a += (v1 ^ v2).norm() / 2.0f;
}
return a;
}
@@ -599,7 +599,7 @@ WFace *WShape::MakeFace(vector<WVertex *>& iVertexList, vector<bool>& iFaceEdgeM
return result;
}
-WFace *WShape::MakeFace(vector<WVertex *>& iVertexList, vector<Vec3r>& iNormalsList, vector<Vec2r>& iTexCoordsList,
+WFace *WShape::MakeFace(vector<WVertex *>& iVertexList, vector<Vec3f>& iNormalsList, vector<Vec2f>& iTexCoordsList,
vector<bool>& iFaceEdgeMarksList, unsigned iMaterial)
{
// allocate the new face
@@ -648,10 +648,10 @@ WFace *WShape::MakeFace(vector<WVertex *>& iVertexList, vector<bool>& iFaceEdgeM
it++;
v3 = *it;
- Vec3r vector1(v2->GetVertex() - v1->GetVertex());
- Vec3r vector2(v3->GetVertex() - v1->GetVertex());
+ Vec3f vector1(v2->GetVertex() - v1->GetVertex());
+ Vec3f vector2(v3->GetVertex() - v1->GetVertex());
- Vec3r normal(vector1 ^ vector2);
+ Vec3f normal(vector1 ^ vector2);
normal.normalize();
face->setNormal(normal);
@@ -709,7 +709,7 @@ real WShape::ComputeMeanEdgeSize() const
{
meanEdgeSize += (*it)->GetaOEdge()->GetVec().norm();
}
- return meanEdgeSize / _EdgeList.size();
+ return meanEdgeSize / (real)_EdgeList.size();
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h
index 9b04333123e..f610f6965aa 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.h
@@ -68,7 +68,7 @@ class WVertex
{
protected:
int _Id; // an identificator
- Vec3r _Vertex;
+ Vec3f _Vertex;
vector<WEdge*> _EdgeList;
WShape *_Shape; // the shape to which the vertex belongs
bool _Smooth; // flag to indicate whether the Vertex belongs to a smooth edge or not
@@ -76,7 +76,7 @@ protected:
public:
void *userdata; // designed to store specific user data
- inline WVertex(const Vec3r &v)
+ inline WVertex(const Vec3f &v)
{
_Id = 0;
_Vertex = v;
@@ -92,7 +92,7 @@ public:
virtual ~WVertex() {}
/*! accessors */
- inline Vec3r& GetVertex()
+ inline Vec3f& GetVertex()
{
return _Vertex;
}
@@ -120,7 +120,7 @@ public:
bool isBoundary();
/*! modifiers */
- inline void setVertex(const Vec3r& v)
+ inline void setVertex(const Vec3f& v)
{
_Vertex = v;
}
@@ -381,8 +381,8 @@ protected:
WFace *_pbFace; // when following the edge, face on the left
WEdge *_pOwner; // Edge
- Vec3r _vec;
- real _angle;
+ Vec3f _vec;
+ float _angle;
public:
void *userdata;
@@ -457,12 +457,12 @@ public:
return _pOwner;
}
- inline const Vec3r& GetVec()
+ inline const Vec3f& GetVec()
{
return _vec;
}
- inline const real GetAngle()
+ inline const float GetAngle()
{
return _angle;
}
@@ -738,11 +738,11 @@ class WFace
{
protected:
vector<WOEdge *> _OEdgeList; // list of oriented edges of bording the face
- Vec3r _Normal; // normal to the face
+ Vec3f _Normal; // normal to the face
// in case there is a normal per vertex.
// The normal number i corresponds to the aVertex of the oedge number i, for that face
- vector<Vec3r> _VerticesNormals;
- vector<Vec2r> _VerticesTexCoords;
+ vector<Vec3f> _VerticesNormals;
+ vector<Vec2f> _VerticesTexCoords;
int _Id;
unsigned _FrsMaterialIndex;
@@ -772,7 +772,7 @@ public:
return _OEdgeList[i];
}
- inline Vec3r& GetNormal()
+ inline Vec3f& GetNormal()
{
return _Normal;
}
@@ -848,30 +848,30 @@ public:
return iOEdge->GetaFace();
}
- inline vector<Vec3r>& GetPerVertexNormals()
+ inline vector<Vec3f>& GetPerVertexNormals()
{
return _VerticesNormals;
}
- inline vector<Vec2r>& GetPerVertexTexCoords()
+ inline vector<Vec2f>& GetPerVertexTexCoords()
{
return _VerticesTexCoords;
}
/*! Returns the normal of the vertex of index index */
- inline Vec3r& GetVertexNormal(int index)
+ inline Vec3f& GetVertexNormal(int index)
{
return _VerticesNormals[index];
}
/*! Returns the tex coords of the vertex of index index */
- inline Vec2r& GetVertexTexCoords(int index)
+ inline Vec2f& GetVertexTexCoords(int index)
{
return _VerticesTexCoords[index];
}
/*! Returns the normal of the vertex iVertex for that face */
- inline Vec3r& GetVertexNormal(WVertex *iVertex)
+ inline Vec3f& GetVertexNormal(WVertex *iVertex)
{
int i = 0;
int index = 0;
@@ -938,17 +938,17 @@ public:
_OEdgeList = iEdgeList;
}
- inline void setNormal(const Vec3r& iNormal)
+ inline void setNormal(const Vec3f& iNormal)
{
_Normal = iNormal;
}
- inline void setNormalList(const vector<Vec3r>& iNormalsList)
+ inline void setNormalList(const vector<Vec3f>& iNormalsList)
{
_VerticesNormals = iNormalsList;
}
- inline void setTexCoordsList(const vector<Vec2r>& iTexCoordsList)
+ inline void setTexCoordsList(const vector<Vec2f>& iTexCoordsList)
{
_VerticesTexCoords = iTexCoordsList;
}
@@ -994,7 +994,7 @@ public:
bool getOppositeEdge (const WVertex *v, WOEdge *&e);
/*! compute the area of the face */
- real getArea ();
+ float getArea ();
WShape *getShape();
virtual void ResetUserData()
@@ -1027,12 +1027,12 @@ protected:
const char *_Name;
static unsigned _SceneCurrentId;
#if 0
- Vec3r _min;
- Vec3r _max;
+ Vec3f _min;
+ Vec3f _max;
#endif
vector<FrsMaterial> _FrsMaterials;
#if 0
- real _meanEdgeSize;
+ float _meanEdgeSize;
#endif
public:
@@ -1098,7 +1098,7 @@ public:
}
#if 0
- inline void bbox(Vec3r& min, Vec3r& max)
+ inline void bbox(Vec3f& min, Vec3f& max)
{
min = _min;
max = _max;
@@ -1116,7 +1116,7 @@ public:
}
#if 0
- inline const real getMeanEdgeSize() const
+ inline const float getMeanEdgeSize() const
{
return _meanEdgeSize;
}
@@ -1154,7 +1154,7 @@ public:
}
#if 0
- inline void setBBox(const Vec3r& min, const Vec3r& max)
+ inline void setBBox(const Vec3f& min, const Vec3f& max)
{
_min = min;
_max = max;
@@ -1210,7 +1210,7 @@ public:
* The list of tex coords, iTexCoordsList[i] corresponding to the normal of the vertex iVertexList[i] for
* that face.
*/
- virtual WFace *MakeFace(vector<WVertex *>& iVertexList, vector<Vec3r>& iNormalsList, vector<Vec2r>& iTexCoordsList,
+ virtual WFace *MakeFace(vector<WVertex *>& iVertexList, vector<Vec3f>& iNormalsList, vector<Vec2f>& iTexCoordsList,
vector<bool>& iFaceEdgeMarksList, unsigned iMaterialIndex);
inline void AddEdge(WEdge *iEdge)
@@ -1257,7 +1257,7 @@ public:
_min = _VertexList[0]->GetVertex();
_max = _VertexList[0]->GetVertex();
- Vec3r v;
+ Vec3f v;
for (vector<WVertex *>::iterator wv = _VertexList.begin(), wvend = _VertexList.end(); wv != wvend; wv++) {
for (unsigned int i = 0; i < 3; i++) {
v = (*wv)->GetVertex();
@@ -1271,7 +1271,7 @@ public:
#endif
#if 0
- inline real ComputeMeanEdgeSize()
+ inline float ComputeMeanEdgeSize()
{
_meanEdgeSize = _meanEdgeSize / _EdgeList.size();
return _meanEdgeSize;
@@ -1385,7 +1385,7 @@ inline void WOEdge::setVecAndAngle()
if (_paVertex && _pbVertex) {
_vec = _pbVertex->GetVertex() - _paVertex->GetVertex();
if (_paFace && _pbFace) {
- real sine = (_pbFace->GetNormal() ^ _paFace->GetNormal()) * _vec / _vec.norm();
+ float sine = (_pbFace->GetNormal() ^ _paFace->GetNormal()) * _vec / _vec.norm();
if (sine >= 1.0) {
_angle = M_PI / 2.0;
return;
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
index 84dbd5fbef8..11bce2b007e 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
@@ -43,7 +43,7 @@ unsigned int WXFaceLayer::Get0VertexIndex() const
int i = 0;
int nEdges = _pWXFace->numberOfEdges();
for (i = 0; i < nEdges; ++i) {
- if (_DotP[i] == 0) {
+ if (_DotP[i] == 0.0f) { // TODO this comparison is weak, check if it actually works
return i;
}
}
@@ -54,7 +54,7 @@ unsigned int WXFaceLayer::GetSmoothEdgeIndex() const
int i = 0;
int nEdges = _pWXFace->numberOfEdges();
for (i = 0; i < nEdges; ++i) {
- if ((_DotP[i] == 0) && (_DotP[(i + 1) % nEdges] == 0)) {
+ if ((_DotP[i] == 0.0f) && (_DotP[(i + 1) % nEdges] == 0.0f)) { // TODO ditto
return i;
}
}
@@ -66,7 +66,7 @@ void WXFaceLayer::RetrieveCuspEdgesIndices(vector<int>& oCuspEdges)
int i = 0;
int nEdges = _pWXFace->numberOfEdges();
for (i = 0; i < nEdges; ++i) {
- if (_DotP[i] * _DotP[(i + 1) % nEdges] < 0) {
+ if (_DotP[i] * _DotP[(i + 1) % nEdges] < 0.0f) {
// we got one
oCuspEdges.push_back(i);
}
@@ -78,7 +78,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
// if the smooth edge has already been built: exit
if (_pSmoothEdge)
return _pSmoothEdge;
- real ta, tb;
+ float ta, tb;
WOEdge *woea(0), *woeb(0);
bool ok = false;
vector<int> cuspEdgesIndices;
@@ -101,7 +101,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
// So if the WOEdge woea is such that woea[0].dotp > 0 and woea[1].dotp < 0, it is the starting edge.
//-------------------------------------------
- if (_DotP[cuspEdgesIndices[0]] > 0) {
+ if (_DotP[cuspEdgesIndices[0]] > 0.0f) {
woea = _pWXFace->GetOEdge(cuspEdgesIndices[0]);
woeb = _pWXFace->GetOEdge(cuspEdgesIndices[1]);
indexStart = cuspEdgesIndices[0];
@@ -136,18 +136,18 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
}
unsigned index0 = Get0VertexIndex(); // retrieve the 0 vertex index
unsigned nedges = _pWXFace->numberOfEdges();
- if (_DotP[cuspEdgesIndices[0]] > 0) {
+ if (_DotP[cuspEdgesIndices[0]] > 0.0f) {
woea = _pWXFace->GetOEdge(cuspEdgesIndices[0]);
woeb = _pWXFace->GetOEdge(index0);
indexStart = cuspEdgesIndices[0];
ta = _DotP[indexStart] / (_DotP[indexStart] - _DotP[(indexStart + 1) % nedges]);
- tb = 0.0;
+ tb = 0.0f;
}
else {
woea = _pWXFace->GetOEdge(index0);
woeb = _pWXFace->GetOEdge(cuspEdgesIndices[0]);
indexEnd = cuspEdgesIndices[0];
- ta = 0.0;
+ ta = 0.0f;
tb = _DotP[indexEnd] / (_DotP[indexEnd] - _DotP[(indexEnd + 1) % nedges]);
}
ok = true;
@@ -159,8 +159,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
// the order of the WOEdge index is wrong
woea = _pWXFace->GetOEdge((index + 1) % nedges);
woeb = _pWXFace->GetOEdge((index - 1) % nedges);
- ta = 0;
- tb = 1;
+ ta = 0.0f;
+ tb = 1.0f;
ok = true;
}
else {
@@ -170,8 +170,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
// the order of the WOEdge index is good
woea = _pWXFace->GetOEdge((index - 1) % nedges);
woeb = _pWXFace->GetOEdge((index + 1) % nedges);
- ta = 1;
- tb = 0;
+ ta = 1.0f;
+ tb = 0.0f;
#endif
}
}
@@ -183,7 +183,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
_pSmoothEdge->setTb(tb);
if (_Nature & Nature::SILHOUETTE) {
if (_nNullDotP != 2) {
- if (_DotP[_ClosestPointIndex] + 0.01 > 0)
+ if (_DotP[_ClosestPointIndex] + 0.01f > 0.0f)
_pSmoothEdge->setFront(true);
else
_pSmoothEdge->setFront(false);
@@ -205,7 +205,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
}
// Else we must build it
WOEdge *woea, *woeb;
- real ta, tb;
+ float ta, tb;
if (!front()) { // is it in the right order ?
// the order of the WOEdge index is wrong
woea = _OEdgeList[(i + 1) % numberOfEdges()];
@@ -213,8 +213,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
woeb = _OEdgeList[numberOfEdges() - 1];
else
woeb = _OEdgeList[(i - 1)];
- ta = 0;
- tb = 1;
+ ta = 0.0f;
+ tb = 1.0f;
}
else {
// the order of the WOEdge index is good
@@ -223,8 +223,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
else
woea = _OEdgeList[(i - 1)];
woeb = _OEdgeList[(i + 1) % numberOfEdges()];
- ta = 1;
- tb = 0;
+ ta = 1.0f;
+ tb = 0.0f;
}
_pSmoothEdge = new ExactSilhouetteEdge(ExactSilhouetteEdge::VERTEX_VERTEX);
@@ -246,11 +246,11 @@ void WXFace::ComputeCenter()
{
vector<WVertex *> iVertexList;
RetrieveVertexList(iVertexList);
- Vec3r center;
+ Vec3f center;
for (vector<WVertex *>::iterator wv = iVertexList.begin(), wvend = iVertexList.end(); wv != wvend; ++wv) {
center += (*wv)->GetVertex();
}
- center /= (real)iVertexList.size();
+ center /= (float)iVertexList.size();
setCenter(center);
}
@@ -268,28 +268,28 @@ WFace *WXShape::MakeFace(vector<WVertex *>& iVertexList, vector<bool>& iFaceEdge
if (!face)
return NULL;
- Vec3r center;
+ Vec3f center;
for (vector<WVertex *>::iterator wv = iVertexList.begin(), wvend = iVertexList.end(); wv != wvend; ++wv) {
center += (*wv)->GetVertex();
}
- center /= (real)iVertexList.size();
+ center /= (float)iVertexList.size();
((WXFace *)face)->setCenter(center);
return face;
}
-WFace *WXShape::MakeFace(vector<WVertex *>& iVertexList, vector<Vec3r>& iNormalsList, vector<Vec2r>& iTexCoordsList,
+WFace *WXShape::MakeFace(vector<WVertex *>& iVertexList, vector<Vec3f>& iNormalsList, vector<Vec2f>& iTexCoordsList,
vector<bool>& iFaceEdgeMarksList, unsigned iMaterialIndex)
{
WFace *face = WShape::MakeFace(iVertexList, iNormalsList, iTexCoordsList, iFaceEdgeMarksList, iMaterialIndex);
#if 0
- Vec3r center;
+ Vec3f center;
for (vector<WVertex *>::iterator wv = iVertexList.begin(), wvend = iVertexList.end(); wv != wvend; ++wv) {
center += (*wv)->GetVertex();
}
- center /= (real)iVertexList.size();
- ((WSFace *)face)->setCenter(center);
+ center /= (float)iVertexList.size();
+ ((WXFace *)face)->setCenter(center);
#endif
return face;
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h
index 6e48860272a..774cc67f3ab 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h
@@ -55,7 +55,7 @@ private:
CurvatureInfo *_curvatures;
public:
- inline WXVertex(const Vec3r &v) : WVertex(v)
+ inline WXVertex(const Vec3f &v) : WVertex(v)
{
_curvatures = NULL;
}
@@ -226,8 +226,8 @@ public:
WOEdge *_woea; // Oriented edge from which the silhouette edge starts
WOEdge *_woeb; // Oriented edge where the silhouette edge ends
- real _ta; // The silhouette starting point's coordinates are : _woea[0]+ta*(_woea[1]-_woea[0])
- real _tb; // The silhouette ending point's coordinates are : _woeb[0]+ta*(_woeb[1]-_woeb[0])
+ float _ta; // The silhouette starting point's coordinates are : _woea[0]+ta*(_woea[1]-_woea[0])
+ float _tb; // The silhouette ending point's coordinates are : _woeb[0]+ta*(_woeb[1]-_woeb[0])
bool _front;
Configuration _config;
@@ -235,8 +235,8 @@ public:
{
_woea = NULL;
_woeb = NULL;
- _ta = 0;
- _tb = 0;
+ _ta = 0.0f;
+ _tb = 0.0f;
_front = false;
_config = EDGE_EDGE;
}
@@ -263,12 +263,12 @@ public:
return _woeb;
}
- inline real ta() const
+ inline float ta() const
{
return _ta;
}
- inline real tb() const
+ inline float tb() const
{
return _tb;
}
@@ -294,12 +294,12 @@ public:
_woeb = iwoeb;
}
- inline void setTa(real ta)
+ inline void setTa(float ta)
{
_ta = ta;
}
- inline void setTb(real tb)
+ inline void setTb(float tb)
{
_tb = tb;
}
@@ -331,7 +331,7 @@ public:
WXFace *_pWXFace;
// in case of silhouette: the values obtained when computing the normal-view direction dot product. _DotP[i] is
// this value for the vertex i for that face.
- vector<real> _DotP;
+ vector<float> _DotP;
WXSmoothEdge *_pSmoothEdge;
WXNature _Nature;
@@ -380,7 +380,7 @@ public:
}
}
- inline const real dotP(int i) const
+ inline const float dotP(int i) const
{
return _DotP[i];
}
@@ -455,21 +455,21 @@ public:
WXSmoothEdge *BuildSmoothEdge();
- inline void setDotP(const vector<real>& iDotP)
+ inline void setDotP(const vector<float>& iDotP)
{
_DotP = iDotP;
}
- inline void PushDotP(real iDotP)
+ inline void PushDotP(float iDotP)
{
_DotP.push_back(iDotP);
- if (iDotP > 0)
+ if (iDotP > 0.0f)
++_nPosDotP;
- if (iDotP == 0)
+ if (iDotP == 0.0f) // TODO this comparison is weak, check if it actually works
++_nNullDotP;
}
- inline void ReplaceDotP(unsigned int index, real newDotP)
+ inline void ReplaceDotP(unsigned int index, float newDotP)
{
_DotP[index] = newDotP;
updateDotPInfos();
@@ -479,10 +479,10 @@ public:
{
_nPosDotP = 0;
_nNullDotP = 0;
- for (vector<real>::iterator d = _DotP.begin(), dend = _DotP.end(); d != dend; ++d) {
- if ((*d) > 0)
+ for (vector<float>::iterator d = _DotP.begin(), dend = _DotP.end(); d != dend; ++d) {
+ if ((*d) > 0.0f)
++_nPosDotP;
- if ((*d) == 0)
+ if ((*d) == 0.0f) // TODO ditto
++_nNullDotP;
}
}
@@ -495,17 +495,17 @@ public:
class WXFace : public WFace
{
protected:
- Vec3r _center; // center of the face
- real _Z; // distance from viewpoint to the center of the face
+ Vec3f _center; // center of the face
+ float _Z; // distance from viewpoint to the center of the face
bool _front; // flag to tell whether the face is front facing or back facing
- real _dotp; // value obtained when computing the normal-viewpoint dot product
+ float _dotp; // value obtained when computing the normal-viewpoint dot product
vector<WXFaceLayer *> _SmoothLayers; // The data needed to store one or several smooth edges that traverse the face
public:
inline WXFace() : WFace()
{
- _Z = 0.0;
+ _Z = 0.0f;
_front = false;
}
@@ -549,12 +549,12 @@ public:
}
/*! accessors */
- inline Vec3r& center()
+ inline Vec3f& center()
{
return _center;
}
- inline real Z()
+ inline float Z()
{
return _Z;
}
@@ -564,7 +564,7 @@ public:
return _front;
}
- inline real dotp()
+ inline float dotp()
{
return _dotp;
}
@@ -625,14 +625,14 @@ public:
}
/*! modifiers */
- inline void setCenter(const Vec3r& iCenter)
+ inline void setCenter(const Vec3f& iCenter)
{
_center = iCenter;
}
void ComputeCenter();
- inline void setZ(real z)
+ inline void setZ(float z)
{
_Z = z;
}
@@ -642,10 +642,10 @@ public:
_front = iFront;
}
- inline void setDotP(real iDotP)
+ inline void setDotP(float iDotP)
{
_dotp = iDotP;
- if (_dotp > 0)
+ if (_dotp > 0.0f)
_front = true;
else
_front = false;
@@ -710,8 +710,10 @@ public:
class WXShape : public WShape
{
+#if 0
public:
typedef WXShape type_name;
+#endif
protected:
bool _computeViewIndependent; // flag to indicate whether the view independent stuff must be computed or not
@@ -774,7 +776,7 @@ public:
* The list of tex coords, iTexCoordsList[i] corresponding to the normal of the vertex iVertexList[i] for
* that face.
*/
- virtual WFace *MakeFace(vector<WVertex *>& iVertexList, vector<Vec3r>& iNormalsList, vector<Vec2r>& iTexCoordsList,
+ virtual WFace *MakeFace(vector<WVertex *>& iVertexList, vector<Vec3f>& iNormalsList, vector<Vec2f>& iTexCoordsList,
vector<bool>& iFaceEdgeMarksList, unsigned iMaterialIndex);
/*! Reset all edges and vertices flags (which might have been set up on a previous pass) */
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
index 590e03255f5..78773a9680d 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
@@ -45,11 +45,11 @@ void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet& ifs)
//ifs.setId(shape->GetId());
}
-void WXEdgeBuilder::buildWVertices(WShape& shape, const real *vertices, unsigned vsize)
+void WXEdgeBuilder::buildWVertices(WShape& shape, const float *vertices, unsigned vsize)
{
WXVertex *vertex;
for (unsigned int i = 0; i < vsize; i += 3) {
- vertex = new WXVertex(Vec3r(vertices[i], vertices[i + 1], vertices[i + 2]));
+ vertex = new WXVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2]));
vertex->setId(i / 3);
shape.AddVertex(vertex);
}
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
index 143c2e33608..6df4efcd9b7 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
+++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
@@ -43,7 +43,7 @@ public:
VISIT_DECL(IndexedFaceSet)
protected:
- virtual void buildWVertices(WShape& shape, const real *vertices, unsigned vsize);
+ virtual void buildWVertices(WShape& shape, const float *vertices, unsigned vsize);
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:WXEdgeBuilder")
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
index 2be46abc87d..2ddc821da78 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
@@ -89,15 +89,15 @@ bool WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs)
unsigned int nsize = ifs.nsize();
//soc unused - unsigned tsize = ifs.tsize();
- const real *vertices = ifs.vertices();
- const real *normals = ifs.normals();
- const real *texCoords = ifs.texCoords();
+ const float *vertices = ifs.vertices();
+ const float *normals = ifs.normals();
+ const float *texCoords = ifs.texCoords();
- real *new_vertices;
- real *new_normals;
+ float *new_vertices;
+ float *new_normals;
- new_vertices = new real[vsize];
- new_normals = new real[nsize];
+ new_vertices = new float[vsize];
+ new_normals = new float[nsize];
// transform coordinates from local to world system
if (_current_matrix) {
@@ -185,7 +185,7 @@ bool WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs)
#endif
// Parse the built winged-edge shape to update post-flags
- set<Vec3r> normalsSet;
+ set<Vec3f> normalsSet;
vector<WVertex *>& wvertices = shape.getVertexList();
for (vector<WVertex *>::iterator wv = wvertices.begin(), wvend = wvertices.end(); wv != wvend; ++wv) {
if ((*wv)->isBoundary())
@@ -213,18 +213,18 @@ bool WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs)
return true;
}
-void WingedEdgeBuilder::buildWVertices(WShape& shape, const real *vertices, unsigned vsize)
+void WingedEdgeBuilder::buildWVertices(WShape& shape, const float *vertices, unsigned vsize)
{
WVertex *vertex;
for (unsigned int i = 0; i < vsize; i += 3) {
- vertex = new WVertex(Vec3r(vertices[i], vertices[i + 1], vertices[i + 2]));
+ vertex = new WVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2]));
vertex->setId(i / 3);
shape.AddVertex(vertex);
}
}
-void WingedEdgeBuilder::buildTriangleStrip(const real * /*vertices*/, const real *normals, vector<FrsMaterial>& /*iMaterials*/,
- const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
+void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/, const float *normals, vector<FrsMaterial>& /*iMaterials*/,
+ const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices, const unsigned *nindices, const unsigned *mindices,
const unsigned *tindices, const unsigned nvertices)
{
@@ -234,8 +234,8 @@ void WingedEdgeBuilder::buildTriangleStrip(const real * /*vertices*/, const real
WShape *currentShape = _current_wshape; // the current shape being built
vector<WVertex *> triangleVertices;
- vector<Vec3r> triangleNormals;
- vector<Vec2r> triangleTexCoords;
+ vector<Vec3f> triangleNormals;
+ vector<Vec2f> triangleTexCoords;
vector<bool> triangleFaceEdgeMarks;
while (nDoneVertices < nvertices) {
@@ -247,18 +247,18 @@ void WingedEdgeBuilder::buildTriangleStrip(const real * /*vertices*/, const real
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 1] / 3]);
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 2] / 3]);
- triangleNormals.push_back(Vec3r(normals[nindices[nTriangle]], normals[nindices[nTriangle] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[nTriangle]], normals[nindices[nTriangle] + 1],
normals[nindices[nTriangle] + 2]));
- triangleNormals.push_back(Vec3r(normals[nindices[nTriangle + 1]], normals[nindices[nTriangle + 1] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 1]], normals[nindices[nTriangle + 1] + 1],
normals[nindices[nTriangle + 1] + 2]));
- triangleNormals.push_back(Vec3r(normals[nindices[nTriangle + 2]], normals[nindices[nTriangle + 2] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 2]], normals[nindices[nTriangle + 2] + 1],
normals[nindices[nTriangle + 2] + 2]));
if (texCoords) {
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1]));
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle + 1]],
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1]));
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[nTriangle + 1]],
texCoords[tindices[nTriangle + 1] + 1]));
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle + 2]],
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[nTriangle + 2]],
texCoords[tindices[nTriangle + 2] + 1]));
}
}
@@ -267,18 +267,18 @@ void WingedEdgeBuilder::buildTriangleStrip(const real * /*vertices*/, const real
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 2] / 3]);
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 1] / 3]);
- triangleNormals.push_back(Vec3r(normals[nindices[nTriangle]], normals[nindices[nTriangle] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[nTriangle]], normals[nindices[nTriangle] + 1],
normals[nindices[nTriangle] + 2]));
- triangleNormals.push_back(Vec3r(normals[nindices[nTriangle + 2]], normals[nindices[nTriangle + 2] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 2]], normals[nindices[nTriangle + 2] + 1],
normals[nindices[nTriangle + 2] + 2]));
- triangleNormals.push_back(Vec3r(normals[nindices[nTriangle + 1]], normals[nindices[nTriangle + 1] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 1]], normals[nindices[nTriangle + 1] + 1],
normals[nindices[nTriangle + 1] + 2]));
if (texCoords) {
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1]));
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle + 2]],
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1]));
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[nTriangle + 2]],
texCoords[tindices[nTriangle + 2] + 1]));
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle + 1]],
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[nTriangle + 1]],
texCoords[tindices[nTriangle + 1] + 1]));
}
}
@@ -298,23 +298,23 @@ void WingedEdgeBuilder::buildTriangleStrip(const real * /*vertices*/, const real
}
}
-void WingedEdgeBuilder::buildTriangleFan(const real * /*vertices*/, const real * /*normals*/, vector<FrsMaterial>& /*iMaterials*/,
- const real * /*texCoords*/, const IndexedFaceSet::FaceEdgeMark * /*iFaceEdgeMarks*/,
+void WingedEdgeBuilder::buildTriangleFan(const float * /*vertices*/, const float * /*normals*/, vector<FrsMaterial>& /*iMaterials*/,
+ const float * /*texCoords*/, const IndexedFaceSet::FaceEdgeMark * /*iFaceEdgeMarks*/,
const unsigned * /*vindices*/, const unsigned * /*nindices*/, const unsigned * /*mindices*/,
const unsigned * /*tindices*/, const unsigned /*nvertices*/)
{
// Nothing to be done
}
-void WingedEdgeBuilder::buildTriangles(const real * /*vertices*/, const real *normals, vector<FrsMaterial>& /*iMaterials*/,
- const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
+void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, const float *normals, vector<FrsMaterial>& /*iMaterials*/,
+ const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices, const unsigned *nindices, const unsigned *mindices,
const unsigned *tindices, const unsigned nvertices)
{
WShape *currentShape = _current_wshape; // the current shape begin built
vector<WVertex *> triangleVertices;
- vector<Vec3r> triangleNormals;
- vector<Vec2r> triangleTexCoords;
+ vector<Vec3f> triangleNormals;
+ vector<Vec2f> triangleTexCoords;
vector<bool> triangleFaceEdgeMarks;
// Each triplet of vertices is considered as an independent triangle
@@ -323,17 +323,17 @@ void WingedEdgeBuilder::buildTriangles(const real * /*vertices*/, const real *no
triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 1] / 3]);
triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 2] / 3]);
- triangleNormals.push_back(Vec3r(normals[nindices[3 * i]], normals[nindices[3 * i] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[3 * i]], normals[nindices[3 * i] + 1],
normals[nindices[3 * i] + 2]));
- triangleNormals.push_back(Vec3r(normals[nindices[3 * i + 1]], normals[nindices[3 * i + 1] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[3 * i + 1]], normals[nindices[3 * i + 1] + 1],
normals[nindices[3 * i + 1] + 2]));
- triangleNormals.push_back(Vec3r(normals[nindices[3 * i + 2]], normals[nindices[3 * i + 2] + 1],
+ triangleNormals.push_back(Vec3f(normals[nindices[3 * i + 2]], normals[nindices[3 * i + 2] + 1],
normals[nindices[3 * i + 2] + 2]));
if (texCoords) {
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[3 * i]], texCoords[tindices[3 * i] + 1]));
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[3 * i + 1]], texCoords[tindices[3 * i + 1] + 1]));
- triangleTexCoords.push_back(Vec2r(texCoords[tindices[3 * i + 2]], texCoords[tindices[3 * i + 2] + 1]));
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[3 * i]], texCoords[tindices[3 * i] + 1]));
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[3 * i + 1]], texCoords[tindices[3 * i + 1] + 1]));
+ triangleTexCoords.push_back(Vec2f(texCoords[tindices[3 * i + 2]], texCoords[tindices[3 * i + 2] + 1]));
}
triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::FACE_MARK) != 0);
@@ -348,10 +348,10 @@ void WingedEdgeBuilder::buildTriangles(const real * /*vertices*/, const real *no
currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, 0);
}
-void WingedEdgeBuilder::transformVertices(const real *vertices, unsigned vsize, const Matrix44r& transform, real *res)
+void WingedEdgeBuilder::transformVertices(const float *vertices, unsigned vsize, const Matrix44r& transform, float *res)
{
- const real *v = vertices;
- real *pv = res;
+ const float *v = vertices;
+ float *pv = res;
for (unsigned int i = 0; i < vsize / 3; i++) {
HVec3r hv_tmp(v[0], v[1], v[2]);
@@ -363,10 +363,10 @@ void WingedEdgeBuilder::transformVertices(const real *vertices, unsigned vsize,
}
}
-void WingedEdgeBuilder::transformNormals(const real *normals, unsigned nsize, const Matrix44r& transform, real *res)
+void WingedEdgeBuilder::transformNormals(const float *normals, unsigned nsize, const Matrix44r& transform, float *res)
{
- const real *n = normals;
- real *pn = res;
+ const float *n = normals;
+ float *pn = res;
for (unsigned int i = 0; i < nsize / 3; i++) {
Vec3r hn(n[0], n[1], n[2]);
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
index 36f090f4ae9..5683b39fd28 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
@@ -118,29 +118,29 @@ public:
protected:
virtual bool buildWShape(WShape& shape, IndexedFaceSet& ifs);
- virtual void buildWVertices(WShape& shape, const real *vertices, unsigned vsize);
+ virtual void buildWVertices(WShape& shape, const float *vertices, unsigned vsize);
RenderMonitor *_pRenderMonitor;
private:
- void buildTriangleStrip(const real *vertices, const real *normals, vector<FrsMaterial>& iMaterials,
- const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
+ void buildTriangleStrip(const float *vertices, const float *normals, vector<FrsMaterial>& iMaterials,
+ const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices, const unsigned *nindices, const unsigned *mindices,
const unsigned *tindices, const unsigned nvertices);
- void buildTriangleFan(const real *vertices, const real *normals, vector<FrsMaterial>& iMaterials,
- const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
+ void buildTriangleFan(const float *vertices, const float *normals, vector<FrsMaterial>& iMaterials,
+ const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices, const unsigned *nindices, const unsigned *mindices,
const unsigned *tindices, const unsigned nvertices);
- void buildTriangles(const real *vertices, const real *normals, vector<FrsMaterial>& iMaterials,
- const real *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
+ void buildTriangles(const float *vertices, const float *normals, vector<FrsMaterial>& iMaterials,
+ const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices, const unsigned *nindices, const unsigned *mindices,
const unsigned *tindices, const unsigned nvertices);
- void transformVertices(const real *vertices, unsigned vsize, const Matrix44r& transform, real *res);
+ void transformVertices(const float *vertices, unsigned vsize, const Matrix44r& transform, float *res);
- void transformNormals(const real *normals, unsigned nsize, const Matrix44r& transform, real *res);
+ void transformNormals(const float *normals, unsigned nsize, const Matrix44r& transform, float *res);
WShape *_current_wshape;
FrsMaterial *_current_frs_material;
@@ -151,7 +151,6 @@ private:
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:WingedEdgeBuilder")
#endif
-
};
} /* namespace Freestyle */