Loading...
Searching...
No Matches
instanceSchema.h
1//
2// Copyright 2023 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
25
26/* ************************************************************************** */
27/* ** This file is generated by a script. Do not edit directly. Edit ** */
28/* ** defs.py or the (*)Schema.template.h files to make changes. ** */
29/* ************************************************************************** */
30
31#ifndef PXR_IMAGING_HD_INSTANCE_SCHEMA_H
32#define PXR_IMAGING_HD_INSTANCE_SCHEMA_H
33
34#include "pxr/imaging/hd/api.h"
35
36#include "pxr/imaging/hd/schema.h"
37
38PXR_NAMESPACE_OPEN_SCOPE
39
40//-----------------------------------------------------------------------------
41
42#define HD_INSTANCE_SCHEMA_TOKENS \
43 (instance) \
44 (instancer) \
45 (prototypeIndex) \
46 (instanceIndex) \
47
48TF_DECLARE_PUBLIC_TOKENS(HdInstanceSchemaTokens, HD_API,
49 HD_INSTANCE_SCHEMA_TOKENS);
50
51//-----------------------------------------------------------------------------
52// This schema can be considered the opposite of instancerTopology's
53// "instanceLocations". When the scene coalesces scene prims into multiple
54// instances of a single prototype, it inserts "instance" prims at the site of
55// de-duplication. The instancer prim added to manage the prototype uses
56// "instanceLocations" to point back to all of these instance prims.
57//
58// The instance prims aren't directly useful for rendering but can be useful
59// for scene processing and data aggregation.
60//
61
62class HdInstanceSchema : public HdSchema
63{
64public:
65 HdInstanceSchema(HdContainerDataSourceHandle container)
66 : HdSchema(container) {}
67
68// --(BEGIN CUSTOM CODE: Schema Methods)--
69// --(END CUSTOM CODE: Schema Methods)--
70
71 //ACCESSORS
72
73
74 // Path to instancer for which a (sub-)entry was added to its
75 // instancerTopology's instanceIndices during instance aggregation to
76 // account for this instance. Note that instanceIndices is nested, that
77 // is a vector data source containing integer arrays, one for each
78 // prototype the instancer is instancing. Thus, we need two indices to
79 // identify the entry: prototypeIndex is the outer index and
80 // instanceIndex the inner index.
81 HD_API
82 HdPathDataSourceHandle GetInstancer();
83
84 // Index into vector data source at instancer's instancerTopology's
85 // instanceIndices to find entry corresponding to this instance.
86 HD_API
87 HdIntDataSourceHandle GetPrototypeIndex();
88
89 // Index into int array within the vector data source at instancer's
90 // instancerTopology's instanceIndices to find entry corresponding to
91 // this instance.
92 HD_API
93 HdIntDataSourceHandle GetInstanceIndex();
94
95 // RETRIEVING AND CONSTRUCTING
96
102 HD_API
103 static HdContainerDataSourceHandle
104 BuildRetained(
105 const HdPathDataSourceHandle &instancer,
106 const HdIntDataSourceHandle &prototypeIndex,
107 const HdIntDataSourceHandle &instanceIndex
108 );
109
117 {
118 public:
119 HD_API
120 Builder &SetInstancer(
121 const HdPathDataSourceHandle &instancer);
122 HD_API
123 Builder &SetPrototypeIndex(
124 const HdIntDataSourceHandle &prototypeIndex);
125 HD_API
126 Builder &SetInstanceIndex(
127 const HdIntDataSourceHandle &instanceIndex);
128
130 HD_API
131 HdContainerDataSourceHandle Build();
132
133 private:
134 HdPathDataSourceHandle _instancer;
135 HdIntDataSourceHandle _prototypeIndex;
136 HdIntDataSourceHandle _instanceIndex;
137 };
138
144 HD_API
145 static HdInstanceSchema GetFromParent(
146 const HdContainerDataSourceHandle &fromParentContainer);
147
150 HD_API
151 static const TfToken &GetSchemaToken();
152
155 HD_API
156 static const HdDataSourceLocator &GetDefaultLocator();
157
158};
159
160PXR_NAMESPACE_CLOSE_SCOPE
161
162#endif
Represents an object that can identify the location of a data source.
Utility class for setting sparse sets of child data source fields to be filled as arguments into Buil...
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
Schema classes represent a structured view of the inherently unstructured container data source passe...
Definition: schema.h:43
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:108