179 lines
6.0 KiB
C++
179 lines
6.0 KiB
C++
//
|
|
// Copyright 2021 Pixar
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
// with the following modification; you may not use this file except in
|
|
// compliance with the Apache License and the following modification to it:
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
|
//
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
// the License and to reproduce the content of the NOTICE file.
|
|
//
|
|
// You may obtain a copy of the Apache License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the Apache License with the above modification is
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
// language governing permissions and limitations under the Apache License.
|
|
//
|
|
////////////////////////////////////////////////////////////////////////
|
|
// This file is generated by a script. Do not edit directly. Edit the
|
|
// schema.template.h file to make changes.
|
|
|
|
#ifndef PXR_IMAGING_HD_PRIMVAR_SCHEMA_H
|
|
#define PXR_IMAGING_HD_PRIMVAR_SCHEMA_H
|
|
|
|
#include "pxr/imaging/hd/api.h"
|
|
|
|
#include "pxr/imaging/hd/schema.h"
|
|
|
|
PXR_NAMESPACE_OPEN_SCOPE
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#define HDPRIMVAR_SCHEMA_TOKENS \
|
|
(primvarValue) \
|
|
(indexedPrimvarValue) \
|
|
(indices) \
|
|
(interpolation) \
|
|
(role) \
|
|
(constant) \
|
|
(uniform) \
|
|
(varying) \
|
|
(vertex) \
|
|
(faceVarying) \
|
|
(instance) \
|
|
(Point) \
|
|
(Normal) \
|
|
(Vector) \
|
|
(Color) \
|
|
(PointIndex) \
|
|
(EdgeIndex) \
|
|
(FaceIndex) \
|
|
(TextureCoordinate) \
|
|
(Transform) \
|
|
|
|
TF_DECLARE_PUBLIC_TOKENS(HdPrimvarSchemaTokens, HD_API,
|
|
HDPRIMVAR_SCHEMA_TOKENS);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class HdPrimvarSchema : public HdSchema
|
|
{
|
|
public:
|
|
HdPrimvarSchema(HdContainerDataSourceHandle container)
|
|
: HdSchema(container) {}
|
|
|
|
//ACCESSORS
|
|
|
|
|
|
// If the primvar does not have indices, GetPrimvarValue() and
|
|
// GetIndexedPrimvarValue() will return the same thing. If the primvar
|
|
// does has indices, GetPrimvarValue() will return the flattened value,
|
|
// while GetIndexedPrimvarValue() will return the unflattened value.
|
|
HD_API
|
|
HdSampledDataSourceHandle GetPrimvarValue();
|
|
HD_API
|
|
HdSampledDataSourceHandle GetIndexedPrimvarValue();
|
|
HD_API
|
|
HdIntArrayDataSourceHandle GetIndices();
|
|
HD_API
|
|
HdTokenDataSourceHandle GetInterpolation();
|
|
HD_API
|
|
HdTokenDataSourceHandle GetRole();
|
|
|
|
// RETRIEVING AND CONSTRUCTING
|
|
|
|
/// Builds a container data source which includes the provided child data
|
|
/// sources. Parameters with nullptr values are excluded. This is a
|
|
/// low-level interface. For cases in which it's desired to define
|
|
/// the container with a sparse set of child fields, the Builder class
|
|
/// is often more convenient and readable.
|
|
HD_API
|
|
static HdContainerDataSourceHandle
|
|
BuildRetained(
|
|
const HdSampledDataSourceHandle &primvarValue,
|
|
const HdSampledDataSourceHandle &indexedPrimvarValue,
|
|
const HdIntArrayDataSourceHandle &indices,
|
|
const HdTokenDataSourceHandle &interpolation,
|
|
const HdTokenDataSourceHandle &role
|
|
);
|
|
|
|
/// \class HdPrimvarSchema::Builder
|
|
///
|
|
/// Utility class for setting sparse sets of child data source fields to be
|
|
/// filled as arguments into BuildRetained. Because all setter methods
|
|
/// return a reference to the instance, this can be used in the "builder
|
|
/// pattern" form.
|
|
class Builder
|
|
{
|
|
public:
|
|
HD_API
|
|
Builder &SetPrimvarValue(
|
|
const HdSampledDataSourceHandle &primvarValue);
|
|
HD_API
|
|
Builder &SetIndexedPrimvarValue(
|
|
const HdSampledDataSourceHandle &indexedPrimvarValue);
|
|
HD_API
|
|
Builder &SetIndices(
|
|
const HdIntArrayDataSourceHandle &indices);
|
|
HD_API
|
|
Builder &SetInterpolation(
|
|
const HdTokenDataSourceHandle &interpolation);
|
|
HD_API
|
|
Builder &SetRole(
|
|
const HdTokenDataSourceHandle &role);
|
|
|
|
/// Returns a container data source containing the members set thus far.
|
|
HD_API
|
|
HdContainerDataSourceHandle Build();
|
|
|
|
private:
|
|
HdSampledDataSourceHandle _primvarValue;
|
|
HdSampledDataSourceHandle _indexedPrimvarValue;
|
|
HdIntArrayDataSourceHandle _indices;
|
|
HdTokenDataSourceHandle _interpolation;
|
|
HdTokenDataSourceHandle _role;
|
|
};
|
|
// Returns true if it contains data sources for an indexed primvar value
|
|
// and for indices.
|
|
bool IsIndexed();
|
|
|
|
|
|
/// Returns token data source for use as interpolation value.
|
|
/// Values of...
|
|
/// - HdPrimvarSchemaTokens->constant
|
|
/// - HdPrimvarSchemaTokens->uniform
|
|
/// - HdPrimvarSchemaTokens->varying
|
|
/// - HdPrimvarSchemaTokens->vertex
|
|
/// - HdPrimvarSchemaTokens->faceVarying
|
|
/// - HdPrimvarSchemaTokens->instance
|
|
/// ...will be stored statically and reused for future calls.
|
|
HD_API
|
|
static HdTokenDataSourceHandle BuildInterpolationDataSource(
|
|
const TfToken &interpolation);
|
|
/// Returns token data source for use as role value.
|
|
/// Values of...
|
|
/// - HdPrimvarSchemaTokens->Point
|
|
/// - HdPrimvarSchemaTokens->Normal
|
|
/// - HdPrimvarSchemaTokens->Vector
|
|
/// - HdPrimvarSchemaTokens->Color
|
|
/// - HdPrimvarSchemaTokens->PointIndex
|
|
/// - HdPrimvarSchemaTokens->EdgeIndex
|
|
/// - HdPrimvarSchemaTokens->FaceIndex
|
|
/// - HdPrimvarSchemaTokens->TextureCoordinate
|
|
/// ...will be stored statically and reused for future calls.
|
|
HD_API
|
|
static HdTokenDataSourceHandle BuildRoleDataSource(
|
|
const TfToken &role);
|
|
|
|
};
|
|
|
|
PXR_NAMESPACE_CLOSE_SCOPE
|
|
|
|
#endif |