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/freestyle/intern/scene_graph
parent67057865405700572b29e1e3ba1f660c9be39152 (diff)
Freestyle: internal switch from double to float in mesh loading and construction of winged edges.
Diffstat (limited to 'source/blender/freestyle/intern/scene_graph')
-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
5 files changed, 36 insertions, 37 deletions
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;