3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Graphics::ShaderVariable Class Referencefinal

Represents the reflection data of a shader variable, which is a field in a constant buffer. More...

#include <ShaderVariable.hpp>

Inheritance diagram for Engine3DRadSpace.Graphics::ShaderVariable:
Collaboration diagram for Engine3DRadSpace.Graphics::ShaderVariable:

Public Member Functions

 ShaderVariable (const std::string &name, int idxCbuffer, size_t offset, size_t size)
 Constructs an shader variable reflection data with the given name, constant buffer index, offset, and size.
virtual const void * Get (void *objPtr) const override
 Gets the value of the field from the given object pointer.
virtual void Set (void *objPtr, const void *value) const override
 Sets the value of this shader variable in the given object pointer to the specified value.
const void * DefaultValue () const override
 Returns a pointer to the default value of the field's type.
Reflection::FieldRepresentation Representation () const override
 Returns an empty field representation, as shader variables aren't serializable in an editor.
int ConstantBuffer () const noexcept
 Returns the id of the constant buffer that this shader variable belongs to.
std::unique_ptr< Reflection::IReflectedField > Clone () const override
 Creates a deep clone of this shader variable reflection data.
 ~ShaderVariable () override=default
Public Member Functions inherited from Engine3DRadSpace.Reflection.IReflectedField
IntPtr Get (IntPtr objPtr)
void Set (IntPtr objPtr, IntPtr value)
const size_t TypeHash () const noexcept
 Type hash of the field's type, usually typeid(T).hash_code() for the field's type T.
const std::string & FieldName () const noexcept
 Name of the field.
const std::string & FieldDesc () const noexcept
 Description of the field.
const size_t TypeSize () const noexcept
 Size of the field's type in bytes.
const ptrdiff_t FieldOffset () const noexcept
 Offset of the field within the object, in bytes.
template<typename T>
const T GetAtOffset (void *objPtr, intptr_t offset) const
 Gets the type T with an additional offset from the field's offset within the object.
virtual ~IReflectedField ()=default

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.Reflection.IReflectedField
 IReflectedField ()=default
 IReflectedField (size_t offset, size_t size, const std::string &name, const std::string &desc, const std::type_info &info)
 IReflectedField (const IReflectedField &f)=default
 IReflectedField (IReflectedField &&)=default
IReflectedField & operator= (const IReflectedField &f)=default
IReflectedField & operator= (IReflectedField &&f)=default
Protected Attributes inherited from Engine3DRadSpace.Reflection.IReflectedField
size_t _typeHash = 0
std::type_index _typeIndex
size_t _size = 0
size_t _offset = 0
std::string _name
std::string _desc
Properties inherited from Engine3DRadSpace.Reflection.IReflectedField
ulong TypeHash [get]
string FieldName [get]
string FieldDesc [get]
ulong TypeSize [get]
ulong FieldOffset [get]
IntPtr DefaultValue [get]

Detailed Description

Represents the reflection data of a shader variable, which is a field in a constant buffer.

Constructor & Destructor Documentation

◆ ShaderVariable()

ShaderVariable::ShaderVariable ( const std::string & name,
int idxCbuffer,
size_t offset,
size_t size )

Constructs an shader variable reflection data with the given name, constant buffer index, offset, and size.

Parameters
nameThe name of the shader variable.
idxCbufferThe index of the constant buffer that this shader variable belongs to.
offsetThe offset of the shader variable within the constant buffer.
sizeThe size of the shader variable.

◆ ~ShaderVariable()

Engine3DRadSpace.Graphics::ShaderVariable::~ShaderVariable ( )
overridedefault

Member Function Documentation

◆ Clone()

std::unique_ptr< IReflectedField > ShaderVariable::Clone ( ) const
overridevirtual

Creates a deep clone of this shader variable reflection data.

Returns

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ ConstantBuffer()

int ShaderVariable::ConstantBuffer ( ) const
noexcept

Returns the id of the constant buffer that this shader variable belongs to.

Returns

◆ DefaultValue()

const void * ShaderVariable::DefaultValue ( ) const
overridevirtual

Returns a pointer to the default value of the field's type.

Returns
Pointer to the default value of the field's type

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ Get()

const void * ShaderVariable::Get ( void * objPtr) const
overridevirtual

Gets the value of the field from the given object pointer.

Parameters
objPtrPointer to the object containing the field.
Returns
Pointer to the field's value.

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ Representation()

FieldRepresentation ShaderVariable::Representation ( ) const
overridevirtual

Returns an empty field representation, as shader variables aren't serializable in an editor.

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ Set()

void ShaderVariable::Set ( void * objPtr,
const void * value ) const
overridevirtual

Sets the value of this shader variable in the given object pointer to the specified value.

Parameters
objPtrA pointer to the constant buffer.
valueA pointer to the value to set.

Implements Engine3DRadSpace.Reflection.IReflectedField.


The documentation for this class was generated from the following files: