A memory slot that fits into a ConstantBuffer. The slot fills entries within the buffer.
More...
|
enum | DATA_TYPE {
DATA_TYPE::UNKNOWN = 0,
DATA_TYPE::VECTOR,
DATA_TYPE::MATRIX,
DATA_TYPE::CAM_CORNERS_WORLD,
DATA_TYPE::CAM_CORNERS_VIEW,
DATA_TYPE::TARGET_SIZE,
DATA_TYPE::PROJECTION_PARAMS,
DATA_TYPE::TEXTURE_SIZE,
DATA_TYPE::VIEW_MATRIX,
DATA_TYPE::VIEW_MATRIX_INV,
DATA_TYPE::PROJ_MATRIX,
DATA_TYPE::PROJ_MATRIX_INV,
DATA_TYPE::CAM_POSITION,
DATA_TYPE::CAM_DIRECTION_WORLD,
DATA_TYPE::TIME,
DATA_TYPE::CUSTOM
} |
|
A memory slot that fits into a ConstantBuffer. The slot fills entries within the buffer.
This is done per pass. This means that these slots are made to be called before a full pass rendering is done. It is opposed to the ShaderInstanceMemorySlot, which is called once per renderable during a pass.
◆ DATA_TYPE
Available filling type for the slots.
Enumerator |
---|
UNKNOWN | Unknown place holder.
|
VECTOR | Writes a vector (float4).
|
MATRIX | Writes a matrix (float4x4).
|
CAM_CORNERS_WORLD | Writes the cam corners direction in world space (float4 [4]).
|
CAM_CORNERS_VIEW | Writes the cam corners direction in view space (float4 [4]).
|
TARGET_SIZE | Writes the active render target size (int4).
|
PROJECTION_PARAMS | Writes the projection parameters (float4).
|
TEXTURE_SIZE | Writes a given texture's size (int4).
|
VIEW_MATRIX | Writes the active view matrix (float4x4).
|
VIEW_MATRIX_INV | Writes the active inverse view matrix (float4x4).
|
PROJ_MATRIX | Writes the active projection matrix (float4x4).
|
PROJ_MATRIX_INV | Writes the active inverse projection matrix (float4x4).
|
CAM_POSITION | Writes the active camera position (float4).
|
CAM_DIRECTION_WORLD | Writes the active camera direction (float4).
|
TIME | Writes information about time (float4).
|
CUSTOM | Uses a custom slot made by external code.
|
◆ ShaderPassMemorySlot()
nkGraphics::ShaderPassMemorySlot::ShaderPassMemorySlot |
( |
System * |
system | ) |
|
|
noexcept |
◆ ~ShaderPassMemorySlot()
virtual nkGraphics::ShaderPassMemorySlot::~ShaderPassMemorySlot |
( |
| ) |
|
|
virtual |
◆ getData()
void* nkGraphics::ShaderPassMemorySlot::getData |
( |
| ) |
const |
- Returns
- The data allocated for the tracking.
◆ getDataSize()
virtual unsigned int nkGraphics::ShaderPassMemorySlot::getDataSize |
( |
| ) |
const |
|
virtual |
- Returns
- The written size, in bytes.
◆ getDataTypeAsString()
◆ getType()
DATA_TYPE nkGraphics::ShaderPassMemorySlot::getType |
( |
| ) |
const |
◆ getDataAsVector()
nkMaths::Vector* nkGraphics::ShaderPassMemorySlot::getDataAsVector |
( |
| ) |
const |
- Returns
- The data already casted as a vector. To be used when the slot type is DATA_TYPE::VECTOR.
◆ getDataAsMatrix()
nkMaths::Matrix* nkGraphics::ShaderPassMemorySlot::getDataAsMatrix |
( |
| ) |
const |
- Returns
- The data already casted as a matrix. To be used when the slot type is DATA_TYPE::MATRIX.
◆ setFromVector()
void nkGraphics::ShaderPassMemorySlot::setFromVector |
( |
const nkMaths::Vector & |
data | ) |
|
Changes the slot to fill a vector. In hlsl, can be received in a float4.
- Parameters
-
◆ setFromMatrix()
void nkGraphics::ShaderPassMemorySlot::setFromMatrix |
( |
const nkMaths::Matrix & |
data | ) |
|
Changes the slot to fill a matrix. In hlsl, can be received in a float4x4.
- Parameters
-
◆ setAsCamCornersWorld()
void nkGraphics::ShaderPassMemorySlot::setAsCamCornersWorld |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the camera corners directions, in world space. The directions are non normalized and goes from the near to the far. In hlsl, can be received in a float4 [4].
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsCamCornersView()
void nkGraphics::ShaderPassMemorySlot::setAsCamCornersView |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the camera corners directions, in view space. The directions are Z normalized, which means the Z component will be 1.0, and the other components will be expressed relative to that. In hlsl, can be received in a float4 [4].
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsTargetSize()
void nkGraphics::ShaderPassMemorySlot::setAsTargetSize |
( |
| ) |
|
Changes the slot to fill the active render target size, in pixels. In hlsl, can be received in a int4.
cbuffer MyConstantBuffer : register(b0)
{
int4 targetSize ;
}
#define TARGET_WIDTH targetSize.x
#define TARGET_HEIGHT targetSize.y
#define TARGET_DEPTH targetSize.z
#define TARGET_MIPS targetSize.w
◆ setAsProjectionParameters()
void nkGraphics::ShaderPassMemorySlot::setAsProjectionParameters |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the projection parameters of a camera. In hlsl, can be received in a float4.
cbuffer MyConstantBuffer : register(b0)
{
float4 projectionParams ;
}
#define PROJ_A projectionParams.x
#define PROJ_B projectionParams.y
#define PROJ_NEAR projectionParams.z
#define PROJ_FAR projectionParams.w
The projection parameter A corresponds to far / (far - near).
The projection parameter B corresponds to (-far * near) / (far - near).
Together, they allow to reconstruct the linear depth from the standard written depth, using : PROJ_B / (depth - PROJ_A).
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsViewMatrix()
void nkGraphics::ShaderPassMemorySlot::setAsViewMatrix |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the view matrix of a camera. In hlsl, can be received in a float4x4.
The view and projection matrix are provided as row-major, meaning they can be used like :
float4x4 mvp = mul(projection, mul(view, world)) ;
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsViewMatrixInv()
void nkGraphics::ShaderPassMemorySlot::setAsViewMatrixInv |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the inverse view matrix of a camera. in hlsl, can be received in a float4x4.
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsProjectionMatrix()
void nkGraphics::ShaderPassMemorySlot::setAsProjectionMatrix |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the projection matrix of a camera. In hlsl, can be received in a float4x4.
The view and projection matrix are provided as row-major, meaning they can be used like :
float4x4 mvp = mul(projection, mul(view, world)) ;
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsProjectionMatrixInv()
void nkGraphics::ShaderPassMemorySlot::setAsProjectionMatrixInv |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the inverse projection matrix of a camera. In hlsl, can be received in a float4x4.
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsCameraPosition()
void nkGraphics::ShaderPassMemorySlot::setAsCameraPosition |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the position of a camera, in world space. In hlsl, can be received in a float4.
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsCameraDirectionWorld()
void nkGraphics::ShaderPassMemorySlot::setAsCameraDirectionWorld |
( |
Camera * |
forcedCamera = nullptr | ) |
|
Changes the slot to fill the direction of the camera in world space. In hlsl, can be received in a float4.
- Parameters
-
forcedCamera | The camera to retrieve information from. If left nullptr, will fetch the active camera. |
◆ setAsTextureSize()
void nkGraphics::ShaderPassMemorySlot::setAsTextureSize |
( |
Texture * |
tex | ) |
|
Changes the slot to fill a texture size, in pixels. In hlsl, can be received in a int4.
cbuffer MyConstantBuffer : register(b0)
{
int4 texSize ;
}
#define TEX_WIDTH texSize.x
#define TEX_HEIGHT texSize.y
#define TEX_DEPTH texSize.z
#define TEX_MIPS texSize.w
◆ setAsTime()
void nkGraphics::ShaderPassMemorySlot::setAsTime |
( |
unsigned int |
modulo | ) |
|
Changes the slot to fill time information. In hlsl, can be received in a float4.
cbuffer MyConstantBuffer : register(b0)
{
float4 timeInfo ;
}
#define TIME_MODULO_VAL timeInfo.x
#define TIME timeInfo.y
#define TIME_DELTA timeInfo.z
#define TIME_UNUSED timeInfo.w
- Parameters
-
modulo | The modulo looping time of the timer. |
◆ setAsCustom()
Changes the slot to request the data to be filled by a custom pass.
- Parameters
-
slot | The slot to delegate to. |
◆ exportClassToTree()
virtual void nkGraphics::ShaderPassMemorySlot::exportClassToTree |
( |
nkExport::Node * |
rootNode | ) |
|
|
overridevirtual |
Exports an item into a tree describing its structure and its data.
- Parameters
-
rootNode | The node into which the object has to write its related information. |
Reimplemented from nkGraphics::ShaderMemorySlot.
◆ importClassFromTree()
virtual void nkGraphics::ShaderPassMemorySlot::importClassFromTree |
( |
nkExport::Node * |
rootNode | ) |
|
|
overridevirtual |
Imports information from a tree which is supposed to describe its structure and data.
- Parameters
-
rootNode | The root node of the tree holding the information. |
Implements nkExport::Exportable.
The documentation for this class was generated from the following file: