VRay SDK for C++
Loading...
Searching...
No Matches
VRay::BinUserAttributesWriter Struct Reference

Attributes storage format: [attrName\0|type{uint8}|value{some_bytes}][...][...]\0. More...

#include <vraysdk.hpp>

Public Types

enum  BinUserAttributeType : byte {
  binUserAttributeType_int = 0 , binUserAttributeType_float , binUserAttributeType_vector , binUserAttributeType_acolor ,
  binUserAttributeType_string , binUserAttributeType_last
}
 
enum  BinUserAttributeTypeFlags : byte { binUserAttributeFlag_small = 1 << 3 , binUserAttributeFlag_smallY = 1 << 2 , binUserAttributeFlag_smallZ = 1 << 1 , binUserAttributeFlag_smallA = 1 << 0 }
 

Public Member Functions

void add (const char *name, size_t nameLen, const AColor &value)
 
void add (const char *name, size_t nameLen, const char *value, size_t valueLen)
 
void add (const char *name, size_t nameLen, const Vector &value)
 
void add (const char *name, size_t nameLen, float value)
 
void add (const char *name, size_t nameLen, int value)
 
template<size_t count>
void add (const char(&name)[count], const AColor &value)
 
template<size_t count>
void add (const char(&name)[count], const Vector &value)
 
template<size_t count>
void add (const char(&name)[count], float value)
 
template<size_t count>
void add (const char(&name)[count], int value)
 
template<size_t nameLen>
void add (const char(&name)[nameLen], const char *value, size_t valueLen)
 
template<size_t nameLen, size_t valueLen>
void add (const char(&name)[nameLen], const char(&value)[valueLen])
 
template<size_t nameLen>
void add (const char(&name)[nameLen], const std::string &value)
 
void add (const std::string &name, const AColor &value)
 
void add (const std::string &name, const char *value, size_t valueLen)
 
template<size_t valueLen>
void add (const std::string &name, const char(&value)[valueLen])
 
void add (const std::string &name, const std::string &value)
 
void add (const std::string &name, const Vector &value)
 
void add (const std::string &name, float value)
 
void add (const std::string &name, int value)
 
void close ()
 
size_t getNumBytes () const
 Get number of written bytes.
 
bool hasData () const
 Checks if we've written any attributes.
 
IntList toIntList ()
 
std::string toString () const
 

Detailed Description

Attributes storage format: [attrName\0|type{uint8}|value{some_bytes}][...][...]\0.

Member Enumeration Documentation

◆ BinUserAttributeType

Attribute type format: uint8 76543210 00000000 ||||~~~~ - Attribute type. |||- AColor.alpha is small. ||- Vector.z is small. |- Vector.y is small. - Int, float or vector.x is small.

◆ BinUserAttributeTypeFlags

Enumerator
binUserAttributeFlag_small 

Means that int, float or vector.x value fits in int8. Basically used to store values like 0.0 or 1.0 more efficiently.

binUserAttributeFlag_smallY 

Vector.y component is a small value.

binUserAttributeFlag_smallZ 

Vector.z component is a small value.

binUserAttributeFlag_smallA 

AColor.alpha component is a small value.

Member Function Documentation

◆ add() [1/19]

void VRay::BinUserAttributesWriter::add ( const char *  name,
size_t  nameLen,
const AColor value 
)
inline

Append color attribute.

Parameters
nameAttribute name.
nameLenAttribute name length.
valueColor value.

◆ add() [2/19]

void VRay::BinUserAttributesWriter::add ( const char *  name,
size_t  nameLen,
const char *  value,
size_t  valueLen 
)
inline

Append string attribute.

Parameters
nameAttribute name.
nameLenAttribute name length.
valueString value.
valueLenString value length.

◆ add() [3/19]

void VRay::BinUserAttributesWriter::add ( const char *  name,
size_t  nameLen,
const Vector value 
)
inline

Append vector attribute.

Parameters
nameAttribute name.
nameLenAttribute name length.
valueVector value.

◆ add() [4/19]

void VRay::BinUserAttributesWriter::add ( const char *  name,
size_t  nameLen,
float  value 
)
inline

Append float attribute.

