source: golgotha/src/render/glide/gr_vram.hh

Last change on this file was 80, checked in by Sam Hocevar, 11 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: 2.3 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 __GLIDE_VRAM_HH
10#define __GLIDE_VRAM_HH
11
12#include "memory/lalloc.hh"
13#include "memory/array.hh"
14#include "tmanage.hh"
15#include "tex_heap.hh"
16
17// this class keeps track of what's where in 3dfx texture memory
18
19
20class r1_glide_vram_class : public r1_texture_manager_class
21{
22  friend void glide_async_callback(w32 count, void *context);
23
24  class free_node
25  {
26  public:
27    R1_TEX_HEAP_FREE_NODE_DATA   
28    i4_float smul, tmul;   
29   
30    //used when loading asynchronously from disk
31    i4_file_class *async_fp;
32    w8 *data;
33
34    w8 lod, aspect, tmu;
35  };
36
37  class used_node
38  {
39  public:
40    R1_TEX_HEAP_USED_NODE_DATA
41    //no extra members for this class
42  };
43
44  enum {scratch_texture_size = 256*256*2};
45
46  w8 scratch_texture[scratch_texture_size]; // used (shared) to load in textures off disk 
47
48  r1_texture_heap_class *tex_heap_man;
49  r1_texture_heap_class *tex_heap_man_2;
50  int heap1_address;
51  int heap2_address;
52 
53public:
54
55  void next_frame();
56
57  void select_texture(r1_vram_handle_type handle,
58                      float &smul, float &tmul, i4_bool holy, i4_bool alpha);
59
60
61  r1_glide_vram_class(const i4_pal *pal);
62
63  void init();
64  void uninit();
65
66  ~r1_glide_vram_class()
67  {
68    uninit();
69  }
70
71  i4_bool immediate_mip_load(r1_mip_load_info *load_info);
72  i4_bool async_mip_load(r1_mip_load_info *load_info);
73
74  void free_mip(r1_vram_handle_type vram_handle);
75
76  r1_miplevel_t *get_texture(r1_texture_handle handle,
77                             w32 frame_counter,
78                             sw32 desired_width,
79                             sw32 &w, sw32 &h);
80
81  i4_critical_section_class array_lock; 
82 
83  i4_array<used_node *> finished_array;
84 
85  void async_load_finished(used_node *u);
86
87  sw32 bytes_loaded;
88  sw32 textures_loaded;
89};
90
91
92#endif
Note: See TracBrowser for help on using the repository browser.