OpenSubdiv
Loading...
Searching...
No Matches
refinerSurfaceFactory.h
Go to the documentation of this file.
1//
2// Copyright 2021 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_BFR_REFINER_SURFACE_FACTORY_H
26#define OPENSUBDIV3_BFR_REFINER_SURFACE_FACTORY_H
27
28#include "../version.h"
29
30#include "../bfr/surfaceFactory.h"
31#include "../bfr/surfaceFactoryCache.h"
32
33namespace OpenSubdiv {
34namespace OPENSUBDIV_VERSION {
35
36namespace Far {
37 class TopologyRefiner;
38}
39
40namespace Bfr {
41
59public:
61
65
67 Options const & options);
68
69 ~RefinerSurfaceFactoryBase() override = default;
71
73
77
79 Far::TopologyRefiner const & GetMesh() const { return _mesh; }
80
82 int GetNumFaces() const { return _numFaces; }
83
85 int GetNumFVarChannels() const { return _numFVarChannels; }
87
88protected:
90 //
91 // Virtual overrides to satisfy the SurfaceFactoryMeshAdapter interface:
92 //
93 bool isFaceHole( Index faceIndex) const override;
94 int getFaceSize(Index faceIndex) const override;
95
96 int getFaceVertexIndices(Index faceIndex,
97 Index vertexIndices[]) const override;
98 int getFaceFVarValueIndices(Index faceIndex,
99 FVarID fvarID, Index fvarValueIndices[]) const override;
100
101 int populateFaceVertexDescriptor(Index faceIndex, int faceVertex,
102 VertexDescriptor * vertexDescriptor) const override;
103
105 Index faceIndex, int faceVertex,
106 Index vertexIndices[]) const override;
108 Index faceIndex, int faceVertex,
109 FVarID fvarID, Index fvarValueIndices[]) const override;
110
111 // Optional SurfaceFactoryMeshAdapter overrides for regular patches:
113 Index faceIndex,
114 Index vertexIndices[]) const override;
115
117 Index faceIndex,
118 FVarID fvarID, Index fvarValueIndices[]) const override;
120
121private:
122 //
123 // Internal supporting methods:
124 //
125 int getFaceVaryingChannel(FVarID fvarID) const;
126
127 int getFaceVertexPointIndices(Index faceIndex, int faceVertex,
128 Index indices[], int vtxOrFVarChannel) const;
129
130 int getFacePatchPointIndices(Index faceIndex,
131 Index indices[], int vtxOrFVarChannel) const;
132
133private:
134 // Additional members for the subclass:
135 Far::TopologyRefiner const & _mesh;
136
137 int _numFaces;
138 int _numFVarChannels;
139};
140
141
142//
156template <class CACHE_TYPE = SurfaceFactoryCache>
158public:
160 Options const & options = Options()) :
161 RefinerSurfaceFactoryBase(mesh, options),
162 _localCache() {
163
165 }
166 ~RefinerSurfaceFactory() override = default;
167
168private:
169 CACHE_TYPE _localCache;
170};
171
172} // end namespace Bfr
173
174} // end namespace OPENSUBDIV_VERSION
175using namespace OPENSUBDIV_VERSION;
176
177} // end namespace OpenSubdiv
178
179#endif /* OPENSUBDIV3_BFR_REFINER_SURFACE_FACTORY_H */
Intermediate subclass of SurfaceFactory with Far::TopologyRefiner as the mesh.
int GetNumFVarChannels() const
Return the number of face-varying channels.
Far::TopologyRefiner const & GetMesh() const
Return the instance of the mesh.
RefinerSurfaceFactoryBase(Far::TopologyRefiner const &mesh, Options const &options)
Template for concrete subclasses of RefinerSurfaceFactoryBase.
RefinerSurfaceFactory(Far::TopologyRefiner const &mesh, Options const &options=Options())
Base class providing initialization of a Surface for each face of a mesh.
void setInternalCache(SurfaceFactoryCache *cache)
Subclass to identify an internal cache for use by base class.
Simple set of options assigned to instances of SurfaceFactory.
virtual int getFaceVertexIncidentFaceFVarValueIndices(Index faceIndex, int faceVertex, FVarID fvarID, Index fvarValueIndices[]) const =0
Gather face-varying indices of incident faces around a face-vertex.
virtual int getFaceVertexIncidentFaceVertexIndices(Index faceIndex, int faceVertex, Index vertexIndices[]) const =0
Gather vertex indices of incident faces around a face-vertex.
virtual int getFaceSize(Index faceIndex) const =0
Returns the size of a face (number of vertices)
virtual int populateFaceVertexDescriptor(Index faceIndex, int faceVertex, VertexDescriptor *vertexDescriptor) const =0
Describe the topology of incident faces around a face-vertex.
virtual bool getFaceNeighborhoodVertexIndicesIfRegular(Index faceIndex, Index vertexIndices[]) const
virtual bool getFaceNeighborhoodFVarValueIndicesIfRegular(Index faceIndex, FVarID fvarID, Index fvarValueIndices[]) const
virtual int getFaceFVarValueIndices(Index faceIndex, FVarID fvarID, Index fvarValueIndices[]) const =0
Gather the face-varying indices of the face's vertices.
virtual int getFaceVertexIndices(Index faceIndex, Index vertexIndices[]) const =0
Gather the indices of the face's vertices.
virtual bool isFaceHole(Index faceIndex) const =0
Returns if a face is a hole.
std::intptr_t FVarID
Type used to identify and specify face-varying primvars.
Simple class used by subclasses of SurfaceFactory to describe a vertex.
Stores topology data for a specified set of refinement options.