mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Fixed VS2015 warnings.
This commit is contained in:
2
3rdparty/sdf/sdf.h
vendored
2
3rdparty/sdf/sdf.h
vendored
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -1217,6 +1216,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
, s_renderStates[RenderState::StencilReflection_DrawScene]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -2276,9 +2276,9 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -2286,9 +2286,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
|
||||
@@ -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) );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user