source: golgotha/src/render/dx5/r1_dx5.hh

Last change on this file was 80, checked in by Sam Hocevar, 13 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 3.6 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef _R1_DX5_HH_
10#define _R1_DX5_HH_
11
12#include "r1_api.hh"
13#include "r1_win.hh"
14#include <ddraw.h>
15#include <d3d.h>
16
17class r1_dx5_render_window_class : public r1_render_window_class
18{
19public: 
20  r1_dx5_render_window_class(w16 w, w16 h,
21                             r1_expand_type expand_type,
22                             r1_render_api_class *api);
23 
24  ~r1_dx5_render_window_class();
25
26  void draw(i4_draw_context_class &context);
27 
28  I4_EVENT_NAME("dx5 render window");
29};
30
31class r1_dx5_class : public r1_render_api_class
32{
33  void copy_part(i4_image_class *im,                                         
34                 int x, int y,             // position on screen
35                 int x1, int y1,           // area of image to copy
36                 int x2, int y2);
37
38public:
39
40  friend inline void make_d3d_verts(D3DTLVERTEX *dx_v,r1_vert *r1_v,r1_dx5_class *c,int total);
41  r1_dx5_class();
42  ~r1_dx5_class();
43
44  // returns false if display is not compatible with render_api, i.e. if you pass
45  // the directx display to the glide render api it return false
46  // init will create the texture manager, which can be used after this call
47  // text_mem_size if size of buffer to hold compressed textures (in system memory)
48  i4_bool init(i4_display_class *display);
49
50  // this will delete the texture manager (and free textures associated with) created by init
51  void uninit();
52 
53  void set_z_range(i4_float near_z, i4_float far_z);
54
55   
56  void set_filter_mode(r1_filter_type type);
57  void set_alpha_mode(r1_alpha_type type);
58  void set_write_mode(r1_write_mask_type mask);
59 
60  // draws the polygon at the end of the frame (during end_render())
61  void render_poly(int t_verts, r1_vert *verts);
62  void render_pixel(r1_vert *pixel);
63  void render_lines(int t_lines, r1_vert *verts);
64  void clear_area(int x1, int y1, int x2, int y2, w32 color, float w);
65 
66  // creates an image of the same bit depth and palette of screen (for use with put_image)
67  i4_image_class *create_compatible_image(w16 w, w16 h);
68 
69    // texture handle is obtained from the texture manager, this is enables texture mapping
70  void use_texture(r1_texture_handle material_ref,
71                   sw32 desired_width,
72                   w32 frame);
73
74  r1_alpha_type      pre_holy_alpha_mode;
75  r1_write_mask_type pre_holy_write_mask;
76
77  i4_bool states_have_changed;
78  i4_bool holy_mode;
79  i4_bool texture_mode;
80
81  void enable_holy();
82  void disable_holy();
83
84  void flush_vert_buffer();
85
86  // drawing will the constant color to render with if textures are disabled
87  void disable_texture();
88
89  r1_render_window_class *create_render_window(int visable_w, int visable_h,
90                                               r1_expand_type type);
91
92  i4_float x_off,y_off;
93
94  i4_bool hardware_tmapping;
95  i4_bool needs_square_textures;
96 
97  char    dd_driver_name[128];
98  char    d3d_driver_name[128];     
99 
100  IDirectDrawSurface3 *zbuffer_surface;
101  IDirect3D2          *d3d;
102  IDirect3DDevice2    *d3d_device;
103  IDirect3DViewport2  *d3d_viewport;
104};
105
106extern r1_dx5_class r1_dx5_class_instance;
107
108#endif
109
Note: See TracBrowser for help on using the repository browser.