![]() |
An implementation of HdBufferSource where the source data value is a VtValue. More...
Public Member Functions | |
HD_API | HdVtBufferSource (TfToken const &name, VtValue const &value, int arraySize=1) |
Constructs a new buffer from a VtValue. More... | |
HD_API | HdVtBufferSource (TfToken const &name, GfMatrix4d const &matrix) |
Constructs a new buffer from a matrix. More... | |
HD_API | HdVtBufferSource (TfToken const &name, VtArray< GfMatrix4d > const &matrices, int arraySize=1) |
Constructs a new buffer from a matrix. More... | |
HD_API | ~HdVtBufferSource () |
Destructor deletes the internal storage. More... | |
HD_API void | Truncate (size_t numElements) |
Truncate the buffer to the given number of elements. More... | |
virtual TfToken const & | GetName () const override |
Return the name of this buffer source. More... | |
virtual void const * | GetData () const override |
Returns the raw pointer to the underlying data. More... | |
virtual HdTupleType | GetTupleType () const override |
Returns the data type and count of this buffer source. More... | |
virtual HD_API size_t | GetNumElements () const override |
Returns the number of elements (e.g. More... | |
virtual void | GetBufferSpecs (HdBufferSpecVector *specs) const override |
Add the buffer spec for this buffer source into given bufferspec vector. More... | |
virtual bool | Resolve () override |
Prepare the access of GetData(). More... | |
![]() | |
virtual HD_API size_t | ComputeHash () const |
Computes and returns a hash value for the underlying data. More... | |
bool | IsResolved () const |
Returns true it this computation has already been resolved. More... | |
bool | HasResolveError () const |
Returns true if an error occurred during resolve. More... | |
HD_API bool | IsValid () const |
Checks the validity of the source buffer. More... | |
virtual HD_API bool | HasPreChainedBuffer () const |
Returns true if this buffer has a pre-chained buffer. More... | |
virtual HD_API HdBufferSourceSharedPtr | GetPreChainedBuffer () const |
Returns the pre-chained buffer. More... | |
virtual HD_API bool | HasChainedBuffer () const |
Returns true if this buffer has any chained buffer(s) More... | |
virtual HD_API HdBufferSourceSharedPtrVector | GetChainedBuffers () const |
Returns the vector of chained buffers. More... | |
Static Public Member Functions | |
static HD_API HdType | GetDefaultMatrixType () |
Returns the default matrix type. More... | |
Protected Member Functions | |
virtual HD_API bool | _CheckValid () const override |
Checks the validity of the source buffer. More... | |
![]() | |
void | _SetResolved () |
Marks this buffer source as resolved. More... | |
void | _SetResolveError () |
Called during Resolve() to indicate an unrecoverable failure occurred and the results of the computation can not be used. More... | |
bool | _TryLock () |
Non-blocking lock acquisition. More... | |
An implementation of HdBufferSource where the source data value is a VtValue.
Definition at line 49 of file vtBufferSource.h.
HD_API HdVtBufferSource | ( | TfToken const & | name, |
VtValue const & | value, | ||
int | arraySize = 1 |
||
) |
Constructs a new buffer from a VtValue.
arraySize | indicates how many values are provided per element. |
HD_API HdVtBufferSource | ( | TfToken const & | name, |
GfMatrix4d const & | matrix | ||
) |
Constructs a new buffer from a matrix.
The data is convert to the default type (see GetDefaultMatrixType()).
note that if we use above VtValue taking constructor, we can use either float or double matrix regardless the default type.
HD_API HdVtBufferSource | ( | TfToken const & | name, |
VtArray< GfMatrix4d > const & | matrices, | ||
int | arraySize = 1 |
||
) |
Constructs a new buffer from a matrix.
The data is convert to the default type (see GetDefaultMatrixType()).
note that if we use above VtValue taking constructor, we can use either float or double matrix regardless the default type.
arraySize | indicates how many values are provided per element. |
HD_API ~HdVtBufferSource | ( | ) |
Destructor deletes the internal storage.
|
overrideprotectedvirtual |
Checks the validity of the source buffer.
This function is called by IsValid() to do the real checking.
Should only be implemented in classes at leafs of the class hierarchy (Please place common validation code in a new non-virtual method)
This code should return false:
The resolve step requires a 'source' buffer and that buffer is invalid.
If returning false, the buffer will not be registered with the resource registry. AddBufferSpec and Resolve will not be called
Implements HdBufferSource.
|
inlineoverridevirtual |
Add the buffer spec for this buffer source into given bufferspec vector.
Implements HdBufferSource.
Definition at line 116 of file vtBufferSource.h.
|
inlineoverridevirtual |
Returns the raw pointer to the underlying data.
Implements HdBufferSource.
Definition at line 101 of file vtBufferSource.h.
|
static |
Returns the default matrix type.
The default is HdTypeFloatMat4, but if HD_ENABLE_DOUBLEMATRIX is true, then HdTypeDoubleMat4 is used instead.
|
inlineoverridevirtual |
Return the name of this buffer source.
Implements HdBufferSource.
Definition at line 96 of file vtBufferSource.h.
|
overridevirtual |
Returns the number of elements (e.g.
VtVec3dArray().GetLength()) from the source array.
Implements HdBufferSource.
|
inlineoverridevirtual |
Returns the data type and count of this buffer source.
Implements HdBufferSource.
Definition at line 106 of file vtBufferSource.h.
|
inlineoverridevirtual |
Prepare the access of GetData().
Implements HdBufferSource.
Definition at line 121 of file vtBufferSource.h.
HD_API void Truncate | ( | size_t | numElements | ) |
Truncate the buffer to the given number of elements.
If the VtValue contains too much data, this is a way to only forward part of the data to the hydra buffer system. numElements must be less than or equal to the current result of GetNumElements().