~ubuntu-branches/ubuntu/utopic/lebiniou/utopic

« back to all changes in this revision

Viewing changes to src/params3d.c

  • Committer: Package Import Robot
  • Author(s): Olivier Girondel
  • Date: 2012-04-22 22:07:40 UTC
  • mfrom: (6.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120422220740-xncgwhc3g71nopnu
Tags: 3.18-1
* New upstream release 3.18.
* Support older libswscale.
* Add missing Build-Depends: libfreetype6-dev, libasound2-dev,
  libpulse-dev. (Closes: #669437)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright 1994-2011 Olivier Girondel
 
2
 *  Copyright 1994-2012 Olivier Girondel
3
3
 *
4
4
 *  This file is part of lebiniou.
5
5
 *
99
99
 
100
100
  p->xs = p->xe = HWIDTH;
101
101
  p->ys = p->ye = HHEIGHT;
 
102
#ifdef WITH_GL
 
103
  p->gl_xs = p->gl_xe = HWIDTH;
 
104
  p->gl_ys = p->gl_ye = HHEIGHT;
 
105
#endif
102
106
 
103
107
  init_sphere_3d();
104
108
  zero_3d(p);
106
110
  p->auto_rotate[Y_AXIS] = 1;
107
111
  p->rotate_amount[Y_AXIS] = 3 * ROT_STEP;
108
112
 
109
 
#ifdef Z_BUFFER
110
 
  Params3d_init_z_buffer();
111
 
#endif
112
 
 
113
113
  p->do_auto_rotate = 0;
114
114
  p->rotate_amount[X_AXIS] = 1 * ROT_STEP;
115
115
  p->rotate_amount[Y_AXIS] = 2 * ROT_STEP;
116
116
  p->rotate_amount[Z_AXIS] = 4 * ROT_STEP;
 
117
 
 
118
#ifdef WITH_GL
 
119
  p->gl_fov = 45; /* FIXME empirical value */
 
120
#endif
117
121
}
118
122
 
119
123
 
213
217
  float dy = (p->ye-p->ys)/(float)(HEIGHT/8);
214
218
 
215
219
  /* printf ("dx= %f, dy= %f\n", dx, dy); */
216
 
        
 
220
 
 
221
  // BUGGY (Y/X) then check (X/Z)?!
217
222
  p->rotations[Y_AXIS] += dx;
218
223
  p->rotations[X_AXIS] += dy;
219
224
        
235
240
 
236
241
 
237
242
void
 
243
Params3d_rotate_GL(Params3d_t *p)
 
244
{
 
245
  float dx = (p->gl_xe-p->gl_xs)/(float)(WIDTH/8);
 
246
  float dy = (p->gl_ye-p->gl_ys)/(float)(HEIGHT/8);
 
247
 
 
248
  // printf ("dx= %f, dy= %f\n", dx, dy);
 
249
        
 
250
  p->gl_rotations[Y_AXIS] += dx*30;
 
251
  p->gl_rotations[X_AXIS] += dy*30;
 
252
        
 
253
  if (p->gl_rotations[Y_AXIS] > 360)
 
254
    p->gl_rotations[Y_AXIS] -= 360;
 
255
  else if (p->gl_rotations[Y_AXIS] < 0)
 
256
    p->gl_rotations[Y_AXIS] += 360;
 
257
        
 
258
  if (p->rotations[X_AXIS] > 360)
 
259
    p->rotations[X_AXIS] -= 360;
 
260
  else if (p->rotations[X_AXIS] < 0)
 
261
    p->rotations[X_AXIS] += 360;
 
262
        
 
263
  p->gl_xs = p->gl_xe;
 
264
  p->gl_ys = p->gl_ye;
 
265
}
 
266
 
 
267
 
 
268
void
238
269
Params3d_change_rotations(Params3d_t *p)
239
270
{
240
271
  int i, changed = 0;
249
280
}
250
281
 
251
282
 
252
 
#ifdef Z_BUFFER
253
 
void
254
 
Params3d_init_z_buffer()
255
 
{
256
 
  int i, j;
257
 
  
258
 
  for (j = 0; j < HEIGHT; j++)
259
 
    for (i = 0; i < WIDTH; i++)
260
 
      z_buffer[j][i] = -1e6;
261
 
}
262
 
#endif
263
 
 
264
 
 
265
283
void
266
284
update_x(Params3d_t *p)
267
285
{