~ubuntu-branches/ubuntu/raring/xscreensaver/raring

« back to all changes in this revision

Viewing changes to hacks/glx/molecule.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-11-17 15:40:52 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20101117154052-w4ou7vty38gpp1r3
Tags: 5.12-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#define DEFAULTS        "*delay:        10000         \n" \
28
28
                        "*showFPS:      False         \n" \
29
29
                        "*wireframe:    False         \n" \
30
 
                        "*atomFont:   -*-helvetica-medium-r-normal-*-240-*\n" \
 
30
                        "*atomFont:   -*-helvetica-medium-r-normal-*-180-*\n" \
 
31
                        "*atomFont2:  -*-helvetica-bold-r-normal-*-80-*\n" \
31
32
                        "*titleFont:  -*-helvetica-medium-r-normal-*-180-*\n" \
32
33
                        "*noLabelThreshold:    30     \n" \
33
34
                        "*wireframeThreshold:  150    \n" \
65
66
#define DEF_MOLECULE    "(default)"
66
67
#define DEF_VERBOSE     "False"
67
68
 
68
 
#define SPHERE_SLICES 24  /* how densely to render spheres */
69
 
#define SPHERE_STACKS 12
 
69
#define SPHERE_SLICES 48  /* how densely to render spheres */
 
70
#define SPHERE_STACKS 24
70
71
 
71
72
#define SMOOTH_TUBE       /* whether to have smooth or faceted tubes */
72
73
 
76
77
# define TUBE_FACES  8
77
78
#endif
78
79
 
79
 
#define SPHERE_SLICES_2  7
80
 
#define SPHERE_STACKS_2  4
81
 
#define TUBE_FACES_2     3
 
80
#define SPHERE_SLICES_2  14
 
81
#define SPHERE_STACKS_2  8
 
82
#define TUBE_FACES_2     6
82
83
 
83
84
 
84
85
# ifdef __GNUC__
104
105
   and their approximate size in angstroms.
105
106
 */
106
107
static const atom_data all_atom_data[] = {
107
 
  { "H",    1.17,  0.40, "#FFFFFF", "#B3B3B3", { 0, }},
 
108
  { "H",    1.17,  0.40, "#FFFFFF", "#000000", { 0, }},
108
109
  { "C",    1.75,  0.58, "#999999", "#FFFFFF", { 0, }},
109
110
  { "CA",   1.80,  0.60, "#0000FF", "#ADD8E6", { 0, }},
110
 
  { "N",    1.55,  0.52, "#A2B5CD", "#836FFF", { 0, }},
 
111
  { "N",    1.55,  0.52, "#A2B5CD", "#EE99FF", { 0, }},
111
112
  { "O",    1.40,  0.47, "#FF0000", "#FFB6C1", { 0, }},
112
113
  { "P",    1.28,  0.43, "#9370DB", "#DB7093", { 0, }},
113
114
  { "S",    1.80,  0.60, "#8B8B00", "#FFFF00", { 0, }},
159
160
  GLuint molecule_dlist;
160
161
  GLuint shell_dlist;
161
162
 
162
 
  XFontStruct *xfont1, *xfont2;
163
 
  GLuint font1_dlist, font2_dlist;
 
163
  XFontStruct *xfont1, *xfont2, *xfont3;
 
164
  GLuint font1_dlist, font2_dlist, font3_dlist;
164
165
  int polygon_count;
165
166
 
166
167
  time_t draw_time;
258
259
{
259
260
  molecule_configuration *mc = &mcs[MI_SCREEN(mi)];
260
261
  load_font (mi->dpy, "atomFont",  &mc->xfont1, &mc->font1_dlist);
261
 
  load_font (mi->dpy, "titleFont", &mc->xfont2, &mc->font2_dlist);
 
262
  load_font (mi->dpy, "atomFont2", &mc->xfont2, &mc->font2_dlist);
 
263
  load_font (mi->dpy, "titleFont", &mc->xfont3, &mc->font3_dlist);
262
264
}
263
265
 
264
266
 
333
335
  
334
336
  gl_color[3] = alpha;
335
337
 
 
338
  /* If we're not drawing atoms, and the color is black, use white instead.
 
339
     This is a kludge so that H can have black text over its white ball,
 
340
     but the text still shows up if balls are off.
 
341
   */
 
342
  if (font_p && !do_atoms &&
 
343
      gl_color[0] == 0 && gl_color[1] == 0 && gl_color[2] == 0)
 
344
    {
 
345
      gl_color[0] = gl_color[1] = gl_color[2] = 1;
 
346
    }
 
347
 
336
348
  if (font_p)
337
349
    glColor4f (gl_color[0], gl_color[1], gl_color[2], gl_color[3]);
338
350
  else
1195
1207
{
1196
1208
  molecule_configuration *mc = &mcs[MI_SCREEN(mi)];
1197
1209
  const char *s = "Constructing molecules...";
1198
 
  print_gl_string (mi->dpy, mc->xfont2, mc->font2_dlist,
 
1210
  print_gl_string (mi->dpy, mc->xfont3, mc->font3_dlist,
1199
1211
                   mi->xgwa.width, mi->xgwa.height,
1200
1212
                   10, mi->xgwa.height - 10,
1201
1213
                   s, False);
1353
1365
  molecule_configuration *mc = &mcs[MI_SCREEN(mi)];
1354
1366
  int wire = MI_IS_WIREFRAME(mi);
1355
1367
  molecule *m = &mc->molecules[mc->which];
 
1368
  XFontStruct *xfont = (mc->scale_down ? mc->xfont2 : mc->xfont1);
 
1369
  GLuint font_dlist  = (mc->scale_down ? mc->font2_dlist : mc->font1_dlist);
1356
1370
  int i, j;
1357
1371
 
1358
1372
  if (!do_labels)
1412
1426
      /* Before drawing the string, shift the origin to center
1413
1427
         the text over the origin of the sphere. */
1414
1428
      glBitmap (0, 0, 0, 0,
1415
 
                -string_width (mc->xfont1, a->label, 0) / 2,
1416
 
                -mc->xfont1->descent,
 
1429
                -string_width (xfont, a->label, 0) / 2,
 
1430
                -xfont->descent,
1417
1431
                NULL);
1418
1432
 
1419
1433
      for (j = 0; j < strlen(a->label); j++)
1420
1434
 
1421
 
        glCallList (mc->font1_dlist + (int)(a->label[j]));
 
1435
        glCallList (font_dlist + (int)(a->label[j]));
1422
1436
 
1423
1437
      glPopMatrix();
1424
1438
    }
1613
1627
      if (do_titles && m->label && *m->label)
1614
1628
        {
1615
1629
          set_atom_color (mi, 0, True, 1);
1616
 
          print_gl_string (mi->dpy, mc->xfont2, mc->font2_dlist,
 
1630
          print_gl_string (mi->dpy, mc->xfont3, mc->font3_dlist,
1617
1631
                           mi->xgwa.width, mi->xgwa.height,
1618
1632
                           10, mi->xgwa.height - 10,
1619
1633
                           m->label, False);