OpenSubdiv
Loading...
Searching...
No Matches
surfaceFactoryMeshAdapter.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_SURFACE_FACTORY_ADAPTER_H
9#define OPENSUBDIV3_BFR_SURFACE_FACTORY_ADAPTER_H
10
11#include "../version.h"
12
13#include <cstdint>
14
15namespace OpenSubdiv {
16namespace OPENSUBDIV_VERSION {
17
18namespace Bfr {
19
20class VertexDescriptor;
21
26// SurfaceFactoryMeshAdapter is an abstract class that defines the interface
27// through which subclasses of SurfaceFactory adapt to a connected mesh
28// representation. The interface defines methods that describe the mesh
29// topology and control indices in the neighborhood of a mesh -- from
30// which the SurfaceFactory to identifies an appropriate limit surface.
31//
32// SurfaceFactoryMeshAdapter methods require a subclass to provide a complete
33// description of the topology around a base face, as well as indices
34// associated with it (both vertex and face-varying). The intent here is
35// to keep the number of methods required to a minimum, and also to minimize
36// the number of invocations required by the factory.
37//
38// With the need to support both linear and non-linear cases (for which
39// linear is trivial by comparison) and the limit surface for both vertex
40// and face-varying topologies, the result is a small set of methods
41// covering this matrix of functionality.
42//
43// Since face-varying data may differ in topology from the vertex data --
44// with each set of face-varying data potentially having its own unique
45// topology -- sets of face-varying data are uniquely distinguished by an
46// associated integer (a face-varying ID).
47//
49public:
51 typedef int Index;
52
63 typedef std::intptr_t FVarID;
64
65protected:
68 virtual ~SurfaceFactoryMeshAdapter() { }
70
71protected:
73
77
79 virtual bool isFaceHole(Index faceIndex) const = 0;
80
82 virtual int getFaceSize(Index faceIndex) const = 0;
84
86
94
96 virtual int getFaceVertexIndices(Index faceIndex,
97 Index vertexIndices[]) const = 0;
98
100 virtual int getFaceFVarValueIndices(Index faceIndex,
101 FVarID fvarID, Index fvarValueIndices[]) const = 0;
103
104protected:
106
142
145 Index faceIndex, int faceVertex,
146 VertexDescriptor * vertexDescriptor) const = 0;
147
150 Index faceIndex, int faceVertex,
151 Index vertexIndices[]) const = 0;
152
156 Index faceIndex, int faceVertex,
157 FVarID fvarID, Index fvarValueIndices[]) const = 0;
159
160protected:
162
187 Index faceIndex, Index vertexIndices[]) const;
188
190 Index faceIndex, FVarID fvarID, Index fvarValueIndices[]) const;
192
193private:
194 // No private members
195};
196
197//
198// Inline defaults for optional methods:
199//
200inline bool
205
206inline bool
211
212} // end namespace Bfr
213
214} // end namespace OPENSUBDIV_VERSION
215using namespace OPENSUBDIV_VERSION;
216
217} // end namespace OpenSubdiv
218
219#endif /* OPENSUBDIV3_BFR_SURFACE_FACTORY_ADAPTER_H */
Abstract interface adapting SurfaceFactory to a connected mesh representation.
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.