1 // 2 // Copyright 2015 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 #ifndef OPENSUBDIV3_FAR_PTEX_INDICES_H 25 #define OPENSUBDIV3_FAR_PTEX_INDICES_H 26 27 #include "../version.h" 28 29 #include "../far/topologyRefiner.h" 30 #include "../far/types.h" 31 32 #include <vector> 33 34 namespace OpenSubdiv { 35 namespace OPENSUBDIV_VERSION { 36 37 namespace Far { 38 39 /// 40 /// \brief Object used to compute and query ptex face indices. 41 /// 42 /// Given a refiner, constructing a PtexIndices object builds the mapping 43 /// from coarse faces to ptex ids. Once built, the object can be used to 44 /// query the mapping. 45 /// 46 class PtexIndices { 47 48 public: 49 50 /// \brief Constructor 51 PtexIndices(TopologyRefiner const &refiner); 52 53 /// \brief Destructor 54 ~PtexIndices(); 55 56 //@{ 57 /// 58 /// Ptex 59 /// 60 61 /// \brief Returns the number of ptex faces in the mesh 62 /// 63 int GetNumFaces() const; 64 65 /// \brief Returns the ptex face index given a coarse face 'f' or -1 66 /// 67 int GetFaceId(Index f) const; 68 69 /// \brief Returns ptex face adjacency information for a given coarse face 70 /// 71 /// @param refiner refiner used to build this PtexIndices object. 72 /// 73 /// @param face coarse face index 74 /// 75 /// @param quadrant quadrant index if 'face' is not a quad (the local ptex 76 /// sub-face index). Must be less than the number of face 77 /// vertices. 78 /// 79 /// @param adjFaces ptex face indices of adjacent faces 80 /// 81 /// @param adjEdges ptex edge indices of adjacent faces 82 /// 83 void GetAdjacency( 84 TopologyRefiner const &refiner, 85 int face, int quadrant, 86 int adjFaces[4], int adjEdges[4]) const; 87 88 //@} 89 90 private: 91 92 void initializePtexIndices(TopologyRefiner const &refiner); 93 94 private: 95 96 std::vector<Index> _ptexIndices; 97 }; 98 99 100 } // end namespace Far 101 102 } // end namespace OPENSUBDIV_VERSION 103 using namespace OPENSUBDIV_VERSION; 104 } // end namespace OpenSubdiv 105 106 #endif /* OPENSUBDIV3_FAR_PTEX_INDICES_H */ 107