24 #ifndef PXR_IMAGING_HD_ST_MESH_H
25 #define PXR_IMAGING_HD_ST_MESH_H
36 #include "pxr/base/vt/array.h"
47 std::shared_ptr<class HdSt_VertexAdjacencyBuilder>;
52 std::shared_ptr<class HdStResourceRegistry>;
75 TfToken const &reprToken)
override;
108 bool * isFirstInstance,
112 const SdfPath &materialId)
const;
118 const SdfPath &materialId)
const;
134 bool requireSmoothNormals,
135 bool requireFlatNormals,
136 int geomSubsetDescIndex);
146 bool updateMaterialNetworkShader,
147 bool updateGeometricShader);
159 int geomSubsetDescIndex);
167 size_t oldNumGeomSubsets);
178 const VtIntArray &faceIndices,
185 int geomSubsetDescIndex,
198 int geomSubsetDescIndex,
200 bool requireSmoothNormals);
207 int geomSubsetDescIndex,
215 int geomSubsetDescIndex,
217 bool requireFlatNormals);
235 const VtIntArray &topology) {
236 for (
size_t i = 0; i < _topologies.size(); ++i) {
238 if (_topologies[i].
first == topology) {
240 if (
std::find(_topologies[i].second.begin(),
241 _topologies[i].second.end(),
242 primvar) == _topologies[i].second.end()) {
245 _topologies[i].second.push_back(primvar);
253 _topologies.push_back(
254 std::pair<VtIntArray, std::vector<TfToken>>(
255 topology, {primvar}));
260 for (
size_t i = 0; i < _topologies.size(); ++i) {
262 _topologies[i].second.begin(),
263 _topologies[i].second.end(),
264 primvar), _topologies[i].second.end());
272 _topologies.erase(std::remove_if(
273 _topologies.begin(), _topologies.end(), NoPrimvars),
280 for (
size_t i = 0; i < _topologies.size(); ++i) {
281 if (
std::find(_topologies[i].second.begin(),
282 _topologies[i].second.end(),
284 _topologies[i].second.end()) {
293 std::vector<VtIntArray> fvarTopologies;
294 for (
const auto& it : _topologies) {
295 fvarTopologies.push_back(it.first);
297 return fvarTopologies;
301 return _topologies.size();
307 static bool NoPrimvars(
const std::pair<VtIntArray, std::vector<TfToken>>
309 return topology.second.empty();
327 DirtyFlatNormals = (DirtySmoothNormals << 1),
328 DirtyIndices = (DirtyFlatNormals << 1),
329 DirtyHullIndices = (DirtyIndices << 1),
330 DirtyPointsIndices = (DirtyHullIndices << 1)
343 bool _hasMirroredTransform : 1;
344 bool _doubleSided : 1;
345 bool _flatShadingEnabled : 1;
346 bool _displacementEnabled : 1;
347 bool _limitNormals : 1;
348 bool _sceneNormals : 1;
349 bool _hasVaryingTopology : 1;
351 bool _displayOpacity : 1;
352 bool _occludedSelectionShowsThrough : 1;
353 bool _pointsShadingEnabled : 1;
355 std::unique_ptr<_FvarTopologyTracker> _fvarTopologyTracker;
361 #endif // PXR_IMAGING_HD_ST_MESH_H
static const int CustomSlotsBegin
HDST_API void Finalize(HdRenderParam *renderParam) override
std::shared_ptr< HdRepr > HdReprSharedPtr
void _PopulateElementPrimvars(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, const HdReprSharedPtr &repr, const HdMeshReprDesc &desc, HdStDrawItem *drawItem, int geomSubsetDescIndex, HdDirtyBits *dirtyBits, bool requireFlatNormals)
std::shared_ptr< class HdMeshTopology > HdMeshTopologySharedPtr
bool _UseSmoothNormals(HdSt_MeshTopologySharedPtr const &topology) const
HDST_API void Sync(HdSceneDelegate *delegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits, TfToken const &reprToken) override
void _PopulateAdjacency(HdStResourceRegistrySharedPtr const &resourceRegistry)
bool _UseFlatNormals(const HdMeshReprDesc &desc) const
HDST_API HdMeshTopologySharedPtr GetTopology() const override
Topology (member) getter.
std::shared_ptr< class HdSt_MeshTopology > HdSt_MeshTopologySharedPtr
std::vector< VtIntArray > GetFvarTopologies() const
HDST_API void UpdateRenderTag(HdSceneDelegate *delegate, HdRenderParam *renderParam) override
void RemovePrimvar(const TfToken &primvar)
GT_API const UT_StringHolder topology
void _GatherFaceVaryingTopologies(HdSceneDelegate *sceneDelegate, const HdReprSharedPtr &repr, const HdMeshReprDesc &desc, HdStDrawItem *drawItem, int geomSubsetDescIndex, HdDirtyBits *dirtyBits, const SdfPath &id, HdSt_MeshTopologySharedPtr topology)
int GetChannelFromPrimvar(const TfToken &primvar) const
HDST_API ~HdStMesh() override
void AddOrUpdateTopology(const TfToken &primvar, const VtIntArray &topology)
HDST_API HdDirtyBits _PropagateDirtyBits(HdDirtyBits bits) const override
void _CreateTopologyRangeForGeomSubset(HdStResourceRegistrySharedPtr resourceRegistry, HdChangeTracker &changeTracker, HdRenderParam *renderParam, HdStDrawItem *drawItem, const TfToken &indexToken, HdBufferSourceSharedPtr indicesSource, HdBufferSourceSharedPtr fvarIndicesSource, HdBufferSourceSharedPtr geomSubsetFaceIndicesHelperSource, const VtIntArray &faceIndices, bool refined)
std::vector< struct HdBufferSpec > HdBufferSpecVector
HdBufferArrayRangeSharedPtr _GetSharedPrimvarRange(uint64_t primvarId, HdBufferSpecVector const &updatedOrAddedSpecs, HdBufferSpecVector const &removedSpecs, HdBufferArrayRangeSharedPtr const &curRange, bool *isFirstInstance, HdStResourceRegistrySharedPtr const &resourceRegistry) const
bool _MaterialHasPtex(const HdRenderIndex &renderIndex, const SdfPath &materialId) const
void _UpdateDrawItem(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, const TfToken &reprToken, const HdReprSharedPtr &repr, const HdMeshReprDesc &desc, bool requireSmoothNormals, bool requireFlatNormals, int geomSubsetDescIndex)
void _UpdateMaterialTagsForAllReprs(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam)
std::vector< HdGeomSubset > HdGeomSubsets
A group of geometry subsets.
std::vector< std::pair< VtIntArray, std::vector< TfToken >>> TopologyToPrimvarVector
size_t GetNumTopologies() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
static HDST_API bool IsEnabledPackedNormals()
Returns whether packed (10_10_10 bits) normals to be used.
HF_MALLOC_TAG_NEW("new HdStMesh")
HDST_API HdStMesh(SdfPath const &id)
void _PopulateVertexPrimvars(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, const HdReprSharedPtr &repr, const HdMeshReprDesc &desc, HdStDrawItem *drawItem, int geomSubsetDescIndex, HdDirtyBits *dirtyBits, bool requireSmoothNormals)
#define PXR_NAMESPACE_CLOSE_SCOPE
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
std::shared_ptr< class HdSt_VertexAdjacencyBuilder > HdSt_VertexAdjacencyBuilderSharedPtr
void RemoveUnusedTopologies()
void _PopulateTopology(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, const TfToken &reprToken, const HdReprSharedPtr &repr, const HdMeshReprDesc &desc, int geomSubsetDescIndex)
void _UpdateDrawItemGeometricShader(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, const HdMeshReprDesc &desc, const SdfPath &materialId)
void _PopulateFaceVaryingPrimvars(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, const HdReprSharedPtr &repr, const HdMeshReprDesc &desc, HdStDrawItem *drawItem, int geomSubsetDescIndex, HdDirtyBits *dirtyBits)
HDST_API HdDirtyBits GetInitialDirtyBitsMask() const override
bool _UseLimitRefinement(const HdRenderIndex &renderIndex, const HdMeshTopology &topology) const
bool _MaterialHasLimitSurface(const HdRenderIndex &renderIndex, const SdfPath &materialId) const
std::shared_ptr< class HdBufferSource > HdBufferSourceSharedPtr
void _UpdateRepr(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, TfToken const &reprToken, HdDirtyBits *dirtyBitsState)
std::shared_ptr< class HdStResourceRegistry > HdStResourceRegistrySharedPtr
void _UpdateShadersForAllReprs(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, bool updateMaterialNetworkShader, bool updateGeometricShader)
const TopologyToPrimvarVector & GetTopologyToPrimvarVector() const
bool _UseQuadIndices(const HdRenderIndex &renderIndex, const HdSt_MeshTopologySharedPtr &topology) const
HDST_API void _InitRepr(TfToken const &reprToken, HdDirtyBits *dirtyBits) override
int _GetRefineLevelForDesc(const HdMeshReprDesc &desc) const
void _UpdateDrawItemsForGeomSubsets(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, const TfToken &reprToken, const HdReprSharedPtr &repr, const HdGeomSubsets &geomSubsets, size_t oldNumGeomSubsets)
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool