Merge branch 'master' of github.com:bkaradzic/bgfx

This commit is contained in:
bkaradzic 2012-10-28 00:00:43 -07:00
commit 6492a17f82
2 changed files with 77 additions and 90 deletions

View File

@ -71,7 +71,7 @@ uint32_t packF4u(float _x, float _y = 0.0f, float _z = 0.0f, float _w = 0.0f)
return packUint32(xx, yy, zz, ww); return packUint32(xx, yy, zz, ww);
} }
void unpackF4u(float _result[3], uint32_t _packed) void unpackF4u(float _result[4], uint32_t _packed)
{ {
uint8_t unpacked[4]; uint8_t unpacked[4];
unpackUint32(unpacked, _packed); unpackUint32(unpacked, _packed);
@ -183,7 +183,6 @@ void calcTangents(const uint16_t* _indices, uint32_t _numIndices, Ty* _vertices,
float* tangents = new float[6*_numVertices]; float* tangents = new float[6*_numVertices];
memset(tangents, 0, 6*_numVertices*sizeof(float) ); memset(tangents, 0, 6*_numVertices*sizeof(float) );
float* tan = tangents;
for (uint32_t ii = 0, num = _numIndices/3; ii < num; ++ii) for (uint32_t ii = 0, num = _numIndices/3; ii < num; ++ii)
{ {
const uint16_t* indices = &_indices[ii*3]; const uint16_t* indices = &_indices[ii*3];
@ -234,7 +233,7 @@ void calcTangents(const uint16_t* _indices, uint32_t _numIndices, Ty* _vertices,
const float* tanu = &tangents[ii*6]; const float* tanu = &tangents[ii*6];
const float* tanv = &tangents[ii*6 + 3]; const float* tanv = &tangents[ii*6 + 3];
float normal[3]; float normal[4];
unpackF4u(normal, v0.m_normal); unpackF4u(normal, v0.m_normal);
float ndt = vec3Dot(normal, tanu); float ndt = vec3Dot(normal, tanu);
@ -392,10 +391,10 @@ int _main_(int _argc, char** _argv)
float lightRgbInnerR[4][4] = float lightRgbInnerR[4][4] =
{ {
1.0f, 0.7f, 0.2f, 0.8f, { 1.0f, 0.7f, 0.2f, 0.8f },
0.7f, 0.2f, 1.0f, 0.8f, { 0.7f, 0.2f, 1.0f, 0.8f },
0.2f, 1.0f, 0.7f, 0.8f, { 0.2f, 1.0f, 0.7f, 0.8f },
1.0f, 0.4f, 0.2f, 0.8f, { 1.0f, 0.4f, 0.2f, 0.8f },
}; };
bgfx::setUniform(u_lightRgbInnerR, lightRgbInnerR, numLights); bgfx::setUniform(u_lightRgbInnerR, lightRgbInnerR, numLights);

View File

@ -153,6 +153,7 @@ configuration { "mingw" }
defines { "WIN32" } defines { "WIN32" }
includedirs { BX_DIR .. "include/compat/mingw" } includedirs { BX_DIR .. "include/compat/mingw" }
buildoptions { buildoptions {
"-std=c++0x",
"-U__STRICT_ANSI__", "-U__STRICT_ANSI__",
"-Wunused-value", "-Wunused-value",
"-fdata-sections", "-fdata-sections",
@ -163,11 +164,6 @@ configuration { "mingw" }
"-Wl,--gc-sections", "-Wl,--gc-sections",
} }
configuration { "*.cpp", "mingw" }
buildoptions {
"-std=c++0x"
}
configuration { "x32", "mingw" } configuration { "x32", "mingw" }
targetdir (BGFX_BUILD_DIR .. "win32_mingw" .. "/bin") targetdir (BGFX_BUILD_DIR .. "win32_mingw" .. "/bin")
objdir (BGFX_BUILD_DIR .. "win32_mingw" .. "/obj") objdir (BGFX_BUILD_DIR .. "win32_mingw" .. "/obj")
@ -182,6 +178,7 @@ configuration { "x64", "mingw" }
configuration { "linux" } configuration { "linux" }
buildoptions { buildoptions {
"-std=c++0x",
"-U__STRICT_ANSI__", "-U__STRICT_ANSI__",
"-Wunused-value", "-Wunused-value",
"-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
@ -191,11 +188,6 @@ configuration { "linux" }
"-Wl,--gc-sections", "-Wl,--gc-sections",
} }
configuration { "*.cpp", "linux" }
buildoptions {
"-std=c++0x"
}
configuration { "linux", "x32" } configuration { "linux", "x32" }
targetdir (BGFX_BUILD_DIR .. "linux32_gcc" .. "/bin") targetdir (BGFX_BUILD_DIR .. "linux32_gcc" .. "/bin")
objdir (BGFX_BUILD_DIR .. "linux32_gcc" .. "/obj") objdir (BGFX_BUILD_DIR .. "linux32_gcc" .. "/obj")
@ -225,6 +217,7 @@ configuration { "nacl" }
defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600" } defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600" }
includedirs { BX_DIR .. "include/compat/nacl" } includedirs { BX_DIR .. "include/compat/nacl" }
buildoptions { buildoptions {
"-std=c++0x",
"-U__STRICT_ANSI__", "-U__STRICT_ANSI__",
"-pthread", "-pthread",
"-fno-stack-protector", "-fno-stack-protector",
@ -240,11 +233,6 @@ configuration { "nacl" }
"-Wl,--gc-sections", "-Wl,--gc-sections",
} }
configuration { "*.cpp", "nacl" }
buildoptions {
"-std=c++0x"
}
configuration { "x32", "nacl" } configuration { "x32", "nacl" }
targetdir (BGFX_BUILD_DIR .. "nacl-x86" .. "/bin") targetdir (BGFX_BUILD_DIR .. "nacl-x86" .. "/bin")
objdir (BGFX_BUILD_DIR .. "nacl-x86" .. "/obj") objdir (BGFX_BUILD_DIR .. "nacl-x86" .. "/obj")