1 // 2 // Copyright 2013 Pixar 3 // 4 // Licensed under the Apache License, Version 2.0 (the "Apache License") 5 // with the following modification; you may not use this file except in 6 // compliance with the Apache License and the following modification to it: 7 // Section 6. Trademarks. is deleted and replaced with: 8 // 9 // 6. Trademarks. This License does not grant permission to use the trade 10 // names, trademarks, service marks, or product names of the Licensor 11 // and its affiliates, except as required to comply with Section 4(c) of 12 // the License and to reproduce the content of the NOTICE file. 13 // 14 // You may obtain a copy of the Apache License at 15 // 16 // http://www.apache.org/licenses/LICENSE-2.0 17 // 18 // Unless required by applicable law or agreed to in writing, software 19 // distributed under the Apache License with the above modification is 20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 // KIND, either express or implied. See the Apache License for the specific 22 // language governing permissions and limitations under the Apache License. 23 // 24 25 #ifndef OPENSUBDIV3_FAR_PATCH_BASIS_H 26 #define OPENSUBDIV3_FAR_PATCH_BASIS_H 27 28 #include "../version.h" 29 30 #include "../far/patchParam.h" 31 32 namespace OpenSubdiv { 33 namespace OPENSUBDIV_VERSION { 34 35 namespace Far { 36 namespace internal { 37 38 // 39 // XXXX barfowl: These functions are being kept internal while more complete 40 // underlying support for all patch types is being worked out. The set of 41 // bases supported here is actually larger than PatchDescriptor::Type -- with 42 // Bezier available for internal use. A new and more complete set of types 43 // is warranted (without the non-patch types associated with PatchDescriptor) 44 // along with an interface to query properties associated with them. 45 // 46 // Note that with the high-level functions here that operate on all patch 47 // types, it is not strictly necessary to expose the low-level methods in 48 // currant usage. 49 // 50 51 // 52 // Low-level basis evaluation (normalized, unscaled) for quad patch types: 53 // 54 template <typename REAL> 55 int EvalBasisLinear(REAL s, REAL t, 56 REAL wP[4], REAL wDs[4] = 0, REAL wDt[4] = 0, REAL wDss[4] = 0, REAL wDst[4] = 0, REAL wDtt[4] = 0); 57 58 template <typename REAL> 59 int EvalBasisBezier(REAL s, REAL t, 60 REAL wP[16], REAL wDs[16] = 0, REAL wDt[16] = 0, REAL wDss[16] = 0, REAL wDst[16] = 0, REAL wDtt[16] = 0); 61 62 template <typename REAL> 63 int EvalBasisBSpline(REAL s, REAL t, 64 REAL wP[16], REAL wDs[16] = 0, REAL wDt[16] = 0, REAL wDss[16] = 0, REAL wDst[16] = 0, REAL wDtt[16] = 0); 65 66 template <typename REAL> 67 int EvalBasisGregory(REAL s, REAL t, 68 REAL wP[20], REAL wDs[20] = 0, REAL wDt[20] = 0, REAL wDss[20] = 0, REAL wDst[20] = 0, REAL wDtt[20] = 0); 69 70 // 71 // Low-level basis evaluation (normalized, unscaled) for triangular patch types: 72 // 73 template <typename REAL> 74 int EvalBasisLinearTri(REAL s, REAL t, 75 REAL wP[3], REAL wDs[3] = 0, REAL wDt[3] = 0, REAL wDss[3] = 0, REAL wDst[3] = 0, REAL wDtt[3] = 0); 76 77 template <typename REAL> 78 int EvalBasisBezierTri(REAL s, REAL t, 79 REAL wP[15], REAL wDs[15] = 0, REAL wDt[15] = 0, REAL wDss[15] = 0, REAL wDst[15] = 0, REAL wDtt[15] = 0); 80 81 template <typename REAL> 82 int EvalBasisBoxSplineTri(REAL s, REAL t, 83 REAL wP[12], REAL wDs[12] = 0, REAL wDt[12] = 0, REAL wDss[12] = 0, REAL wDst[12] = 0, REAL wDtt[12] = 0); 84 85 template <typename REAL> 86 int EvalBasisGregoryTri(REAL s, REAL t, 87 REAL wP[18], REAL wDs[18] = 0, REAL wDt[18] = 0, REAL wDss[18] = 0, REAL wDst[18] = 0, REAL wDtt[18] = 0); 88 89 90 // 91 // High-level basis evaluation for all types using PatchParam: 92 // 93 template <typename REAL> 94 int EvaluatePatchBasisNormalized(int patchType, PatchParam const & param, REAL s, REAL t, 95 REAL wP[], REAL wDs[] = 0, REAL wDt[] = 0, REAL wDss[] = 0, REAL wDst[] = 0, REAL wDtt[] = 0); 96 97 template <typename REAL> 98 int EvaluatePatchBasis(int patchType, PatchParam const & param, REAL s, REAL t, 99 REAL wP[], REAL wDs[] = 0, REAL wDt[] = 0, REAL wDss[] = 0, REAL wDst[] = 0, REAL wDtt[] = 0); 100 101 102 } // end namespace internal 103 } // end namespace Far 104 105 } // end namespace OPENSUBDIV_VERSION 106 using namespace OPENSUBDIV_VERSION; 107 108 } // end namespace OpenSubdiv 109 110 #endif /* OPENSUBDIV3_FAR_PATCH_BASIS_H */ 111