omni/connect/core/PrimvarData.h
File members: omni/connect/core/PrimvarData.h
// SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates is strictly prohibited.
#pragma once
#include "Api.h"
#include <pxr/base/gf/vec2f.h>
#include <pxr/base/gf/vec3f.h>
#include <pxr/base/tf/token.h>
#include <pxr/base/vt/array.h>
#include <pxr/usd/usdGeom/primvar.h>
namespace omni::connect::core
{
template <typename T>
class PrimvarData
{
public:
PrimvarData(const pxr::TfToken& interpolation, const pxr::VtArray<T>& values, int elementSize = -1);
PrimvarData(const pxr::TfToken& interpolation, const pxr::VtArray<T>& values, const pxr::VtArray<int>& indices, int elementSize = -1);
static PrimvarData getPrimvarData(const pxr::UsdGeomPrimvar& primvar, pxr::UsdTimeCode time = pxr::UsdTimeCode::Default());
bool setPrimvar(pxr::UsdGeomPrimvar& primvar, pxr::UsdTimeCode time = pxr::UsdTimeCode::Default()) const;
const pxr::TfToken& interpolation() const;
const pxr::VtArray<T>& values() const;
bool hasIndices() const;
const pxr::VtArray<int>& indices() const;
int elementSize() const;
size_t effectiveSize() const;
bool isValid() const;
bool isIdentical(const PrimvarData& other) const;
bool index();
bool operator==(const PrimvarData& other) const;
bool operator!=(const PrimvarData& other) const;
private:
pxr::TfToken m_interpolation;
int m_elementSize;
pxr::VtArray<T> m_values;
pxr::VtArray<int> m_indices;
};
using FloatPrimvarData = PrimvarData<float>;
using Int64PrimvarData = PrimvarData<int64_t>;
using IntPrimvarData = PrimvarData<int>;
using StringPrimvarData = PrimvarData<std::string>;
using TokenPrimvarData = PrimvarData<pxr::TfToken>;
using Vec2fPrimvarData = PrimvarData<pxr::GfVec2f>;
using Vec3fPrimvarData = PrimvarData<pxr::GfVec3f>;
} // namespace omni::connect::core
#include "omni/connect/core/PrimvarData.inl"