| 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
13#include "../bfr/surfaceFactory.h"
14#include "../bfr/surfaceFactoryCache.h"
15
16 namespace OpenSubdiv {
17 namespace OPENSUBDIV_VERSION {
18
19 namespace Far {
20 class TopologyRefiner;
21}
22
23 namespace Bfr {
24
41 class RefinerSurfaceFactoryBase : public SurfaceFactory {
42 public:
44
48
49 RefinerSurfaceFactoryBase(Far::TopologyRefiner const & mesh,
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
71 protected:
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
87 int getFaceVertexIncidentFaceVertexIndices(
88 Index faceIndex, int faceVertex,
89 Index vertexIndices[]) const override;
90 int getFaceVertexIncidentFaceFVarValueIndices(
91 Index faceIndex, int faceVertex,
92 FVarID fvarID, Index fvarValueIndices[]) const override;
93
94 // Optional SurfaceFactoryMeshAdapter overrides for regular patches:
95 bool getFaceNeighborhoodVertexIndicesIfRegular(
96 Index faceIndex,
97 Index vertexIndices[]) const override;
98
99 bool getFaceNeighborhoodFVarValueIndicesIfRegular(
100 Index faceIndex,
101 FVarID fvarID, Index fvarValueIndices[]) const override;
103
104 private:
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
116 private:
117 // Additional members for the subclass:
118 Far::TopologyRefiner const & _mesh;
119
120 int _numFaces;
121 int _numFVarChannels;
122};
123
124
125//
139 template <class CACHE_TYPE = SurfaceFactoryCache>
140 class RefinerSurfaceFactory : public RefinerSurfaceFactoryBase {
141 public:
142 RefinerSurfaceFactory(Far::TopologyRefiner const & mesh,
143 Options const & options = Options()) :
144 RefinerSurfaceFactoryBase(mesh, options),
145 _localCache() {
146
147 SurfaceFactory::setInternalCache(&_localCache);
148 }
149 ~RefinerSurfaceFactory() override = default;
150
151 private:
152 CACHE_TYPE _localCache;
153};
154
155} // end namespace Bfr
156
157} // end namespace OPENSUBDIV_VERSION
158 using namespace OPENSUBDIV_VERSION;
159
160} // end namespace OpenSubdiv
161
162#endif /* OPENSUBDIV3_BFR_REFINER_SURFACE_FACTORY_H */
surfaceFactoryCache.h
surfaceFactory.h
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Bfr
Definition limits.h:18
OpenSubdiv::OPENSUBDIV_VERSION::Far
Definition refinerSurfaceFactory.h:19
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::RefinerSurfaceFactoryBase::GetNumFaces
int GetNumFaces() const
Return the number of faces.
Definition refinerSurfaceFactory.h:65
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::RefinerSurfaceFactoryBase::GetNumFVarChannels
int GetNumFVarChannels() const
Return the number of face-varying channels.
Definition refinerSurfaceFactory.h:68
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::RefinerSurfaceFactoryBase::GetMesh
Far::TopologyRefiner const & GetMesh() const
Return the instance of the mesh.
Definition refinerSurfaceFactory.h:62
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::RefinerSurfaceFactoryBase::~RefinerSurfaceFactoryBase
~RefinerSurfaceFactoryBase() override=default
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::RefinerSurfaceFactoryBase::RefinerSurfaceFactoryBase
RefinerSurfaceFactoryBase(Far::TopologyRefiner const &mesh, Options const &options)
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::RefinerSurfaceFactory::~RefinerSurfaceFactory
~RefinerSurfaceFactory() override=default
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::RefinerSurfaceFactory::RefinerSurfaceFactory
RefinerSurfaceFactory(Far::TopologyRefiner const &mesh, Options const &options=Options())
Definition refinerSurfaceFactory.h:142
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactory::setInternalCache
void setInternalCache(SurfaceFactoryCache *cache)
Subclass to identify an internal cache for use by base class.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactory::SurfaceFactory
SurfaceFactory(Sdc::SchemeType schemeType, Sdc::Options const &schemeOptions, Options const &limitOptions)
Constructor to be used by subclasses.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactory::Options
Simple set of options assigned to instances of SurfaceFactory.
Definition surfaceFactory.h:99
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::getFaceVertexIncidentFaceFVarValueIndices
virtual int getFaceVertexIncidentFaceFVarValueIndices(Index faceIndex, int faceVertex, FVarID fvarID, Index fvarValueIndices[]) const =0
Gather face-varying indices of incident faces around a face-vertex.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::getFaceVertexIncidentFaceVertexIndices
virtual int getFaceVertexIncidentFaceVertexIndices(Index faceIndex, int faceVertex, Index vertexIndices[]) const =0
Gather vertex indices of incident faces around a face-vertex.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::getFaceSize
virtual int getFaceSize(Index faceIndex) const =0
Returns the size of a face (number of vertices).
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::Index
int Index
Integer type representing a mesh index.
Definition surfaceFactoryMeshAdapter.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::populateFaceVertexDescriptor
virtual int populateFaceVertexDescriptor(Index faceIndex, int faceVertex, VertexDescriptor *vertexDescriptor) const =0
Describe the topology of incident faces around a face-vertex.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::getFaceNeighborhoodVertexIndicesIfRegular
virtual bool getFaceNeighborhoodVertexIndicesIfRegular(Index faceIndex, Index vertexIndices[]) const
Definition surfaceFactoryMeshAdapter.h:201
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::getFaceNeighborhoodFVarValueIndicesIfRegular
virtual bool getFaceNeighborhoodFVarValueIndicesIfRegular(Index faceIndex, FVarID fvarID, Index fvarValueIndices[]) const
Definition surfaceFactoryMeshAdapter.h:207
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::getFaceFVarValueIndices
virtual int getFaceFVarValueIndices(Index faceIndex, FVarID fvarID, Index fvarValueIndices[]) const =0
Gather the face-varying indices of the face's vertices.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::getFaceVertexIndices
virtual int getFaceVertexIndices(Index faceIndex, Index vertexIndices[]) const =0
Gather the indices of the face's vertices.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::isFaceHole
virtual bool isFaceHole(Index faceIndex) const =0
Returns if a face is a hole.
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::SurfaceFactoryMeshAdapter::FVarID
std::intptr_t FVarID
Type used to identify and specify face-varying primvars.
Definition surfaceFactoryMeshAdapter.h:63
OpenSubdiv::OPENSUBDIV_VERSION::Bfr::VertexDescriptor
Simple class used by subclasses of SurfaceFactory to describe a vertex.
Definition vertexDescriptor.h:114
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner
Stores topology data for a specified set of refinement options.
Definition topologyRefiner.h:34