mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 06:14:28 +08:00
Solve all 'fractals' warnings in VS2017/Win32 for issue #109.
This commit is contained in:
+50
-49
@@ -39,18 +39,18 @@
|
|||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* Initial polar movement settings */
|
/* Initial polar movement settings */
|
||||||
#define INIT_POLAR_AZ 0.0
|
#define INIT_POLAR_AZ 0.0f
|
||||||
#define INIT_POLAR_EL 30.0
|
#define INIT_POLAR_EL 30.0f
|
||||||
#define INIT_DIST 4.0
|
#define INIT_DIST 4.0f
|
||||||
#define INIT_AZ_SPIN 0.5
|
#define INIT_AZ_SPIN 0.5f
|
||||||
#define INIT_EL_SPIN 0.0
|
#define INIT_EL_SPIN 0.0f
|
||||||
|
|
||||||
/* Initial flying movement settings */
|
/* Initial flying movement settings */
|
||||||
#define INIT_EX 0.0
|
#define INIT_EX 0.0f
|
||||||
#define INIT_EY -2.0
|
#define INIT_EY -2.0f
|
||||||
#define INIT_EZ -2.0
|
#define INIT_EZ -2.0f
|
||||||
#define INIT_MOVE 0.01
|
#define INIT_MOVE 0.01f
|
||||||
#define MINMOVE 0.001
|
#define MINMOVE 0.001f
|
||||||
|
|
||||||
/* Start in this mode */
|
/* Start in this mode */
|
||||||
#define INIT_MODE POLAR
|
#define INIT_MODE POLAR
|
||||||
@@ -58,30 +58,30 @@
|
|||||||
/* Controls: */
|
/* Controls: */
|
||||||
|
|
||||||
/* map 0-9 to an EyeMove value when number key is hit in FLYING mode */
|
/* map 0-9 to an EyeMove value when number key is hit in FLYING mode */
|
||||||
#define SPEEDFUNCTION(x) ((x)*(x)*0.001)
|
#define SPEEDFUNCTION(x) ((x)*(x)*0.001f)
|
||||||
|
|
||||||
/* Multiply EyeMove by (1+-MOVEFRACTION) when +/- hit in FLYING mode */
|
/* Multiply EyeMove by (1+-MOVEFRACTION) when +/- hit in FLYING mode */
|
||||||
#define MOVEFRACTION 0.25
|
#define MOVEFRACTION 0.25f
|
||||||
|
|
||||||
/* What to multiply number of pixels mouse moved by to get rotation amount */
|
/* What to multiply number of pixels mouse moved by to get rotation amount */
|
||||||
#define EL_SENS 0.5
|
#define EL_SENS 0.5f
|
||||||
#define AZ_SENS 0.5
|
#define AZ_SENS 0.5f
|
||||||
|
|
||||||
/* What to multiply number of pixels mouse moved by for movement amounts */
|
/* What to multiply number of pixels mouse moved by for movement amounts */
|
||||||
#define DIST_SENS 0.01
|
#define DIST_SENS 0.01f
|
||||||
#define E_SENS 0.01
|
#define E_SENS 0.01f
|
||||||
|
|
||||||
/* Minimum spin to allow in polar (lower forced to zero) */
|
/* Minimum spin to allow in polar (lower forced to zero) */
|
||||||
#define MIN_AZSPIN 0.1
|
#define MIN_AZSPIN 0.1f
|
||||||
#define MIN_ELSPIN 0.1
|
#define MIN_ELSPIN 0.1f
|
||||||
|
|
||||||
/* Factors used in computing dAz and dEl (which determine AzSpin, ElSpin) */
|
/* Factors used in computing dAz and dEl (which determine AzSpin, ElSpin) */
|
||||||
#define SLOW_DAZ 0.90
|
#define SLOW_DAZ 0.90f
|
||||||
#define SLOW_DEL 0.90
|
#define SLOW_DEL 0.90f
|
||||||
#define PREV_DAZ 0.80
|
#define PREV_DAZ 0.80f
|
||||||
#define PREV_DEL 0.80
|
#define PREV_DEL 0.80f
|
||||||
#define CUR_DAZ 0.20
|
#define CUR_DAZ 0.20f
|
||||||
#define CUR_DEL 0.20
|
#define CUR_DEL 0.20f
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/************************** GLOBALS ****************************/
|
/************************** GLOBALS ****************************/
|
||||||
@@ -182,9 +182,9 @@ void FlyLookFrom(GLfloat x, GLfloat y, GLfloat z, GLfloat az, GLfloat el)
|
|||||||
{
|
{
|
||||||
float lookat[3], perp[3], up[3];
|
float lookat[3], perp[3], up[3];
|
||||||
|
|
||||||
lookat[0] = sin(TORAD(az))*cos(TORAD(el));
|
lookat[0] = GLfloat(sin(TORAD(az))*cos(TORAD(el)));
|
||||||
lookat[1] = sin(TORAD(el));
|
lookat[1] = GLfloat(sin(TORAD(el)));
|
||||||
lookat[2] = -cos(TORAD(az))*cos(TORAD(el));
|
lookat[2] = GLfloat(-cos(TORAD(az))*cos(TORAD(el)));
|
||||||
normalize(lookat);
|
normalize(lookat);
|
||||||
perp[0] = lookat[2];
|
perp[0] = lookat[2];
|
||||||
perp[1] = 0;
|
perp[1] = 0;
|
||||||
@@ -219,10 +219,10 @@ void agvViewTransform(void)
|
|||||||
int ConstrainEl(void)
|
int ConstrainEl(void)
|
||||||
{
|
{
|
||||||
if (EyeEl <= -90) {
|
if (EyeEl <= -90) {
|
||||||
EyeEl = -89.99;
|
EyeEl = -89.99f;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (EyeEl >= 90) {
|
} else if (EyeEl >= 90) {
|
||||||
EyeEl = 89.99;
|
EyeEl = 89.99f;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -235,9 +235,9 @@ void agvMove(void)
|
|||||||
{
|
{
|
||||||
switch (MoveMode) {
|
switch (MoveMode) {
|
||||||
case FLYING:
|
case FLYING:
|
||||||
Ex += EyeMove*sin(TORAD(EyeAz))*cos(TORAD(EyeEl));
|
Ex += GLfloat(EyeMove*sin(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
||||||
Ey += EyeMove*sin(TORAD(EyeEl));
|
Ey += GLfloat(EyeMove*sin(TORAD(EyeEl)));
|
||||||
Ez -= EyeMove*cos(TORAD(EyeAz))*cos(TORAD(EyeEl));
|
Ez -= GLfloat(EyeMove*cos(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POLAR:
|
case POLAR:
|
||||||
@@ -247,7 +247,7 @@ void agvMove(void)
|
|||||||
ElSpin = -ElSpin; /* look better when you are kept from going */
|
ElSpin = -ElSpin; /* look better when you are kept from going */
|
||||||
/* upside down while spinning - Isn't great */
|
/* upside down while spinning - Isn't great */
|
||||||
if (fabs(ElSpin) > fabs(AzSpin))
|
if (fabs(ElSpin) > fabs(AzSpin))
|
||||||
AzSpin = fabs(ElSpin) * ((AzSpin > 0) ? 1 : -1);
|
AzSpin = fabs(ElSpin) * (AzSpin > 0.0f) ? 1.0f : -1.0f;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -305,9 +305,9 @@ void agvSwitchMoveMode(int move)
|
|||||||
switch (move) {
|
switch (move) {
|
||||||
case FLYING:
|
case FLYING:
|
||||||
if (MoveMode == FLYING) return;
|
if (MoveMode == FLYING) return;
|
||||||
Ex = -EyeDist*sin(TORAD(EyeAz))*cos(TORAD(EyeEl));
|
Ex = GLfloat(-EyeDist*sin(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
||||||
Ey = EyeDist*sin(TORAD(EyeEl));
|
Ey = GLfloat( EyeDist*sin(TORAD(EyeEl)));
|
||||||
Ez = EyeDist*(cos(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
Ez = GLfloat( EyeDist*(cos(TORAD(EyeAz))*cos(TORAD(EyeEl))));
|
||||||
EyeEl = -EyeEl;
|
EyeEl = -EyeEl;
|
||||||
EyeMove = INIT_MOVE;
|
EyeMove = INIT_MOVE;
|
||||||
break;
|
break;
|
||||||
@@ -347,9 +347,9 @@ void agvHandleButton(int button, int state, int x, int y)
|
|||||||
EyeMove = 0;
|
EyeMove = 0;
|
||||||
|
|
||||||
EyeDist = downDist + deltay;
|
EyeDist = downDist + deltay;
|
||||||
Ex = downEx - E_SENS*deltay*sin(TORAD(EyeAz))*cos(TORAD(EyeEl));
|
Ex = GLfloat(downEx - E_SENS*deltay*sin(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
||||||
Ey = downEy - E_SENS*deltay*sin(TORAD(EyeEl));
|
Ey = GLfloat(downEy - E_SENS*deltay*sin(TORAD(EyeEl)));
|
||||||
Ez = downEz + E_SENS*deltay*cos(TORAD(EyeAz))*cos(TORAD(EyeEl));
|
Ez = GLfloat(downEz + E_SENS*deltay*cos(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
||||||
|
|
||||||
EyeMove = downEyeMove;
|
EyeMove = downEyeMove;
|
||||||
glutPostRedisplay();
|
glutPostRedisplay();
|
||||||
@@ -413,19 +413,19 @@ void agvHandleMotion(int x, int y)
|
|||||||
|
|
||||||
switch (downb) {
|
switch (downb) {
|
||||||
case GLUT_LEFT_BUTTON:
|
case GLUT_LEFT_BUTTON:
|
||||||
EyeEl = downEl + EL_SENS * deltay;
|
EyeEl = GLfloat(downEl + EL_SENS * deltay);
|
||||||
ConstrainEl();
|
ConstrainEl();
|
||||||
EyeAz = downAz + AZ_SENS * deltax;
|
EyeAz = GLfloat(downAz + AZ_SENS * deltax);
|
||||||
dAz = PREV_DAZ*dAz + CUR_DAZ*(lastAz - EyeAz);
|
dAz = GLfloat(PREV_DAZ*dAz + CUR_DAZ*(lastAz - EyeAz));
|
||||||
dEl = PREV_DEL*dEl + CUR_DEL*(lastEl - EyeEl);
|
dEl = GLfloat(PREV_DEL*dEl + CUR_DEL*(lastEl - EyeEl));
|
||||||
lastAz = EyeAz;
|
lastAz = EyeAz;
|
||||||
lastEl = EyeEl;
|
lastEl = EyeEl;
|
||||||
break;
|
break;
|
||||||
case GLUT_MIDDLE_BUTTON:
|
case GLUT_MIDDLE_BUTTON:
|
||||||
EyeDist = downDist + DIST_SENS*deltay;
|
EyeDist = GLfloat(downDist + DIST_SENS*deltay);
|
||||||
Ex = downEx - E_SENS*deltay*sin(TORAD(EyeAz))*cos(TORAD(EyeEl));
|
Ex = GLfloat(downEx - E_SENS*deltay*sin(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
||||||
Ey = downEy - E_SENS*deltay*sin(TORAD(EyeEl));
|
Ey = GLfloat(downEy - E_SENS*deltay*sin(TORAD(EyeEl)));
|
||||||
Ez = downEz + E_SENS*deltay*cos(TORAD(EyeAz))*cos(TORAD(EyeEl));
|
Ez = GLfloat(downEz + E_SENS*deltay*cos(TORAD(EyeAz))*cos(TORAD(EyeEl)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
glutPostRedisplay();
|
glutPostRedisplay();
|
||||||
@@ -479,7 +479,7 @@ void agvHandleKeys(unsigned char key, int, int) {
|
|||||||
/* normalizes v */
|
/* normalizes v */
|
||||||
static void normalize(GLfloat v[3])
|
static void normalize(GLfloat v[3])
|
||||||
{
|
{
|
||||||
GLfloat d = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
GLfloat d = sqrtf(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
||||||
|
|
||||||
if (d == 0)
|
if (d == 0)
|
||||||
fprintf(stderr, "Zero length vector in normalize\n");
|
fprintf(stderr, "Zero length vector in normalize\n");
|
||||||
@@ -507,6 +507,7 @@ void agvMakeAxesList(int displaylistnum)
|
|||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
GLfloat axes_ambuse[] = { 0.5, 0.0, 0.0, 1.0 };
|
GLfloat axes_ambuse[] = { 0.5, 0.0, 0.0, 1.0 };
|
||||||
|
GLfloat trans = -10;
|
||||||
glNewList(displaylistnum, GL_COMPILE);
|
glNewList(displaylistnum, GL_COMPILE);
|
||||||
glPushAttrib(GL_LIGHTING_BIT);
|
glPushAttrib(GL_LIGHTING_BIT);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
@@ -518,7 +519,7 @@ void agvMakeAxesList(int displaylistnum)
|
|||||||
glEnd();
|
glEnd();
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(-10*(i==0), -10*(i==1), -10*(i==2));
|
glTranslatef(trans*(i==0), trans*(i==1), trans*(i==2));
|
||||||
for (j = 0; j < 21; j++) {
|
for (j = 0; j < 21; j++) {
|
||||||
// glutSolidCube(0.1);
|
// glutSolidCube(0.1);
|
||||||
glTranslatef(i==0, i==1, i==2);
|
glTranslatef(i==0, i==1, i==2);
|
||||||
|
|||||||
Reference in New Issue
Block a user