Skip to content

Commit

Permalink
Fixed VS2015 warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Mar 29, 2015
1 parent 675745c commit a34e6e7
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/sdf/sdf.h
Expand Up @@ -92,7 +92,7 @@ static float sdf__edgedf(float gx, float gy, float a)
} else if (a < (1.0-a1)) { // a1 <= a <= 1-a1
df = (0.5f-a)*gx;
} else { // 1-a1 < a <= 1
df = -0.5f*(gx + gy) + sqrt(2.0f*gx*gy*(1.0f-a));
df = -0.5f*(gx + gy) + sqrtf(2.0f*gx*gy*(1.0f-a));
}
}
return df;
Expand Down
8 changes: 4 additions & 4 deletions examples/02-metaballs/metaballs.cpp
Expand Up @@ -592,10 +592,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float sphere[numSpheres][4];
for (uint32_t ii = 0; ii < numSpheres; ++ii)
{
sphere[ii][0] = sin(time*(ii*0.21f)+ii*0.37f) * (DIMS * 0.5f - 8.0f);
sphere[ii][1] = sin(time*(ii*0.37f)+ii*0.67f) * (DIMS * 0.5f - 8.0f);
sphere[ii][2] = cos(time*(ii*0.11f)+ii*0.13f) * (DIMS * 0.5f - 8.0f);
sphere[ii][3] = 1.0f/(2.0f + (sin(time*(ii*0.13f) )*0.5f+0.5f)*2.0f);
sphere[ii][0] = sinf(time*(ii*0.21f)+ii*0.37f) * (DIMS * 0.5f - 8.0f);
sphere[ii][1] = sinf(time*(ii*0.37f)+ii*0.67f) * (DIMS * 0.5f - 8.0f);
sphere[ii][2] = cosf(time*(ii*0.11f)+ii*0.13f) * (DIMS * 0.5f - 8.0f);
sphere[ii][3] = 1.0f/(2.0f + (sinf(time*(ii*0.13f) )*0.5f+0.5f)*2.0f);
}

profUpdate = bx::getHPCounter();
Expand Down
6 changes: 3 additions & 3 deletions examples/05-instancing/instancing.cpp
Expand Up @@ -182,9 +182,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
mtx[14] = 0.0f;

float* color = (float*)&data[64];
color[0] = sin(time+float(xx)/11.0f)*0.5f+0.5f;
color[1] = cos(time+float(yy)/11.0f)*0.5f+0.5f;
color[2] = sin(time*3.0f)*0.5f+0.5f;
color[0] = sinf(time+float(xx)/11.0f)*0.5f+0.5f;
color[1] = cosf(time+float(yy)/11.0f)*0.5f+0.5f;
color[2] = sinf(time*3.0f)*0.5f+0.5f;
color[3] = 1.0f;

data += instanceStride;
Expand Down
8 changes: 4 additions & 4 deletions examples/06-bump/bump.cpp
Expand Up @@ -192,7 +192,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)

float at[3] = { 0.0f, 0.0f, 0.0f };
float eye[3] = { 0.0f, 0.0f, -7.0f };

// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd)
Expand Down Expand Up @@ -227,8 +227,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float lightPosRadius[4][4];
for (uint32_t ii = 0; ii < numLights; ++ii)
{
lightPosRadius[ii][0] = sin( (time*(0.1f + ii*0.17f) + ii*bx::piHalf*1.37f ) )*3.0f;
lightPosRadius[ii][1] = cos( (time*(0.2f + ii*0.29f) + ii*bx::piHalf*1.49f ) )*3.0f;
lightPosRadius[ii][0] = sinf( (time*(0.1f + ii*0.17f) + ii*bx::piHalf*1.37f ) )*3.0f;
lightPosRadius[ii][1] = cosf( (time*(0.2f + ii*0.29f) + ii*bx::piHalf*1.49f ) )*3.0f;
lightPosRadius[ii][2] = -2.5f;
lightPosRadius[ii][3] = 3.0f;
}
Expand Down Expand Up @@ -338,7 +338,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
}
}

