// // Copyright 2013 Pixar // // Licensed under the Apache License, Version 2.0 (the "Apache License") // with the following modification; you may not use this file except in // compliance with the Apache License and the following modification to it: // Section 6. Trademarks. is deleted and replaced with: // // 6. Trademarks. This License does not grant permission to use the trade // names, trademarks, service marks, or product names of the Licensor // and its affiliates, except as required to comply with Section 4(c) of // the License and to reproduce the content of the NOTICE file. // // You may obtain a copy of the Apache License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the Apache License with the above modification is // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the Apache License for the specific // language governing permissions and limitations under the Apache License. // #include "../osd/cpuEvalLimitKernel.h" #include #include #include #include #include #include #include namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { void evalBilinear(float u, float v, unsigned int const * vertexIndices, OsdVertexBufferDescriptor const & inDesc, float const * inQ, OsdVertexBufferDescriptor const & outDesc, float * outQ) { assert( inDesc.length <= (outDesc.stride-outDesc.offset) ); float const * inOffset = inQ + inDesc.offset; float * Q = outQ + outDesc.offset; memset(Q, 0, inDesc.length*sizeof(float)); float ou = 1.0f - u, ov = 1.0f - v, w[4] = { ov*ou, v*ou, v*u, ov*u }; for (int i=0; i<4; ++i) { float const * in = inOffset + vertexIndices[i]*inDesc.stride; for (int k=0; k2) { for (int k=0; k0); float const * diagonal = inOffset + idx_diagonal * inDesc.stride; for (int k=0; k0 and idx_diagonal>0 ); float const * neighbor = inOffset + idx_neighbor * inDesc.stride, * diagonal = inOffset + idx_diagonal * inDesc.stride; for (int k=0; k 2) { float s1 = 3.0f - 2.0f*csf(n-3,2)-csf(np-3,2), s2 = 2.0f*csf(n-3,2), s3 = 3.0f -2.0f*cosf(2.0f*float(M_PI)/float(n)) - cosf(2.0f*float(M_PI)/float(nm)); for (int k=0, ofs=vofs; k