Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>. |
||
3 | * It is copyright by its individual contributors, as recorded in the |
||
4 | * project's Git history. See COPYING.txt at the top level for license |
||
5 | * terms and a link to the Git history. |
||
6 | */ |
||
7 | /* |
||
8 | * |
||
9 | * Setup for 3d library |
||
10 | * |
||
11 | */ |
||
12 | |||
13 | |||
14 | #include <stdlib.h> |
||
15 | |||
16 | #include "dxxerror.h" |
||
17 | |||
18 | #include "3d.h" |
||
19 | #include "globvars.h" |
||
20 | #include "clipper.h" |
||
21 | |||
22 | #if DXX_USE_OGL |
||
23 | #include "ogl_init.h" |
||
24 | #else |
||
25 | #include "texmap.h" // for init_interface_vars_to_assembler() |
||
26 | #endif |
||
27 | #include "gr.h" |
||
28 | |||
29 | namespace dcx { |
||
30 | |||
31 | //start the frame |
||
32 | void g3_start_frame(grs_canvas &canvas) |
||
33 | { |
||
34 | fix s; |
||
35 | |||
36 | //set int w,h & fixed-point w,h/2 |
||
37 | const int Canvas_width = canvas.cv_bitmap.bm_w; |
||
38 | const int Canvas_height = canvas.cv_bitmap.bm_h; |
||
39 | Canv_w2 = Canvas_width << 15; |
||
40 | Canv_h2 = Canvas_height << 15; |
||
41 | #ifdef __powerc |
||
42 | fCanv_w2 = f2fl((Canvas_width)<<15); |
||
43 | fCanv_h2 = f2fl((Canvas_height)<<15); |
||
44 | #endif |
||
45 | |||
46 | //compute aspect ratio for this canvas |
||
47 | |||
48 | s = fixmuldiv(grd_curscreen->sc_aspect,Canvas_height,Canvas_width); |
||
49 | |||
50 | if (s <= f1_0) { //scale x |
||
51 | Window_scale.x = s; |
||
52 | Window_scale.y = f1_0; |
||
53 | } |
||
54 | else { |
||
55 | Window_scale.y = fixdiv(f1_0,s); |
||
56 | Window_scale.x = f1_0; |
||
57 | } |
||
58 | |||
59 | Window_scale.z = f1_0; //always 1 |
||
60 | |||
61 | #if DXX_USE_OGL |
||
62 | ogl_start_frame(canvas); |
||
63 | #else |
||
64 | init_interface_vars_to_assembler(); //for the texture-mapper |
||
65 | #endif |
||
66 | } |
||
67 | |||
68 | } |