// Advance to next frame. Rendering thread will be kicked to
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
}
Expand Down
12 changes: 6 additions & 6 deletions examples/13-stencil/stencil.cpp
Expand Up @@ -1040,9 +1040,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
const float radius = (scene == StencilReflectionScene) ? 15.0f : 25.0f;
for (uint8_t ii = 0; ii < numLights; ++ii)
{
lightPosRadius[ii][0] = sin( (lightTimeAccumulator*1.1f + ii*0.03f + ii*bx::piHalf*1.07f ) )*20.0f;
lightPosRadius[ii][1] = 8.0f + (1.0f - cos( (lightTimeAccumulator*1.5f + ii*0.29f + bx::piHalf*1.49f ) ))*4.0f;
lightPosRadius[ii][2] = cos( (lightTimeAccumulator*1.3f + ii*0.13f + ii*bx::piHalf*1.79f ) )*20.0f;
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][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));
Expand Down Expand Up @@ -1112,9 +1112,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
, 0.0f
, 0.0f
, 0.0f
, sin(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
, sinf(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
, 4.0f
, cos(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
, cosf(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
);
}

Expand Down Expand Up @@ -1188,7 +1188,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)

// Set lights back.
memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float));

// Third pass - Blend plane.

// Floor.
Expand Down Expand Up @@ -1217,6 +1216,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
, s_renderStates[RenderState::StencilReflection_DrawScene]
);
}

}
break;

Expand Down
16 changes: 8 additions & 8 deletions examples/14-shadowvolumes/shadowvolumes.cpp
Expand Up @@ -2276,19 +2276,19 @@ int _main_(int /*_argc*/, char** /*_argv*/)
{
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
{
lightPosRadius[ii][0] = cos(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][0] = cosf(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][1] = 20.0f;
lightPosRadius[ii][2] = sin(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][2] = sinf(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][3] = 20.0f;
}
}
else
{
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
{
lightPosRadius[ii][0] = cos(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][0] = cosf(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][1] = 20.0f;
lightPosRadius[ii][2] = sin(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][2] = sinf(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][3] = 20.0f;
}
}
Expand Down Expand Up @@ -2362,9 +2362,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
inst.m_rotation[0] = 0.0f;
inst.m_rotation[1] = 0.0f;
inst.m_rotation[2] = 0.0f;
inst.m_pos[0] = sin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[0] = sinf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[1] = 6.0f;
inst.m_pos[2] = cos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[2] = cosf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_model = &cubeModel;
}

Expand All @@ -2379,9 +2379,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
inst.m_rotation[0] = 0.0f;
inst.m_rotation[1] = 0.0f;
inst.m_rotation[2] = 0.0f;
inst.m_pos[0] = sin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[0] = sinf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[1] = 22.0f;
inst.m_pos[2] = cos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[2] = cosf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_model = &cubeModel;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/15-shadowmaps-simple/shadowmaps_simple.cpp
Expand Up @@ -221,9 +221,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)

// Setup lights.
float lightPos[4];
lightPos[0] = -cos(timeAccumulatorLight);
lightPos[0] = -cosf(timeAccumulatorLight);
lightPos[1] = -1.0f;
lightPos[2] = -sin(timeAccumulatorLight);
lightPos[2] = -sinf(timeAccumulatorLight);
lightPos[3] = 0.0f;

bgfx::setUniform(u_lightPos, lightPos);
Expand Down
8 changes: 4 additions & 4 deletions examples/16-shadowmaps/shadowmaps.cpp
Expand Up @@ -2165,16 +2165,16 @@ int _main_(int /*_argc*/, char** /*_argv*/)
if (settings.m_updateScene) { timeAccumulatorScene += deltaTime; }

// Setup lights.
pointLight.m_position.m_x = cos(timeAccumulatorLight) * 20.0f;
pointLight.m_position.m_x = cosf(timeAccumulatorLight) * 20.0f;
pointLight.m_position.m_y = 26.0f;
pointLight.m_position.m_z = sin(timeAccumulatorLight) * 20.0f;
pointLight.m_position.m_z = sinf(timeAccumulatorLight) * 20.0f;
pointLight.m_spotDirectionInner.m_x = -pointLight.m_position.m_x;
pointLight.m_spotDirectionInner.m_y = -pointLight.m_position.m_y;
pointLight.m_spotDirectionInner.m_z = -pointLight.m_position.m_z;

directionalLight.m_position.m_x = -cos(timeAccumulatorLight);
directionalLight.m_position.m_x = -cosf(timeAccumulatorLight);
directionalLight.m_position.m_y = -1.0f;
directionalLight.m_position.m_z = -sin(timeAccumulatorLight);
directionalLight.m_position.m_z = -sinf(timeAccumulatorLight);

