home *** CD-ROM | disk | FTP | other *** search
/ Black Art of 3D Game Programming / Black_Art_of_3D_Game_Programming.iso / source / borland / chap_15 / zdemo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-14  |  1.5 KB  |  81 lines

  1.  
  2. // I N C L U D E S ///////////////////////////////////////////////////////////
  3.  
  4. #include <io.h>
  5. #include <conio.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <dos.h>
  9. #include <bios.h>
  10. #include <fcntl.h>
  11. #include <memory.h>
  12. #include <malloc.h>
  13. #include <math.h>
  14. #include <string.h>
  15. #include <search.h>             // this one is needed for qsort()
  16.  
  17. // include all of our stuff
  18.  
  19. #include "black3.h"
  20. #include "black4.h"
  21. #include "black5.h"
  22. #include "black6.h"
  23. #include "black8.h"
  24. #include "black9.h"
  25. #include "black11.h"
  26. #include "black15.h"
  27.  
  28. ///////////////////////////////////////////////////////////////////////////////
  29.  
  30. void main(void)
  31. {
  32.  
  33. int x=160,  // local position of object
  34.     y=100,
  35.     z=100;
  36.  
  37. // set graphics to mode 13h
  38.  
  39. Set_Graphics_Mode(GRAPHICS_MODE13);
  40.  
  41. // point double buffer at video buffer, so we can see output without an
  42. // animation loop
  43.  
  44. double_buffer = video_buffer;
  45.  
  46. // create a 200 line z buffer (128k)
  47.  
  48. Create_Z_Buffer(200);
  49.  
  50. // initialize the z buffer with a impossibly distant value
  51.  
  52. Fill_Z_Buffer(16000);
  53.  
  54. // draw two interesecting triangles
  55.  
  56. Draw_Tri_3D_Z(x,y,z,
  57.               x-30,y+40,z,
  58.               x+40,y+50,z,
  59.               10);
  60.  
  61.  
  62. Draw_Tri_3D_Z(x+10,y+10,z-5,
  63.               x-50,y+60,z+5,
  64.               x+30,y+20,z-2,
  65.               1);
  66.  
  67. // wait for keyboard hit
  68.  
  69. while(!kbhit());
  70.  
  71. // restore graphics mode back to text
  72.  
  73. Set_Graphics_Mode(TEXT_MODE);
  74.  
  75. // release the z buffer memory
  76.  
  77. Delete_Z_Buffer();
  78.  
  79. } // end main
  80.  
  81.