r_geoscape.c File Reference

#include "r_local.h"
#include "r_error.h"
#include "r_sphere.h"
#include "r_geoscape.h"
#include "r_mesh.h"
#include "r_draw.h"
Include dependency graph for r_geoscape.c:

Go to the source code of this file.

Defines

#define MARKER_SIZE   60.0
#define SKYBOX_HALFSIZE   800.0f
 Half size of Skybox.

Functions

void R_DrawFlatGeoscape (int x, int y, int w, int h, float p, float cx, float cy, float iz, const char *map, qboolean overlayNation, qboolean overlayXVI, qboolean overlayRadar, image_t *r_dayandnightTexture, image_t *r_xviTexture, image_t *r_radarTexture)
 Draw the day and night images of a flat geoscape multitexture feature is used to blend the images.
void R_Draw2DMapMarkers (const vec2_t screenPos, float direction, const char *model, int skin)
 Draw 3D Marker on the 2D geoscape.
void R_Draw3DMapMarkers (int x, int y, int w, int h, const vec3_t rotate, const vec2_t pos, float direction, float earthRadius, const char *model, int skin)
 Draw 3D Marker on the 3D geoscape.
static void R_DrawStarfield (int texnum, const vec3_t pos, const vec3_t rotate, float p)
 Bind and draw starfield.
static void RotateCelestialBody (const vec4_t v, vec4_t *r, const vec3_t rotate, const vec3_t earthPos, const float celestialDist)
 rotate a planet (sun or moon) with respect to the earth
void R_Draw3DGlobe (int x, int y, int w, int h, int day, int second, const vec3_t rotate, float zoom, const char *map, qboolean disableSolarRender, float ambient, qboolean overlayNation, qboolean overlayXVI, qboolean overlayRadar, image_t *r_xviTexture, image_t *r_radarTexture)
 responsible for drawing the 3d globe on geoscape
static void R_DrawQuad (void)
 Draw the current texture on a quad the size of the renderbuffer.
static void R_Blur (r_framebuffer_t *source, r_framebuffer_t *dest, int tex, int dir)
 does 1D filter convolution to blur a framebuffer texture. dir=0 for horizontal, dir=1 for vertical
static void R_BlurStack (int levels, r_framebuffer_t **sources, r_framebuffer_t **dests)
 blur from the source image pyramid into the dest image pyramid
void R_DrawBloom (void)
 handle post-processing bloom

Variables

const float STANDARD_3D_ZOOM
 Typical zoom to use in 3D geoscape to use same zoom values for both 2D and 3D geoscape.
const float SKYBOX_DEPTH = -9999.0f
 Center position of skybox along z-axis. This is used to make sure we see only the inside of Skybox.
static const float starFieldVerts []
static const float starFieldTexCoords []

Detailed Description

Definition in file r_geoscape.c.


Define Documentation

#define MARKER_SIZE   60.0

Definition at line 33 of file r_geoscape.c.

Referenced by R_Draw2DMapMarkers(), and R_Draw3DMapMarkers().

#define SKYBOX_HALFSIZE   800.0f

Half size of Skybox.

