[Brlcad-commits] CVS: brlcad/src/rt rtexample.c,14.4,14.5
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: Sean M. <br...@us...> - 2005-12-08 01:41:05
|
Update of /cvsroot/brlcad/brlcad/src/rt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15392 Modified Files: rtexample.c Log Message: make the application structure non-global, use RT_APPLICATION_INIT; ws Index: rtexample.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/rt/rtexample.c,v retrieving revision 14.4 retrieving revision 14.5 diff -w -u -r14.4 -r14.5 --- rtexample.c 19 Sep 2005 18:02:09 -0000 14.4 +++ rtexample.c 8 Dec 2005 01:40:57 -0000 14.5 @@ -35,18 +35,19 @@ #include "rtprivate.h" -/* every application needs one of these */ -struct application ap; - /* routines for shootray() to call on hit or miss */ extern int hit(struct application *ap, struct partition *PartHeadp, struct seg *segs); extern int miss(register struct application *ap); + char usage[] = "\ Usage: rtexample model.g objects...\n"; main(int argc, char **argv) { + /* every application needs one of these */ + struct application ap; + static struct rt_i *rtip; /* rt_dirbuild returns this */ char idbuf[RT_BUFSIZE] = {0}; /* First ID record info */ @@ -65,6 +66,10 @@ fprintf(stderr,"rtexample: rt_dirbuild failure\n"); exit(2); } + + /* intialize the application structure to all zeros */ + RT_APPLICATION_INIT(&ap); + ap.a_rt_i = rtip; /* your application uses this instance */ fprintf(stderr, "db title: %s\n", idbuf); @@ -112,6 +117,7 @@ return(0); } + /* * rt_shootray() was told to call this on a hit. He gives up the * application structure which describes the state of the world @@ -184,6 +190,7 @@ return(1); } + /* * rt_shootray() was told to call this on a miss. */ |