1 /**
2  * @file
3  * @brief Functions to generate and render spheres
4  */
5 /*
6 Copyright (C) 1997-2001 Id Software, Inc.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 typedef struct sphere_s {
28 	GLint list;			/**< the opengl list id */
29 	float* texes;		/**< globe tex coords, points in 2D on the texture to be mapped onto the sphere */
30 	float* verts;		/**< globe vertices, points in 3D on the surface of the sphere */
31 	float* normals;		/**< vertex normal array */
32 	image_t* texture;	/**< the texture for this globe - @note scaled texture matrix */
33 	image_t* blendTexture;	/**< the texture for the next season (for blending) */
34 	image_t* overlay;	/**< the overlay for the world (e.g. nation borders) */
35 	image_t* overlayAlphaMask;	/**< in case of multitexture this is the alpha mask */
36 	image_t* normalMap;	/**< bump map */
37 	int num_tris;		/**< number of tris */
38 
39 	/** @note  extra stuff for new GLSL renderer*/
40 	r_program_t* glslProgram;
41 	float blendScale;
42 	float glowScale;
43 	vec4_t nightLightPos;
44 	int season;
45 } sphere_t;
46 
47 extern sphere_t r_globeEarth;
48 extern sphere_t r_globeMoon;
49 extern sphere_t r_globeEarthAtmosphere;
50 
51 void R_SphereGenerate(sphere_t* sphere, const int tris, const float radius);
52 void R_SphereRender(const sphere_t* sphere, const vec3_t pos, const vec3_t rotate, const float scale, const vec4_t lightPos);
53 void R_SphereInit(void);
54