source:golgotha/src/golg/f_tables.hh@80Tweet

Last change on this file since 80 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: 1.2 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 G1_F_TABLES_HH
10#define G1_F_TABLES_HH
11
12
13
14#include "math/point.hh"
15#include "math/num_type.hh"
16
17extern float g1_table_0_31_to_n1_1[32];   // maps 5 bits of integer into float range -1 to 1
18extern float g1_table_0_31_to_0_1[32];    // maps 5 bits of integer into float range 0 to 1
19extern float g1_table_0_255_to_0_1[256];
20
21extern float g1_shadow_sub_0_63_to_0_1_red_or_green[64];  // used in map_vert.hh for cloud shadows
23
24
25
26inline w16 g1_normal_to_16(i4_3d_vector v)
27{
28  w32 x=i4_f_to_i((v.x+1.0)*15.5),
29    y=i4_f_to_i((v.y+1.0)*15.5),
30    z=i4_f_to_i((v.z+1.0)*15.5);
31
32  return (x<<10)|(y<<5)|z;
33}
34
35
36#endif
Note: See TracBrowser for help on using the repository browser.