16#pragma warning(disable : 4275)
17#include <pxr/usd/usdGeom/primvar.h>
18#include <pxr/usd/usdGeom/mesh.h>
20#include <pxr/base/tf/token.h>
22#include "MaxUsd/MeshConversion/MeshFacade.h"
26namespace MAXUSD_NS_DEF {
32 enum class MaxUSDAPI Type
46 pxr::TfToken primvarName;
52 : primvarType(), autoExpandType(
false)
56 MaxUSDAPI
Config(
const pxr::TfToken& primvarName, Type type,
bool autoExpandType =
false)
58 this->primvarName = primvarName;
59 this->primvarType = type;
60 this->autoExpandType = autoExpandType;
63 MaxUSDAPI
bool operator==(
const Config& config)
65 return primvarName == config.primvarName && primvarType == config.primvarType && autoExpandType == config.autoExpandType;
68 MaxUSDAPI
const pxr::TfToken& GetPrimvarName()
const
72 MaxUSDAPI
const Type GetPrimvarType()
const
76 MaxUSDAPI
bool IsAutoExpandType()
const
78 return autoExpandType;
88 const std::shared_ptr<std::vector<int>> faceDataIndices;
93 const Point3* data,
size_t dataCount,
const std::shared_ptr<std::vector<int>> faceDataIndices)
95 , dataCount(dataCount)
96 , faceDataIndices(faceDataIndices)
99 MaxUSDAPI
const Point3* GetData()
const
103 MaxUSDAPI
const size_t GetDataCount()
const
107 MaxUSDAPI
const std::shared_ptr<std::vector<int>> GetFaceDataIndices()
const
109 return faceDataIndices;
116 pxr::TfToken interpolation;
121 MaxUSDAPI
explicit DataLayout(
const pxr::TfToken interpolation,
bool indexed)
122 : interpolation(interpolation)
126 MaxUSDAPI
const pxr::TfToken& GetInterpolation()
const
128 return interpolation;
130 MaxUSDAPI
bool IsIndexed()
const
157 pxr::UsdGeomMesh& target,
const Config& config,
const pxr::UsdTimeCode& timeCode,
bool animated)
const;
168 pxr::UsdGeomPrimvar* primvar,
const pxr::UsdTimeCode& timeCode)
const;
204 std::shared_ptr<const std::vector<int>> faceIndices;
206 std::shared_ptr<MappedData> mappedData;
Definition: MappedAttributeBuilder.h:43
Definition: MappedAttributeBuilder.h:114
Definition: MappedAttributeBuilder.h:84
Definition: MappedAttributeBuilder.h:29
MaxUSDAPI DataLayout InferAttributeDataLayout() const
Infers the data layout i.e. the interpolation scheme and whether it should be indexed or not.
MaxUSDAPI bool PopulateAttribute(pxr::UsdAttribute &attribute, const DataLayout &layout, pxr::UsdGeomPrimvar *primvar, const pxr::UsdTimeCode &timeCode) const
Populates a given attribute with the mapped data.
static MaxUSDAPI size_t GetTypeDimension(const Type &type)
Returns the dimension of the given type.
MaxUSDAPI MappedAttributeBuilder(MeshFacade &maxMesh, std::shared_ptr< MappedData > data)
Constructor.
static MaxUSDAPI pxr::SdfValueTypeName GetValueTypeName(const Type &type)
Returns the SdfValueTypeName associated with this type.
MaxUSDAPI MappedAttributeBuilder(MeshFacade &&maxMesh, std::shared_ptr< MappedData > data)
Constructor. This overload was added to allow passing a temporary MeshFacade as parameter.
Definition: MappedAttributeBuilder.h:145
static MaxUSDAPI Type GetEquivalentType(const Type &type, int dimension)
Returns a type equivalent to the given type for a given dimension. For example the equivalent to texc...
MaxUSDAPI bool BuildPrimvar(pxr::UsdGeomMesh &target, const Config &config, const pxr::UsdTimeCode &timeCode, bool animated) const
Creates a new primvar onto the target USD mesh and populate it with the the mapped data.
A facade to work with the 3dsMax Mesh and MNMesh classes transparently. Does some caching internally ...
Definition: MeshFacade.h:30