// Setup instance matrices.
float mtxFloor[16];
Expand Down
20 changes: 10 additions & 10 deletions examples/20-nanovg/nanovg.cpp
Expand Up @@ -387,7 +387,7 @@ void drawEyes(struct NVGcontext* vg, float x, float y, float w, float h, float m
float ry = y + ey;
float dx,dy,d;
float br = (ex < ey ? ex : ey) * 0.5f;
float blink = 1 - pow(sinf(t*0.5f),200)*0.8f;
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));
nvgBeginPath(vg);
Expand Down Expand Up @@ -1075,11 +1075,11 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h
nvgBeginPath(vg);
nvgFillColor(vg, nvgRGBA(255,192,0,255));
nvgRoundedRect(vg
, round(bounds[0])-4.0f
, round(bounds[1])-2.0f
, round(bounds[2]-bounds[0])+8.0f
, round(bounds[3]-bounds[1])+4.0f
, (round(bounds[3]-bounds[1])+4.0f)/2.0f-1.0f
, roundf(bounds[0])-4.0f
, roundf(bounds[1])-2.0f
, roundf(bounds[2]-bounds[0])+8.0f
, roundf(bounds[3]-bounds[1])+4.0f
, (roundf(bounds[3]-bounds[1])+4.0f)/2.0f-1.0f
);
nvgFill(vg);

Expand All @@ -1097,10 +1097,10 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h
nvgBeginPath(vg);
nvgFillColor(vg, nvgRGBA(220,220,220,255));
nvgRoundedRect(vg
, round(bounds[0]-2.0f)
, round(bounds[1]-2.0f)
, round(bounds[2]-bounds[0])+4.0f
, round(bounds[3]-bounds[1])+4.0f
, roundf(bounds[0]-2.0f)
, roundf(bounds[1]-2.0f)
, roundf(bounds[2]-bounds[0])+4.0f
, roundf(bounds[3]-bounds[1])+4.0f
, 3.0f
);
px = float( (int)((bounds[2]+bounds[0])/2) );
Expand Down
8 changes: 4 additions & 4 deletions examples/21-deferred/deferred.cpp
Expand Up @@ -529,10 +529,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
{
Sphere lightPosRadius;

float lightTime = time * lightAnimationSpeed * (sin(light/float(numLights) * bx::piHalf ) * 0.5f + 0.5f);
lightPosRadius.m_center[0] = sin( ( (lightTime + light*0.47f) + bx::piHalf*1.37f ) )*offset;
lightPosRadius.m_center[1] = cos( ( (lightTime + light*0.69f) + bx::piHalf*1.49f ) )*offset;
lightPosRadius.m_center[2] = sin( ( (lightTime + light*0.37f) + bx::piHalf*1.57f ) )*2.0f;
float lightTime = time * lightAnimationSpeed * (sinf(light/float(numLights) * bx::piHalf ) * 0.5f + 0.5f);
lightPosRadius.m_center[0] = sinf( ( (lightTime + light*0.47f) + bx::piHalf*1.37f ) )*offset;
lightPosRadius.m_center[1] = cosf( ( (lightTime + light*0.69f) + bx::piHalf*1.49f ) )*offset;
lightPosRadius.m_center[2] = sinf( ( (lightTime + light*0.37f) + bx::piHalf*1.57f ) )*2.0f;
lightPosRadius.m_radius = 2.0f;

Aabb aabb;
Expand Down
4 changes: 2 additions & 2 deletions examples/23-vectordisplay/main.cpp
Expand Up @@ -150,8 +150,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// draw moving shape
static float counter = 0.0f;
counter += 0.01f;
float posX = width / 2.0f + sin(counter * 3.18378f) * (width / 2.0f);
float posY = height / 2.0f + cos(counter) * (height / 2.0f);
float posX = width / 2.0f + sinf(counter * 3.18378f) * (width / 2.0f);
float posY = height / 2.0f + cosf(counter) * (height / 2.0f);
vd.drawCircle(posX, posY, 5.0f, 10.0f);

vd.endFrame();
Expand Down
6 changes: 3 additions & 3 deletions examples/common/bounds.cpp
Expand Up @@ -264,9 +264,9 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num
{
position = (float*)&vertex[index*_stride];

float xx = position[0] - center[0];
float yy = position[1] - center[1];
float zz = position[2] - center[2];
xx = position[0] - center[0];
yy = position[1] - center[1];
zz = position[2] - center[2];
float distSq = xx*xx + yy*yy + zz*zz;

if (distSq > maxDistSq)
Expand Down

0 comments on commit a34e6e7

Please sign in to comment.