mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-10 16:40:11 +00:00
iso-646 fix for ptex / examples / tutorials
This commit is contained in:
parent
3e3695652f
commit
1ba1e07ad1
@ -104,7 +104,7 @@ D3D11PtexMipmapTexture::Create(ID3D11DeviceContext *deviceContext,
|
||||
int maxNumPages = D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
|
||||
|
||||
// Read the ptex data and pack the texels
|
||||
bool padAlpha = reader->numChannels()==3 and reader->dataType()!=Ptex::dt_float;
|
||||
bool padAlpha = reader->numChannels()==3 && reader->dataType()!=Ptex::dt_float;
|
||||
|
||||
PtexMipmapTextureLoader loader(reader,
|
||||
maxNumPages,
|
||||
@ -119,7 +119,7 @@ D3D11PtexMipmapTexture::Create(ID3D11DeviceContext *deviceContext,
|
||||
ID3D11Buffer *layout = genTextureBuffer(deviceContext,
|
||||
numFaces * 6 * sizeof(short),
|
||||
loader.GetLayoutBuffer());
|
||||
if (not layout) return NULL;
|
||||
if (!layout) return NULL;
|
||||
|
||||
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
|
||||
int bpp = 0;
|
||||
|
@ -43,7 +43,7 @@ PtexMipmapTextureLoader::Block::guttering(PtexMipmapTextureLoader *loader,
|
||||
unsigned char * lineBuffer = new unsigned char[lineBufferSize];
|
||||
|
||||
for (int edge = 0; edge < 4; edge++) {
|
||||
int len = (edge == 0 or edge == 2) ? wid : hei;
|
||||
int len = (edge == 0 || edge == 2) ? wid : hei;
|
||||
loader->sampleNeighbor(lineBuffer, this->index, edge, len, bpp);
|
||||
|
||||
unsigned char *s = lineBuffer, *d;
|
||||
@ -172,11 +172,11 @@ PtexMipmapTextureLoader::Block::Generate(PtexMipmapTextureLoader *loader,
|
||||
// instead of nothing.
|
||||
limit = std::min(std::min(limit, ulog2_), vlog2_);
|
||||
|
||||
while (ulog2_ >= limit and vlog2_ >= limit
|
||||
and (maxLevels == -1 or level <= maxLevels)) {
|
||||
while (ulog2_ >= limit && vlog2_ >= limit
|
||||
&& (maxLevels == -1 || level <= maxLevels)) {
|
||||
if (level % 2 == 1)
|
||||
uofs += (1<<(ulog2_+1))+2;
|
||||
if ((level > 0) and (level % 2 == 0))
|
||||
if ((level > 0) && (level % 2 == 0))
|
||||
vofs += (1<<(vlog2_+1)) + 2;
|
||||
|
||||
unsigned char *dst = destination + vofs * stride + uofs * bpp;
|
||||
@ -228,7 +228,7 @@ struct PtexMipmapTextureLoader::Page
|
||||
|
||||
// returns true if a block can fit in this slot
|
||||
bool Fits(const Block *block) {
|
||||
return (block->width <= width) and (block->height <= height);
|
||||
return (block->width <= width) && (block->height <= height);
|
||||
}
|
||||
};
|
||||
|
||||
@ -374,8 +374,8 @@ public:
|
||||
_currentFace = _ptex->getFaceInfo(_currentFace).adjface(2);
|
||||
_currentEdge = 1;
|
||||
_mid = false;
|
||||
} else if (info.isSubface() and
|
||||
(not _ptex->getFaceInfo(_currentFace).isSubface()) and
|
||||
} else if (info.isSubface() &&
|
||||
(! _ptex->getFaceInfo(_currentFace).isSubface()) &&
|
||||
_currentEdge == 3) {
|
||||
_mid = true;
|
||||
_currentEdge = info.adjedge(_currentEdge);
|
||||
@ -404,8 +404,8 @@ public:
|
||||
}
|
||||
}
|
||||
Ptex::FaceInfo nextFaceInfo = _ptex->getFaceInfo(_currentFace);
|
||||
if ((not _clockWise) and
|
||||
(not info.isSubface()) and (nextFaceInfo.isSubface())) {
|
||||
if ((! _clockWise) &&
|
||||
(! info.isSubface()) && (nextFaceInfo.isSubface())) {
|
||||
// needs tricky traverse for boundary subface...
|
||||
if (_currentEdge == 3) {
|
||||
_currentFace = nextFaceInfo.adjface(2);
|
||||
@ -726,7 +726,7 @@ PtexMipmapTextureLoader::getCornerPixel(float *resultPixel, int numchannels,
|
||||
+------+-------+
|
||||
*/
|
||||
int adjface = fi.adjface(edge);
|
||||
if (adjface != -1 and !_ptex->getFaceInfo(adjface).isSubface()) {
|
||||
if (adjface != -1 && !_ptex->getFaceInfo(adjface).isSubface()) {
|
||||
int adjedge = fi.adjedge(edge);
|
||||
|
||||
Ptex::Res res(std::min((int)_blocks[adjface].ulog2, reslog2+1),
|
||||
@ -768,7 +768,7 @@ PtexMipmapTextureLoader::getCornerPixel(float *resultPixel, int numchannels,
|
||||
but the edge 0 is an adjacent edge to get D pixel.
|
||||
*/
|
||||
int adjface = fi.adjface(0);
|
||||
if (adjface != -1 and !_ptex->getFaceInfo(adjface).isSubface()) {
|
||||
if (adjface != -1 && !_ptex->getFaceInfo(adjface).isSubface()) {
|
||||
int adjedge = fi.adjedge(0);
|
||||
Ptex::Res res(std::min((int)_blocks[adjface].ulog2, reslog2+1),
|
||||
std::min((int)_blocks[adjface].vlog2, reslog2+1));
|
||||
@ -802,7 +802,7 @@ PtexMipmapTextureLoader::getCornerPixel(float *resultPixel, int numchannels,
|
||||
// iterate faces around the vertex
|
||||
int numFaces = 0;
|
||||
CornerIterator it(_ptex, face, edge, reslog2);
|
||||
for (; not it.IsDone(); it.Next(), ++numFaces) {
|
||||
for (; !it.IsDone(); it.Next(), ++numFaces) {
|
||||
it.GetPixel(pixel);
|
||||
|
||||
// accumulate pixel value
|
||||
@ -815,7 +815,7 @@ PtexMipmapTextureLoader::getCornerPixel(float *resultPixel, int numchannels,
|
||||
}
|
||||
}
|
||||
// if regular corner, returns diagonal pixel without averaging
|
||||
if (numFaces == 4 and (not it.IsBoundary())) {
|
||||
if (numFaces == 4 && (! it.IsBoundary())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -839,7 +839,7 @@ PtexMipmapTextureLoader::getLevelDiff(int face, int edge)
|
||||
|
||||
int maxDiff = 0;
|
||||
CornerIterator it(_ptex, face, edge, baseRes);
|
||||
for (; not it.IsDone(); it.Next()) {
|
||||
for (; !it.IsDone(); it.Next()) {
|
||||
int res = _blocks[it.GetCurrentFace()].ulog2;
|
||||
if (it.IsSubface()) ++res;
|
||||
maxDiff = std::max(maxDiff, baseRes - res);
|
||||
@ -866,12 +866,12 @@ PtexMipmapTextureLoader::optimizePacking(int maxNumPages,
|
||||
blocks.sort(Block::sort);
|
||||
|
||||
// try to fit into the target memory size if specified
|
||||
if (targetMemory != 0 and _bpp * numTexels > targetMemory) {
|
||||
if (targetMemory != 0 && _bpp * numTexels > targetMemory) {
|
||||
size_t numTargetTexels = targetMemory / _bpp;
|
||||
while (numTexels > numTargetTexels) {
|
||||
Block *block = blocks.front();
|
||||
|
||||
if (block->ulog2 < 2 or block->vlog2 < 2) break;
|
||||
if (block->ulog2 < 2 || block->vlog2 < 2) break;
|
||||
|
||||
// pick a smaller mipmap
|
||||
numTexels -= block->GetNumTexels();
|
||||
@ -946,7 +946,7 @@ PtexMipmapTextureLoader::optimizePacking(int maxNumPages,
|
||||
}
|
||||
|
||||
// adjust the page flag to the first page with open slots
|
||||
if (_pages.size() > (firstslot+1) and
|
||||
if (_pages.size() > (firstslot+1) &&
|
||||
_pages[firstslot+1]->IsFull()) ++firstslot;
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ private:
|
||||
unsigned char *pptr, int bpp, int stride);
|
||||
|
||||
static bool sort(const Block *a, const Block *b) {
|
||||
return (a->height > b->height) or
|
||||
((a->height == b->height) and (a->width > b->width));
|
||||
return (a->height > b->height) ||
|
||||
((a->height == b->height) && (a->width > b->width));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -323,7 +323,7 @@ updateGeom() {
|
||||
|
||||
int nverts = (int)g_positions.size() / 3;
|
||||
|
||||
if (g_moveScale and g_adaptive and not g_animPositions.empty()) {
|
||||
if (g_moveScale && g_adaptive && !g_animPositions.empty()) {
|
||||
|
||||
// baked animation only works with adaptive for now
|
||||
// (since non-adaptive requires normals)
|
||||
@ -780,7 +780,7 @@ createOsdMesh(int level, int kernel) {
|
||||
|
||||
// generate Hbr representation from ptex
|
||||
Shape * shape = createPTexGeo(ptexColor);
|
||||
if (not shape) {
|
||||
if (!shape) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -817,7 +817,7 @@ createOsdMesh(int level, int kernel) {
|
||||
g_mesh = NULL;
|
||||
|
||||
// Adaptive refinement currently supported only for catmull-clark scheme
|
||||
bool doAdaptive = (g_adaptive != 0 and g_scheme == 0);
|
||||
bool doAdaptive = (g_adaptive != 0 && g_scheme == 0);
|
||||
|
||||
OpenSubdiv::Osd::MeshBitset bits;
|
||||
bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive);
|
||||
@ -1224,7 +1224,7 @@ display() {
|
||||
|
||||
g_fpsTimer.Stop();
|
||||
float elapsed = (float)g_fpsTimer.GetElapsed();
|
||||
if (not g_freeze)
|
||||
if (!g_freeze)
|
||||
g_animTime += elapsed;
|
||||
g_fpsTimer.Start();
|
||||
|
||||
@ -1301,7 +1301,7 @@ motion(int x, int y) {
|
||||
// pan
|
||||
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
|
||||
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
|
||||
} else if ((g_mbutton[0] && g_mbutton[1] && !g_mbutton[2]) or
|
||||
} else if ((g_mbutton[0] && g_mbutton[1] && !g_mbutton[2]) ||
|
||||
(!g_mbutton[0] && !g_mbutton[1] && g_mbutton[2])) {
|
||||
// dolly
|
||||
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
|
||||
@ -1372,7 +1372,7 @@ callbackKernel(int k) {
|
||||
g_kernel = k;
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_OPENCL
|
||||
if (g_kernel == kCL and (not g_clDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCL && (!g_clDeviceContext.IsInitialized())) {
|
||||
if (g_clDeviceContext.Initialize(g_pd3dDeviceContext) == false) {
|
||||
printf("Error in initializing OpenCL\n");
|
||||
exit(1);
|
||||
@ -1380,7 +1380,7 @@ callbackKernel(int k) {
|
||||
}
|
||||
#endif
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
if (g_kernel == kCUDA and (not g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCUDA && (!g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_cudaDeviceContext.Initialize(g_pd3dDevice) == false) {
|
||||
printf("Error in initializing Cuda\n");
|
||||
exit(1);
|
||||
@ -2026,7 +2026,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
|
||||
+ (g_osdPTexSpecular ? g_osdPTexSpecular->GetMemoryUsage() : 0);
|
||||
|
||||
// load animation obj sequences (optional)
|
||||
if (not animobjs.empty()) {
|
||||
if (!animobjs.empty()) {
|
||||
for (int i = 0; i < (int)animobjs.size(); ++i) {
|
||||
std::ifstream ifs(animobjs[i].c_str());
|
||||
if (ifs) {
|
||||
@ -2118,7 +2118,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
if (not g_freeze)
|
||||
if (!g_freeze)
|
||||
g_frame++;
|
||||
|
||||
updateGeom();
|
||||
|
@ -1043,7 +1043,7 @@ callbackKernel(int k) {
|
||||
g_kernel = k;
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_OPENCL_DX_INTEROP
|
||||
if (g_kernel == kCL and (not g_clDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCL && (!g_clDeviceContext.IsInitialized())) {
|
||||
if (g_clDeviceContext.Initialize(g_pd3dDeviceContext) == false) {
|
||||
printf("Error in initializing OpenCL\n");
|
||||
exit(1);
|
||||
@ -1051,7 +1051,7 @@ callbackKernel(int k) {
|
||||
}
|
||||
#endif
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
if (g_kernel == kCUDA and (not g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCUDA && (!g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_cudaDeviceContext.Initialize(g_pd3dDevice) == false) {
|
||||
printf("Error in initializing Cuda\n");
|
||||
exit(1);
|
||||
|
@ -414,7 +414,7 @@ createFVarPatches(OpenSubdiv::Far::TopologyRefiner const & refiner,
|
||||
OpenSubdiv::Far::PatchTable const & patchTable,
|
||||
std::vector<Vertex> const & fvarBuffer) {
|
||||
|
||||
assert(not fvarBuffer.empty());
|
||||
assert(!fvarBuffer.empty());
|
||||
|
||||
static int channel = 0;
|
||||
|
||||
|
@ -163,7 +163,7 @@ void GLFont::Draw(GLuint transformUB) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(_VAO and _VBO);
|
||||
assert(_VAO && _VBO);
|
||||
|
||||
glBindVertexArray(_VAO);
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
void Initialize(Options options,
|
||||
std::vector<OpenSubdiv::HbrFace<T> const *> const & faces) {
|
||||
|
||||
assert(not faces.empty());
|
||||
assert(!faces.empty());
|
||||
|
||||
OpenSubdiv::HbrMesh<T> const * hmesh = faces[0]->GetMesh();
|
||||
|
||||
|
@ -1038,7 +1038,7 @@ callbackKernel(int k) {
|
||||
g_kernel = k;
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_OPENCL
|
||||
if (g_kernel == kCL and (not g_clDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCL && (!g_clDeviceContext.IsInitialized())) {
|
||||
if (g_clDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing OpenCL\n");
|
||||
exit(1);
|
||||
@ -1046,7 +1046,7 @@ callbackKernel(int k) {
|
||||
}
|
||||
#endif
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
if (g_kernel == kCUDA and (not g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCUDA && (!g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_cudaDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing Cuda\n");
|
||||
exit(1);
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
p->t += dp[1] * _speed;
|
||||
|
||||
// make sure particles can't skip more than 1 face boundary at a time
|
||||
assert((p->s>-2.0f) and (p->s<2.0f) and (p->t>-2.0f) and (p->t<2.0f));
|
||||
assert((p->s>-2.0f) && (p->s<2.0f) && (p->t>-2.0f) && (p->t<2.0f));
|
||||
|
||||
// check if the particle is jumping a boundary
|
||||
// note: a particle can jump 2 edges at a time (a "diagonal" jump)
|
||||
@ -70,7 +70,7 @@ public:
|
||||
// warp the particle to the other side of the boundary
|
||||
STParticles::WarpParticle(_adjacency, edge, p, dp);
|
||||
}
|
||||
assert((p->s>=0.0f) and (p->s<=1.0f) and (p->t>=0.0f) and (p->t<=1.0f));
|
||||
assert((p->s>=0.0f) && (p->s<=1.0f) && (p->t>=0.0f) && (p->t<=1.0f));
|
||||
|
||||
// resolve particle positions into patch handles
|
||||
OpenSubdiv::Far::PatchTable::PatchHandle const *handle =
|
||||
@ -193,7 +193,7 @@ Rotate(int rot, STParticles::Position * p, float * dp) {
|
||||
case 2: FlipS(p, dp); FlipT(p, dp); break;
|
||||
case 3: FlipT(p, dp); SwapST(p, dp); break;
|
||||
}
|
||||
assert((p->s>=0.0f) and (p->s<=1.0f) and (p->t>=0.0f) and (p->t<=1.0f));
|
||||
assert((p->s>=0.0f) && (p->s<=1.0f) && (p->t>=0.0f) && (p->t<=1.0f));
|
||||
}
|
||||
|
||||
inline void
|
||||
@ -202,7 +202,7 @@ Trim(STParticles::Position * p) {
|
||||
if (p->s>=1.0f) p->s = p->s - 1.0f;
|
||||
if (p->t <0.0f) p->t = 1.0f + p->t;
|
||||
if (p->t>=1.0f) p->t = p->t - 1.0f;
|
||||
assert((p->s>=0.0f) and (p->s<=1.0f) and (p->t>=0.0f) and (p->t<=1.0f));
|
||||
assert((p->s>=0.0f) && (p->s<=1.0f) && (p->t>=0.0f) && (p->t<=1.0f));
|
||||
}
|
||||
|
||||
inline void
|
||||
@ -231,13 +231,13 @@ Bounce(int edge, STParticles::Position * p, float * dp) {
|
||||
// because 'diagonal' cases aren't handled, stick particles to edges when
|
||||
// if they cross 2 boundaries
|
||||
Clamp(p);
|
||||
assert((p->s>=0.0f) and (p->s<=1.0f) and (p->t>=0.0f) and (p->t<=1.0f));
|
||||
assert((p->s>=0.0f) && (p->s<=1.0f) && (p->t>=0.0f) && (p->t<=1.0f));
|
||||
}
|
||||
|
||||
void
|
||||
STParticles::WarpParticle(std::vector<FaceInfo> const &adjacency,
|
||||
int edge, Position * p, float * dp) {
|
||||
assert(p->ptexIndex<(int)adjacency.size() and (edge>=0 and edge<4));
|
||||
assert(p->ptexIndex<(int)adjacency.size() && (edge>=0 && edge<4));
|
||||
|
||||
FaceInfo const & f = adjacency[p->ptexIndex];
|
||||
|
||||
@ -263,7 +263,7 @@ STParticles::WarpParticle(std::vector<FaceInfo> const &adjacency,
|
||||
p->ptexIndex = afid; // move particle to adjacent face
|
||||
}
|
||||
}
|
||||
assert((p->s>=0.0f) and (p->s<=1.0f) and (p->t>=0.0f) and (p->t<=1.0f));
|
||||
assert((p->s>=0.0f) && (p->s<=1.0f) && (p->t>=0.0f) && (p->t<=1.0f));
|
||||
}
|
||||
|
||||
STParticles::~STParticles() {
|
||||
@ -297,7 +297,7 @@ STParticles::Update(float deltaTime) {
|
||||
p->t += dp[1] * speed;
|
||||
|
||||
// make sure particles can't skip more than 1 face boundary at a time
|
||||
assert((p->s>-2.0f) and (p->s<2.0f) and (p->t>-2.0f) and (p->t<2.0f));
|
||||
assert((p->s>-2.0f) && (p->s<2.0f) && (p->t>-2.0f) && (p->t<2.0f));
|
||||
|
||||
// check if the particle is jumping a boundary
|
||||
// note: a particle can jump 2 edges at a time (a "diagonal" jump)
|
||||
@ -313,7 +313,7 @@ STParticles::Update(float deltaTime) {
|
||||
// warp the particle to the other side of the boundary
|
||||
WarpParticle(_adjacency, edge, p, dp);
|
||||
}
|
||||
assert((p->s>=0.0f) and (p->s<=1.0f) and (p->t>=0.0f) and (p->t<=1.0f));
|
||||
assert((p->s>=0.0f) && (p->s<=1.0f) && (p->t>=0.0f) && (p->t<=1.0f));
|
||||
|
||||
// resolve particle positions into patch handles
|
||||
OpenSubdiv::Far::PatchTable::PatchHandle const *handle =
|
||||
|
@ -346,7 +346,7 @@ updateGeom() {
|
||||
|
||||
int nverts = (int)g_positions.size() / 3;
|
||||
|
||||
if (g_moveScale and g_adaptive and not g_animPositions.empty()) {
|
||||
if (g_moveScale && g_adaptive && !g_animPositions.empty()) {
|
||||
// baked animation only works with adaptive for now
|
||||
// (since non-adaptive requires normals)
|
||||
int nkey = (int)g_animPositions.size();
|
||||
@ -875,7 +875,7 @@ createOsdMesh(int level, int kernel) {
|
||||
|
||||
// generate Shape representation from ptex
|
||||
Shape * shape = createPTexGeo(ptexColor);
|
||||
if (not shape) {
|
||||
if (!shape) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -901,7 +901,7 @@ createOsdMesh(int level, int kernel) {
|
||||
g_mesh = NULL;
|
||||
|
||||
// Adaptive refinement currently supported only for catmull-clark scheme
|
||||
bool doAdaptive = (g_adaptive != 0 and g_scheme == 0);
|
||||
bool doAdaptive = (g_adaptive != 0 && g_scheme == 0);
|
||||
|
||||
OpenSubdiv::Osd::MeshBitset bits;
|
||||
bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive);
|
||||
@ -1394,7 +1394,7 @@ display() {
|
||||
|
||||
g_fpsTimer.Stop();
|
||||
float elapsed = (float)g_fpsTimer.GetElapsed();
|
||||
if (not g_freeze)
|
||||
if (!g_freeze)
|
||||
g_animTime += elapsed;
|
||||
g_fpsTimer.Start();
|
||||
|
||||
@ -1466,7 +1466,7 @@ motion(GLFWwindow *, double dx, double dy) {
|
||||
// pan
|
||||
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
|
||||
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
|
||||
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
|
||||
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
|
||||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
|
||||
// dolly
|
||||
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
|
||||
@ -1510,7 +1510,7 @@ callbackKernel(int k) {
|
||||
g_kernel = k;
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_OPENCL
|
||||
if (g_kernel == kCL and (not g_clDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCL && (!g_clDeviceContext.IsInitialized())) {
|
||||
// Initialize OpenCL
|
||||
if (g_clDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing OpenCL\n");
|
||||
@ -1519,7 +1519,7 @@ callbackKernel(int k) {
|
||||
}
|
||||
#endif
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
if (g_kernel == kCUDA and (not g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCUDA && (!g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_cudaDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing Cuda\n");
|
||||
exit(1);
|
||||
@ -1616,10 +1616,10 @@ callbackSlider(float value, int data) {
|
||||
//-------------------------------------------------------------------------------
|
||||
void
|
||||
reloadShaderFile() {
|
||||
if (not g_shaderFilename) return;
|
||||
if (!g_shaderFilename) return;
|
||||
|
||||
std::ifstream ifs(g_shaderFilename);
|
||||
if (not ifs) return;
|
||||
if (!ifs) return;
|
||||
printf("Load shader %s\n", g_shaderFilename);
|
||||
|
||||
std::stringstream ss;
|
||||
@ -1661,7 +1661,7 @@ keyboard(GLFWwindow *, int key, int /* scancode */, int event, int /* mods */) {
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
idle() {
|
||||
if (not g_freeze)
|
||||
if (!g_freeze)
|
||||
g_frame++;
|
||||
|
||||
updateGeom();
|
||||
@ -1778,7 +1778,7 @@ int main(int argc, char ** argv) {
|
||||
}
|
||||
|
||||
glfwSetErrorCallback(callbackErrorGLFW);
|
||||
if (not glfwInit()) {
|
||||
if (!glfwInit()) {
|
||||
printf("Failed to initialize GLFW\n");
|
||||
return 1;
|
||||
}
|
||||
@ -1792,7 +1792,7 @@ int main(int argc, char ** argv) {
|
||||
|
||||
// apparently glfwGetPrimaryMonitor fails under linux : if no primary,
|
||||
// settle for the first one in the list
|
||||
if (not g_primary) {
|
||||
if (!g_primary) {
|
||||
int count = 0;
|
||||
GLFWmonitor ** monitors = glfwGetMonitors(&count);
|
||||
|
||||
@ -1807,8 +1807,8 @@ int main(int argc, char ** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
|
||||
fullscreen and g_primary ? g_primary : NULL, NULL))) {
|
||||
if (!(g_window=glfwCreateWindow(g_width, g_height, windowTitle,
|
||||
fullscreen && g_primary ? g_primary : NULL, NULL))) {
|
||||
std::cerr << "Failed to create OpenGL context.\n";
|
||||
glfwTerminate();
|
||||
return 1;
|
||||
@ -1866,7 +1866,7 @@ int main(int argc, char ** argv) {
|
||||
g_hud.AddCheckBox("Specular (S)", g_specular,
|
||||
-200, 590, callbackCheckBox, HUD_CB_DISPLAY_SPECULAR, 's');
|
||||
|
||||
if (diffuseEnvironmentMap or specularEnvironmentMap) {
|
||||
if (diffuseEnvironmentMap || specularEnvironmentMap) {
|
||||
g_hud.AddCheckBox("IBL (I)", g_ibl,
|
||||
-200, 610, callbackCheckBox, HUD_CB_IBL, 'i');
|
||||
}
|
||||
@ -2015,7 +2015,7 @@ int main(int argc, char ** argv) {
|
||||
+ (g_osdPTexSpecular ? g_osdPTexSpecular->GetMemoryUsage() : 0);
|
||||
|
||||
// load animation obj sequences (optional)
|
||||
if (not animobjs.empty()) {
|
||||
if (!animobjs.empty()) {
|
||||
for (int i = 0; i < (int)animobjs.size(); ++i) {
|
||||
std::ifstream ifs(animobjs[i].c_str());
|
||||
if (ifs) {
|
||||
|
@ -978,7 +978,7 @@ callbackKernel(int k) {
|
||||
g_kernel = k;
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_OPENCL
|
||||
if (g_kernel == kCL and (not g_clDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCL && (!g_clDeviceContext.IsInitialized())) {
|
||||
if (g_clDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing OpenCL\n");
|
||||
exit(1);
|
||||
@ -987,7 +987,7 @@ callbackKernel(int k) {
|
||||
#endif
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
if (g_kernel == kCUDA and (not g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCUDA && (!g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_cudaDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing Cuda\n");
|
||||
exit(1);
|
||||
|
@ -858,7 +858,7 @@ callbackKernel(int k) {
|
||||
g_kernel = k;
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_OPENCL
|
||||
if (g_kernel == kCL and (not g_clDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCL && (!g_clDeviceContext.IsInitialized())) {
|
||||
if (g_clDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing OpenCL\n");
|
||||
exit(1);
|
||||
@ -866,7 +866,7 @@ callbackKernel(int k) {
|
||||
}
|
||||
#endif
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
if (g_kernel == kCUDA and (not g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCUDA && (!g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_cudaDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing Cuda\n");
|
||||
exit(1);
|
||||
|
@ -1350,7 +1350,7 @@ callbackKernel(int k) {
|
||||
g_kernel = k;
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_OPENCL
|
||||
if (g_kernel == kCL and (not g_clDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCL && (!g_clDeviceContext.IsInitialized())) {
|
||||
if (g_clDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing OpenCL\n");
|
||||
exit(1);
|
||||
@ -1358,7 +1358,7 @@ callbackKernel(int k) {
|
||||
}
|
||||
#endif
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
if (g_kernel == kCUDA and (not g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_kernel == kCUDA && (!g_cudaDeviceContext.IsInitialized())) {
|
||||
if (g_cudaDeviceContext.Initialize() == false) {
|
||||
printf("Error in initializing Cuda\n");
|
||||
exit(1);
|
||||
|
@ -797,7 +797,7 @@ MayaPolySmooth::compute( const MPlug& plug, MDataBlock& data ) {
|
||||
int subdivisionLevel = data.inputValue(a_subdivisionLevels).asInt();
|
||||
short stateH = data.inputValue(state).asShort();
|
||||
|
||||
if ((subdivisionLevel > 0) and (stateH !=1)) {
|
||||
if ((subdivisionLevel > 0) && (stateH !=1)) {
|
||||
|
||||
// == Retrieve input mesh ====================================
|
||||
// Get attr values
|
||||
@ -1212,9 +1212,9 @@ MStatus initializePlugin( MObject obj ) {
|
||||
|
||||
// Source UI scripts
|
||||
MString path = plugin.loadPath()+"/mayaPolySmooth.mel";
|
||||
if (not MGlobal::sourceFile(path)) {
|
||||
if (!MGlobal::sourceFile(path)) {
|
||||
path = "mayaPolySmooth.mel";
|
||||
if (not MGlobal::sourceFile(path)) {
|
||||
if (!MGlobal::sourceFile(path)) {
|
||||
MGlobal::displayWarning("Failed to source mayaPolySmooth.mel.");
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public:
|
||||
|
||||
// Returns the edgeVertIndex for a given Hbr halfedge 'e' and vertex 'v'
|
||||
int GetEdgeVertIndex(OpenSubdiv::HbrHalfedge<T> const * e, OpenSubdiv::HbrVertex<T> const * v) const {
|
||||
assert(e and v);
|
||||
assert(e && v);
|
||||
if (_edgeset.find(e)==_edgeset.end()) {
|
||||
e = e->GetOpposite();
|
||||
assert(e);
|
||||
@ -279,7 +279,7 @@ FarTopologyRefinerFactory<OsdHbrConverter>::resizeComponentTopology(
|
||||
|
||||
// index Hbr edge pointers in the map
|
||||
OsdHbrHalfedge const * e = f->GetEdge(j);
|
||||
if (e->IsBoundary() or (e->GetRightFace()->GetID()>f->GetID())) {
|
||||
if (e->IsBoundary() || (e->GetRightFace()->GetID()>f->GetID())) {
|
||||
int id = (int)edges.size();
|
||||
edges[e] = id;
|
||||
}
|
||||
@ -311,7 +311,7 @@ FarTopologyRefinerFactory<OsdHbrConverter>::resizeComponentTopology(
|
||||
GatherOperator(OsdHbrVertex const * v) : _v(v), vertEdgeCount(0), vertFaceCount(0) { }
|
||||
|
||||
virtual void operator() (OsdHbrHalfedge &e) {
|
||||
if (e.GetOrgVertex()==_v and e.GetFace())
|
||||
if (e.GetOrgVertex()==_v && e.GetFace())
|
||||
++vertFaceCount;
|
||||
++vertEdgeCount;
|
||||
}
|
||||
@ -408,7 +408,7 @@ FarTopologyRefinerFactory<OsdHbrConverter>::assignComponentTopology(
|
||||
virtual void operator() (OsdHbrHalfedge &e) {
|
||||
|
||||
OsdHbrFace * f=e.GetFace();
|
||||
if (f and (e.GetOrgVertex()==_v)) {
|
||||
if (f & (e.GetOrgVertex()==_v)) {
|
||||
*_dstVertFaces++ = f->GetID();
|
||||
for (int j=0; j<f->GetNumVertices(); ++j) {
|
||||
if (f->GetVertex(j)==_v) {
|
||||
|
Loading…
Reference in New Issue
Block a user