]> icculus.org git repositories - btb/d2x.git/blob - 3d/setup.c
win32 networking backtrack
[btb/d2x.git] / 3d / setup.c
1 /* $Id: setup.c,v 1.4 2002-07-17 21:55:19 bradleyb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
12 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14 /*
15  * 
16  * Setup for 3d library
17  * 
18  * Old Log:
19  *
20  * Revision 1.4  1995/10/11  00:27:04  allender
21  * bash free_num_points to 0
22  *
23  * Revision 1.3  1995/09/13  11:31:58  allender
24  * calc for fCanv_w2 and fCanv_h2
25  *
26  * Revision 1.2  1995/06/25  21:57:57  allender
27  * *** empty log message ***
28  *
29  * Revision 1.1  1995/05/05  08:52:54  allender
30  * Initial revision
31  *
32  * Revision 1.1  1995/04/17  03:59:01  matt
33  * Initial revision
34  * 
35  * 
36  */
37
38 #ifdef HAVE_CONFIG_H
39 #include <conf.h>
40 #endif
41
42 #ifdef RCS
43 static char rcsid[] = "$Id: setup.c,v 1.4 2002-07-17 21:55:19 bradleyb Exp $";
44 #endif
45
46 #include <stdlib.h>
47
48 #include "error.h"
49
50 #include "3d.h"
51 #include "globvars.h"
52 #include "clipper.h"
53 //#include "div0.h"
54
55 #ifdef OGL
56 #include "ogl_init.h"
57 #endif
58
59 //initialize the 3d system
60 void g3_init(void)
61 {
62 //      div0_init(DM_ERROR);
63         atexit(g3_close);
64 }
65
66 //close down the 3d system
67 void g3_close(void) {}
68
69 extern void init_interface_vars_to_assembler(void);
70
71 //start the frame
72 void g3_start_frame(void)
73 {
74         fix s;
75
76         //set int w,h & fixed-point w,h/2
77         Canv_w2 = (Canvas_width  = grd_curcanv->cv_bitmap.bm_w)<<15;
78         Canv_h2 = (Canvas_height = grd_curcanv->cv_bitmap.bm_h)<<15;
79 #ifdef __powerc
80         fCanv_w2 = f2fl((Canvas_width  = grd_curcanv->cv_bitmap.bm_w)<<15);
81         fCanv_h2 = f2fl((Canvas_height = grd_curcanv->cv_bitmap.bm_h)<<15);
82 #endif
83
84         //compute aspect ratio for this canvas
85
86         s = fixmuldiv(grd_curscreen->sc_aspect,Canvas_height,Canvas_width);
87
88         if (s <= f1_0) {           //scale x
89                 Window_scale.x = s;
90                 Window_scale.y = f1_0;
91         }
92         else {
93                 Window_scale.y = fixdiv(f1_0,s);
94                 Window_scale.x = f1_0;
95         }
96         
97         Window_scale.z = f1_0;          //always 1
98
99         init_free_points();
100
101 #ifdef D1XD3D
102         Win32_start_frame ();
103 #else
104 #ifdef OGL
105         ogl_start_frame();
106 #else
107         init_interface_vars_to_assembler();             //for the texture-mapper
108 #endif
109 #endif
110
111 }
112
113 //this doesn't do anything, but is here for completeness
114 void g3_end_frame(void)
115 {
116 #ifdef D1XD3D
117         Win32_end_frame ();
118 #endif
119 #ifdef OGL
120         ogl_end_frame();
121 #endif
122
123 //      Assert(free_point_num==0);
124         free_point_num = 0;
125
126 }
127
128