Functions to generate and render spheres. More...
#include "r_local.h"
#include "r_sphere.h"
#include "r_error.h"
Go to the source code of this file.
Functions | |
static float | rhoSpiral (const int index, const float deltaRho, const float thetaAngle) |
void | R_SphereGenerate (sphere_t *sphere, const int tris, const float radius) |
Initialize the globe chain arrays. | |
void | R_SphereInit (void) |
Creates the spheres we need for rendering the 3d globe. | |
static void | R_SphereActivateTextureUnit (gltexunit_t *texunit, void *texCoordBuffer) |
static void | R_SphereDeactivateTextureUnit (gltexunit_t *texunit) |
static void | R_SphereRenderTris (const sphere_t *sphere) |
static qboolean | R_SphereCheckGLSL (const sphere_t *sphere) |
void | R_SphereRender (const sphere_t *sphere, const vec3_t pos, const vec3_t rotate, const float scale, const vec4_t lightPos) |
Draw the sphere. | |
void | R_SphereShade (const sphere_t *sphere) |
render sphere using standard OpenGL lighting | |
void | R_SphereShadeGLSL (const sphere_t *sphere) |
render sphere using GLSL (bump mapping, specularity, and season-blending) | |
Variables | |
static cvar_t * | r_sphereDetails |
sphere_t | r_globeEarth |
sphere_t | r_globeMoon |
sphere_t | r_globeEarthAtmosphere |
Functions to generate and render spheres.
Definition in file r_sphere.c.
static void R_SphereActivateTextureUnit | ( | gltexunit_t * | texunit, | |
void * | texCoordBuffer | |||
) | [inline, static] |
Definition at line 132 of file r_sphere.c.
References R_BindArray(), and R_SelectTexture().
Referenced by R_SphereShadeGLSL().
sphere | The sphere to check |
true
if all needed data is loaded to use the geoscape glsl shaders, false
otherwise Definition at line 161 of file r_sphere.c.
References sphere_s::glslProgram, cvar_s::integer, and r_programs.
Referenced by R_SphereRender().
static void R_SphereDeactivateTextureUnit | ( | gltexunit_t * | texunit | ) | [inline, static] |
Definition at line 139 of file r_sphere.c.
References R_BindDefaultArray(), and R_SelectTexture().
Referenced by R_SphereShadeGLSL().
void R_SphereGenerate | ( | sphere_t * | sphere, | |
const int | tris, | |||
const float | radius | |||
) |
Initialize the globe chain arrays.
[out] | sphere | The sphere you want to create |
[in] | tris | The amount of tris the globe should have - the higher the number the higher the details. tris*tris triangles are obtained. |
[in] | radius | The radius of the sphere |
< angle from the pole (z-axis)
< angle around the equator, from y-axis
Definition at line 50 of file r_sphere.c.
References sphere_s::glslProgram, i, Mem_PoolAlloc, sphere_s::normals, sphere_s::num_tris, rhoSpiral(), st, sphere_s::texes, Vector2Set, VectorNormalize2(), VectorSet, sphere_s::verts, and vid_genericPool.
Referenced by R_SphereInit().
void R_SphereInit | ( | void | ) |
Creates the spheres we need for rendering the 3d globe.
Definition at line 120 of file r_sphere.c.
References CVAR_ARCHIVE, Cvar_Get(), Cvar_SetValue(), EARTH_RADIUS, cvar_s::integer, MOON_RADIUS, R_SphereGenerate(), and cvar_s::value.
Referenced by R_Init().
void R_SphereRender | ( | const sphere_t * | sphere, | |
const vec3_t | pos, | |||
const vec3_t | rotate, | |||
const float | scale, | |||
const vec4_t | lightPos | |||
) |
Draw the sphere.
[in] | sphere | The sphere that should be rendered |
[in] | pos | The position (translation) of the matrix |
[in] | rotate | The rotation of the matrix |
[in] | scale | The scale of the matrix |
[in] | lightPos | Set this to NULL if you don't want to change the light position |
Definition at line 174 of file r_sphere.c.
References rendererData_t::aliasCount, sphere_s::num_tris, sphere_s::overlay, PITCH, R_BindDefaultArray(), R_CheckError, R_SphereCheckGLSL(), R_SphereShade(), R_SphereShadeGLSL(), refdef, ROLL, viddef_t::rx, viddef_t::ry, VectorNotEmpty, viddef, and YAW.
Referenced by R_Draw3DGlobe().
static void R_SphereRenderTris | ( | const sphere_t * | sphere | ) | [static] |
Definition at line 146 of file r_sphere.c.
References sphere_s::num_tris.
Referenced by R_SphereShade(), and R_SphereShadeGLSL().
void R_SphereShade | ( | const sphere_t * | sphere | ) |
render sphere using standard OpenGL lighting
Definition at line 218 of file r_sphere.c.
References sphere_s::normals, sphere_s::overlay, sphere_s::overlayAlphaMask, qfalse, qtrue, R_BindArray(), R_BindLightmapTexture(), R_BindTexture, R_EnableTexture(), R_SelectTexture(), R_SphereRenderTris(), sphere_s::texes, image_s::texnum, sphere_s::texture, texunit_lightmap, and sphere_s::verts.
Referenced by R_SphereRender().
void R_SphereShadeGLSL | ( | const sphere_t * | sphere | ) |
render sphere using GLSL (bump mapping, specularity, and season-blending)
Definition at line 249 of file r_sphere.c.
References sphere_s::blendScale, sphere_s::blendTexture, sphere_s::glowScale, sphere_s::glslProgram, cvar_s::integer, sphere_s::nightLightPos, sphere_s::normalMap, sphere_s::normals, qfalse, qtrue, R_BindArray(), R_BindTexture, R_BindTextureForTexUnit(), R_EnableLighting(), r_lights, r_postprocess, R_ProgramParameter1f(), R_SelectTexture(), R_SphereActivateTextureUnit(), R_SphereDeactivateTextureUnit(), R_SphereRenderTris(), sphere_s::texes, image_s::texnum, sphere_s::texture, texunit_1, texunit_2, texunit_diffuse, Vector4NotEmpty, and sphere_s::verts.
Referenced by R_SphereRender().
static float rhoSpiral | ( | const int | index, | |
const float | deltaRho, | |||
const float | thetaAngle | |||
) | [inline, static] |
Definition at line 32 of file r_sphere.c.
Referenced by R_Draw3DGlobe().
Definition at line 34 of file r_sphere.c.
Referenced by R_Draw3DGlobe().
Definition at line 33 of file r_sphere.c.
Referenced by R_Draw3DGlobe().
cvar_t* r_sphereDetails [static] |
Definition at line 30 of file r_sphere.c.