home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char sccsid[] = "@(#)draw_starfield_xgl.c 1.1 92/05/28 SMI" ;
- /* from draw_starfield_xgl.c 1.1 90/07/23 SMI */
- #endif
-
- /*
- * Copyright (c) 1986 by Sun Microsystems, Inc.
- */
-
- /*
- * this file draws all the stars
- */
-
-
- #include <stdio.h>
- #include <math.h>
- #include "graphics.h"
- #include "dstar.h"
-
- static Pt3d starfield[] = {
- #include "starfield.h"
- } ;
-
- #define NSTAR (sizeof(starfield)/sizeof(Pt3d))
-
- static Xgl_pt_flag_f3d starpts[NSTAR][2] ;
-
- extern int debug_level ;
-
- static int initialized = 0 ;
-
-
- starfield_init()
- {
- int i ;
-
- for(i=0; i<NSTAR; ++i)
- {
- starpts[i][0].x = starfield[i].x ;
- starpts[i][0].y = starfield[i].y ;
- starpts[i][0].z = starfield[i].z ;
- starpts[i][1] = starpts[i][0] ;
- starpts[i][0].flag = 0 ;
- starpts[i][1].flag = 1 ;
- }
- initialized = 1 ;
- }
-
- draw_starfield()
- {
- int i ;
- int nwhite, nother ;
- int color ;
- register Pt3d *ptr ;
- register int fit ;
- Xgl_pt_list pts ;
-
- if( !initialized )
- starfield_init() ;
-
- pts.pt_type = XGL_PT_FLAG_F3D ;
- pts.bbox = NULL ;
- pts.num_pts = NSTAR*2 ;
- pts.pts.flag_f3d = &starpts[0][0] ;
- xgl_multipolyline(Main_gfx, NULL, 1, &pts) ;
- }
-
-
-
-
- #ifdef COMMENT
- draw_starfield()
- {
- int i ;
- int nstars ;
- int nwhite, nother ;
- int color ;
- register Pt3d *ptr ;
- register int fit ;
- Xgl_pt_list pts ;
-
-
- nstars = sizeof(starfield) / sizeof(Pt3d) ;
- nwhite = nstars/2 ;
- nother = nstars/8 ;
- color = 4 ;
- ptr = &starfield[0] ;
-
- xgl_object_set(Main_gfx,
- XGL_CTX_MARKER_DESCRIPTION, xgl_marker_dot,
- XGL_CTX_MARKER_COLOR, ¤t_xgl_color, 0) ;
-
- pts.pt_type = XGL_PT_F3D ;
- pts.bbox = NULL ;
- pts.num_pts = nstars ;
- pts.pts.f3d = starfield ;
- xgl_multimarker(Main_gfx, &pts) ;
- }
- #endif COMMENT
-