This commit is contained in:
Branimir Karadžić
2017-03-31 21:01:08 -07:00
parent 1d44a7a030
commit 8499319009
7 changed files with 116 additions and 250 deletions

View File

@@ -19,31 +19,6 @@
#define RENDER_SHADOW_PASS_ID 0
#define RENDER_SCENE_PASS_ID 1
uint32_t packUint32(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w)
{
union
{
uint32_t ui32;
uint8_t arr[4];
} un;
un.arr[0] = _x;
un.arr[1] = _y;
un.arr[2] = _z;
un.arr[3] = _w;
return un.ui32;
}
uint32_t packF4u(float _x, float _y = 0.0f, float _z = 0.0f, float _w = 0.0f)
{
const uint8_t xx = uint8_t(_x*127.0f + 128.0f);
const uint8_t yy = uint8_t(_y*127.0f + 128.0f);
const uint8_t zz = uint8_t(_z*127.0f + 128.0f);
const uint8_t ww = uint8_t(_w*127.0f + 128.0f);
return packUint32(xx, yy, zz, ww);
}
struct PosNormalVertex
{
float m_x;
@@ -54,10 +29,10 @@ struct PosNormalVertex
static PosNormalVertex s_hplaneVertices[] =
{
{ -1.0f, 0.0f, 1.0f, packF4u(0.0f, 1.0f, 0.0f) },
{ 1.0f, 0.0f, 1.0f, packF4u(0.0f, 1.0f, 0.0f) },
{ -1.0f, 0.0f, -1.0f, packF4u(0.0f, 1.0f, 0.0f) },
{ 1.0f, 0.0f, -1.0f, packF4u(0.0f, 1.0f, 0.0f) },
{ -1.0f, 0.0f, 1.0f, encodeNormalRgba8(0.0f, 1.0f, 0.0f) },
{ 1.0f, 0.0f, 1.0f, encodeNormalRgba8(0.0f, 1.0f, 0.0f) },
{ -1.0f, 0.0f, -1.0f, encodeNormalRgba8(0.0f, 1.0f, 0.0f) },
{ 1.0f, 0.0f, -1.0f, encodeNormalRgba8(0.0f, 1.0f, 0.0f) },
};
static const uint16_t s_planeIndices[] =