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

Represents references to shaders, specifically vertex, pixel, and geometry shaders. This class is used to set the shaders to the graphics device. More...

#include <Effect.hpp>

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

Public Member Functions

 Effect (IGraphicsDevice device, IShader[] shaders, int numShaders)
 Effect (IntPtr handle)
void SetAll ()
void Set (int shaderID)
void SetData (IntPtr data, ulong size, int cBufferID, int shaderID)
void SetData (IntPtr data, ulong size, int cBufferID)
void SetTexture (ITexture2D texture, int textureID)
void SetTexture (ITexture2D texture, int textureID, int shaderID)
void SetSampler (ISamplerState samplerState, int idx)
void SetSampler (ISamplerState samplerState, int idx, int shaderID)
IShader GetShader (int shaderID)
 Effect (IGraphicsDevice *device, std::span< IShader * > shaders)
 Constructs an Effect object with the specified graphics device and shaders.
 Effect (const Effect &p)=delete
 Effect (Effect &&p) noexcept=default
 Move constructor for the Effect class. Transfers ownership of resources from another Effect object to this one.
Effect & operator= (const Effect &p)=delete
Effect & operator= (Effect &&p) noexcept=default
 Move assignment operator for the Effect class. Transfers ownership of resources from another Effect object to this one.
int SetAll () const noexcept
 Sets all the effects.
bool Set (int index) const noexcept
 Sets the index-th shader.
template<typename T>
void Set (const std::string &name, const T &value) noexcept
 Sets the value of variable named "name" in all shaders that are owned by this instance.
template<typename T>
void Set (const std::string &name, const T &value, int shaderIndex) noexcept
 Sets the value of variable named "name" in the specified shader.
void SetData (void *data, size_t size, int cbufferID, int shaderID)
 Directly sets the data of a constant buffer in an specified shader.
void SetData (void *data, size_t size, int cbufferID)
 Directly sets the data of a constant buffer in all shaders owned by this instance.
template<typename T>
void SetData (T *data, int cbufferID, int shaderID)
 Directly sets the data of a constant buffer in an specified shader, using a templated type to determine the size of the data.
template<typename T>
void SetData (T *data, int cbufferID)
 Directly sets the data of a constant buffer in all shaders owned by this instance, using a templated type to determine the size of the data.
void SetTexture (ITexture2D *texture, int idx) noexcept
 Sets a texture to all shaders owned by this instance at the specified index.
void SetTexture (ITexture2D *texture, int textureID, int shaderID) noexcept
 Sets a texture to a specific shader owned by this instance at the specified index.
void SetSampler (ISamplerState *sampler, int idx) noexcept
 Sets a sampler state to all shaders owned by this instance at the specified index.
void SetSampler (ISamplerState *sampler, int samplerID, int shaderID) noexcept
 Sets a sampler state to a specific shader owned by this instance at the specified index.
IShader * operator[] (size_t idx) const
 Gets the shader at the specified index.
 ~Effect ()=default
Public Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
virtual void Dispose ()

Protected Attributes

IGraphicsDevice * _device
std::vector< IShader * > _shaders
Protected Attributes inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr _handle
bool _disposed

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
 NatPtrWrapper (IntPtr handle, Action< IntPtr > fnDestroy)
 NatPtrWrapper (Action< IntPtr > fnDestroy)
void Reset (IntPtr newObj)
void Dispose (bool disposing)
Properties inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr Handle [get]

Detailed Description

Represents references to shaders, specifically vertex, pixel, and geometry shaders. This class is used to set the shaders to the graphics device.

Constructor & Destructor Documentation

◆ Effect() [1/5]

Engine3DRadSpace.Graphics.Effect.Effect ( IGraphicsDevice device,
IShader[] shaders,
int numShaders )
inline

◆ Effect() [2/5]

Engine3DRadSpace.Graphics.Effect.Effect ( IntPtr handle)
inline

◆ Effect() [3/5]

Effect::Effect ( IGraphicsDevice * device,
std::span< IShader * > shaders )

Constructs an Effect object with the specified graphics device and shaders.

Parameters
deviceThe graphics device to be used by the effect.
shadersA span of shader pointers to be used by the effect.

◆ Effect() [4/5]

◆ Effect() [5/5]

Move constructor for the Effect class. Transfers ownership of resources from another Effect object to this one.

Parameters
pThe Effect object to move from.

◆ ~Effect()

Engine3DRadSpace.Graphics.Effect.~Effect ( )
default

Member Function Documentation

◆ GetShader()

IShader Engine3DRadSpace.Graphics.Effect.GetShader ( int shaderID)
inline

◆ operator=() [1/2]

Effect & Engine3DRadSpace.Graphics.Effect.operator= ( const Effect & p)
delete

◆ operator=() [2/2]

Effect & Engine3DRadSpace.Graphics.Effect.operator= ( Effect && p)
defaultnoexcept

Move assignment operator for the Effect class. Transfers ownership of resources from another Effect object to this one.

Parameters
pThe Effect object to move from.
Returns
The current Effect object with resources transferred from the other Effect object.

◆ operator[]()

IShader * Effect::operator[] ( size_t idx) const

Gets the shader at the specified index.

Parameters
idxThe index of the shader to retrieve.

◆ Set() [1/4]

void Engine3DRadSpace.Graphics.Effect.Set ( int shaderID)
inline

◆ Set() [2/4]

template<typename T>
void Engine3DRadSpace.Graphics.Effect.Set ( const std::string & name,
const T & value )
inlinenoexcept

Sets the value of variable named "name" in all shaders that are owned by this instance.