Note:
The bigger, the less perspective default you'll have, but the more you'll zoom on the texture (and see it's default).
See also:
R_DrawStarfield
R_Setup2D

Definition at line 303 of file r_geoscape.c.

Referenced by R_Draw3DGlobe().


Function Documentation

static void R_Blur ( r_framebuffer_t source,
r_framebuffer_t dest,
int  tex,
int  dir 
) [static]

does 1D filter convolution to blur a framebuffer texture. dir=0 for horizontal, dir=1 for vertical

Definition at line 685 of file r_geoscape.c.

References rstate_t::convolve_program, qfalse, qtrue, R_BindTextureForTexUnit(), R_DrawQuad(), R_EnableBlur(), r_state, R_UseViewport(), r_framebuffer_t::textures, and texunit_0.

Referenced by R_BlurStack(), and R_DrawBloom().

static void R_BlurStack ( int  levels,
r_framebuffer_t **  sources,
r_framebuffer_t **  dests 
) [static]

blur from the source image pyramid into the dest image pyramid

Definition at line 700 of file r_geoscape.c.

References rstate_t::combine2_program, default_program, i, R_BindTextureForTexUnit(), R_Blur(), R_DrawQuad(), r_state, R_UseFramebuffer(), R_UseProgram(), R_UseViewport(), texunit_0, and texunit_1.

Referenced by R_DrawBloom().

void R_Draw2DMapMarkers ( const vec2_t  screenPos,
float  direction,
const char *  model,
int  skin 
)

Draw 3D Marker on the 2D geoscape.

Parameters:
[in] screenPos Position on screenlongitude and latitude of the model to draw.
[in] direction angle giving the direction the model is heading toward.

Definition at line 169 of file r_geoscape.c.

References modelInfo_t::angles, modelInfo_t::center, Com_Printf(), f, MARKER_SIZE, modelInfo_t::model, modelInfo_t::name, modelInfo_t::origin, R_DrawModelDirect(), R_ModelAutoScale(), R_RegisterModelShort(), viddef_t::rx, viddef_t::ry, scale, modelInfo_t::skin, vec3_origin, VectorCopy, and viddef.

Referenced by MAP_Draw3DMarkerIfVisible().

void R_Draw3DGlobe ( int  x,
int  y,
int  w,
int  h,
int  day,
int  second,
const vec3_t  rotate,
float  zoom,
const char *  map,
qboolean  disableSolarRender,
float  ambient,
qboolean  overlayNation,
qboolean  overlayXVI,
qboolean  overlayRadar,
image_t r_xviTexture,
image_t r_radarTexture 
)

responsible for drawing the 3d globe on geoscape

Parameters:
[in] x menu node x position
[in] y menu node y position
[in] w menu node widht
[in] h menu node height
[in] rotate the rotate angle of the globe
[in] zoom the current globe zoon
[in] map the prefix of the map to use (image must be at base/pics/menu/<map>_[day|night])
See also:
R_DrawFlatGeoscape
R_SphereGenerate

Todo:
Replace this magic number with some speaking constant

Definition at line 427 of file r_geoscape.c.

References rstate_t::atmosphere_program, sphere_s::blendScale, sphere_s::blendTexture, Com_Error(), DAYS_PER_YEAR, ERR_FATAL, f, rstate_t::geoscape_program, sphere_s::glowScale, sphere_s::glslProgram, int(), cvar_s::integer, it_pic, it_wrappic, rconfig_t::lodDir, m, sphere_s::nightLightPos, sphere_s::normalMap, sphere_s::overlay, sphere_s::overlayAlphaMask, r_config, R_DrawBuffers(), R_DrawStarfield(), R_DrawTexture(), R_FindImage(), R_FreeImage(), r_globeEarth, r_globeEarthAtmosphere, r_globeMoon, r_noTexture, r_postprocess, r_programs, R_SphereRender(), r_state, RotateCelestialBody(), viddef_t::rx, viddef_t::ry, sphere_s::season, SEASONS_PER_YEAR, SECONDS_PER_DAY, SIN_ALPHA, SKYBOX_HALFSIZE, STANDARD_3D_ZOOM, sun, image_s::texnum, sphere_s::texture, va(), Vector4Set, VectorCopy, VectorSet, and viddef.

Referenced by MAP_DrawMap().

void R_Draw3DMapMarkers ( int  x,
int  y,
int  w,
int  h,
const vec3_t  rotate,
const vec2_t  pos,
float  direction,
float  earthRadius,
const char *  model,
int  skin 
)

Draw 3D Marker on the 3D geoscape.

Parameters:
[in] x menu node x position
[in] y menu node y position
[in] w menu node widht
[in] h menu node height
[in] rotate vector giving the angles of earth rotation due to player view.
[in] pos longitude and latitude of the model to draw.
[in] direction angle giving the direction the model is heading toward.
[in] earthRadius Radius of earth on screen (this include zoom).

Definition at line 227 of file r_geoscape.c.

References modelInfo_t::angles, modelInfo_t::center, Com_Printf(), f, MARKER_SIZE, modelInfo_t::model, modelInfo_t::name, modelInfo_t::origin, R_DrawModelDirect(), R_ModelAutoScale(), R_RegisterModelShort(), viddef_t::rx, viddef_t::ry, scale, modelInfo_t::skin, vec3_origin, VectorCopy, and viddef.

Referenced by MAP_Draw3DMarkerIfVisible().

void R_DrawBloom ( void   ) 
void R_DrawFlatGeoscape ( int  x,
int  y,
int  w,
int  h,
float  p,
float  cx,
float  cy,
float  iz,
const char *  map,
qboolean  overlayNation,
qboolean  overlayXVI,
qboolean  overlayRadar,
image_t r_dayandnightTexture,
image_t r_xviTexture,
image_t r_radarTexture 
)

Draw the day and night images of a flat geoscape multitexture feature is used to blend the images.

See also:
R_Draw3DGlobe
Parameters:
[in] map The geoscape map to draw (can be changed in the campaign definition)
[in] iz The zoomlevel of the geoscape - see ccs.zoom
[in] cx The x texture coordinate
[in] cy The y texture coordinate
[in] p The horizontal shift of the night map
[in] x The x position of the geoscape node
[in] y The y position of the geoscape node
[in] w The width of the geoscape node
[in] h The height of the geoscape node

Definition at line 51 of file r_geoscape.c.

References Com_Error(), ERR_FATAL, it_wrappic, qfalse, qtrue, R_BindArray(), R_BindDefaultArray(), R_BindLightmapTexture(), R_BindTexture, R_EnableTexture(), R_FindImage(), r_noTexture, R_SelectTexture(), viddef_t::rx, viddef_t::ry, image_s::texnum, texunit_diffuse, texunit_lightmap, va(), and viddef.

Referenced by MAP_DrawMap().

static void R_DrawQuad ( void   )  [inline, static]

Draw the current texture on a quad the size of the renderbuffer.

Definition at line 667 of file r_geoscape.c.

References fbo_render.

Referenced by R_Blur(), R_BlurStack(), and R_DrawBloom().

static void R_DrawStarfield ( int  texnum,
const vec3_t  pos,
const vec3_t  rotate,
float  p 
) [static]

Bind and draw starfield.

Parameters:
[in] texnum The texture id (already uploaded of course)
Note:
We draw a skybox: the camera is inside a cube rotating at earth rotation speed (stars seems to rotate because we see earth as idle, but in reality stars are statics and earth rotate around itself)
See also:
R_Setup2D
R_Draw3DGlobe

< Angle of rotation of starfield

Definition at line 361 of file r_geoscape.c.

References PITCH, R_BindTexture, ROLL, SKYBOX_DEPTH, starFieldTexCoords, starFieldVerts, todeg, VectorSet, and YAW.

Referenced by R_Draw3DGlobe().

static void RotateCelestialBody ( const vec4_t  v,
vec4_t r,
const vec3_t  rotate,
const vec3_t  earthPos,
const float  celestialDist 
) [inline, static]

rotate a planet (sun or moon) with respect to the earth

Parameters:
[in] v 
[out] r 
int] rotate
int] earthPos
int] celestialDist

