1 /* 2 Copyright (C) 1997-2001 Id Software, Inc. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 */ 19 20 // 21 // rb_local.h 22 // 23 24 #include "r_local.h" 25 26 #define FTABLE_SIZE 2048 27 #define FTABLE_CLAMP(x) (((int)((x)*FTABLE_SIZE) & (FTABLE_SIZE-1))) 28 #define FTABLE_EVALUATE(table,x) (table[FTABLE_CLAMP(x)]) 29 30 extern float rb_sinTable[FTABLE_SIZE]; 31 extern float rb_triangleTable[FTABLE_SIZE]; 32 extern float rb_squareTable[FTABLE_SIZE]; 33 extern float rb_sawtoothTable[FTABLE_SIZE]; 34 extern float rb_inverseSawtoothTable[FTABLE_SIZE]; 35 extern float rb_noiseTable[FTABLE_SIZE]; 36 37 /* 38 =============================================================================== 39 40 OPENGL STATE 41 42 =============================================================================== 43 */ 44 45 // FIXME: make part of rbData once it's made local to the backend 46 typedef struct rb_glState_s { 47 // Texture state 48 texUnit_t texUnit; 49 image_t *texBound[MAX_TEXUNITS]; 50 GLenum texTarget[MAX_TEXUNITS]; 51 GLfloat texEnvModes[MAX_TEXUNITS]; 52 qBool texMatIdentity[MAX_TEXUNITS]; 53 54 // Program state 55 GLenum boundFragProgram; 56 GLenum boundVertProgram; 57 58 // Scene 59 qBool in2D; 60 61 // Generic state 62 uint32 stateBits1; 63 } rb_glState_t; 64 65 extern rb_glState_t rb_glState; 66 67 /* 68 =============================================================================== 69 70 FUNCTION PROTOTYPES 71 72 =============================================================================== 73 */ 74 75 // 76 // rb_math.c 77 // 78 79 float *RB_TableForFunc (shTableFunc_t func); 80 81 void Matrix4_Copy2D (const mat4x4_t m1, mat4x4_t m2); 82 void Matrix4_Multiply2D (const mat4x4_t m1, const mat4x4_t m2, mat4x4_t out); 83 void Matrix4_Scale2D (mat4x4_t m, float x, float y); 84 void Matrix4_Stretch2D (mat4x4_t m, float s, float t); 85 void Matrix4_Translate2D (mat4x4_t m, float x, float y); 86 87 // 88 // rb_state.c 89 // 90 91 void RB_StateForBits (uint32 bits1); 92 93 void RB_SelectTexture (texUnit_t texUnit); 94 void RB_TextureEnv (GLfloat mode); 95 void RB_TextureTarget (GLenum target); 96 void RB_LoadTexMatrix (mat4x4_t m); 97 void RB_LoadIdentityTexMatrix (void); 98 99 void RB_BindProgram (program_t *program); 100