Loading...
Searching...
No Matches
layerOffset.h
Go to the documentation of this file.
1//
2// Copyright 2016 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//
24#ifndef PXR_USD_SDF_LAYER_OFFSET_H
25#define PXR_USD_SDF_LAYER_OFFSET_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/sdf/api.h"
31
32#include <iosfwd>
33#include <vector>
34
35PXR_NAMESPACE_OPEN_SCOPE
36
37class SdfTimeCode;
38
61{
62public:
65
67 SDF_API
68 explicit SdfLayerOffset(double offset = 0.0, double scale = 1.0);
69
71
74
76 double GetOffset() const { return _offset; }
77
79 double GetScale() const { return _scale; }
80
82 void SetOffset(double newOffset) { _offset = newOffset; }
83
85 void SetScale(double newScale) { _scale = newScale; }
86
89 SDF_API
90 bool IsIdentity() const;
91
95 SDF_API
96 bool IsValid() const;
97
99 SDF_API
101
104
106 SDF_API
107 size_t GetHash() const;
108
110 struct Hash {
111 size_t operator()(const SdfLayerOffset &offset) const {
112 return offset.GetHash();
113 }
114 };
115
116 friend inline size_t hash_value(const SdfLayerOffset &offset) {
117 return offset.GetHash();
118 }
119
121
124
126 SDF_API
127 bool operator==(const SdfLayerOffset &rhs) const;
128
130 bool operator!=(const SdfLayerOffset &rhs) const {
131 return !(*this == rhs);
132 }
133
136 SDF_API
137 bool operator<(const SdfLayerOffset &rhs) const;
138
140 bool operator>(const SdfLayerOffset& rhs) const {
141 return rhs < *this;
142 }
143
145 bool operator>=(const SdfLayerOffset& rhs) const {
146 return !(*this < rhs);
147 }
148
150 bool operator<=(const SdfLayerOffset& rhs) const {
151 return !(*this > rhs);
152 }
153
156 SDF_API
158
160 SDF_API
161 double operator*(double rhs) const;
162
164 SDF_API
166
168
169private:
170 double _offset;
171 double _scale;
172};
173
174typedef std::vector<SdfLayerOffset> SdfLayerOffsetVector;
175
178SDF_API
179std::ostream & operator<<( std::ostream &out,
180 const SdfLayerOffset &layerOffset );
181
182PXR_NAMESPACE_CLOSE_SCOPE
183
184#endif // PXR_USD_SDF_LAYER_OFFSET_H
Represents a time offset and scale between layers.
Definition: layerOffset.h:61
bool operator>(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:140
double GetScale() const
Returns the time scale factor.
Definition: layerOffset.h:79
SDF_API SdfLayerOffset GetInverse() const
Gets the inverse offset, which performs the opposite transformation.
SDF_API bool IsValid() const
Returns true if this offset is valid, i.e.
bool operator>=(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:145
bool operator!=(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:130
SDF_API SdfLayerOffset operator*(const SdfLayerOffset &rhs) const
Composes this with the offset rhs, such that the resulting offset is equivalent to first applying rhs...
SDF_API bool operator==(const SdfLayerOffset &rhs) const
Returns whether the offsets are equal.
SDF_API bool operator<(const SdfLayerOffset &rhs) const
Returns whether this offset is less than another.
bool operator<=(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:150
SDF_API SdfTimeCode operator*(const SdfTimeCode &rhs) const
Applies the offset to the given value.
SDF_API bool IsIdentity() const
Returns true if this is an identity transformation, with an offset of 0.0 and a scale of 1....
SDF_API SdfLayerOffset(double offset=0.0, double scale=1.0)
Constructs a new SdfLayerOffset instance.
void SetOffset(double newOffset)
Sets the time offset.
Definition: layerOffset.h:82
double GetOffset() const
Returns the time offset.
Definition: layerOffset.h:76
SDF_API double operator*(double rhs) const
Applies the offset to the given value.
void SetScale(double newScale)
Sets the time scale factor.
Definition: layerOffset.h:85
SDF_API size_t GetHash() const
Returns hash for this offset.
Value type that represents a time code.
Definition: timeCode.h:45
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
Hash functor for hash maps and sets.
Definition: layerOffset.h:110