Definition at line 399 of file r_geoscape.c.

References PITCH, RotatePointAroundVector(), Vector4Set, VectorSet, and YAW.

Referenced by R_Draw3DGlobe().


Variable Documentation

const float SKYBOX_DEPTH = -9999.0f

Center position of skybox along z-axis. This is used to make sure we see only the inside of Skybox.

See also:
R_DrawStarfield
R_Setup2D

Definition at line 294 of file r_geoscape.c.

Referenced by R_DrawBloom(), R_DrawStarfield(), and R_Setup2D().

const float STANDARD_3D_ZOOM

Typical zoom to use in 3D geoscape to use same zoom values for both 2D and 3D geoscape.

Note:
Used to convert openGL coordinates of the sphere into screen coordinates
See also:
GLOBE_RADIUS

Definition at line 433 of file cp_map.c.

Referenced by R_Draw3DGlobe().

const float starFieldTexCoords[] [static]
Initial value:
 {
    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0,
    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0,
    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0,
    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0,
    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0,
    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0,
}

Definition at line 343 of file r_geoscape.c.

Referenced by R_DrawStarfield().

const float starFieldVerts[] [static]

Definition at line 305 of file r_geoscape.c.

Referenced by R_DrawStarfield().


Generated by  doxygen 1.6.2