|
@@ -47,7 +47,7 @@ bgfx::VertexDecl PosColorUvVertex::ms_decl;
|
|
|
|
|
|
|
|
inline float normalizef(float _a)
|
|
inline float normalizef(float _a)
|
|
|
{
|
|
{
|
|
|
- return bx::fwrap(_a, 2.0f * bx::pi);
|
|
|
|
|
|
|
+ return bx::fwrap(_a, 2.0f * bx::kPi);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
VectorDisplay::VectorDisplay(bool _originBottomLeft, float _texelHalf)
|
|
VectorDisplay::VectorDisplay(bool _originBottomLeft, float _texelHalf)
|
|
@@ -368,12 +368,12 @@ void VectorDisplay::endDraw()
|
|
|
float a2pa = normalizef(line->a - pline->a);
|
|
float a2pa = normalizef(line->a - pline->a);
|
|
|
float maxshorten = bx::fmin(line->len, pline->len) / 2.0f;
|
|
float maxshorten = bx::fmin(line->len, pline->len) / 2.0f;
|
|
|
|
|
|
|
|
- if (bx::fmin(a2pa, pa2a) <= (bx::pi / 2.0f + FLT_EPSILON) )
|
|
|
|
|
|
|
+ if (bx::fmin(a2pa, pa2a) <= (bx::kPi / 2.0f + FLT_EPSILON) )
|
|
|
{
|
|
{
|
|
|
if (a2pa < pa2a)
|
|
if (a2pa < pa2a)
|
|
|
{
|
|
{
|
|
|
float shorten = t * bx::fsin(a2pa / 2.0f) / bx::fcos(a2pa / 2.0f);
|
|
float shorten = t * bx::fsin(a2pa / 2.0f) / bx::fcos(a2pa / 2.0f);
|
|
|
- float a = (bx::pi - a2pa) / 2.0f;
|
|
|
|
|
|
|
+ float a = (bx::kPi - a2pa) / 2.0f;
|
|
|
if (shorten > maxshorten)
|
|
if (shorten > maxshorten)
|
|
|
{
|
|
{
|
|
|
line->s0 = pline->s1 = maxshorten;
|
|
line->s0 = pline->s1 = maxshorten;
|
|
@@ -389,7 +389,7 @@ void VectorDisplay::endDraw()
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
float shorten = t * bx::fsin(pa2a / 2.0f) / bx::fcos(pa2a / 2.0f);
|
|
float shorten = t * bx::fsin(pa2a / 2.0f) / bx::fcos(pa2a / 2.0f);
|
|
|
- float a = (bx::pi - pa2a) / 2.0f;
|
|
|
|
|
|
|
+ float a = (bx::kPi - pa2a) / 2.0f;
|
|
|
if (shorten > maxshorten)
|
|
if (shorten > maxshorten)
|
|
|
{
|
|
{
|
|
|
line->s0 = pline->s1 = maxshorten;
|
|
line->s0 = pline->s1 = maxshorten;
|
|
@@ -474,11 +474,11 @@ void VectorDisplay::drawCircle(float _x, float _y, float _radius, float _steps)
|
|
|
float edgeangle = 0.0f;
|
|
float edgeangle = 0.0f;
|
|
|
float angadjust = 0.0f;
|
|
float angadjust = 0.0f;
|
|
|
|
|
|
|
|
- float step = bx::pi * 2.0f / _steps;
|
|
|
|
|
|
|
+ float step = bx::kPi * 2.0f / _steps;
|
|
|
|
|
|
|
|
beginDraw(_x + _radius * bx::fsin(edgeangle + angadjust),
|
|
beginDraw(_x + _radius * bx::fsin(edgeangle + angadjust),
|
|
|
_y - _radius * bx::fcos(edgeangle + angadjust) );
|
|
_y - _radius * bx::fcos(edgeangle + angadjust) );
|
|
|
- for (edgeangle = 0; edgeangle < 2.0f * bx::pi - 0.001; edgeangle += step)
|
|
|
|
|
|
|
+ for (edgeangle = 0; edgeangle < 2.0f * bx::kPi - 0.001; edgeangle += step)
|
|
|
{
|
|
{
|
|
|
drawTo(_x + _radius * bx::fsin(edgeangle + step - angadjust),
|
|
drawTo(_x + _radius * bx::fsin(edgeangle + step - angadjust),
|
|
|
_y - _radius * bx::fcos(edgeangle + step - angadjust) );
|
|
_y - _radius * bx::fcos(edgeangle + step - angadjust) );
|
|
@@ -495,28 +495,28 @@ void VectorDisplay::drawWheel(float _angle, float _x, float _y, float _radius)
|
|
|
_y - spokeradius * bx::fcos(_angle),
|
|
_y - spokeradius * bx::fcos(_angle),
|
|
|
_x - spokeradius * bx::fsin(_angle),
|
|
_x - spokeradius * bx::fsin(_angle),
|
|
|
_y + spokeradius * bx::fcos(_angle) );
|
|
_y + spokeradius * bx::fcos(_angle) );
|
|
|
- drawLine(_x + spokeradius * bx::fsin(_angle + bx::pi / 4.0f),
|
|
|
|
|
- _y - spokeradius * bx::fcos(_angle + bx::pi / 4.0f),
|
|
|
|
|
- _x - spokeradius * bx::fsin(_angle + bx::pi / 4.0f),
|
|
|
|
|
- _y + spokeradius * bx::fcos(_angle + bx::pi / 4.0f) );
|
|
|
|
|
- drawLine(_x + spokeradius * bx::fsin(_angle + bx::pi / 2.0f),
|
|
|
|
|
- _y - spokeradius * bx::fcos(_angle + bx::pi / 2.0f),
|
|
|
|
|
- _x - spokeradius * bx::fsin(_angle + bx::pi / 2.0f),
|
|
|
|
|
- _y + spokeradius * bx::fcos(_angle + bx::pi / 2.0f) );
|
|
|
|
|
- drawLine(_x + spokeradius * bx::fsin(_angle + 3.0f * bx::pi / 4.0f),
|
|
|
|
|
- _y - spokeradius * bx::fcos(_angle + 3.0f * bx::pi / 4.0f),
|
|
|
|
|
- _x - spokeradius * bx::fsin(_angle + 3.0f * bx::pi / 4.0f),
|
|
|
|
|
- _y + spokeradius * bx::fcos(_angle + 3.0f * bx::pi / 4.0f) );
|
|
|
|
|
|
|
+ drawLine(_x + spokeradius * bx::fsin(_angle + bx::kPi / 4.0f),
|
|
|
|
|
+ _y - spokeradius * bx::fcos(_angle + bx::kPi / 4.0f),
|
|
|
|
|
+ _x - spokeradius * bx::fsin(_angle + bx::kPi / 4.0f),
|
|
|
|
|
+ _y + spokeradius * bx::fcos(_angle + bx::kPi / 4.0f) );
|
|
|
|
|
+ drawLine(_x + spokeradius * bx::fsin(_angle + bx::kPi / 2.0f),
|
|
|
|
|
+ _y - spokeradius * bx::fcos(_angle + bx::kPi / 2.0f),
|
|
|
|
|
+ _x - spokeradius * bx::fsin(_angle + bx::kPi / 2.0f),
|
|
|
|
|
+ _y + spokeradius * bx::fcos(_angle + bx::kPi / 2.0f) );
|
|
|
|
|
+ drawLine(_x + spokeradius * bx::fsin(_angle + 3.0f * bx::kPi / 4.0f),
|
|
|
|
|
+ _y - spokeradius * bx::fcos(_angle + 3.0f * bx::kPi / 4.0f),
|
|
|
|
|
+ _x - spokeradius * bx::fsin(_angle + 3.0f * bx::kPi / 4.0f),
|
|
|
|
|
+ _y + spokeradius * bx::fcos(_angle + 3.0f * bx::kPi / 4.0f) );
|
|
|
|
|
|
|
|
float edgeangle = 0.0f;
|
|
float edgeangle = 0.0f;
|
|
|
float angadjust = 0.0f;
|
|
float angadjust = 0.0f;
|
|
|
|
|
|
|
|
beginDraw(_x + _radius * bx::fsin(_angle + edgeangle + angadjust),
|
|
beginDraw(_x + _radius * bx::fsin(_angle + edgeangle + angadjust),
|
|
|
_y - _radius * bx::fcos(_angle + edgeangle + angadjust) );
|
|
_y - _radius * bx::fcos(_angle + edgeangle + angadjust) );
|
|
|
- for (edgeangle = 0; edgeangle < 2.0f * bx::pi - 0.001f; edgeangle += bx::pi / 4.0f)
|
|
|
|
|
|
|
+ for (edgeangle = 0; edgeangle < 2.0f * bx::kPi - 0.001f; edgeangle += bx::kPi / 4.0f)
|
|
|
{
|
|
{
|
|
|
- drawTo(_x + _radius * bx::fsin(_angle + edgeangle + bx::pi / 4.0f - angadjust),
|
|
|
|
|
- _y - _radius * bx::fcos(_angle + edgeangle + bx::pi / 4.0f - angadjust) );
|
|
|
|
|
|
|
+ drawTo(_x + _radius * bx::fsin(_angle + edgeangle + bx::kPi / 4.0f - angadjust),
|
|
|
|
|
+ _y - _radius * bx::fcos(_angle + edgeangle + bx::kPi / 4.0f - angadjust) );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
endDraw();
|
|
endDraw();
|
|
@@ -603,7 +603,7 @@ void VectorDisplay::drawFan(float _cx, float _cy, float _pa, float _a, float _t,
|
|
|
if (a2pa < pa2a)
|
|
if (a2pa < pa2a)
|
|
|
{
|
|
{
|
|
|
_t = -_t;
|
|
_t = -_t;
|
|
|
- nsteps = (int)bx::fmax(1, bx::fround(a2pa / (bx::pi / 8.0f) ) );
|
|
|
|
|
|
|
+ nsteps = (int)bx::fmax(1, bx::fround(a2pa / (bx::kPi / 8.0f) ) );
|
|
|
angles = (float*)alloca(sizeof(float) * (nsteps + 1) );
|
|
angles = (float*)alloca(sizeof(float) * (nsteps + 1) );
|
|
|
for (i = 0; i <= nsteps; i++)
|
|
for (i = 0; i <= nsteps; i++)
|
|
|
{
|
|
{
|
|
@@ -612,7 +612,7 @@ void VectorDisplay::drawFan(float _cx, float _cy, float _pa, float _a, float _t,
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- nsteps = (int)bx::fmax(1, bx::fround(pa2a / (bx::pi / 8.0f) ) );
|
|
|
|
|
|
|
+ nsteps = (int)bx::fmax(1, bx::fround(pa2a / (bx::kPi / 8.0f) ) );
|
|
|
angles = (float*)alloca(sizeof(float) * (nsteps + 1) );
|
|
angles = (float*)alloca(sizeof(float) * (nsteps + 1) );
|
|
|
for (i = 0; i <= nsteps; i++)
|
|
for (i = 0; i <= nsteps; i++)
|
|
|
{
|
|
{
|