it works!! mostly
This commit is contained in:
@@ -101,7 +101,7 @@ namespace Game
|
||||
{
|
||||
bgfx::renderFrame();
|
||||
bgfx::Init init;
|
||||
init.type = bgfx::RendererType::Direct3D12;
|
||||
init.type = bgfx::RendererType::Direct3D11;
|
||||
init.debug = true;
|
||||
init.callback = &Callback;
|
||||
init.platformData.nwh = window;
|
||||
@@ -136,21 +136,71 @@ namespace Game
|
||||
|
||||
void GameRendering::Update()
|
||||
{
|
||||
float time = (float)((bx::getHPCounter() - State.StartTime) / double(bx::getHPFrequency()));
|
||||
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
||||
float proj[16];
|
||||
bx::mtxProj(proj, 60.0f, float(State.WindowWidth) / float(State.WindowHeight), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRect(0, 0, 0, State.WindowWidth, State.WindowHeight);
|
||||
}
|
||||
|
||||
// This dummy draw call is here to make sure that view 0 is cleared
|
||||
// if no other draw calls are submitted to view 0.
|
||||
bgfx::touch(0);
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -5.0f };
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
float proj[16];
|
||||
bx::mtxProj(proj, 60.0f, float(State.WindowWidth) / float(State.WindowHeight), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
||||
bgfx::setVertexBuffer(0, VertexBuffer);
|
||||
bgfx::setIndexBuffer(IndexBuffer);
|
||||
bgfx::IndexBufferHandle ibh = IndexBuffer;
|
||||
uint64_t state = 0
|
||||
| (true ? BGFX_STATE_WRITE_R : 0)
|
||||
| (true ? BGFX_STATE_WRITE_G : 0)
|
||||
| (true ? BGFX_STATE_WRITE_B : 0)
|
||||
| (true ? BGFX_STATE_WRITE_A : 0)
|
||||
| BGFX_STATE_WRITE_Z
|
||||
| BGFX_STATE_DEPTH_TEST_LESS
|
||||
| BGFX_STATE_CULL_CW
|
||||
| BGFX_STATE_MSAA
|
||||
| 0
|
||||
;
|
||||
|
||||
bgfx::dbgTextPrintf(10, 10, 0x0F, "TEST");
|
||||
// Submit 11x11 cubes.
|
||||
for (uint32_t yy = 0; yy < 11; ++yy)
|
||||
{
|
||||
for (uint32_t xx = 0; xx < 11; ++xx)
|
||||
{
|
||||
float mtx[16];
|
||||
bx::mtxRotateXY(mtx, time + xx * 0.21f, time + yy * 0.37f);
|
||||
mtx[12] = -15.0f + float(xx) * 3.0f;
|
||||
mtx[13] = -15.0f + float(yy) * 3.0f;
|
||||
mtx[14] = 0.0f;
|
||||
|
||||
bgfx::submit(0, Shader);
|
||||
// Set model matrix for rendering.
|
||||
bgfx::setTransform(mtx);
|
||||
|
||||
// Set vertex and index buffer.
|
||||
bgfx::setVertexBuffer(0, VertexBuffer);
|
||||
bgfx::setIndexBuffer(ibh);
|
||||
|
||||
// Set render states.
|
||||
bgfx::setState(state);
|
||||
|
||||
// Submit primitive for rendering to view 0.
|
||||
bgfx::submit(0, Shader);
|
||||
}
|
||||
}
|
||||
|
||||
bgfx::dbgTextPrintf(1, 1, 0x0F, "Time: %f", time);
|
||||
|
||||
// Advance to next frame. Rendering thread will be kicked to
|
||||
// process submitted rendering primitives.
|
||||
bgfx::frame();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user