-
Notifications
You must be signed in to change notification settings - Fork 0
/
PixelShaderConstant.cpp
49 lines (39 loc) · 1.26 KB
/
PixelShaderConstant.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "PixelShaderConstant.h"
void PixelShaderConstant::SetFloat(RwUInt32 index, float value)
{
float params[] = {0.0f, 0.0f, 0.0f, 0.0f};
params[0] = value;
_rwD3D9SetPixelShaderConstant(index, params, 1);
}
void PixelShaderConstant::SetInt(RwUInt32 index, int value)
{
float params[] = {0.0f, 0.0f, 0.0f, 0.0f};
params[0] = static_cast<float>(value);
_rwD3D9SetPixelShaderConstant(index, params, 1);
}
void PixelShaderConstant::SetVector(RwUInt32 index, void* value)
{
_rwD3D9SetPixelShaderConstant(index, value, 1);
}
void PixelShaderConstant::SetRwRGBA(RwUInt32 index, RwRGBA value)
{
RwRGBAReal color;
RwRGBARealFromRwRGBA(&color, &value);
_rwD3D9SetPixelShaderConstant(index, &color, 1);
}
void PixelShaderConstant::SetData(RwUInt32 index, void* value, size_t size)
{
_rwD3D9SetPixelShaderConstant(index, value, size);
}
void PixelShaderConstant::SetMatrix(RwUInt32 index, void* value)
{
_rwD3D9SetPixelShaderConstant(index, value, 4);
}
void PixelShaderConstant::SetMatrix(RwUInt32 index, XMMATRIX value)
{
_rwD3D9SetPixelShaderConstant(index, &value, 4);
}
void PixelShaderConstant::SetMatrixArray(RwUInt32 index, void* value, size_t size)
{
_rwD3D9SetPixelShaderConstant(index, value, size / sizeof(float[4]));
}