home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19371 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.9 KB  |  56 lines

  1. Path: sparky!uunet!haven.umd.edu!purdue!ames!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!cs.ucf.edu!tarpit!tous!business!f181.n363.z1.fidonet.org!Mike.Tedder
  2. From: Mike.Tedder@f181.n363.z1.fidonet.org (Mike Tedder)
  3. Sender: ufgate@business.fidonet.org (newsout1.26)
  4. Newsgroups: comp.lang.c
  5. Subject: 3-D graphics
  6. Message-ID: <234.2B4A27B6@business.fidonet.org>
  7. Date: Tue, 05 Jan 93 15:45:00 PDT
  8. Organization: FidoNet node 1:363/181
  9. Lines: 45
  10.  
  11. I'm not exactly sure how to put this... but I'd appreciate any help if maybe one of you out there can help me...
  12.  
  13. What I'd like to do is create a new data type, called "object".  (C++ here, please)  Here's the best typedef I could come out with:
  14.  
  15. typedef struct
  16. {
  17.   int xcoord, ycoord, zcoord;
  18.   int scale;
  19.   int roll, pitch, yaw;
  20.   ????? ????????;
  21.   int active;
  22. } object[999];
  23.  
  24. The ???? marks are what I'm not sure about.... I don't exactly know *HOW* to define the object in any of C++'s terms.  (I'd be using 256 color VGA)  And, after I *WAS* able to define the term, say "char *" or something, how would I draw the object on the screen, denoting whatever coordinate in space it was? (There would also be a 'camera' structure, like so:)
  25.  
  26. struct
  27. {
  28.   int xcoord, int ycoord ....
  29.   ..
  30.   ..
  31.   int active;
  32. } camera;
  33.  
  34. Now, finally, in my program, I could do something like this, very easily:
  35.  
  36. void main(void)
  37. {
  38.   camera.active=1;
  39.   object[1]=loadobject("GRAPHIC.IMG");
  40.   camera_follow_obj(1);  /* Say, maybe 10 units away from object on z axis,
  41.                             and maybe 5 units away from object on y axis */
  42.   object.active=1;
  43.   object.xcoord=0; object.ycoord=0; object.zcoord=0;
  44.   object_draw(1);
  45.   object_moveto(10,10,10);
  46.   ...
  47.   ...
  48. }
  49.  
  50. Any help?  Please?
  51.  
  52. --  
  53.         Mike Tedder  -  via FidoNet Node: 1:363/42
  54.              UUCP:  -  ...tarpit!tous!business!181!Mike.Tedder
  55.              ARPA:  -  Mike.Tedder@f181.n363.z1.fidonet.org
  56.