mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-04-15 16:54:24 -04:00
iOS: Fixed aspect ratio in examples.
This commit is contained in:
parent
5707309e6f
commit
538796302f
10 changed files with 14 additions and 11 deletions
examples
01-cubes
02-metaballs
03-raymarch
04-mesh
05-instancing
06-bump
07-callback
08-update
09-hdr
12-lod
|
@ -179,7 +179,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
|
@ -556,7 +556,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
|
@ -266,7 +266,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 1.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
|
@ -364,7 +364,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
|
@ -204,7 +204,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
|
@ -381,7 +381,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
float lightPosRadius[4][4];
|
||||
for (uint32_t ii = 0; ii < numLights; ++ii)
|
||||
|
|
|
@ -259,8 +259,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
{
|
||||
BgfxCallback callback;
|
||||
|
||||
uint32_t width = 1280;
|
||||
uint32_t height = 720;
|
||||
|
||||
bgfx::init(&callback);
|
||||
bgfx::reset(1280, 720, BGFX_RESET_CAPTURE);
|
||||
bgfx::reset(width, height, BGFX_RESET_CAPTURE);
|
||||
|
||||
// Enable debug text.
|
||||
bgfx::setDebug(BGFX_DEBUG_TEXT);
|
||||
|
@ -362,7 +365,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
|
@ -309,7 +309,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
|
@ -640,7 +640,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
vec3MulMtx(temp, eye, mtx);
|
||||
|
||||
mtxLookAt(view, temp, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 1.
|
||||
bgfx::setViewTransformMask(1<<1, view, proj);
|
||||
|
|
|
@ -457,7 +457,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
|
Loading…
Add table
Reference in a new issue