mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-22 07:50:07 +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() {
|
||||
struct timeval l_rtime;
|
||||
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() {
|
||||
struct timeval l_rtime;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -221,10 +221,10 @@ namespace {
|
||||
ConstIndexArray vFaces = level.getVertexFaces(vIndex);
|
||||
ConstLocalIndexArray vInFaces = level.getVertexFaceLocalIndices(vIndex);
|
||||
|
||||
vSpan._startFace = vFaces.size();
|
||||
vSpan._startFace = (LocalIndex) vFaces.size();
|
||||
for (int i = 0; i < vFaces.size(); ++i) {
|
||||
if ((vFaces[i] == startFace) && (vInFaces[i] == startCorner)) {
|
||||
vSpan._startFace = i;
|
||||
vSpan._startFace = (LocalIndex) i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1137,8 +1137,8 @@ PatchBuilder::assembleIrregularSourcePatch(
|
||||
} else {
|
||||
ConstIndexArray vFaces = level.getVertexFaces(fVerts[corner]);
|
||||
|
||||
patchCorner._numFaces = vFaces.size();
|
||||
patchCorner._patchFace = vFaces.FindIndex(faceIndex);
|
||||
patchCorner._numFaces = (LocalIndex) vFaces.size();
|
||||
patchCorner._patchFace = (LocalIndex) vFaces.FindIndex(faceIndex);
|
||||
patchCorner._boundary = vTag._boundary;
|
||||
}
|
||||
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 cValueTags = childFVar.getVertexValueTags(cVert);
|
||||
|
||||
for (int cSibling = 0; cSibling < cVertValues.size(); ++cSibling) {
|
||||
int pSibling = refineFVar.getChildValueParentSource(cVert, cSibling);
|
||||
assert(pSibling == cSibling);
|
||||
for (int cSiblingIndex = 0; cSiblingIndex < cVertValues.size(); ++cSiblingIndex) {
|
||||
int pSiblingIndex = refineFVar.getChildValueParentSource(cVert, cSiblingIndex);
|
||||
assert(pSiblingIndex == cSiblingIndex);
|
||||
|
||||
typedef Vtr::internal::FVarLevel::Sibling SiblingIntType;
|
||||
|
||||
SiblingIntType cSibling = (SiblingIntType) cSiblingIndex;
|
||||
SiblingIntType pSibling = (SiblingIntType) pSiblingIndex;
|
||||
|
||||
Vtr::Index pVertValue = pVertValues[pSibling];
|
||||
Vtr::Index cVertValue = cVertValues[cSibling];
|
||||
|
@ -451,7 +451,7 @@ template <class MESH>
|
||||
inline void
|
||||
TopologyRefinerFactory<MESH>::setNumBaseFaceVertices(TopologyRefiner & newRefiner, Index f, int count) {
|
||||
newRefiner._levels[0]->resizeFaceVertices(f, count);
|
||||
newRefiner._hasIrregFaces |= (count != newRefiner._regFaceSize);
|
||||
newRefiner._hasIrregFaces = newRefiner._hasIrregFaces || (count != newRefiner._regFaceSize);
|
||||
}
|
||||
template <class MESH>
|
||||
inline void
|
||||
@ -553,7 +553,7 @@ template <class MESH>
|
||||
inline void
|
||||
TopologyRefinerFactory<MESH>::setBaseFaceHole(TopologyRefiner & newRefiner, Index f, bool b) {
|
||||
newRefiner._levels[0]->setFaceHole(f, b);
|
||||
newRefiner._hasHoles |= b;
|
||||
newRefiner._hasHoles = newRefiner._hasHoles || b;
|
||||
}
|
||||
|
||||
template <class MESH>
|
||||
|
@ -277,9 +277,11 @@ Scheme<SCHEME_CATMARK>::assignSmoothLimitMask(VERTEX const& vertex, MASK& posMas
|
||||
posMask.FaceWeight(2) = fWeight;
|
||||
posMask.FaceWeight(3) = fWeight;
|
||||
} 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 vWeight = (Weight)(1.0f - valence * (eWeight + fWeight));
|
||||
Weight vWeight = 1.0f - Valence * (eWeight + fWeight);
|
||||
|
||||
posMask.VertexWeight(0) = vWeight;
|
||||
for (int i = 0; i < valence; ++i) {
|
||||
|
@ -89,33 +89,34 @@ public:
|
||||
VtxBoundaryInterpolation GetVtxBoundaryInterpolation() const { return (VtxBoundaryInterpolation) _vtxBoundInterp; }
|
||||
|
||||
/// \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
|
||||
FVarLinearInterpolation GetFVarLinearInterpolation() const { return (FVarLinearInterpolation) _fvarLinInterp; }
|
||||
|
||||
/// \brief Set face-varying interpolation rule
|
||||
void SetFVarLinearInterpolation(FVarLinearInterpolation b) { _fvarLinInterp = b; }
|
||||
void SetFVarLinearInterpolation(FVarLinearInterpolation b) { _fvarLinInterp = (EnumIntType) b; }
|
||||
|
||||
/// \brief Get edge crease rule
|
||||
CreasingMethod GetCreasingMethod() const { return (CreasingMethod) _creasingMethod; }
|
||||
|
||||
/// \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 !)
|
||||
TriangleSubdivision GetTriangleSubdivision() const { return (TriangleSubdivision) _triangleSub; }
|
||||
|
||||
/// \brief Set triangle subdivision weights rule (Catmark scheme only !)
|
||||
void SetTriangleSubdivision(TriangleSubdivision t) { _triangleSub = t; }
|
||||
void SetTriangleSubdivision(TriangleSubdivision t) { _triangleSub = (EnumIntType) t; }
|
||||
|
||||
private:
|
||||
// Use a small integer type to pack these rather than bitfields:
|
||||
typedef unsigned char EnumIntType;
|
||||
|
||||
// Bitfield members:
|
||||
unsigned int _vtxBoundInterp : 2,
|
||||
_fvarLinInterp : 3,
|
||||
_creasingMethod : 2,
|
||||
_triangleSub : 2;
|
||||
EnumIntType _vtxBoundInterp;
|
||||
EnumIntType _fvarLinInterp;
|
||||
EnumIntType _creasingMethod;
|
||||
EnumIntType _triangleSub;
|
||||
};
|
||||
|
||||
} // end namespace sdc
|
||||
|
@ -33,7 +33,7 @@
|
||||
static int
|
||||
parseIntArg(const char* argString, int dfltValue = 0) {
|
||||
char *argEndptr;
|
||||
int argValue = strtol(argString, &argEndptr, 10);
|
||||
int argValue = (int) strtol(argString, &argEndptr, 10);
|
||||
if (*argEndptr != 0) {
|
||||
printf("Warning: non-integer option parameter '%s' ignored\n",
|
||||
argString);
|
||||
|
@ -122,7 +122,7 @@ struct Shape {
|
||||
char FindMaterial(char const * name) {
|
||||
for (int i=0; i<(int)mtls.size(); ++i) {
|
||||
if (mtls[i]->name==name) {
|
||||
return i;
|
||||
return (char) i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -134,10 +134,7 @@ RunPerfTest(Shape const & shape, TestOptions const & options) {
|
||||
FarStencilTable const * vertexStencils = NULL;
|
||||
if (options.createStencils) {
|
||||
s.Start();
|
||||
|
||||
typename FarStencilTableFactory::Options options;
|
||||
vertexStencils = FarStencilTableFactory::Create(*refiner, options);
|
||||
|
||||
vertexStencils = FarStencilTableFactory::Create(*refiner);
|
||||
s.Stop();
|
||||
result.timeStencilFactory = s.GetElapsed();
|
||||
} else {
|
||||
@ -273,7 +270,7 @@ PrintResultCSV(TestResult const & result, PrintOptions const & options) {
|
||||
static int
|
||||
parseIntArg(char const * argString, int dfltValue = 0) {
|
||||
char *argEndptr;
|
||||
int argValue = strtol(argString, &argEndptr, 10);
|
||||
int argValue = (int) strtol(argString, &argEndptr, 10);
|
||||
if (*argEndptr != 0) {
|
||||
fprintf(stderr,
|
||||
"Warning: non-integer option parameter '%s' ignored\n",
|
||||
|
Loading…
Reference in New Issue
Block a user