From 921a315c4d5855912c1083610f4070b593e3f316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 16 Jul 2015 20:28:43 -0700 Subject: [PATCH] Cleanup. --- examples/01-cubes/cubes.cpp | 2 +- examples/02-metaballs/metaballs.cpp | 2 +- examples/04-mesh/mesh.cpp | 2 +- examples/05-instancing/instancing.cpp | 2 +- examples/06-bump/bump.cpp | 2 +- examples/10-font/font.cpp | 2 +- examples/11-fontsdf/fontsdf.cpp | 2 +- examples/12-lod/lod.cpp | 2 +- examples/13-stencil/stencil.cpp | 10 +- examples/14-shadowvolumes/shadowvolumes.cpp | 12 +- examples/16-shadowmaps/shadowmaps.cpp | 6 +- examples/18-ibl/ibl.cpp | 4 +- examples/20-nanovg/nanovg.cpp | 178 ++++++++++---------- examples/24-nbody/nbody.cpp | 2 +- examples/common/camera.cpp | 4 +- examples/common/cube_atlas.cpp | 2 +- examples/common/cube_atlas.h | 4 +- examples/common/entry/entry.cpp | 2 +- examples/common/entry/entry_sdl.cpp | 2 +- examples/common/entry/entry_winrt.cpp | 6 +- examples/common/font/text_metrics.cpp | 2 +- examples/common/imgui/imgui.cpp | 12 +- examples/common/imgui/imgui.h | 2 +- examples/common/imgui/ocornut_imgui.cpp | 34 ++-- examples/common/imgui/scintilla.cpp | 2 +- examples/common/nanovg/nanovg_bgfx.cpp | 28 +-- src/bgfx.cpp | 11 +- src/bgfx_p.h | 6 +- src/renderer_d3d.h | 8 +- src/renderer_d3d11.cpp | 28 +-- src/renderer_d3d9.cpp | 6 +- src/renderer_gl.cpp | 10 +- src/vertexdecl.cpp | 2 +- 33 files changed, 199 insertions(+), 200 deletions(-) diff --git a/examples/01-cubes/cubes.cpp b/examples/01-cubes/cubes.cpp index 48ecc5e25..fd86fee19 100644 --- a/examples/01-cubes/cubes.cpp +++ b/examples/01-cubes/cubes.cpp @@ -119,7 +119,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float view[16]; bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); diff --git a/examples/02-metaballs/metaballs.cpp b/examples/02-metaballs/metaballs.cpp index fd511b95c..9a7081d99 100644 --- a/examples/02-metaballs/metaballs.cpp +++ b/examples/02-metaballs/metaballs.cpp @@ -548,7 +548,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float view[16]; bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); diff --git a/examples/04-mesh/mesh.cpp b/examples/04-mesh/mesh.cpp index 7848de010..49e38b431 100644 --- a/examples/04-mesh/mesh.cpp +++ b/examples/04-mesh/mesh.cpp @@ -65,7 +65,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float view[16]; bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); diff --git a/examples/05-instancing/instancing.cpp b/examples/05-instancing/instancing.cpp index 7d8f4f6b3..53f71ccdc 100644 --- a/examples/05-instancing/instancing.cpp +++ b/examples/05-instancing/instancing.cpp @@ -135,7 +135,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float view[16]; bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); diff --git a/examples/06-bump/bump.cpp b/examples/06-bump/bump.cpp index d78402ddb..da58c1cf3 100644 --- a/examples/06-bump/bump.cpp +++ b/examples/06-bump/bump.cpp @@ -195,7 +195,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float view[16]; bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); diff --git a/examples/10-font/font.cpp b/examples/10-font/font.cpp index 1cd001264..fa2858784 100644 --- a/examples/10-font/font.cpp +++ b/examples/10-font/font.cpp @@ -203,7 +203,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Setup a top-left ortho matrix for screen space drawing. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float proj[16]; bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f); diff --git a/examples/11-fontsdf/fontsdf.cpp b/examples/11-fontsdf/fontsdf.cpp index 02d17314e..c5016b44b 100644 --- a/examples/11-fontsdf/fontsdf.cpp +++ b/examples/11-fontsdf/fontsdf.cpp @@ -201,7 +201,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Setup a top-left ortho matrix for screen space drawing. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float proj[16]; bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f); diff --git a/examples/12-lod/lod.cpp b/examples/12-lod/lod.cpp index acc8c17d0..e25f97960 100644 --- a/examples/12-lod/lod.cpp +++ b/examples/12-lod/lod.cpp @@ -163,7 +163,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float view[16]; bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); diff --git a/examples/13-stencil/stencil.cpp b/examples/13-stencil/stencil.cpp index 4be3ef786..52c25ffbe 100644 --- a/examples/13-stencil/stencil.cpp +++ b/examples/13-stencil/stencil.cpp @@ -906,7 +906,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) lightRgbInnerR[ii][2] = rgbInnerR[index][2]; lightRgbInnerR[ii][3] = rgbInnerR[index][3]; } - memcpy(s_uniforms.m_lightRgbInnerR, lightRgbInnerR, MAX_NUM_LIGHTS * 4*sizeof(float)); + memcpy(s_uniforms.m_lightRgbInnerR, lightRgbInnerR, MAX_NUM_LIGHTS * 4*sizeof(float) ); // Set view and projection matrices. const float aspect = float(viewState.m_width)/float(viewState.m_height); @@ -1031,11 +1031,11 @@ int _main_(int /*_argc*/, char** /*_argv*/) for (uint8_t ii = 0; ii < numLights; ++ii) { lightPosRadius[ii][0] = sinf( (lightTimeAccumulator*1.1f + ii*0.03f + ii*bx::piHalf*1.07f ) )*20.0f; - lightPosRadius[ii][1] = 8.0f + (1.0f - cosf( (lightTimeAccumulator*1.5f + ii*0.29f + bx::piHalf*1.49f ) ))*4.0f; + lightPosRadius[ii][1] = 8.0f + (1.0f - cosf( (lightTimeAccumulator*1.5f + ii*0.29f + bx::piHalf*1.49f ) ) )*4.0f; lightPosRadius[ii][2] = cosf( (lightTimeAccumulator*1.3f + ii*0.13f + ii*bx::piHalf*1.79f ) )*20.0f; lightPosRadius[ii][3] = radius; } - memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float)); + memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float) ); // Floor position. float floorMtx[16]; @@ -1153,7 +1153,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) bx::vec3MulMtx(reflectedLights[ii], lightPosRadius[ii], reflectMtx); reflectedLights[ii][3] = lightPosRadius[ii][3]; } - memcpy(s_uniforms.m_lightPosRadius, reflectedLights, numLights * 4*sizeof(float)); + memcpy(s_uniforms.m_lightPosRadius, reflectedLights, numLights * 4*sizeof(float) ); // Reflect and submit bunny. float mtxReflectedBunny[16]; @@ -1177,7 +1177,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) } // Set lights back. - memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float)); + memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float) ); // Third pass - Blend plane. // Floor. diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index d75797d77..e2e1ba903 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -843,7 +843,7 @@ struct Group //Init faces and edges. m_faces.reserve(m_numIndices/3); //1 face = 3 indices - m_edges = (Edge*)malloc(m_numIndices * sizeof(Edge)); //1 triangle = 3 indices = 3 edges. + m_edges = (Edge*)malloc(m_numIndices * sizeof(Edge) ); //1 triangle = 3 indices = 3 edges. m_edgePlanesUnalignedPtr = (Plane*)malloc(m_numIndices * sizeof(Plane) + 15); m_edgePlanes = (Plane*)bx::alignPtr(m_edgePlanesUnalignedPtr, 0, 16); @@ -910,7 +910,7 @@ struct Group std::pair keyInv = std::make_pair(ui1, ui0); EdgeMap::iterator iter = edgeMap.find(keyInv); - if (iter != edgeMap.end()) + if (iter != edgeMap.end() ) { EdgeAndPlane& ep = iter->second; memcpy(ep.m_plane[ep.m_faceIndex].m_plane, plane, 4*sizeof(float) ); @@ -935,8 +935,8 @@ struct Group Edge* edge = &m_edges[m_numEdges]; Plane* plane = &m_edgePlanes[index]; - memcpy(edge, iter->second.m_faceReverseOrder, sizeof(Edge)); - memcpy(plane, iter->second.m_plane, 2 * sizeof(Plane)); + memcpy(edge, iter->second.m_faceReverseOrder, sizeof(Edge) ); + memcpy(plane, iter->second.m_plane, 2 * sizeof(Plane) ); m_numEdges++; index += 2; @@ -1547,7 +1547,7 @@ void shadowVolumeCreate(ShadowVolume& _shadowVolume const float4_t r1 = float4_mul(vY, ly); const float4_t r2 = float4_mul(vZ, lz); - const float4_t dot = float4_add(r0, float4_add(r1, r2)); + const float4_t dot = float4_add(r0, float4_add(r1, r2) ); const float4_t f = float4_add(dot, vW); const float4_t zero = float4_zero(); @@ -2107,7 +2107,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float eye[3]; cameraGetPosition(eye); diff --git a/examples/16-shadowmaps/shadowmaps.cpp b/examples/16-shadowmaps/shadowmaps.cpp index cc106298e..0f4eb7d02 100644 --- a/examples/16-shadowmaps/shadowmaps.cpp +++ b/examples/16-shadowmaps/shadowmaps.cpp @@ -1985,9 +1985,9 @@ int _main_(int /*_argc*/, char** /*_argv*/) #define IMGUI_FLOAT_SLIDER(_name, _val) \ imguiSlider(_name \ , _val \ - , *(((float*)&_val)+1) \ - , *(((float*)&_val)+2) \ - , *(((float*)&_val)+3) \ + , *( ((float*)&_val)+1) \ + , *( ((float*)&_val)+2) \ + , *( ((float*)&_val)+3) \ ) imguiBool("Update lights", settings.m_updateLights); diff --git a/examples/18-ibl/ibl.cpp b/examples/18-ibl/ibl.cpp index 08f3be89b..36593a704 100644 --- a/examples/18-ibl/ibl.cpp +++ b/examples/18-ibl/ibl.cpp @@ -434,8 +434,8 @@ int _main_(int /*_argc*/, char** /*_argv*/) s_uniforms.m_flags[1] = float(settings.m_specular); s_uniforms.m_flags[2] = float(settings.m_diffuseIbl); s_uniforms.m_flags[3] = float(settings.m_specularIbl); - memcpy(s_uniforms.m_rgbDiff, settings.m_rgbDiff, 3*sizeof(float)); - memcpy(s_uniforms.m_rgbSpec, settings.m_rgbSpec, 3*sizeof(float)); + memcpy(s_uniforms.m_rgbDiff, settings.m_rgbDiff, 3*sizeof(float) ); + memcpy(s_uniforms.m_rgbSpec, settings.m_rgbSpec, 3*sizeof(float) ); s_uniforms.submitPerFrameUniforms(); diff --git a/examples/20-nanovg/nanovg.cpp b/examples/20-nanovg/nanovg.cpp index 4439dd03c..9bcd58355 100644 --- a/examples/20-nanovg/nanovg.cpp +++ b/examples/20-nanovg/nanovg.cpp @@ -91,12 +91,12 @@ void drawWindow(struct NVGcontext* vg, const char* title, float x, float y, floa // Window nvgBeginPath(vg); nvgRoundedRect(vg, x,y, w,h, cornerRadius); - nvgFillColor(vg, nvgRGBA(28,30,34,192)); - // nvgFillColor(vg, nvgRGBA(0,0,0,128)); + nvgFillColor(vg, nvgRGBA(28,30,34,192) ); + // nvgFillColor(vg, nvgRGBA(0,0,0,128) ); nvgFill(vg); // Drop shadow - shadowPaint = nvgBoxGradient(vg, x,y+2, w,h, cornerRadius*2, 10, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0)); + shadowPaint = nvgBoxGradient(vg, x,y+2, w,h, cornerRadius*2, 10, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0) ); nvgBeginPath(vg); nvgRect(vg, x-10,y-10, w+20,h+30); nvgRoundedRect(vg, x,y, w,h, cornerRadius); @@ -105,7 +105,7 @@ void drawWindow(struct NVGcontext* vg, const char* title, float x, float y, floa nvgFill(vg); // Header - headerPaint = nvgLinearGradient(vg, x,y,x,y+15, nvgRGBA(255,255,255,8), nvgRGBA(0,0,0,16)); + headerPaint = nvgLinearGradient(vg, x,y,x,y+15, nvgRGBA(255,255,255,8), nvgRGBA(0,0,0,16) ); nvgBeginPath(vg); nvgRoundedRect(vg, x+1,y+1, w-2,30, cornerRadius-1); nvgFillPaint(vg, headerPaint); @@ -113,7 +113,7 @@ void drawWindow(struct NVGcontext* vg, const char* title, float x, float y, floa nvgBeginPath(vg); nvgMoveTo(vg, x+0.5f, y+0.5f+30); nvgLineTo(vg, x+0.5f+w-1, y+0.5f+30); - nvgStrokeColor(vg, nvgRGBA(0,0,0,32)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,32) ); nvgStroke(vg); nvgFontSize(vg, 18.0f); @@ -121,11 +121,11 @@ void drawWindow(struct NVGcontext* vg, const char* title, float x, float y, floa nvgTextAlign(vg,NVG_ALIGN_CENTER|NVG_ALIGN_MIDDLE); nvgFontBlur(vg,2); - nvgFillColor(vg, nvgRGBA(0,0,0,128)); + nvgFillColor(vg, nvgRGBA(0,0,0,128) ); nvgText(vg, x+w/2,y+16+1, title, NULL); nvgFontBlur(vg,0); - nvgFillColor(vg, nvgRGBA(220,220,220,160)); + nvgFillColor(vg, nvgRGBA(220,220,220,160) ); nvgText(vg, x+w/2,y+16, title, NULL); nvgRestore(vg); @@ -138,7 +138,7 @@ void drawSearchBox(struct NVGcontext* vg, const char* text, float x, float y, fl float cornerRadius = h/2-1; // Edit - bg = nvgBoxGradient(vg, x,y+1.5f, w,h, h/2,5, nvgRGBA(0,0,0,16), nvgRGBA(0,0,0,92)); + bg = nvgBoxGradient(vg, x,y+1.5f, w,h, h/2,5, nvgRGBA(0,0,0,16), nvgRGBA(0,0,0,92) ); nvgBeginPath(vg); nvgRoundedRect(vg, x,y, w,h, cornerRadius); nvgFillPaint(vg, bg); @@ -146,25 +146,25 @@ void drawSearchBox(struct NVGcontext* vg, const char* text, float x, float y, fl /* nvgBeginPath(vg); nvgRoundedRect(vg, x+0.5f,y+0.5f, w-1,h-1, cornerRadius-0.5f); - nvgStrokeColor(vg, nvgRGBA(0,0,0,48)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,48) ); nvgStroke(vg);*/ nvgFontSize(vg, h*1.3f); nvgFontFace(vg, "icons"); - nvgFillColor(vg, nvgRGBA(255,255,255,64)); + nvgFillColor(vg, nvgRGBA(255,255,255,64) ); nvgTextAlign(vg,NVG_ALIGN_CENTER|NVG_ALIGN_MIDDLE); nvgText(vg, x+h*0.55f, y+h*0.55f, cpToUTF8(ICON_SEARCH,icon), NULL); nvgFontSize(vg, 20.0f); nvgFontFace(vg, "sans"); - nvgFillColor(vg, nvgRGBA(255,255,255,32)); + nvgFillColor(vg, nvgRGBA(255,255,255,32) ); nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); nvgText(vg, x+h*1.05f,y+h*0.5f,text, NULL); nvgFontSize(vg, h*1.3f); nvgFontFace(vg, "icons"); - nvgFillColor(vg, nvgRGBA(255,255,255,32)); + nvgFillColor(vg, nvgRGBA(255,255,255,32) ); nvgTextAlign(vg,NVG_ALIGN_CENTER|NVG_ALIGN_MIDDLE); nvgText(vg, x+w-h*0.55f, y+h*0.55f, cpToUTF8(ICON_CIRCLED_CROSS,icon), NULL); } @@ -175,7 +175,7 @@ void drawDropDown(struct NVGcontext* vg, const char* text, float x, float y, flo char icon[8]; float cornerRadius = 4.0f; - bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(255,255,255,16), nvgRGBA(0,0,0,16)); + bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(255,255,255,16), nvgRGBA(0,0,0,16) ); nvgBeginPath(vg); nvgRoundedRect(vg, x+1,y+1, w-2,h-2, cornerRadius-1); nvgFillPaint(vg, bg); @@ -183,18 +183,18 @@ void drawDropDown(struct NVGcontext* vg, const char* text, float x, float y, flo nvgBeginPath(vg); nvgRoundedRect(vg, x+0.5f,y+0.5f, w-1,h-1, cornerRadius-0.5f); - nvgStrokeColor(vg, nvgRGBA(0,0,0,48)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,48) ); nvgStroke(vg); nvgFontSize(vg, 20.0f); nvgFontFace(vg, "sans"); - nvgFillColor(vg, nvgRGBA(255,255,255,160)); + nvgFillColor(vg, nvgRGBA(255,255,255,160) ); nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); nvgText(vg, x+h*0.3f,y+h*0.5f,text, NULL); nvgFontSize(vg, h*1.3f); nvgFontFace(vg, "icons"); - nvgFillColor(vg, nvgRGBA(255,255,255,64)); + nvgFillColor(vg, nvgRGBA(255,255,255,64) ); nvgTextAlign(vg,NVG_ALIGN_CENTER|NVG_ALIGN_MIDDLE); nvgText(vg, x+w-h*0.5f, y+h*0.5f, cpToUTF8(ICON_CHEVRON_RIGHT,icon), NULL); } @@ -205,7 +205,7 @@ void drawLabel(struct NVGcontext* vg, const char* text, float x, float y, float nvgFontSize(vg, 18.0f); nvgFontFace(vg, "sans"); - nvgFillColor(vg, nvgRGBA(255,255,255,128)); + nvgFillColor(vg, nvgRGBA(255,255,255,128) ); nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); nvgText(vg, x,y+h*0.5f,text, NULL); @@ -215,7 +215,7 @@ void drawEditBoxBase(struct NVGcontext* vg, float x, float y, float w, float h) { struct NVGpaint bg; // Edit - bg = nvgBoxGradient(vg, x+1,y+1+1.5f, w-2,h-2, 3,4, nvgRGBA(255,255,255,32), nvgRGBA(32,32,32,32)); + bg = nvgBoxGradient(vg, x+1,y+1+1.5f, w-2,h-2, 3,4, nvgRGBA(255,255,255,32), nvgRGBA(32,32,32,32) ); nvgBeginPath(vg); nvgRoundedRect(vg, x+1,y+1, w-2,h-2, 4-1); nvgFillPaint(vg, bg); @@ -223,7 +223,7 @@ void drawEditBoxBase(struct NVGcontext* vg, float x, float y, float w, float h) nvgBeginPath(vg); nvgRoundedRect(vg, x+0.5f,y+0.5f, w-1,h-1, 4-0.5f); - nvgStrokeColor(vg, nvgRGBA(0,0,0,48)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,48) ); nvgStroke(vg); } @@ -233,7 +233,7 @@ void drawEditBox(struct NVGcontext* vg, const char* text, float x, float y, floa nvgFontSize(vg, 20.0f); nvgFontFace(vg, "sans"); - nvgFillColor(vg, nvgRGBA(255,255,255,64)); + nvgFillColor(vg, nvgRGBA(255,255,255,64) ); nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); nvgText(vg, x+h*0.3f,y+h*0.5f,text, NULL); } @@ -249,13 +249,13 @@ void drawEditBoxNum(struct NVGcontext* vg, nvgFontSize(vg, 18.0f); nvgFontFace(vg, "sans"); - nvgFillColor(vg, nvgRGBA(255,255,255,64)); + nvgFillColor(vg, nvgRGBA(255,255,255,64) ); nvgTextAlign(vg,NVG_ALIGN_RIGHT|NVG_ALIGN_MIDDLE); nvgText(vg, x+w-h*0.3f,y+h*0.5f,units, NULL); nvgFontSize(vg, 20.0f); nvgFontFace(vg, "sans"); - nvgFillColor(vg, nvgRGBA(255,255,255,128)); + nvgFillColor(vg, nvgRGBA(255,255,255,128) ); nvgTextAlign(vg,NVG_ALIGN_RIGHT|NVG_ALIGN_MIDDLE); nvgText(vg, x+w-uw-h*0.5f,y+h*0.5f,text, NULL); } @@ -268,12 +268,12 @@ void drawCheckBox(struct NVGcontext* vg, const char* text, float x, float y, flo nvgFontSize(vg, 18.0f); nvgFontFace(vg, "sans"); - nvgFillColor(vg, nvgRGBA(255,255,255,160)); + nvgFillColor(vg, nvgRGBA(255,255,255,160) ); nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); nvgText(vg, x+28,y+h*0.5f,text, NULL); - bg = nvgBoxGradient(vg, x+1,y+(int)(h*0.5f)-9+1, 18,18, 3,3, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,92)); + bg = nvgBoxGradient(vg, x+1,y+(int)(h*0.5f)-9+1, 18,18, 3,3, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,92) ); nvgBeginPath(vg); nvgRoundedRect(vg, x+1,y+(int)(h*0.5f)-9, 18,18, 3); nvgFillPaint(vg, bg); @@ -281,7 +281,7 @@ void drawCheckBox(struct NVGcontext* vg, const char* text, float x, float y, flo nvgFontSize(vg, 40); nvgFontFace(vg, "icons"); - nvgFillColor(vg, nvgRGBA(255,255,255,128)); + nvgFillColor(vg, nvgRGBA(255,255,255,128) ); nvgTextAlign(vg,NVG_ALIGN_CENTER|NVG_ALIGN_MIDDLE); nvgText(vg, x+9+2, y+h*0.5f, cpToUTF8(ICON_CHECK,icon), NULL); } @@ -293,10 +293,10 @@ void drawButton(struct NVGcontext* vg, int preicon, const char* text, float x, f float cornerRadius = 4.0f; float tw = 0, iw = 0; - bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(255,255,255,isBlack(col)?16:32), nvgRGBA(0,0,0,isBlack(col)?16:32)); + bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(255,255,255,isBlack(col)?16:32), nvgRGBA(0,0,0,isBlack(col)?16:32) ); nvgBeginPath(vg); nvgRoundedRect(vg, x+1,y+1, w-2,h-2, cornerRadius-1); - if (!isBlack(col)) { + if (!isBlack(col) ) { nvgFillColor(vg, col); nvgFill(vg); } @@ -305,7 +305,7 @@ void drawButton(struct NVGcontext* vg, int preicon, const char* text, float x, f nvgBeginPath(vg); nvgRoundedRect(vg, x+0.5f,y+0.5f, w-1,h-1, cornerRadius-0.5f); - nvgStrokeColor(vg, nvgRGBA(0,0,0,48)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,48) ); nvgStroke(vg); nvgFontSize(vg, 20.0f); @@ -321,7 +321,7 @@ void drawButton(struct NVGcontext* vg, int preicon, const char* text, float x, f if (preicon != 0) { nvgFontSize(vg, h*1.3f); nvgFontFace(vg, "icons"); - nvgFillColor(vg, nvgRGBA(255,255,255,96)); + nvgFillColor(vg, nvgRGBA(255,255,255,96) ); nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); nvgText(vg, x+w*0.5f-tw*0.5f-iw*0.75f, y+h*0.5f, cpToUTF8(preicon,icon), NULL); } @@ -329,9 +329,9 @@ void drawButton(struct NVGcontext* vg, int preicon, const char* text, float x, f nvgFontSize(vg, 20.0f); nvgFontFace(vg, "sans-bold"); nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); - nvgFillColor(vg, nvgRGBA(0,0,0,160)); + nvgFillColor(vg, nvgRGBA(0,0,0,160) ); nvgText(vg, x+w*0.5f-tw*0.5f+iw*0.25f,y+h*0.5f-1,text, NULL); - nvgFillColor(vg, nvgRGBA(255,255,255,160)); + nvgFillColor(vg, nvgRGBA(255,255,255,160) ); nvgText(vg, x+w*0.5f-tw*0.5f+iw*0.25f,y+h*0.5f,text, NULL); } @@ -345,14 +345,14 @@ void drawSlider(struct NVGcontext* vg, float pos, float x, float y, float w, flo // nvgClearState(vg); // Slot - bg = nvgBoxGradient(vg, x,cy-2+1, w,4, 2,2, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,128)); + bg = nvgBoxGradient(vg, x,cy-2+1, w,4, 2,2, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,128) ); nvgBeginPath(vg); nvgRoundedRect(vg, x,cy-2, w,4, 2); nvgFillPaint(vg, bg); nvgFill(vg); // Knob Shadow - bg = nvgRadialGradient(vg, x+(int)(pos*w),cy+1, kr-3,kr+3, nvgRGBA(0,0,0,64), nvgRGBA(0,0,0,0)); + bg = nvgRadialGradient(vg, x+(int)(pos*w),cy+1, kr-3,kr+3, nvgRGBA(0,0,0,64), nvgRGBA(0,0,0,0) ); nvgBeginPath(vg); nvgRect(vg, x+(int)(pos*w)-kr-5,cy-kr-5,kr*2+5+5,kr*2+5+5+3); nvgCircle(vg, x+(int)(pos*w),cy, kr); @@ -361,17 +361,17 @@ void drawSlider(struct NVGcontext* vg, float pos, float x, float y, float w, flo nvgFill(vg); // Knob - knob = nvgLinearGradient(vg, x,cy-kr,x,cy+kr, nvgRGBA(255,255,255,16), nvgRGBA(0,0,0,16)); + knob = nvgLinearGradient(vg, x,cy-kr,x,cy+kr, nvgRGBA(255,255,255,16), nvgRGBA(0,0,0,16) ); nvgBeginPath(vg); nvgCircle(vg, x+(int)(pos*w),cy, kr-1); - nvgFillColor(vg, nvgRGBA(40,43,48,255)); + nvgFillColor(vg, nvgRGBA(40,43,48,255) ); nvgFill(vg); nvgFillPaint(vg, knob); nvgFill(vg); nvgBeginPath(vg); nvgCircle(vg, x+(int)(pos*w),cy, kr-0.5f); - nvgStrokeColor(vg, nvgRGBA(0,0,0,92)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,92) ); nvgStroke(vg); nvgRestore(vg); @@ -390,14 +390,14 @@ void drawEyes(struct NVGcontext* vg, float x, float y, float w, float h, float m float br = (ex < ey ? ex : ey) * 0.5f; float blink = 1 - powf(sinf(t*0.5f),200)*0.8f; - bg = nvgLinearGradient(vg, x,y+h*0.5f,x+w*0.1f,y+h, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,16)); + bg = nvgLinearGradient(vg, x,y+h*0.5f,x+w*0.1f,y+h, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,16) ); nvgBeginPath(vg); nvgEllipse(vg, lx+3.0f,ly+16.0f, ex,ey); nvgEllipse(vg, rx+3.0f,ry+16.0f, ex,ey); nvgFillPaint(vg, bg); nvgFill(vg); - bg = nvgLinearGradient(vg, x,y+h*0.25f,x+w*0.1f,y+h, nvgRGBA(220,220,220,255), nvgRGBA(128,128,128,255)); + bg = nvgLinearGradient(vg, x,y+h*0.25f,x+w*0.1f,y+h, nvgRGBA(220,220,220,255), nvgRGBA(128,128,128,255) ); nvgBeginPath(vg); nvgEllipse(vg, lx,ly, ex,ey); nvgEllipse(vg, rx,ry, ex,ey); @@ -414,7 +414,7 @@ void drawEyes(struct NVGcontext* vg, float x, float y, float w, float h, float m dy *= ey*0.5f; nvgBeginPath(vg); nvgEllipse(vg, lx+dx,ly+dy+ey*0.25f*(1-blink), br,br*blink); - nvgFillColor(vg, nvgRGBA(32,32,32,255)); + nvgFillColor(vg, nvgRGBA(32,32,32,255) ); nvgFill(vg); dx = (mx - rx) / (ex * 10); @@ -427,16 +427,16 @@ void drawEyes(struct NVGcontext* vg, float x, float y, float w, float h, float m dy *= ey*0.5f; nvgBeginPath(vg); nvgEllipse(vg, rx+dx,ry+dy+ey*0.25f*(1-blink), br,br*blink); - nvgFillColor(vg, nvgRGBA(32,32,32,255)); + nvgFillColor(vg, nvgRGBA(32,32,32,255) ); nvgFill(vg); - gloss = nvgRadialGradient(vg, lx-ex*0.25f,ly-ey*0.5f, ex*0.1f,ex*0.75f, nvgRGBA(255,255,255,128), nvgRGBA(255,255,255,0)); + gloss = nvgRadialGradient(vg, lx-ex*0.25f,ly-ey*0.5f, ex*0.1f,ex*0.75f, nvgRGBA(255,255,255,128), nvgRGBA(255,255,255,0) ); nvgBeginPath(vg); nvgEllipse(vg, lx,ly, ex,ey); nvgFillPaint(vg, gloss); nvgFill(vg); - gloss = nvgRadialGradient(vg, rx-ex*0.25f,ry-ey*0.5f, ex*0.1f,ex*0.75f, nvgRGBA(255,255,255,128), nvgRGBA(255,255,255,0)); + gloss = nvgRadialGradient(vg, rx-ex*0.25f,ry-ey*0.5f, ex*0.1f,ex*0.75f, nvgRGBA(255,255,255,128), nvgRGBA(255,255,255,0) ); nvgBeginPath(vg); nvgEllipse(vg, rx,ry, ex,ey); nvgFillPaint(vg, gloss); @@ -451,12 +451,12 @@ void drawGraph(struct NVGcontext* vg, float x, float y, float w, float h, float float dx = w/5.0f; int i; - samples[0] = (1+sinf(t*1.2345f+cosf(t*0.33457f)*0.44f))*0.5f; - samples[1] = (1+sinf(t*0.68363f+cosf(t*1.3f)*1.55f))*0.5f; - samples[2] = (1+sinf(t*1.1642f+cosf(t*0.33457f)*1.24f))*0.5f; - samples[3] = (1+sinf(t*0.56345f+cosf(t*1.63f)*0.14f))*0.5f; - samples[4] = (1+sinf(t*1.6245f+cosf(t*0.254f)*0.3f))*0.5f; - samples[5] = (1+sinf(t*0.345f+cosf(t*0.03f)*0.6f))*0.5f; + samples[0] = (1+sinf(t*1.2345f+cosf(t*0.33457f)*0.44f) )*0.5f; + samples[1] = (1+sinf(t*0.68363f+cosf(t*1.3f)*1.55f) )*0.5f; + samples[2] = (1+sinf(t*1.1642f+cosf(t*0.33457f)*1.24f) )*0.5f; + samples[3] = (1+sinf(t*0.56345f+cosf(t*1.63f)*0.14f) )*0.5f; + samples[4] = (1+sinf(t*1.6245f+cosf(t*0.254f)*0.3f) )*0.5f; + samples[5] = (1+sinf(t*0.345f+cosf(t*0.03f)*0.6f) )*0.5f; for (i = 0; i < 6; i++) { sx[i] = x+i*dx; @@ -464,7 +464,7 @@ void drawGraph(struct NVGcontext* vg, float x, float y, float w, float h, float } // Graph background - bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(0,160,192,0), nvgRGBA(0,160,192,64)); + bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(0,160,192,0), nvgRGBA(0,160,192,64) ); nvgBeginPath(vg); nvgMoveTo(vg, sx[0], sy[0]); for (i = 1; i < 6; i++) @@ -479,7 +479,7 @@ void drawGraph(struct NVGcontext* vg, float x, float y, float w, float h, float nvgMoveTo(vg, sx[0], sy[0]+2); for (i = 1; i < 6; i++) nvgBezierTo(vg, sx[i-1]+dx*0.5f,sy[i-1]+2, sx[i]-dx*0.5f,sy[i]+2, sx[i],sy[i]+2); - nvgStrokeColor(vg, nvgRGBA(0,0,0,32)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,32) ); nvgStrokeWidth(vg, 3.0f); nvgStroke(vg); @@ -487,13 +487,13 @@ void drawGraph(struct NVGcontext* vg, float x, float y, float w, float h, float nvgMoveTo(vg, sx[0], sy[0]); for (i = 1; i < 6; i++) nvgBezierTo(vg, sx[i-1]+dx*0.5f,sy[i-1], sx[i]-dx*0.5f,sy[i], sx[i],sy[i]); - nvgStrokeColor(vg, nvgRGBA(0,160,192,255)); + nvgStrokeColor(vg, nvgRGBA(0,160,192,255) ); nvgStrokeWidth(vg, 3.0f); nvgStroke(vg); // Graph sample pos for (i = 0; i < 6; i++) { - bg = nvgRadialGradient(vg, sx[i],sy[i]+2, 3.0f,8.0f, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,0)); + bg = nvgRadialGradient(vg, sx[i],sy[i]+2, 3.0f,8.0f, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,0) ); nvgBeginPath(vg); nvgRect(vg, sx[i]-10, sy[i]-10+2, 20,20); nvgFillPaint(vg, bg); @@ -503,12 +503,12 @@ void drawGraph(struct NVGcontext* vg, float x, float y, float w, float h, float nvgBeginPath(vg); for (i = 0; i < 6; i++) nvgCircle(vg, sx[i], sy[i], 4.0f); - nvgFillColor(vg, nvgRGBA(0,160,192,255)); + nvgFillColor(vg, nvgRGBA(0,160,192,255) ); nvgFill(vg); nvgBeginPath(vg); for (i = 0; i < 6; i++) nvgCircle(vg, sx[i], sy[i], 2.0f); - nvgFillColor(vg, nvgRGBA(220,220,220,255)); + nvgFillColor(vg, nvgRGBA(220,220,220,255) ); nvgFill(vg); nvgStrokeWidth(vg, 1.0f); @@ -524,14 +524,14 @@ void drawThumbnails(struct NVGcontext* vg, float x, float y, float w, float h, c int imgw, imgh; float stackh = (nimages/2) * (thumb+10) + 10; int i; - float u = (1+cosf(t*0.5f))*0.5f; + float u = (1+cosf(t*0.5f) )*0.5f; float scrollh; nvgSave(vg); // nvgClearState(vg); // Drop shadow - shadowPaint = nvgBoxGradient(vg, x,y+4, w,h, cornerRadius*2, 20, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0)); + shadowPaint = nvgBoxGradient(vg, x,y+4, w,h, cornerRadius*2, 20, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0) ); nvgBeginPath(vg); nvgRect(vg, x-10,y-10, w+20,h+30); nvgRoundedRect(vg, x,y, w,h, cornerRadius); @@ -545,7 +545,7 @@ void drawThumbnails(struct NVGcontext* vg, float x, float y, float w, float h, c nvgMoveTo(vg, x-10,y+arry); nvgLineTo(vg, x+1,y+arry-11); nvgLineTo(vg, x+1,y+arry+11); - nvgFillColor(vg, nvgRGBA(200,200,200,255)); + nvgFillColor(vg, nvgRGBA(200,200,200,255) ); nvgFill(vg); nvgSave(vg); @@ -576,7 +576,7 @@ void drawThumbnails(struct NVGcontext* vg, float x, float y, float w, float h, c nvgFillPaint(vg, imgPaint); nvgFill(vg); - shadowPaint = nvgBoxGradient(vg, tx-1,ty, thumb+2,thumb+2, 5, 3, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0)); + shadowPaint = nvgBoxGradient(vg, tx-1,ty, thumb+2,thumb+2, 5, 3, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0) ); nvgBeginPath(vg); nvgRect(vg, tx-5,ty-5, thumb+10,thumb+10); nvgRoundedRect(vg, tx,ty, thumb,thumb, 6); @@ -587,38 +587,38 @@ void drawThumbnails(struct NVGcontext* vg, float x, float y, float w, float h, c nvgBeginPath(vg); nvgRoundedRect(vg, tx+0.5f,ty+0.5f, thumb-1,thumb-1, 4-0.5f); nvgStrokeWidth(vg,1.0f); - nvgStrokeColor(vg, nvgRGBA(255,255,255,192)); + nvgStrokeColor(vg, nvgRGBA(255,255,255,192) ); nvgStroke(vg); } nvgRestore(vg); // Hide fades - fadePaint = nvgLinearGradient(vg, x,y,x,y+6, nvgRGBA(200,200,200,255), nvgRGBA(200,200,200,0)); + fadePaint = nvgLinearGradient(vg, x,y,x,y+6, nvgRGBA(200,200,200,255), nvgRGBA(200,200,200,0) ); nvgBeginPath(vg); nvgRect(vg, x+4,y,w-8,6); nvgFillPaint(vg, fadePaint); nvgFill(vg); - fadePaint = nvgLinearGradient(vg, x,y+h,x,y+h-6, nvgRGBA(200,200,200,255), nvgRGBA(200,200,200,0)); + fadePaint = nvgLinearGradient(vg, x,y+h,x,y+h-6, nvgRGBA(200,200,200,255), nvgRGBA(200,200,200,0) ); nvgBeginPath(vg); nvgRect(vg, x+4,y+h-6,w-8,6); nvgFillPaint(vg, fadePaint); nvgFill(vg); // Scroll bar - shadowPaint = nvgBoxGradient(vg, x+w-12+1,y+4+1, 8,h-8, 3,4, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,92)); + shadowPaint = nvgBoxGradient(vg, x+w-12+1,y+4+1, 8,h-8, 3,4, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,92) ); nvgBeginPath(vg); nvgRoundedRect(vg, x+w-12,y+4, 8,h-8, 3); nvgFillPaint(vg, shadowPaint); - // nvgFillColor(vg, nvgRGBA(255,0,0,128)); + // nvgFillColor(vg, nvgRGBA(255,0,0,128) ); nvgFill(vg); scrollh = (h/stackh) * (h-8); - shadowPaint = nvgBoxGradient(vg, x+w-12-1,y+4+(h-8-scrollh)*u-1, 8,scrollh, 3,4, nvgRGBA(220,220,220,255), nvgRGBA(128,128,128,255)); + shadowPaint = nvgBoxGradient(vg, x+w-12-1,y+4+(h-8-scrollh)*u-1, 8,scrollh, 3,4, nvgRGBA(220,220,220,255), nvgRGBA(128,128,128,255) ); nvgBeginPath(vg); nvgRoundedRect(vg, x+w-12+1,y+4+1 + (h-8-scrollh)*u, 8-2,scrollh-2, 2); nvgFillPaint(vg, shadowPaint); - // nvgFillColor(vg, nvgRGBA(0,0,0,128)); + // nvgFillColor(vg, nvgRGBA(0,0,0,128) ); nvgFill(vg); nvgRestore(vg); @@ -635,7 +635,7 @@ void drawColorwheel(struct NVGcontext* vg, float x, float y, float w, float h, f /* nvgBeginPath(vg); nvgRect(vg, x,y,w,h); - nvgFillColor(vg, nvgRGBA(255,0,0,128)); + nvgFillColor(vg, nvgRGBA(255,0,0,128) ); nvgFill(vg);*/ cx = x + w*0.5f; @@ -656,7 +656,7 @@ void drawColorwheel(struct NVGcontext* vg, float x, float y, float w, float h, f ay = cy + sinf(a0) * (r0+r1)*0.5f; bx = cx + cosf(a1) * (r0+r1)*0.5f; by = cy + sinf(a1) * (r0+r1)*0.5f; - paint = nvgLinearGradient(vg, ax,ay, bx,by, nvgHSLA(a0/(NVG_PI*2),1.0f,0.55f,255), nvgHSLA(a1/(NVG_PI*2),1.0f,0.55f,255)); + paint = nvgLinearGradient(vg, ax,ay, bx,by, nvgHSLA(a0/(NVG_PI*2),1.0f,0.55f,255), nvgHSLA(a1/(NVG_PI*2),1.0f,0.55f,255) ); nvgFillPaint(vg, paint); nvgFill(vg); } @@ -664,7 +664,7 @@ void drawColorwheel(struct NVGcontext* vg, float x, float y, float w, float h, f nvgBeginPath(vg); nvgCircle(vg, cx,cy, r0-0.5f); nvgCircle(vg, cx,cy, r1+0.5f); - nvgStrokeColor(vg, nvgRGBA(0,0,0,64)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,64) ); nvgStrokeWidth(vg, 1.0f); nvgStroke(vg); @@ -677,10 +677,10 @@ void drawColorwheel(struct NVGcontext* vg, float x, float y, float w, float h, f nvgStrokeWidth(vg, 2.0f); nvgBeginPath(vg); nvgRect(vg, r0-1,-3,r1-r0+2,6); - nvgStrokeColor(vg, nvgRGBA(255,255,255,192)); + nvgStrokeColor(vg, nvgRGBA(255,255,255,192) ); nvgStroke(vg); - paint = nvgBoxGradient(vg, r0-3,-5,r1-r0+6,10, 2,4, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0)); + paint = nvgBoxGradient(vg, r0-3,-5,r1-r0+6,10, 2,4, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0) ); nvgBeginPath(vg); nvgRect(vg, r0-2-10,-4-10,r1-r0+4+20,8+20); nvgRect(vg, r0-2,-4,r1-r0+4,8); @@ -699,13 +699,13 @@ void drawColorwheel(struct NVGcontext* vg, float x, float y, float w, float h, f nvgLineTo(vg, ax,ay); nvgLineTo(vg, bx,by); nvgClosePath(vg); - paint = nvgLinearGradient(vg, r,0, ax,ay, nvgHSLA(hue,1.0f,0.5f,255), nvgRGBA(255,255,255,255)); + paint = nvgLinearGradient(vg, r,0, ax,ay, nvgHSLA(hue,1.0f,0.5f,255), nvgRGBA(255,255,255,255) ); nvgFillPaint(vg, paint); nvgFill(vg); - paint = nvgLinearGradient(vg, (r+ax)*0.5f,(0+ay)*0.5f, bx,by, nvgRGBA(0,0,0,0), nvgRGBA(0,0,0,255)); + paint = nvgLinearGradient(vg, (r+ax)*0.5f,(0+ay)*0.5f, bx,by, nvgRGBA(0,0,0,0), nvgRGBA(0,0,0,255) ); nvgFillPaint(vg, paint); nvgFill(vg); - nvgStrokeColor(vg, nvgRGBA(0,0,0,64)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,64) ); nvgStroke(vg); // Select circle on triangle @@ -714,10 +714,10 @@ void drawColorwheel(struct NVGcontext* vg, float x, float y, float w, float h, f nvgStrokeWidth(vg, 2.0f); nvgBeginPath(vg); nvgCircle(vg, ax,ay,5); - nvgStrokeColor(vg, nvgRGBA(255,255,255,192)); + nvgStrokeColor(vg, nvgRGBA(255,255,255,192) ); nvgStroke(vg); - paint = nvgRadialGradient(vg, ax,ay, 7,9, nvgRGBA(0,0,0,64), nvgRGBA(0,0,0,0)); + paint = nvgRadialGradient(vg, ax,ay, 7,9, nvgRGBA(0,0,0,64), nvgRGBA(0,0,0,0) ); nvgBeginPath(vg); nvgRect(vg, ax-20,ay-20,40,40); nvgCircle(vg, ax,ay,7); @@ -760,7 +760,7 @@ void drawLines(struct NVGcontext* vg, float x, float y, float w, float h, float nvgLineJoin(vg, joins[j]); nvgStrokeWidth(vg, s*0.3f); - nvgStrokeColor(vg, nvgRGBA(0,0,0,160)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,160) ); nvgBeginPath(vg); nvgMoveTo(vg, fx+pts[0], fy+pts[1]); nvgLineTo(vg, fx+pts[2], fy+pts[3]); @@ -772,7 +772,7 @@ void drawLines(struct NVGcontext* vg, float x, float y, float w, float h, float nvgLineJoin(vg, NVG_BEVEL); nvgStrokeWidth(vg, 1.0f); - nvgStrokeColor(vg, nvgRGBA(0,192,255,255)); + nvgStrokeColor(vg, nvgRGBA(0,192,255,255) ); nvgBeginPath(vg); nvgMoveTo(vg, fx+pts[0], fy+pts[1]); nvgLineTo(vg, fx+pts[2], fy+pts[3]); @@ -1029,11 +1029,11 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h int hit = mx > x && mx < (x+width) && my >= y && my < (y+lineh); nvgBeginPath(vg); - nvgFillColor(vg, nvgRGBA(255,255,255,hit?64:8)); + nvgFillColor(vg, nvgRGBA(255,255,255,hit?64:8) ); nvgRect(vg, x, y, row->width, lineh); nvgFill(vg); - nvgFillColor(vg, nvgRGBA(255,255,255,255)); + nvgFillColor(vg, nvgRGBA(255,255,255,255) ); nvgText(vg, x, y, row->start, row->end); if (hit) { @@ -1049,7 +1049,7 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h px = tgx; } nvgBeginPath(vg); - nvgFillColor(vg, nvgRGBA(255,192,0,255)); + nvgFillColor(vg, nvgRGBA(255,192,0,255) ); nvgRect(vg, caretx, y, 1, lineh); nvgFill(vg); @@ -1074,7 +1074,7 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h nvgTextBounds(vg, gx,gy, txt, NULL, bounds); nvgBeginPath(vg); - nvgFillColor(vg, nvgRGBA(255,192,0,255)); + nvgFillColor(vg, nvgRGBA(255,192,0,255) ); nvgRoundedRect(vg , roundf(bounds[0])-4.0f , roundf(bounds[1])-2.0f @@ -1084,7 +1084,7 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h ); nvgFill(vg); - nvgFillColor(vg, nvgRGBA(32,32,32,255)); + nvgFillColor(vg, nvgRGBA(32,32,32,255) ); nvgText(vg, gx,gy, txt, NULL); } @@ -1096,7 +1096,7 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h nvgTextBoxBounds(vg, x,y, 150, "Hover your mouse over the text to see calculated caret position.", NULL, bounds); nvgBeginPath(vg); - nvgFillColor(vg, nvgRGBA(220,220,220,255)); + nvgFillColor(vg, nvgRGBA(220,220,220,255) ); nvgRoundedRect(vg , roundf(bounds[0]-2.0f) , roundf(bounds[1]-2.0f) @@ -1104,13 +1104,13 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h , roundf(bounds[3]-bounds[1])+4.0f , 3.0f ); - px = float( (int)((bounds[2]+bounds[0])/2) ); + px = float( (int)( (bounds[2]+bounds[0])/2) ); nvgMoveTo(vg, px,bounds[1] - 10); nvgLineTo(vg, px+7,bounds[1]+1); nvgLineTo(vg, px-7,bounds[1]+1); nvgFill(vg); - nvgFillColor(vg, nvgRGBA(0,0,0,220)); + nvgFillColor(vg, nvgRGBA(0,0,0,220) ); nvgTextBox(vg, x,y, 150, "Hover your mouse over the text to see calculated caret position.", NULL); nvgRestore(vg); @@ -1120,7 +1120,7 @@ void drawWidths(struct NVGcontext* vg, float x, float y, float width) { nvgSave(vg); - nvgStrokeColor(vg, nvgRGBA(0,0,0,255)); + nvgStrokeColor(vg, nvgRGBA(0,0,0,255) ); for (uint32_t ii = 0; ii < 20; ++ii) { @@ -1179,7 +1179,7 @@ void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float he drawEditBox(vg, "Password", x,y, 280,28); y += 38; drawCheckBox(vg, "Remember me", x,y, 140,28); - drawButton(vg, ICON_LOGIN, "Sign in", x+138, y, 140, 28, nvgRGBA(0,96,128,255)); + drawButton(vg, ICON_LOGIN, "Sign in", x+138, y, 140, 28, nvgRGBA(0,96,128,255) ); y += 45; // Slider @@ -1189,8 +1189,8 @@ void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float he drawSlider(vg, 0.4f, x,y, 170,28); y += 55; - drawButton(vg, ICON_TRASH, "Delete", x, y, 160, 28, nvgRGBA(128,16,8,255)); - drawButton(vg, 0, "Cancel", x+170, y, 110, 28, nvgRGBA(0,0,0,0)); + drawButton(vg, ICON_TRASH, "Delete", x, y, 160, 28, nvgRGBA(128,16,8,255) ); + drawButton(vg, 0, "Cancel", x+170, y, 110, 28, nvgRGBA(0,0,0,0) ); // Thumbnails box drawThumbnails(vg, popx, popy-30, 160, 300, data->images, 12, t); diff --git a/examples/24-nbody/nbody.cpp b/examples/24-nbody/nbody.cpp index 90d95e56c..89b1ddef0 100644 --- a/examples/24-nbody/nbody.cpp +++ b/examples/24-nbody/nbody.cpp @@ -294,7 +294,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { float viewHead[16]; float eye[3] = {}; diff --git a/examples/common/camera.cpp b/examples/common/camera.cpp index b7a04553f..63ed98aaf 100644 --- a/examples/common/camera.cpp +++ b/examples/common/camera.cpp @@ -330,12 +330,12 @@ void cameraGetViewMtx(float* _viewMtx) void cameraGetPosition(float* _pos) { - memcpy(_pos, s_camera->m_eye, 3*sizeof(float)); + memcpy(_pos, s_camera->m_eye, 3*sizeof(float) ); } void cameraGetAt(float* _at) { - memcpy(_at, s_camera->m_at, 3*sizeof(float)); + memcpy(_at, s_camera->m_at, 3*sizeof(float) ); } void cameraUpdate(float _deltaTime, const entry::MouseState& _mouseState) diff --git a/examples/common/cube_atlas.cpp b/examples/common/cube_atlas.cpp index 6928338a6..764405c71 100644 --- a/examples/common/cube_atlas.cpp +++ b/examples/common/cube_atlas.cpp @@ -318,7 +318,7 @@ void Atlas::init() { m_texelSize = float(UINT16_MAX) / float(m_textureSize); float texelHalf = m_texelSize/2.0f; - switch (bgfx::getRendererType()) + switch (bgfx::getRendererType() ) { case bgfx::RendererType::Direct3D9: m_texelOffset[0] = 0.0f; diff --git a/examples/common/cube_atlas.h b/examples/common/cube_atlas.h index c35b0a1ef..903221e7a 100644 --- a/examples/common/cube_atlas.h +++ b/examples/common/cube_atlas.h @@ -54,12 +54,12 @@ class Atlas { public: /// create an empty dynamic atlas (region can be updated and added) - /// @param textureSize an atlas creates a texture cube of 6 faces with size equal to (textureSize*textureSize * sizeof(RGBA)) + /// @param textureSize an atlas creates a texture cube of 6 faces with size equal to (textureSize*textureSize * sizeof(RGBA) ) /// @param maxRegionCount maximum number of region allowed in the atlas Atlas(uint16_t _textureSize, uint16_t _maxRegionsCount = 4096); /// initialize a static atlas with serialized data (region can be updated but not added) - /// @param textureSize an atlas creates a texture cube of 6 faces with size equal to (textureSize*textureSize * sizeof(RGBA)) + /// @param textureSize an atlas creates a texture cube of 6 faces with size equal to (textureSize*textureSize * sizeof(RGBA) ) /// @param textureBuffer buffer of size 6*textureSize*textureSize*sizeof(uint32_t) (will be copied) /// @param regionCount number of region in the Atlas /// @param regionBuffer buffer containing the region (will be copied) diff --git a/examples/common/entry/entry.cpp b/examples/common/entry/entry.cpp index 4437da6d5..e8a011973 100644 --- a/examples/common/entry/entry.cpp +++ b/examples/common/entry/entry.cpp @@ -320,7 +320,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); inputAddBindings("bindings", s_bindings); entry::WindowHandle defaultWindow = { 0 }; - entry::setWindowTitle(defaultWindow, bx::baseName(_argv[0])); + entry::setWindowTitle(defaultWindow, bx::baseName(_argv[0]) ); int32_t result = ::_main_(_argc, _argv); diff --git a/examples/common/entry/entry_sdl.cpp b/examples/common/entry/entry_sdl.cpp index d8ba1b47e..b9094e8c3 100644 --- a/examples/common/entry/entry_sdl.cpp +++ b/examples/common/entry/entry_sdl.cpp @@ -644,7 +644,7 @@ namespace entry Msg* msg = (Msg*)uev.data2; if (isValid(handle) ) { - SDL_SetWindowTitle(m_window[handle.idx], msg->m_title.c_str()); + SDL_SetWindowTitle(m_window[handle.idx], msg->m_title.c_str() ); } delete msg; } diff --git a/examples/common/entry/entry_winrt.cpp b/examples/common/entry/entry_winrt.cpp index 1bca2de28..44fb92a4e 100644 --- a/examples/common/entry/entry_winrt.cpp +++ b/examples/common/entry/entry_winrt.cpp @@ -44,7 +44,7 @@ public: window->VisibilityChanged += ref new TypedEventHandler(this, &App::OnVisibilityChanged); window->Closed += ref new TypedEventHandler(this, &App::OnWindowClosed); - bgfx::winrtSetWindow(reinterpret_cast(window)); + bgfx::winrtSetWindow(reinterpret_cast(window) ); } virtual void Load(String^ entryPoint) @@ -62,8 +62,8 @@ public: static const float dipsPerInch = 96.0f; g_eventQueue.postSizeEvent(g_defaultWindow - , lround(floorf(bounds.Width * dpi / dipsPerInch + 0.5f)) - , lround(floorf(bounds.Height * dpi / dipsPerInch + 0.5f)) + , lround(floorf(bounds.Width * dpi / dipsPerInch + 0.5f) ) + , lround(floorf(bounds.Height * dpi / dipsPerInch + 0.5f) ) ); while (!m_windowClosed) diff --git a/examples/common/font/text_metrics.cpp b/examples/common/font/text_metrics.cpp index d48035fb8..677a3585e 100644 --- a/examples/common/font/text_metrics.cpp +++ b/examples/common/font/text_metrics.cpp @@ -158,7 +158,7 @@ void TextLineMetrics::getSubText(const char* _string, uint32_t _firstLine, uint3 uint32_t state = 0; // y is bottom of a text line uint32_t currentLine = 0; - while(*_string && (currentLine < _firstLine)) + while(*_string && (currentLine < _firstLine) ) { for (; *_string; ++_string) { diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index d2cbc0e76..2d785641f 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -770,7 +770,7 @@ struct Imgui && m_leftPressed) { // Toggle active input. - if (isActiveInputField(_id)) + if (isActiveInputField(_id) ) { clearActiveInputField(); } @@ -831,7 +831,7 @@ struct Imgui bgfx::setViewSeq(_view, true); const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING)) + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) { m_viewWidth = _width / 2; m_surfaceWidth = _surfaceWidth / 2; @@ -1080,7 +1080,7 @@ struct Imgui else { // Clear active if scroll is selected but not visible any more. - if (isActive(hid)) + if (isActive(hid) ) { clearActive(); } @@ -1399,7 +1399,7 @@ struct Imgui // Handle input. if (isActiveInputField(id) ) { - const size_t cursor = size_t(strlen(_str)); + const size_t cursor = size_t(strlen(_str) ); if (m_char == 0x08 || m_char == 0x7f) //backspace or delete { @@ -1422,7 +1422,7 @@ struct Imgui if (drawLabel) { uint32_t numVertices = 0; //unused - const int32_t labelWidth = int32_t(getTextLength(m_fonts[m_currentFontIdx].m_cdata, _label, numVertices)); + const int32_t labelWidth = int32_t(getTextLength(m_fonts[m_currentFontIdx].m_cdata, _label, numVertices) ); xx += (labelWidth + 6); width -= (labelWidth + 6); } @@ -1562,7 +1562,7 @@ struct Imgui , enabled?imguiRGBA(255,196,0,200):imguiRGBA(128,128,128,32) ); } - else if (isActive(id)) + else if (isActive(id) ) { drawRoundedRect( (float)buttonX , (float)yy diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index cb0622319..07e539bbe 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -207,7 +207,7 @@ bool imguiMouseOverArea(); namespace ImGui { // Helper function for passing bgfx::TextureHandle to ImGui::Image. - inline void Image(bgfx::TextureHandle _handle, const ImVec2& _size, const ImVec2& _uv0 = ImVec2(0, 0), const ImVec2& _uv1 = ImVec2(1, 1), const ImVec4& _tint_col = ImVec4(1, 1, 1, 1), const ImVec4& _border_col = ImVec4(0, 0, 0, 0)) + inline void Image(bgfx::TextureHandle _handle, const ImVec2& _size, const ImVec2& _uv0 = ImVec2(0, 0), const ImVec2& _uv1 = ImVec2(1, 1), const ImVec4& _tint_col = ImVec4(1, 1, 1, 1), const ImVec4& _border_col = ImVec4(0, 0, 0, 0) ) { union { bgfx::TextureHandle handle; ImTextureID ptr; } texture; texture.handle = _handle; diff --git a/examples/common/imgui/ocornut_imgui.cpp b/examples/common/imgui/ocornut_imgui.cpp index 6d1fa6b97..765dd4e37 100644 --- a/examples/common/imgui/ocornut_imgui.cpp +++ b/examples/common/imgui/ocornut_imgui.cpp @@ -44,7 +44,7 @@ struct OcornutImguiContext uint32_t vtx_size = (uint32_t)cmd_list->VtxBuffer.size(); uint32_t idx_size = (uint32_t)cmd_list->IdxBuffer.size(); - if (!bgfx::checkAvailTransientVertexBuffer(vtx_size, m_decl) || !bgfx::checkAvailTransientIndexBuffer(idx_size)) + if (!bgfx::checkAvailTransientVertexBuffer(vtx_size, m_decl) || !bgfx::checkAvailTransientIndexBuffer(idx_size) ) { // not enough space in transient buffer just quit drawing the rest... break; @@ -54,10 +54,10 @@ struct OcornutImguiContext bgfx::allocTransientIndexBuffer(&tib, idx_size); ImDrawVert* verts = (ImDrawVert*)tvb.data; - memcpy(verts, cmd_list->VtxBuffer.begin(), vtx_size * sizeof(ImDrawVert)); + memcpy(verts, cmd_list->VtxBuffer.begin(), vtx_size * sizeof(ImDrawVert) ); ImDrawIdx* indices = (ImDrawIdx*)tib.data; - memcpy(indices, cmd_list->IdxBuffer.begin(), idx_size * sizeof(ImDrawIdx)); + memcpy(indices, cmd_list->IdxBuffer.begin(), idx_size * sizeof(ImDrawIdx) ); uint32_t elem_offset = 0; const ImDrawCmd* pcmd_begin = cmd_list->CmdBuffer.begin(); @@ -81,10 +81,10 @@ struct OcornutImguiContext | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) | BGFX_STATE_MSAA ); - bgfx::setScissor(uint16_t(bx::fmax(pcmd->ClipRect.x, 0.0f)) - , uint16_t(bx::fmax(pcmd->ClipRect.y, 0.0f)) - , uint16_t(bx::fmin(pcmd->ClipRect.z, 65535.0f)-bx::fmax(pcmd->ClipRect.x, 0.0f)) - , uint16_t(bx::fmin(pcmd->ClipRect.w, 65535.0f)-bx::fmax(pcmd->ClipRect.y, 0.0f)) + bgfx::setScissor(uint16_t(bx::fmax(pcmd->ClipRect.x, 0.0f) ) + , uint16_t(bx::fmax(pcmd->ClipRect.y, 0.0f) ) + , uint16_t(bx::fmin(pcmd->ClipRect.z, 65535.0f)-bx::fmax(pcmd->ClipRect.x, 0.0f) ) + , uint16_t(bx::fmin(pcmd->ClipRect.w, 65535.0f)-bx::fmax(pcmd->ClipRect.y, 0.0f) ) ); union { void* ptr; bgfx::TextureHandle handle; } texture ={ pcmd->TextureId }; @@ -144,22 +144,22 @@ struct OcornutImguiContext const bgfx::Memory* vsmem; const bgfx::Memory* fsmem; - switch (bgfx::getRendererType()) + switch (bgfx::getRendererType() ) { case bgfx::RendererType::Direct3D9: - vsmem = bgfx::makeRef(vs_ocornut_imgui_dx9, sizeof(vs_ocornut_imgui_dx9)); - fsmem = bgfx::makeRef(fs_ocornut_imgui_dx9, sizeof(fs_ocornut_imgui_dx9)); + vsmem = bgfx::makeRef(vs_ocornut_imgui_dx9, sizeof(vs_ocornut_imgui_dx9) ); + fsmem = bgfx::makeRef(fs_ocornut_imgui_dx9, sizeof(fs_ocornut_imgui_dx9) ); break; case bgfx::RendererType::Direct3D11: case bgfx::RendererType::Direct3D12: - vsmem = bgfx::makeRef(vs_ocornut_imgui_dx11, sizeof(vs_ocornut_imgui_dx11)); - fsmem = bgfx::makeRef(fs_ocornut_imgui_dx11, sizeof(fs_ocornut_imgui_dx11)); + vsmem = bgfx::makeRef(vs_ocornut_imgui_dx11, sizeof(vs_ocornut_imgui_dx11) ); + fsmem = bgfx::makeRef(fs_ocornut_imgui_dx11, sizeof(fs_ocornut_imgui_dx11) ); break; default: - vsmem = bgfx::makeRef(vs_ocornut_imgui_glsl, sizeof(vs_ocornut_imgui_glsl)); - fsmem = bgfx::makeRef(fs_ocornut_imgui_glsl, sizeof(fs_ocornut_imgui_glsl)); + vsmem = bgfx::makeRef(vs_ocornut_imgui_glsl, sizeof(vs_ocornut_imgui_glsl) ); + fsmem = bgfx::makeRef(fs_ocornut_imgui_glsl, sizeof(fs_ocornut_imgui_glsl) ); break; } @@ -185,7 +185,7 @@ struct OcornutImguiContext io.Fonts->GetTexDataAsRGBA32(&data, &width, &height); - m_texture = bgfx::createTexture2D((uint16_t)width + m_texture = bgfx::createTexture2D( (uint16_t)width , (uint16_t)height , 1 , bgfx::TextureFormat::BGRA8 @@ -217,9 +217,9 @@ struct OcornutImguiContext io.AddInputCharacter(_inputChar); // ASCII or GTFO! :( } - io.DisplaySize = ImVec2((float)_width, (float)_height); + io.DisplaySize = ImVec2( (float)_width, (float)_height); io.DeltaTime = 1.0f / 60.0f; - io.MousePos = ImVec2((float)_mx, (float)_my); + io.MousePos = ImVec2( (float)_mx, (float)_my); io.MouseDown[0] = 0 != (_button & IMGUI_MBUT_LEFT); io.MouseDown[1] = 0 != (_button & IMGUI_MBUT_RIGHT); io.MouseWheel = (float)(_scroll - m_lastScroll); diff --git a/examples/common/imgui/scintilla.cpp b/examples/common/imgui/scintilla.cpp index 6d0a6a599..7bca82898 100644 --- a/examples/common/imgui/scintilla.cpp +++ b/examples/common/imgui/scintilla.cpp @@ -236,7 +236,7 @@ public: virtual Scintilla::XYPOSITION WidthChar(Scintilla::Font& _font, char ch) BX_OVERRIDE { FontInt* fi = (FontInt*)_font.GetID(); - return fi->m_font->GetCharAdvance((unsigned int)ch) * fi->m_scale; + return fi->m_font->GetCharAdvance( (unsigned int)ch) * fi->m_scale; } virtual Scintilla::XYPOSITION Ascent(Scintilla::Font& _font) BX_OVERRIDE diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 8c86e75ba..33a593ebc 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -188,7 +188,7 @@ namespace tex = &gl->textures[gl->ntextures++]; } - memset(tex, 0, sizeof(*tex)); + memset(tex, 0, sizeof(*tex) ); return tex; } @@ -218,7 +218,7 @@ namespace { bgfx::destroyTexture(gl->textures[ii].id); } - memset(&gl->textures[ii], 0, sizeof(gl->textures[ii])); + memset(&gl->textures[ii], 0, sizeof(gl->textures[ii]) ); gl->textures[ii].id.idx = bgfx::invalidHandle; return 1; } @@ -384,10 +384,10 @@ namespace invdet = 1.0 / det; inv[0] = (float)(t[3] * invdet); inv[2] = (float)(-t[2] * invdet); - inv[4] = (float)(((double)t[2] * t[5] - (double)t[3] * t[4]) * invdet); + inv[4] = (float)( ((double)t[2] * t[5] - (double)t[3] * t[4]) * invdet); inv[1] = (float)(-t[1] * invdet); inv[3] = (float)(t[0] * invdet); - inv[5] = (float)(((double)t[1] * t[4] - (double)t[0] * t[5]) * invdet); + inv[5] = (float)( ((double)t[1] * t[4] - (double)t[0] * t[5]) * invdet); } static void glnvg__xformToMat3x4(float* m3, float* t) @@ -412,7 +412,7 @@ namespace struct GLNVGtexture* tex = NULL; float invxform[6] = {}; - memset(frag, 0, sizeof(*frag)); + memset(frag, 0, sizeof(*frag) ); frag->innerCol = paint->innerColor; frag->outerCol = paint->outerColor; @@ -422,7 +422,7 @@ namespace if (scissor->extent[0] < 0.5f || scissor->extent[1] < 0.5f) { - memset(frag->scissorMat, 0, sizeof(frag->scissorMat)); + memset(frag->scissorMat, 0, sizeof(frag->scissorMat) ); frag->scissorExt[0] = 1.0f; frag->scissorExt[1] = 1.0f; frag->scissorScale[0] = 1.0f; @@ -437,7 +437,7 @@ namespace frag->scissorScale[0] = sqrtf(scissor->xform[0]*scissor->xform[0] + scissor->xform[2]*scissor->xform[2]) / fringe; frag->scissorScale[1] = sqrtf(scissor->xform[1]*scissor->xform[1] + scissor->xform[3]*scissor->xform[3]) / fringe; } - memcpy(frag->extent, paint->extent, sizeof(frag->extent)); + memcpy(frag->extent, paint->extent, sizeof(frag->extent) ); frag->strokeMult = (width*0.5f + fringe*0.5f) / fringe; bgfx::TextureHandle invalid = BGFX_INVALID_HANDLE; @@ -779,7 +779,7 @@ namespace gl->calls = (struct GLNVGcall*)realloc(gl->calls, sizeof(struct GLNVGcall) * gl->ccalls); } ret = &gl->calls[gl->ncalls++]; - memset(ret, 0, sizeof(struct GLNVGcall)); + memset(ret, 0, sizeof(struct GLNVGcall) ); return ret; } @@ -865,7 +865,7 @@ namespace { struct GLNVGpath* copy = &gl->paths[call->pathOffset + i]; const struct NVGpath* path = &paths[i]; - memset(copy, 0, sizeof(struct GLNVGpath)); + memset(copy, 0, sizeof(struct GLNVGpath) ); if (path->nfill > 0) { copy->fillOffset = offset; @@ -901,7 +901,7 @@ namespace call->uniformOffset = glnvg__allocFragUniforms(gl, 2); // Simple shader for stencil frag = nvg__fragUniformPtr(gl, call->uniformOffset); - memset(frag, 0, sizeof(*frag)); + memset(frag, 0, sizeof(*frag) ); frag->type = NSVG_SHADER_SIMPLE; // Fill shader glnvg__convertPaint(gl, nvg__fragUniformPtr(gl, call->uniformOffset + gl->fragSize), paint, scissor, fringe, fringe); @@ -935,7 +935,7 @@ namespace { struct GLNVGpath* copy = &gl->paths[call->pathOffset + i]; const struct NVGpath* path = &paths[i]; - memset(copy, 0, sizeof(struct GLNVGpath)); + memset(copy, 0, sizeof(struct GLNVGpath) ); if (path->nstroke) { copy->strokeOffset = offset; @@ -1018,11 +1018,11 @@ NVGcontext* nvgCreate(int edgeaa, unsigned char viewid) { struct NVGparams params; struct NVGcontext* ctx = NULL; - struct GLNVGcontext* gl = (struct GLNVGcontext*)malloc(sizeof(struct GLNVGcontext)); + struct GLNVGcontext* gl = (struct GLNVGcontext*)malloc(sizeof(struct GLNVGcontext) ); if (gl == NULL) goto error; - memset(gl, 0, sizeof(struct GLNVGcontext)); + memset(gl, 0, sizeof(struct GLNVGcontext) ); - memset(¶ms, 0, sizeof(params)); + memset(¶ms, 0, sizeof(params) ); params.renderCreate = nvgRenderCreate; params.renderCreateTexture = nvgRenderCreateTexture; params.renderDeleteTexture = nvgRenderDeleteTexture; diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 31956b40d..62faca63e 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1493,7 +1493,7 @@ again: { _type = RendererType::OpenGLES; } - else if (BX_ENABLED(BX_PLATFORM_WINRT)) + else if (BX_ENABLED(BX_PLATFORM_WINRT) ) { _type = RendererType::Direct3D11; } @@ -2077,6 +2077,8 @@ again: BX_ALIGNED_DELETE(g_allocator, ctx, 16); + BX_TRACE("Shutdown complete."); + if (NULL != s_callbackStub) { BX_DELETE(g_allocator, s_callbackStub); @@ -2093,11 +2095,8 @@ again: } s_threadIndex = 0; - - BX_TRACE("Shutdown complete."); - - g_callback = NULL; - g_allocator = NULL; + g_callback = NULL; + g_allocator = NULL; } void reset(uint32_t _width, uint32_t _height, uint32_t _flags) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 00d719bbf..cadeec254 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -52,7 +52,7 @@ namespace bgfx { #if BX_COMPILER_CLANG_ANALYZER - void __attribute__((analyzer_noreturn)) fatal(Fatal::Enum _code, const char* _format, ...); + void __attribute__( (analyzer_noreturn) ) fatal(Fatal::Enum _code, const char* _format, ...); #else void fatal(Fatal::Enum _code, const char* _format, ...); #endif // BX_COMPILER_CLANG_ANALYZER @@ -2090,7 +2090,7 @@ namespace bgfx { IndexBufferHandle indexBufferHandle = { m_indexBufferHandle.alloc() }; BX_WARN(isValid(indexBufferHandle), "Failed to allocate index buffer handle."); - if (!isValid(indexBufferHandle)) + if (!isValid(indexBufferHandle) ) { return ptr; } @@ -2117,7 +2117,7 @@ namespace bgfx if (0 != (_flags & BGFX_BUFFER_COMPUTE_WRITE) ) { IndexBufferHandle indexBufferHandle = { m_indexBufferHandle.alloc() }; - if (!isValid(indexBufferHandle)) + if (!isValid(indexBufferHandle) ) { return handle; } diff --git a/src/renderer_d3d.h b/src/renderer_d3d.h index eed410263..61c87499d 100644 --- a/src/renderer_d3d.h +++ b/src/renderer_d3d.h @@ -144,13 +144,13 @@ namespace bgfx void add(uint64_t _id, uint16_t _item) { invalidate(_id); - m_hashMap.insert(stl::make_pair(_id, _item)); + m_hashMap.insert(stl::make_pair(_id, _item) ); } uint16_t find(uint64_t _id) { HashMap::iterator it = m_hashMap.find(_id); - if (it != m_hashMap.end()) + if (it != m_hashMap.end() ) { return it->second; } @@ -161,7 +161,7 @@ namespace bgfx void invalidate(uint64_t _id) { HashMap::iterator it = m_hashMap.find(_id); - if (it != m_hashMap.end()) + if (it != m_hashMap.end() ) { m_hashMap.erase(it); } @@ -174,7 +174,7 @@ namespace bgfx uint32_t getCount() const { - return uint32_t(m_hashMap.size()); + return uint32_t(m_hashMap.size() ); } private: diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index e64c85cfd..b267777de 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -788,10 +788,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ); BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Failed to create swap chain."); - DX_CHECK(m_factory->MakeWindowAssociation((HWND)g_platformData.nwh, 0 + DX_CHECK(m_factory->MakeWindowAssociation( (HWND)g_platformData.nwh, 0 | DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER - )); + ) ); #endif // BX_PLATFORM_WINRT } else @@ -853,7 +853,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (m_featureLevel <= D3D_FEATURE_LEVEL_9_2) { g_caps.maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; - g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS)); + g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); } else if (m_featureLevel == D3D_FEATURE_LEVEL_9_3) { @@ -1314,7 +1314,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } ID3D11Texture2D* backBuffer; - DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer)); + DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer) ); D3D11_TEXTURE2D_DESC backBufferDesc; backBuffer->GetDesc(&backBufferDesc); @@ -1509,7 +1509,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (NULL != m_swapChain) { ID3D11Texture2D* color; - DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&color)); + DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&color) ); D3D11_RENDER_TARGET_VIEW_DESC desc; desc.ViewDimension = (m_flags & BGFX_RESET_MSAA_MASK) @@ -1708,7 +1708,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); , getBufferHeight() , getBufferFormat() , DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH - )); + ) ); } else { @@ -1720,7 +1720,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); SwapChainDesc* scd = &m_scd; SwapChainDesc swapChainScd; if (0 != (m_flags & BGFX_RESET_HMD) - && m_ovr.isInitialized()) + && m_ovr.isInitialized() ) { swapChainScd = m_scd; swapChainScd.SampleDesc = s_msaa[0]; @@ -2264,7 +2264,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bx::write(&writer, magic); TextureCreate tc; - tc.m_flags = BGFX_TEXTURE_RT|(((m_flags & BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT) << BGFX_TEXTURE_RT_MSAA_SHIFT); + tc.m_flags = BGFX_TEXTURE_RT|( ((m_flags & BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT) << BGFX_TEXTURE_RT_MSAA_SHIFT); tc.m_width = m_ovr.m_rtSize.w; tc.m_height = m_ovr.m_rtSize.h; tc.m_sides = 0; @@ -2335,7 +2335,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (m_flags&BGFX_RESET_CAPTURE) { ID3D11Texture2D* backBuffer; - DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer)); + DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer) ); D3D11_TEXTURE2D_DESC backBufferDesc; backBuffer->GetDesc(&backBufferDesc); @@ -2381,7 +2381,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (NULL != m_captureTexture) { ID3D11Texture2D* backBuffer; - DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer)); + DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer) ); if (NULL == m_captureResolve) { @@ -2389,7 +2389,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { - m_deviceCtx->ResolveSubresource(m_captureResolve, 0, backBuffer, 0, getBufferFormat()); + m_deviceCtx->ResolveSubresource(m_captureResolve, 0, backBuffer, 0, getBufferFormat() ); m_deviceCtx->CopyResource(m_captureTexture, m_captureResolve); } @@ -2909,7 +2909,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_MAPPED_SUBRESOURCE mapped; BX_UNUSED(_discard); D3D11_MAP type = D3D11_MAP_WRITE_DISCARD; - DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped)); + DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped) ); memcpy( (uint8_t*)mapped.pData + _offset, _data, _size); deviceCtx->Unmap(m_ptr, 0); #endif // 0 @@ -3058,7 +3058,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint8_t numAttrs; bx::read(&reader, numAttrs); - memset(m_attrMask, 0, sizeof(m_attrMask)); + memset(m_attrMask, 0, sizeof(m_attrMask) ); for (uint32_t ii = 0; ii < numAttrs; ++ii) { @@ -3428,7 +3428,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Failed to create swap chain."); ID3D11Resource* ptr; - DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&ptr)); + DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&ptr) ); DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(ptr, NULL, &m_rtv[0]) ); DX_RELEASE(ptr, 0); m_srv[0] = NULL; diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 981c256ed..c4dddded8 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -395,7 +395,7 @@ namespace bgfx { namespace d3d9 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != strstr(desc.Description, "PerfHUD")) + && 0 != strstr(desc.Description, "PerfHUD") ) { m_adapter = ii; m_deviceType = D3DDEVTYPE_REF; @@ -1095,7 +1095,7 @@ namespace bgfx { namespace d3d9 } DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) ); - DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_flags & BGFX_RESET_SRGB_BACKBUFFER) )); + DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_flags & BGFX_RESET_SRGB_BACKBUFFER) ) ); } else { @@ -1337,7 +1337,7 @@ namespace bgfx { namespace d3d9 DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MAGFILTER, magFilter) ); DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MIPFILTER, mipFilter) ); DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, m_maxAnisotropy) ); - DX_CHECK(device->SetSamplerState(stage, D3DSAMP_SRGBTEXTURE, 0 != (flags & BGFX_TEXTURE_SRGB)) ); + DX_CHECK(device->SetSamplerState(stage, D3DSAMP_SRGBTEXTURE, 0 != (flags & BGFX_TEXTURE_SRGB) ) ); } } diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index afcbdb46e..8f91f6494 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2467,7 +2467,7 @@ namespace bgfx { namespace gl bx::write(&writer, magic); TextureCreate tc; - tc.m_flags = BGFX_TEXTURE_RT|(((m_resolution.m_flags & BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT) << BGFX_TEXTURE_RT_MSAA_SHIFT);; + tc.m_flags = BGFX_TEXTURE_RT|( ((m_resolution.m_flags & BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT) << BGFX_TEXTURE_RT_MSAA_SHIFT);; tc.m_width = m_ovr.m_rtSize.w; tc.m_height = m_ovr.m_rtSize.h; tc.m_sides = 0; @@ -5054,7 +5054,7 @@ namespace bgfx { namespace gl case Binding::IndexBuffer: { const IndexBufferGL& buffer = m_indexBuffers[bind.m_idx]; - GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, ii, buffer.m_id)); + GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, ii, buffer.m_id) ); barrier |= GL_SHADER_STORAGE_BARRIER_BIT; } break; @@ -5062,7 +5062,7 @@ namespace bgfx { namespace gl case Binding::VertexBuffer: { const VertexBufferGL& buffer = m_vertexBuffers[bind.m_idx]; - GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, ii, buffer.m_id)); + GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, ii, buffer.m_id) ); barrier |= GL_SHADER_STORAGE_BARRIER_BIT; } break; @@ -5217,7 +5217,7 @@ namespace bgfx { namespace gl GLint ref = (stencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT; GLint mask = (stencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT; uint32_t func = (stencil&BGFX_STENCIL_TEST_MASK)>>BGFX_STENCIL_TEST_SHIFT; - GL_CHECK(glStencilFuncSeparate(face, s_cmpFunc[func], ref, mask)); + GL_CHECK(glStencilFuncSeparate(face, s_cmpFunc[func], ref, mask) ); } if ( (BGFX_STENCIL_OP_FAIL_S_MASK|BGFX_STENCIL_OP_FAIL_Z_MASK|BGFX_STENCIL_OP_PASS_Z_MASK) & changed) @@ -5337,7 +5337,7 @@ namespace bgfx { namespace gl const uint32_t srcA = (blend>> 8)&0xf; const uint32_t dstA = (blend>>12)&0xf; - const uint32_t equ = uint32_t((newFlags&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT); + const uint32_t equ = uint32_t( (newFlags&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT); const uint32_t equRGB = (equ )&0x7; const uint32_t equA = (equ>>3)&0x7; diff --git a/src/vertexdecl.cpp b/src/vertexdecl.cpp index 78d207600..2a519541a 100644 --- a/src/vertexdecl.cpp +++ b/src/vertexdecl.cpp @@ -131,7 +131,7 @@ namespace bgfx { uint8_t val = m_attributes[_attrib]; _num = (val&3)+1; - _type = AttribType::Enum((val>>3)&3); + _type = AttribType::Enum( (val>>3)&3); _normalized = !!(val&(1<<6) ); _asInt = !!(val&(1<<7) ); }