24 #ifndef PXR_IMAGING_HD_ST_MESH_H
25 #define PXR_IMAGING_HD_ST_MESH_H
36 #include "pxr/base/vt/array.h"
51 std::shared_ptr<class HdStResourceRegistry>;
70 TfToken const &reprToken)
override;
103 bool * isFirstInstance,
120 bool requireSmoothNormals,
121 bool requireFlatNormals);
130 bool updateMaterialShader,
131 bool updateGeometricShader);
152 bool requireSmoothNormals);
164 bool requireFlatNormals);
182 const VtIntArray &topology) {
183 for (
size_t i = 0; i < _topologies.size(); ++i) {
185 if (_topologies[i].
first == topology) {
187 if (
std::find(_topologies[i].second.begin(),
188 _topologies[i].second.end(),
189 primvar) == _topologies[i].second.end()) {
192 _topologies[i].second.push_back(primvar);
200 _topologies.push_back(
201 std::pair<VtIntArray, std::vector<TfToken>>(
202 topology, {primvar}));
207 for (
size_t i = 0; i < _topologies.size(); ++i) {
209 _topologies[i].second.begin(),
210 _topologies[i].second.end(),
211 primvar), _topologies[i].second.end());
219 _topologies.erase(std::remove_if(
220 _topologies.begin(), _topologies.end(), NoPrimvars),
227 for (
size_t i = 0; i < _topologies.size(); ++i) {
228 if (
std::find(_topologies[i].second.begin(),
229 _topologies[i].second.end(),
231 _topologies[i].second.end()) {
240 std::vector<VtIntArray> fvarTopologies;
241 for (
const auto& it : _topologies) {
242 fvarTopologies.push_back(it.first);
244 return fvarTopologies;
248 return _topologies.size();
254 static bool NoPrimvars(
const std::pair<VtIntArray, std::vector<TfToken>>
256 return topology.second.empty();
271 DirtyFlatNormals = (DirtySmoothNormals << 1),
272 DirtyIndices = (DirtyFlatNormals << 1),
273 DirtyHullIndices = (DirtyIndices << 1),
274 DirtyPointsIndices = (DirtyHullIndices << 1)
287 bool _hasMirroredTransform : 1;
288 bool _doubleSided : 1;
289 bool _flatShadingEnabled : 1;
290 bool _displacementEnabled : 1;
291 bool _limitNormals : 1;
292 bool _sceneNormals : 1;
293 bool _hasVaryingTopology : 1;
295 bool _displayOpacity : 1;
296 bool _occludedSelectionShowsThrough : 1;
298 std::unique_ptr<_FvarTopologyTracker> _fvarTopologyTracker;
304 #endif // PXR_IMAGING_HD_ST_MESH_H
static const int CustomSlotsBegin
HDST_API void Finalize(HdRenderParam *renderParam) override
void _UpdateDrawItemGeometricShader(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, const HdMeshReprDesc &desc)
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 _UseQuadIndices(const HdRenderIndex &renderIndex, HdSt_MeshTopologySharedPtr const &topology) const
void _PopulateElementPrimvars(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, bool requireFlatNormals)
void _UpdateDrawItem(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, const HdMeshReprDesc &desc, bool requireSmoothNormals, bool requireFlatNormals)
bool _UseFlatNormals(const HdMeshReprDesc &desc) const
HDST_API HdMeshTopologySharedPtr GetTopology() const override
Topology (member) getter.
void _PopulateVertexPrimvars(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, bool requireSmoothNormals)
std::shared_ptr< class HdSt_MeshTopology > HdSt_MeshTopologySharedPtr
std::vector< VtIntArray > GetFvarTopologies() const
void _UpdateShadersForAllReprs(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, bool updateMaterialShader, bool updateGeometricShader)
void RemovePrimvar(const TfToken &primvar)
FMT_CONSTEXPR bool find(Ptr first, Ptr last, T value, Ptr &out)
GT_API const UT_StringHolder 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
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
std::vector< std::pair< VtIntArray, std::vector< TfToken >>> TopologyToPrimvarVector
size_t GetNumTopologies() const
void _PopulateFaceVaryingPrimvars(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, const HdMeshReprDesc &desc)
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)
#define PXR_NAMESPACE_CLOSE_SCOPE
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
void RemoveUnusedTopologies()
void _GatherFaceVaryingTopologies(HdSceneDelegate *sceneDelegate, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, const SdfPath &id, HdSt_MeshTopologySharedPtr topology)
HDST_API HdDirtyBits GetInitialDirtyBitsMask() const override
bool _UseLimitRefinement(const HdRenderIndex &renderIndex) const
std::shared_ptr< class Hd_VertexAdjacency > Hd_VertexAdjacencySharedPtr
void _PopulateTopology(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdStDrawItem *drawItem, HdDirtyBits *dirtyBits, const HdMeshReprDesc &desc)
std::shared_ptr< class HdBufferSource > HdBufferSourceSharedPtr
void _UpdateRepr(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, TfToken const &reprToken, HdDirtyBits *dirtyBitsState)
std::shared_ptr< class HdStResourceRegistry > HdStResourceRegistrySharedPtr
const TopologyToPrimvarVector & GetTopologyToPrimvarVector() const
HDST_API void _InitRepr(TfToken const &reprToken, HdDirtyBits *dirtyBits) override
int _GetRefineLevelForDesc(const HdMeshReprDesc &desc) const