OpenSubdiv
Loading...
Searching...
No Matches
refinerSurfaceFactory.h
Go to the documentation of this file.
1//
2// Copyright 2021 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://opensubdiv.org/license.
6//
7
8#ifndef OPENSUBDIV3_BFR_REFINER_SURFACE_FACTORY_H
9#define OPENSUBDIV3_BFR_REFINER_SURFACE_FACTORY_H
10
11#include "../version.h"
12
15
16namespace OpenSubdiv {
17namespace OPENSUBDIV_VERSION {
18
19namespace Far {
20 class TopologyRefiner;
21}
22
23namespace Bfr {
24
42public:
44
48
50 Options const & options);
51
52 ~RefinerSurfaceFactoryBase() override = default;
54
56
60
62 Far::TopologyRefiner const & GetMesh() const { return _mesh; }
63
65 int GetNumFaces() const { return _numFaces; }
66
68 int GetNumFVarChannels() const { return _numFVarChannels; }
70
71protected:
73 //
74 // Virtual overrides to satisfy the SurfaceFactoryMeshAdapter interface:
75 //
76 bool isFaceHole( Index faceIndex) const override;
77 int getFaceSize(Index faceIndex) const override;
78
79 int getFaceVertexIndices(Index faceIndex,
80 Index vertexIndices[]) const override;
81 int getFaceFVarValueIndices(Index faceIndex,
82 FVarID fvarID, Index fvarValueIndices[]) const override;
83
84 int populateFaceVertexDescriptor(Index faceIndex, int faceVertex,
85 VertexDescriptor * vertexDescriptor) const override;
86
88 Index faceIndex, int faceVertex,
89 Index vertexIndices[]) const override;
91 Index faceIndex, int faceVertex,
92 FVarID fvarID, Index fvarValueIndices[]) const override;
93
94 // Optional SurfaceFactoryMeshAdapter overrides for regular patches:
96 Index faceIndex,
97 Index vertexIndices[]) const override;
98
100 Index faceIndex,
101 FVarID fvarID, Index fvarValueIndices[]) const override;
103
104private:
105 //
106 // Internal supporting methods:
107 //
108 int getFaceVaryingChannel(FVarID fvarID) const;
109
110 int getFaceVertexPointIndices(Index faceIndex, int faceVertex,
111 Index indices[], int vtxOrFVarChannel) const;
112
113 int getFacePatchPointIndices(Index faceIndex,
114 Index indices[], int vtxOrFVarChannel) const;
115
116private:
117 // Additional members for the subclass:
118 Far::TopologyRefiner const & _mesh;
119
120 int _numFaces;
121 int _numFVarChannels;
122};
123
124
125//
139template <class CACHE_TYPE = SurfaceFactoryCache>
141public:
143 Options const & options = Options()) :
144 RefinerSurfaceFactoryBase(mesh, options),
145 _localCache() {
146
148 }
149 ~RefinerSurfaceFactory() override = default;
150
151private:
152 CACHE_TYPE _localCache;
153};
154
155} // end namespace Bfr
156
157} // end namespace OPENSUBDIV_VERSION
158using namespace OPENSUBDIV_VERSION;
159
160} // end namespace OpenSubdiv
161
162#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)
std::intptr_t FVarID
Type used to identify and specify face-varying primvars.
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.
Simple class used by subclasses of SurfaceFactory to describe a vertex.
Stores topology data for a specified set of refinement options.