Template Parameters
TThe type of the value to set.
Parameters
nameThe name of the variable to set.
valueThe value to set.

◆ Set() [3/4]

template<typename T>
void Engine3DRadSpace.Graphics.Effect.Set ( const std::string & name,
const T & value,
int shaderIndex )
inlinenoexcept

Sets the value of variable named "name" in the specified shader.

Template Parameters
TThe type of the value to set.
Parameters
nameThe name of the variable to set.
valueThe value to set.
shaderIndexThe index of the shader in which to set the variable.

◆ Set() [4/4]

bool Effect::Set ( int index) const
noexcept

Sets the index-th shader.

Parameters
indexThe index of the shader to set.
Returns
True if the shader was successfully set; otherwise, false.

◆ SetAll() [1/2]

void Engine3DRadSpace.Graphics.Effect.SetAll ( )
inline

◆ SetAll() [2/2]

int Effect::SetAll ( ) const
noexcept

Sets all the effects.

Returns
Number of effects succesfully set.

◆ SetData() [1/6]

void Engine3DRadSpace.Graphics.Effect.SetData ( IntPtr data,
ulong size,
int cBufferID )
inline

◆ SetData() [2/6]

void Engine3DRadSpace.Graphics.Effect.SetData ( IntPtr data,
ulong size,
int cBufferID,
int shaderID )
inline

◆ SetData() [3/6]

template<typename T>
void Engine3DRadSpace.Graphics.Effect.SetData ( T * data,
int cbufferID )
inline

Directly sets the data of a constant buffer in all shaders owned by this instance, using a templated type to determine the size of the data.

T must have an alignment of 16 bytes (alignas(16)) to ensure proper alignment for GPU constant buffers.

Template Parameters
TThe type of the data to set.
Parameters
dataPointer to the new constant buffer data.
cbufferIDThe ID of the constant buffer to set.

◆ SetData() [4/6]

template<typename T>
void Engine3DRadSpace.Graphics.Effect.SetData ( T * data,
int cbufferID,
int shaderID )
inline

Directly sets the data of a constant buffer in an specified shader, using a templated type to determine the size of the data.

T must have an alignment of 16 bytes (alignas(16)) to ensure proper alignment for GPU constant buffers.

Template Parameters
TThe type of the data to set.
Parameters
dataPointer to the new constant buffer data.
cbufferIDThe ID of the constant buffer to set.
shaderIDThe ID of the shader in which to set the constant buffer.

◆ SetData() [5/6]

void Effect::SetData ( void * data,
size_t size,
int cbufferID )

Directly sets the data of a constant buffer in all shaders owned by this instance.

Parameters
dataPointer to the new constant buffer data.
sizeThe size of the data in bytes.
cbufferIDThe ID of the constant buffer to set.

◆ SetData() [6/6]

void Effect::SetData ( void * data,
size_t size,
int cbufferID,
int shaderID )

Directly sets the data of a constant buffer in an specified shader.

Parameters
dataPointer to the new constant buffer data.
sizeThe size of the data in bytes.
cbufferIDThe ID of the constant buffer to set.
shaderIDThe ID of the shader in which to set the constant buffer.

◆ SetSampler() [1/4]

void Engine3DRadSpace.Graphics.Effect.SetSampler ( ISamplerState samplerState,
int idx )
inline

◆ SetSampler() [2/4]

void Engine3DRadSpace.Graphics.Effect.SetSampler ( ISamplerState samplerState,
int idx,
int shaderID )
inline

◆ SetSampler() [3/4]

void Effect::SetSampler ( ISamplerState * sampler,
int idx )
noexcept

Sets a sampler state to all shaders owned by this instance at the specified index.

Parameters
samplerThe sampler state to set.
idxThe index at which to set the sampler state.

◆ SetSampler() [4/4]

void Effect::SetSampler ( ISamplerState * sampler,
int samplerID,
int shaderID )
noexcept

Sets a sampler state to a specific shader owned by this instance at the specified index.

Parameters
samplerThe sampler state to set.
samplerIDThe index at which to set the sampler state.
shaderIDThe ID of the shader in which to set the sampler state.

◆ SetTexture() [1/4]

void Engine3DRadSpace.Graphics.Effect.SetTexture ( ITexture2D texture,
int textureID )
inline

◆ SetTexture() [2/4]

void Engine3DRadSpace.Graphics.Effect.SetTexture ( ITexture2D texture,
int textureID,
int shaderID )
inline

◆ SetTexture() [3/4]

void Effect::SetTexture ( ITexture2D * texture,
int idx )
noexcept

Sets a texture to all shaders owned by this instance at the specified index.

Parameters
textureTexture to set.
idxThe index at which to set the texture.

◆ SetTexture() [4/4]

void Effect::SetTexture ( ITexture2D * texture,
int textureID,
int shaderID )
noexcept

Sets a texture to a specific shader owned by this instance at the specified index.

Parameters
textureTexture to set.
textureIDThe index at which to set the texture.
shaderIDThe ID of the shader in which to set the texture.

Member Data Documentation

◆ _device

IGraphicsDevice* Engine3DRadSpace.Graphics.Effect._device
protected

◆ _shaders

std::vector<IShader*> Engine3DRadSpace.Graphics.Effect._shaders
protected

The documentation for this class was generated from the following files:
  • E:/3DRadSpace/3DRadSpace_CSharp/Graphics/Effect.cs
  • E:/3DRadSpace/Engine3DRadSpace/Graphics/Effect.hpp
  • E:/3DRadSpace/Engine3DRadSpace/Graphics/Effect.cpp