mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-09 22:00:06 +00:00
Fix GCC warnings with -Wshadow and -Wconversion:
- suppressed -Wshadow in libraries, tutorials and regressions - suppressed -Wconversion when casts to simple POD type required
This commit is contained in:
parent
810d7f671b
commit
57847e625c
@ -43,14 +43,15 @@ public:
|
|||||||
void Start() {
|
void Start() {
|
||||||
struct timeval l_rtime;
|
struct timeval l_rtime;
|
||||||
gettimeofday(&l_rtime,0);
|
gettimeofday(&l_rtime,0);
|
||||||
_elapsed = l_rtime.tv_sec + l_rtime.tv_usec/1000000.0;
|
_elapsed = (double)l_rtime.tv_sec + (double)l_rtime.tv_usec/1000000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop() {
|
void Stop() {
|
||||||
struct timeval l_rtime;
|
struct timeval l_rtime;
|
||||||
|
|
||||||
gettimeofday(&l_rtime,0);
|
gettimeofday(&l_rtime,0);
|
||||||
_elapsed = (l_rtime.tv_sec + l_rtime.tv_usec/1000000.0) - _elapsed;
|
_elapsed = ((double)l_rtime.tv_sec + (double)l_rtime.tv_usec/1000000.0)
|
||||||
|
- _elapsed;
|
||||||
_totalElapsed += _elapsed;
|
_totalElapsed += _elapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,10 +221,10 @@ namespace {
|
|||||||
ConstIndexArray vFaces = level.getVertexFaces(vIndex);
|
ConstIndexArray vFaces = level.getVertexFaces(vIndex);
|
||||||
ConstLocalIndexArray vInFaces = level.getVertexFaceLocalIndices(vIndex);
|
ConstLocalIndexArray vInFaces = level.getVertexFaceLocalIndices(vIndex);
|
||||||
|
|
||||||
vSpan._startFace = vFaces.size();
|
vSpan._startFace = (LocalIndex) vFaces.size();
|
||||||
for (int i = 0; i < vFaces.size(); ++i) {
|
for (int i = 0; i < vFaces.size(); ++i) {
|
||||||
if ((vFaces[i] == startFace) && (vInFaces[i] == startCorner)) {
|
if ((vFaces[i] == startFace) && (vInFaces[i] == startCorner)) {
|
||||||
vSpan._startFace = i;
|
vSpan._startFace = (LocalIndex) i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1137,8 +1137,8 @@ PatchBuilder::assembleIrregularSourcePatch(
|
|||||||
} else {
|
} else {
|
||||||
ConstIndexArray vFaces = level.getVertexFaces(fVerts[corner]);
|
ConstIndexArray vFaces = level.getVertexFaces(fVerts[corner]);
|
||||||
|
|
||||||
patchCorner._numFaces = vFaces.size();
|
patchCorner._numFaces = (LocalIndex) vFaces.size();
|
||||||
patchCorner._patchFace = vFaces.FindIndex(faceIndex);
|
patchCorner._patchFace = (LocalIndex) vFaces.FindIndex(faceIndex);
|
||||||
patchCorner._boundary = vTag._boundary;
|
patchCorner._boundary = vTag._boundary;
|
||||||
}
|
}
|
||||||
patchCorner._sharp = cornerSpans[corner]._sharp;
|
patchCorner._sharp = cornerSpans[corner]._sharp;
|
||||||
|
@ -969,9 +969,14 @@ PrimvarRefinerReal<REAL>::interpFVarFromVerts(int level, T const & src, U & dst,
|
|||||||
Vtr::internal::FVarLevel::ConstValueTagArray pValueTags = parentFVar.getVertexValueTags(vert);
|
Vtr::internal::FVarLevel::ConstValueTagArray pValueTags = parentFVar.getVertexValueTags(vert);
|
||||||
Vtr::internal::FVarLevel::ConstValueTagArray cValueTags = childFVar.getVertexValueTags(cVert);
|
Vtr::internal::FVarLevel::ConstValueTagArray cValueTags = childFVar.getVertexValueTags(cVert);
|
||||||
|
|
||||||
for (int cSibling = 0; cSibling < cVertValues.size(); ++cSibling) {
|
for (int cSiblingIndex = 0; cSiblingIndex < cVertValues.size(); ++cSiblingIndex) {
|
||||||
int pSibling = refineFVar.getChildValueParentSource(cVert, cSibling);
|
int pSiblingIndex = refineFVar.getChildValueParentSource(cVert, cSiblingIndex);
|
||||||
assert(pSibling == cSibling);
|
assert(pSiblingIndex == cSiblingIndex);
|
||||||
|
|
||||||
|
typedef Vtr::internal::FVarLevel::Sibling SiblingIntType;
|
||||||
|
|
||||||
|
SiblingIntType cSibling = (SiblingIntType) cSiblingIndex;
|
||||||
|
SiblingIntType pSibling = (SiblingIntType) pSiblingIndex;
|
||||||
|
|
||||||
Vtr::Index pVertValue = pVertValues[pSibling];
|
Vtr::Index pVertValue = pVertValues[pSibling];
|
||||||
Vtr::Index cVertValue = cVertValues[cSibling];
|
Vtr::Index cVertValue = cVertValues[cSibling];
|
||||||
|
@ -451,7 +451,7 @@ template <class MESH>
|
|||||||
inline void
|
inline void
|
||||||
TopologyRefinerFactory<MESH>::setNumBaseFaceVertices(TopologyRefiner & newRefiner, Index f, int count) {
|
TopologyRefinerFactory<MESH>::setNumBaseFaceVertices(TopologyRefiner & newRefiner, Index f, int count) {
|
||||||
newRefiner._levels[0]->resizeFaceVertices(f, count);
|
newRefiner._levels[0]->resizeFaceVertices(f, count);
|
||||||
newRefiner._hasIrregFaces |= (count != newRefiner._regFaceSize);
|
newRefiner._hasIrregFaces = newRefiner._hasIrregFaces || (count != newRefiner._regFaceSize);
|
||||||
}
|
}
|
||||||
template <class MESH>
|
template <class MESH>
|
||||||
inline void
|
inline void
|
||||||
@ -553,7 +553,7 @@ template <class MESH>
|
|||||||
inline void
|
inline void
|
||||||
TopologyRefinerFactory<MESH>::setBaseFaceHole(TopologyRefiner & newRefiner, Index f, bool b) {
|
TopologyRefinerFactory<MESH>::setBaseFaceHole(TopologyRefiner & newRefiner, Index f, bool b) {
|
||||||
newRefiner._levels[0]->setFaceHole(f, b);
|
newRefiner._levels[0]->setFaceHole(f, b);
|
||||||
newRefiner._hasHoles |= b;
|
newRefiner._hasHoles = newRefiner._hasHoles || b;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MESH>
|
template <class MESH>
|
||||||
|
@ -277,9 +277,11 @@ Scheme<SCHEME_CATMARK>::assignSmoothLimitMask(VERTEX const& vertex, MASK& posMas
|
|||||||
posMask.FaceWeight(2) = fWeight;
|
posMask.FaceWeight(2) = fWeight;
|
||||||
posMask.FaceWeight(3) = fWeight;
|
posMask.FaceWeight(3) = fWeight;
|
||||||
} else {
|
} else {
|
||||||
Weight fWeight = 1.0f / (Weight)(valence * (valence + 5.0f));
|
Weight Valence = (Weight) valence;
|
||||||
|
|
||||||
|
Weight fWeight = 1.0f / (Valence * (Valence + 5.0f));
|
||||||
Weight eWeight = 4.0f * fWeight;
|
Weight eWeight = 4.0f * fWeight;
|
||||||
Weight vWeight = (Weight)(1.0f - valence * (eWeight + fWeight));
|
Weight vWeight = 1.0f - Valence * (eWeight + fWeight);
|
||||||
|
|
||||||
posMask.VertexWeight(0) = vWeight;
|
posMask.VertexWeight(0) = vWeight;
|
||||||
for (int i = 0; i < valence; ++i) {
|
for (int i = 0; i < valence; ++i) {
|
||||||
|
@ -89,33 +89,34 @@ public:
|
|||||||
VtxBoundaryInterpolation GetVtxBoundaryInterpolation() const { return (VtxBoundaryInterpolation) _vtxBoundInterp; }
|
VtxBoundaryInterpolation GetVtxBoundaryInterpolation() const { return (VtxBoundaryInterpolation) _vtxBoundInterp; }
|
||||||
|
|
||||||
/// \brief Set vertex boundary interpolation rule
|
/// \brief Set vertex boundary interpolation rule
|
||||||
void SetVtxBoundaryInterpolation(VtxBoundaryInterpolation b) { _vtxBoundInterp = b; }
|
void SetVtxBoundaryInterpolation(VtxBoundaryInterpolation b) { _vtxBoundInterp = (EnumIntType) b; }
|
||||||
|
|
||||||
/// \brief Get face-varying interpolation rule
|
/// \brief Get face-varying interpolation rule
|
||||||
FVarLinearInterpolation GetFVarLinearInterpolation() const { return (FVarLinearInterpolation) _fvarLinInterp; }
|
FVarLinearInterpolation GetFVarLinearInterpolation() const { return (FVarLinearInterpolation) _fvarLinInterp; }
|
||||||
|
|
||||||
/// \brief Set face-varying interpolation rule
|
/// \brief Set face-varying interpolation rule
|
||||||
void SetFVarLinearInterpolation(FVarLinearInterpolation b) { _fvarLinInterp = b; }
|
void SetFVarLinearInterpolation(FVarLinearInterpolation b) { _fvarLinInterp = (EnumIntType) b; }
|
||||||
|
|
||||||
/// \brief Get edge crease rule
|
/// \brief Get edge crease rule
|
||||||
CreasingMethod GetCreasingMethod() const { return (CreasingMethod) _creasingMethod; }
|
CreasingMethod GetCreasingMethod() const { return (CreasingMethod) _creasingMethod; }
|
||||||
|
|
||||||
/// \brief Set edge crease rule
|
/// \brief Set edge crease rule
|
||||||
void SetCreasingMethod(CreasingMethod c) { _creasingMethod = c; }
|
void SetCreasingMethod(CreasingMethod c) { _creasingMethod = (EnumIntType) c; }
|
||||||
|
|
||||||
/// \brief Get triangle subdivision weights rule (Catmark scheme only !)
|
/// \brief Get triangle subdivision weights rule (Catmark scheme only !)
|
||||||
TriangleSubdivision GetTriangleSubdivision() const { return (TriangleSubdivision) _triangleSub; }
|
TriangleSubdivision GetTriangleSubdivision() const { return (TriangleSubdivision) _triangleSub; }
|
||||||
|
|
||||||
/// \brief Set triangle subdivision weights rule (Catmark scheme only !)
|
/// \brief Set triangle subdivision weights rule (Catmark scheme only !)
|
||||||
void SetTriangleSubdivision(TriangleSubdivision t) { _triangleSub = t; }
|
void SetTriangleSubdivision(TriangleSubdivision t) { _triangleSub = (EnumIntType) t; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Use a small integer type to pack these rather than bitfields:
|
||||||
|
typedef unsigned char EnumIntType;
|
||||||
|
|
||||||
// Bitfield members:
|
EnumIntType _vtxBoundInterp;
|
||||||
unsigned int _vtxBoundInterp : 2,
|
EnumIntType _fvarLinInterp;
|
||||||
_fvarLinInterp : 3,
|
EnumIntType _creasingMethod;
|
||||||
_creasingMethod : 2,
|
EnumIntType _triangleSub;
|
||||||
_triangleSub : 2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace sdc
|
} // end namespace sdc
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
static int
|
static int
|
||||||
parseIntArg(const char* argString, int dfltValue = 0) {
|
parseIntArg(const char* argString, int dfltValue = 0) {
|
||||||
char *argEndptr;
|
char *argEndptr;
|
||||||
int argValue = strtol(argString, &argEndptr, 10);
|
int argValue = (int) strtol(argString, &argEndptr, 10);
|
||||||
if (*argEndptr != 0) {
|
if (*argEndptr != 0) {
|
||||||
printf("Warning: non-integer option parameter '%s' ignored\n",
|
printf("Warning: non-integer option parameter '%s' ignored\n",
|
||||||
argString);
|
argString);
|
||||||
|
@ -122,7 +122,7 @@ struct Shape {
|
|||||||
char FindMaterial(char const * name) {
|
char FindMaterial(char const * name) {
|
||||||
for (int i=0; i<(int)mtls.size(); ++i) {
|
for (int i=0; i<(int)mtls.size(); ++i) {
|
||||||
if (mtls[i]->name==name) {
|
if (mtls[i]->name==name) {
|
||||||
return i;
|
return (char) i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -134,10 +134,7 @@ RunPerfTest(Shape const & shape, TestOptions const & options) {
|
|||||||
FarStencilTable const * vertexStencils = NULL;
|
FarStencilTable const * vertexStencils = NULL;
|
||||||
if (options.createStencils) {
|
if (options.createStencils) {
|
||||||
s.Start();
|
s.Start();
|
||||||
|
vertexStencils = FarStencilTableFactory::Create(*refiner);
|
||||||
typename FarStencilTableFactory::Options options;
|
|
||||||
vertexStencils = FarStencilTableFactory::Create(*refiner, options);
|
|
||||||
|
|
||||||
s.Stop();
|
s.Stop();
|
||||||
result.timeStencilFactory = s.GetElapsed();
|
result.timeStencilFactory = s.GetElapsed();
|
||||||
} else {
|
} else {
|
||||||
@ -273,7 +270,7 @@ PrintResultCSV(TestResult const & result, PrintOptions const & options) {
|
|||||||
static int
|
static int
|
||||||
parseIntArg(char const * argString, int dfltValue = 0) {
|
parseIntArg(char const * argString, int dfltValue = 0) {
|
||||||
char *argEndptr;
|
char *argEndptr;
|
||||||
int argValue = strtol(argString, &argEndptr, 10);
|
int argValue = (int) strtol(argString, &argEndptr, 10);
|
||||||
if (*argEndptr != 0) {
|
if (*argEndptr != 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Warning: non-integer option parameter '%s' ignored\n",
|
"Warning: non-integer option parameter '%s' ignored\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user