diff options
Diffstat (limited to 'source/blender/freestyle/intern/scene_graph')
4 files changed, 72 insertions, 65 deletions
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index d02ff6990a5..39dbf4b87a9 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -7,6 +7,8 @@ #include "IndexedFaceSet.h" +#include "BLI_sys_types.h" + namespace Freestyle { IndexedFaceSet::IndexedFaceSet() @@ -34,26 +36,26 @@ IndexedFaceSet::IndexedFaceSet() } IndexedFaceSet::IndexedFaceSet(float *iVertices, - unsigned iVSize, + uint iVSize, float *iNormals, - unsigned iNSize, + uint iNSize, FrsMaterial **iMaterials, - unsigned iMSize, + uint iMSize, float *iTexCoords, - unsigned iTSize, - unsigned iNumFaces, - unsigned *iNumVertexPerFace, + uint iTSize, + uint iNumFaces, + uint *iNumVertexPerFace, TRIANGLES_STYLE *iFaceStyle, FaceEdgeMark *iFaceEdgeMarks, - unsigned *iVIndices, - unsigned iVISize, - unsigned *iNIndices, - unsigned iNISize, - unsigned *iMIndices, - unsigned iMISize, - unsigned *iTIndices, - unsigned iTISize, - unsigned iCopy) + uint *iVIndices, + uint iVISize, + uint *iNIndices, + uint iNISize, + uint *iMIndices, + uint iMISize, + uint *iTIndices, + uint iTISize, + uint iCopy) { if (1 == iCopy) { _VSize = iVSize; @@ -68,7 +70,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, _FrsMaterials = nullptr; if (iMaterials) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iMaterials[i])); } } @@ -80,8 +82,8 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, } _NumFaces = iNumFaces; - _NumVertexPerFace = new unsigned[_NumFaces]; - memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(unsigned)); + _NumVertexPerFace = new uint[_NumFaces]; + memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(uint)); _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iFaceStyle, _NumFaces * sizeof(TRIANGLES_STYLE)); @@ -90,24 +92,24 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, memcpy(_FaceEdgeMarks, iFaceEdgeMarks, _NumFaces * sizeof(FaceEdgeMark)); _VISize = iVISize; - _VIndices = new unsigned[_VISize]; - memcpy(_VIndices, iVIndices, _VISize * sizeof(unsigned)); + _VIndices = new uint[_VISize]; + memcpy(_VIndices, iVIndices, _VISize * sizeof(uint)); _NISize = iNISize; - _NIndices = new unsigned[_NISize]; - memcpy(_NIndices, iNIndices, _NISize * sizeof(unsigned)); + _NIndices = new uint[_NISize]; + memcpy(_NIndices, iNIndices, _NISize * sizeof(uint)); _MISize = iMISize; _MIndices = nullptr; if (iMIndices) { - _MIndices = new unsigned[_MISize]; - memcpy(_MIndices, iMIndices, _MISize * sizeof(unsigned)); + _MIndices = new uint[_MISize]; + memcpy(_MIndices, iMIndices, _MISize * sizeof(uint)); } _TISize = iTISize; _TIndices = nullptr; if (_TISize) { - _TIndices = new unsigned[_TISize]; - memcpy(_TIndices, iTIndices, _TISize * sizeof(unsigned)); + _TIndices = new uint[_TISize]; + memcpy(_TIndices, iTIndices, _TISize * sizeof(uint)); } } else { @@ -161,7 +163,7 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) _MSize = iBrother.msize(); if (_MSize) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iBrother._FrsMaterials[i])); } } @@ -177,8 +179,8 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) } _NumFaces = iBrother.numFaces(); - _NumVertexPerFace = new unsigned[_NumFaces]; - memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(unsigned)); + _NumVertexPerFace = new uint[_NumFaces]; + memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(uint)); _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iBrother.trianglesStyle(), _NumFaces * sizeof(TRIANGLES_STYLE)); @@ -187,17 +189,17 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) memcpy(_FaceEdgeMarks, iBrother.faceEdgeMarks(), _NumFaces * sizeof(FaceEdgeMark)); _VISize = iBrother.visize(); - _VIndices = new unsigned[_VISize]; - memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(unsigned)); + _VIndices = new uint[_VISize]; + memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(uint)); _NISize = iBrother.nisize(); - _NIndices = new unsigned[_NISize]; - memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(unsigned)); + _NIndices = new uint[_NISize]; + memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(uint)); _MISize = iBrother.misize(); if (_MISize) { - _MIndices = new unsigned[_MISize]; - memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(unsigned)); + _MIndices = new uint[_MISize]; + memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(uint)); } else { _MIndices = nullptr; @@ -206,8 +208,8 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) _TISize = iBrother.tisize(); _TIndices = nullptr; if (_TISize) { - _TIndices = new unsigned[_TISize]; - memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(unsigned)); + _TIndices = new uint[_TISize]; + memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(uint)); } } @@ -224,7 +226,7 @@ IndexedFaceSet::~IndexedFaceSet() } if (nullptr != _FrsMaterials) { - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { delete _FrsMaterials[i]; } delete[] _FrsMaterials; @@ -290,7 +292,7 @@ void IndexedFaceSet::ComputeBBox() // parse all the coordinates to find the Xmax, YMax, ZMax float *v = _Vertices; - for (unsigned int i = 0; i < (_VSize / 3); ++i) { + for (uint i = 0; i < (_VSize / 3); ++i) { if (*v > XMax) { XMax = *v; } diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp index 31101e988e5..0089f68ce2d 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp +++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp @@ -9,6 +9,7 @@ #include "NodeTransform.h" #include "BLI_math.h" +#include "BLI_sys_types.h" namespace Freestyle { @@ -122,7 +123,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) // Computes the transform iBBox HVec3r tbox[8]; - unsigned int i; + uint i; for (i = 0; i < 8; i++) { tbox[i] = _Matrix * box[i]; } @@ -130,7 +131,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) Vec3r newMin(tbox[0]); Vec3r newMax(tbox[0]); for (i = 0; i < 8; i++) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { if (newMin[j] > tbox[i][j]) { newMin[j] = tbox[i][j]; } @@ -147,9 +148,9 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) bool NodeTransform::isScaled(const Matrix44r &M) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { real norm = 0; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { norm += M(i, j) * M(i, j); } if ((norm > 1.01) || (norm < 0.99)) { diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp index af41421fa72..0ab83003514 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -6,6 +6,8 @@ #include "SceneHash.h" +#include "BLI_sys_types.h" + #include <sstream> namespace Freestyle { @@ -20,38 +22,38 @@ string SceneHash::toString() 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 + adler32((uchar *)&r->xsch, sizeof(r->xsch)); // resolution_x + adler32((uchar *)&r->ysch, sizeof(r->ysch)); // resolution_y + adler32((uchar *)&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)); + adler32((uchar *)&config->flags, sizeof(config->flags)); + adler32((uchar *)&config->crease_angle, sizeof(config->crease_angle)); + adler32((uchar *)&config->sphere_radius, sizeof(config->sphere_radius)); + adler32((uchar *)&config->dkr_epsilon, sizeof(config->dkr_epsilon)); } void SceneHash::visitNodeCamera(NodeCamera &cam) { double *proj = cam.projectionMatrix(); for (int i = 0; i < 16; i++) { - adler32((unsigned char *)&proj[i], sizeof(double)); + adler32((uchar *)&proj[i], sizeof(double)); } } void SceneHash::visitIndexedFaceSet(IndexedFaceSet &ifs) { const float *v = ifs.vertices(); - const unsigned n = ifs.vsize(); + const uint n = ifs.vsize(); - for (unsigned i = 0; i < n; i++) { - adler32((unsigned char *)&v[i], sizeof(v[i])); + for (uint i = 0; i < n; i++) { + adler32((uchar *)&v[i], sizeof(v[i])); } } static const int MOD_ADLER = 65521; -void SceneHash::adler32(const unsigned char *data, int size) +void SceneHash::adler32(const uchar *data, int size) { uint32_t sum1 = _sum & 0xffff; uint32_t sum2 = (_sum >> 16) & 0xffff; diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp index 623b6b0e2bf..4a2b6979985 100644 --- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp +++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp @@ -10,6 +10,8 @@ #include "IndexedFaceSet.h" #include "ScenePrettyPrinter.h" +#include "BLI_sys_types.h" + namespace Freestyle { #define VISIT(CLASS) \ @@ -25,42 +27,42 @@ VISIT(NodeLight) VISIT(NodeDrawingStyle) VISIT(NodeTransform) -void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape &UNUSED(shape)) +void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape & /*shape*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeShapeAfter(NodeShape &UNUSED(shape)) +void ScenePrettyPrinter::visitNodeShapeAfter(NodeShape & /*shape*/) { decreaseSpace(); } -void ScenePrettyPrinter::visitNodeGroupBefore(NodeGroup &UNUSED(group)) +void ScenePrettyPrinter::visitNodeGroupBefore(NodeGroup & /*group*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeGroupAfter(NodeGroup &UNUSED(group)) +void ScenePrettyPrinter::visitNodeGroupAfter(NodeGroup & /*group*/) { decreaseSpace(); } -void ScenePrettyPrinter::visitNodeDrawingStyleBefore(NodeDrawingStyle &UNUSED(style)) +void ScenePrettyPrinter::visitNodeDrawingStyleBefore(NodeDrawingStyle & /*style*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeDrawingStyleAfter(NodeDrawingStyle &UNUSED(style)) +void ScenePrettyPrinter::visitNodeDrawingStyleAfter(NodeDrawingStyle & /*style*/) { decreaseSpace(); } -void ScenePrettyPrinter::visitNodeTransformBefore(NodeTransform &UNUSED(transform)) +void ScenePrettyPrinter::visitNodeTransformBefore(NodeTransform & /*transform*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeTransformAfter(NodeTransform &UNUSED(transform)) +void ScenePrettyPrinter::visitNodeTransformAfter(NodeTransform & /*transform*/) { decreaseSpace(); } @@ -73,11 +75,11 @@ VISIT(VertexRep) void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs) { const float *vertices = ifs.vertices(); - unsigned vsize = ifs.vsize(); + uint vsize = ifs.vsize(); _ofs << _space << "IndexedFaceSet" << endl; const float *p = vertices; - for (unsigned int i = 0; i < vsize / 3; i++) { + for (uint i = 0; i < vsize / 3; i++) { _ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", " << p[2] << endl; p += 3; |