Parameters
nameAttribute name.
nameLenAttribute name length.
valueFloat value.

◆ add() [5/19]

void VRay::BinUserAttributesWriter::add ( const char *  name,
size_t  nameLen,
int  value 
)
inline

Append integer attribute.

Parameters
nameAttribute name.
nameLenAttribute name length.
valueInteger value.

◆ add() [6/19]

template<size_t count>
void VRay::BinUserAttributesWriter::add ( const char(&)  name[count],
const AColor value 
)
inline

Append color attribute.

Parameters
nameAttribute name.
valueAColor value.

◆ add() [7/19]

template<size_t count>
void VRay::BinUserAttributesWriter::add ( const char(&)  name[count],
const Vector value 
)
inline

Append vector attribute.

Parameters
nameAttribute name.
valueVector value.

◆ add() [8/19]

template<size_t count>
void VRay::BinUserAttributesWriter::add ( const char(&)  name[count],
float  value 
)
inline

Append float attribute.

Parameters
nameAttribute name.
valueFloat value.

◆ add() [9/19]

template<size_t count>
void VRay::BinUserAttributesWriter::add ( const char(&)  name[count],
int  value 
)
inline

Append integer attribute.

Parameters
nameAttribute name.
valueInteger value.

◆ add() [10/19]

template<size_t nameLen>
void VRay::BinUserAttributesWriter::add ( const char(&)  name[nameLen],
const char *  value,
size_t  valueLen 
)
inline

Append string attribute.

Parameters
nameAttribute name.
valueString value.
valueLenString value length.

◆ add() [11/19]

template<size_t nameLen, size_t valueLen>
void VRay::BinUserAttributesWriter::add ( const char(&)  name[nameLen],
const char(&)  value[valueLen] 
)
inline

Append string attribute.

Parameters
nameAttribute name.
valueString value.

◆ add() [12/19]

template<size_t nameLen>
void VRay::BinUserAttributesWriter::add ( const char(&)  name[nameLen],
const std::string &  value 
)
inline

Append string attribute.

Parameters
nameAttribute name.
valueString value.

◆ add() [13/19]

void VRay::BinUserAttributesWriter::add ( const std::string &  name,
const AColor value 
)
inline

Append color attribute.

Parameters
nameAttribute name.
valueAColor value.

◆ add() [14/19]

void VRay::BinUserAttributesWriter::add ( const std::string &  name,
const char *  value,
size_t  valueLen 
)
inline

Append string attribute.

Parameters
nameAttribute name.
valueString value.
valueLenString value length.

◆ add() [15/19]

template<size_t valueLen>
void VRay::BinUserAttributesWriter::add ( const std::string &  name,
const char(&)  value[valueLen] 
)
inline

Append string attribute.

Parameters
nameAttribute name.
valueString value.

◆ add() [16/19]

void VRay::BinUserAttributesWriter::add ( const std::string &  name,
const std::string &  value 
)
inline

Append string attribute.

Parameters
nameAttribute name.
valueString value.

◆ add() [17/19]

void VRay::BinUserAttributesWriter::add ( const std::string &  name,
const Vector value 
)
inline

Append vector attribute.

Parameters
nameAttribute name.
valueVector value.

◆ add() [18/19]

void VRay::BinUserAttributesWriter::add ( const std::string &  name,
float  value 
)
inline

Append float attribute.

Parameters
nameAttribute name.
valueFloat value.

◆ add() [19/19]

void VRay::BinUserAttributesWriter::add ( const std::string &  name,
int  value 
)
inline

Append integer attribute.

Parameters
nameAttribute name.
valueInteger value.

◆ close()

void VRay::BinUserAttributesWriter::close ( )
inline

Finalize attributes per instance. Call close() to separate attributes between different instances.

◆ toIntList()

IntList VRay::BinUserAttributesWriter::toIntList ( )
inline

Get binary serialized data as IntList for easier assignment as plugin property value. This will reset the state of BinUserAttributesWriter!

◆ toString()

std::string VRay::BinUserAttributesWriter::toString ( ) const
inline

Returns the hex string representation that is written to the returned IntList including the final 0 character.


The documentation for this struct was generated from the following file: