Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Functions | Variables
rendersky.cpp File Reference
#include <SDL_opengl.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <memory>
#include "inexor/engine/glare.hpp"
#include "inexor/engine/glemu.hpp"
#include "inexor/engine/glexts.hpp"
#include "inexor/engine/octa.hpp"
#include "inexor/engine/octaedit.hpp"
#include "inexor/engine/octree.hpp"
#include "inexor/engine/rendergl.hpp"
#include "inexor/engine/rendersky.hpp"
#include "inexor/engine/renderva.hpp"
#include "inexor/engine/shader.hpp"
#include "inexor/engine/water.hpp"
#include "inexor/engine/world.hpp"
#include "inexor/io/Logging.hpp"
#include "inexor/io/filesystem/mediadirs.hpp"
#include "inexor/network/SharedVar.hpp"
#include "inexor/shared/command.hpp"
#include "inexor/shared/cube_formatting.hpp"
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_sort.hpp"
#include "inexor/shared/cube_tools.hpp"
#include "inexor/shared/cube_types.hpp"
#include "inexor/shared/ents.hpp"
#include "inexor/shared/geom.hpp"
#include "inexor/shared/tools.hpp"
#include "inexor/texture/cubemap.hpp"
#include "inexor/texture/texture.hpp"
#include "inexor/util/legacy_time.hpp"

Classes

struct  fogdome::vert
 

Namespaces

 fogdome
 

Functions

void loadsky (const char *basename, Texture *texs[6])
 
Textureloadskyoverlay (const char *basename)
 
 SVARFR (skybox,"",{if(skybox[0]) loadsky(skybox, sky);})
 
 HVARR (skyboxcolour, 0, 0xFFFFFF, 0xFFFFFF)
 
 FVARR (spinsky,-720, 0, 720)
 
 VARR (yawsky, 0, 0, 360)
 
 SVARFR (cloudbox,"",{if(cloudbox[0]) loadsky(cloudbox, clouds);})
 
 HVARR (cloudboxcolour, 0, 0xFFFFFF, 0xFFFFFF)
 
 FVARR (cloudboxalpha, 0, 1, 1)
 
 FVARR (spinclouds,-720, 0, 720)
 
 VARR (yawclouds, 0, 0, 360)
 
 FVARR (cloudclip, 0, 0.5f, 1)
 
 SVARFR (cloudlayer,"",{if(cloudlayer[0]) cloudoverlay=loadskyoverlay(cloudlayer);})
 
 FVARR (cloudoffsetx, 0, 0, 1)
 
 FVARR (cloudoffsety, 0, 0, 1)
 
 FVARR (cloudscrollx,-16, 0, 16)
 
 FVARR (cloudscrolly,-16, 0, 16)
 
 FVARR (cloudscale, 0.001, 1, 64)
 
 FVARR (spincloudlayer,-720, 0, 720)
 
 VARR (yawcloudlayer, 0, 0, 360)
 
 FVARR (cloudheight,-1, 0.2f, 1)
 
 FVARR (cloudfade, 0, 0.2f, 1)
 
 FVARR (cloudalpha, 0, 1, 1)
 
 VARR (cloudsubdiv, 4, 16, 64)
 
 HVARR (cloudcolour, 0, 0xFFFFFF, 0xFFFFFF)
 
void drawenvboxface (float s0, float t0, int x0, int y0, int z0, float s1, float t1, int x1, int y1, int z1, float s2, float t2, int x2, int y2, int z2, float s3, float t3, int x3, int y3, int z3, Texture *tex)
 
void drawenvbox (int w, float z1clip=0.0f, float z2clip=1.0f, int faces=0x3F, Texture **sky=nullptr)
 
void drawenvoverlay (int w, Texture *overlay=nullptr, float tx=0, float ty=0)
 
 FVARR (fogdomeheight,-1,-0.5f, 1)
 
 FVARR (fogdomemin, 0, 0, 1)
 
 FVARR (fogdomemax, 0, 0, 1)
 
 VARR (fogdomecap, 0, 1, 1)
 
 FVARR (fogdomeclip, 0, 1, 1)
 
 HVARFR (fogdomecolour, 0, 0, 0xFFFFFF,{fogdomecolor=bvec((fogdomecolour >>16)&0xFF,(fogdomecolour >>8)&0xFF, fogdomecolour &0xFF);})
 
void fogdome::subdivide (int depth, int face)
 
void fogdome::genface (int depth, int i1, int i2, int i3)
 
int fogdome::sortcap (GLushort x, GLushort y)
 
void fogdome::init (const bvec &color, float minalpha=0.0f, float maxalpha=1.0f, float capsize=-1, float clipz=1, int hres=16, int depth=2)
 
void fogdome::cleanup ()
 
void fogdome::draw ()
 
void cleanupsky ()
 
 VARP (sparklyfix, 0, 0, 1)
 
 VAR (showsky, 0, 1, 1)
 
 VAR (clipsky, 0, 1, 1)
 
bool drawskylimits (bool explicitonly)
 
void drawskyoutline ()
 
 VAR (clampsky, 0, 1, 1)
 
 VARR (fogdomeclouds, 0, 1, 1)
 
static void drawfogdome (int farplane)
 
static int yawskyfaces (int faces, int yaw, float spin=0)
 
void drawskybox (int farplane, bool limited)
 
 VARNR (skytexture, useskytexture, 0, 1, 1)
 
bool limitsky ()
 

Variables

Texturesky [6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
 
Textureclouds [6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
 
Texturecloudoverlay = nullptr
 
bvec fogdomecolor (0, 0, 0)
 
struct fogdome::vertfogdome::verts = nullptr
 
GLushort * fogdome::indices = nullptr
 
int fogdome::numverts = 0
 
int fogdome::numindices = 0
 
int fogdome::capindices = 0
 
GLuint fogdome::vbuf = 0
 
GLuint fogdome::ebuf = 0
 
bvec fogdome::lastcolor (0, 0, 0)
 
float fogdome::lastminalpha = 0
 
float fogdome::lastmaxalpha = 0
 
float fogdome::lastcapsize = -1
 
float fogdome::lastclipz = 1
 
int explicitsky = 0
 
double skyarea = 0
 

Function Documentation

void cleanupsky ( )

References fogdome::cleanup().

Referenced by resetgl().

void drawenvbox ( int  w,
float  z1clip = 0.0f,
float  z2clip = 1.0f,
int  faces = 0x3F,
Texture **  sky = nullptr 
)

References drawenvboxface(), f(), and sky.

Referenced by drawskybox().

void drawenvboxface ( float  s0,
float  t0,
int  x0,
int  y0,
int  z0,
float  s1,
float  t1,
int  x1,
int  y1,
int  z1,
float  s2,
float  t2,
int  x2,
int  y2,
int  z2,
float  s3,
float  t3,
int  x3,
int  y3,
int  z3,
Texture tex 
)

References gle::begin(), gle::end(), notexture, and xtraverts.

Referenced by drawenvbox().

void drawenvoverlay ( int  w,
Texture overlay = nullptr,
float  tx = 0,
float  ty = 0 
)
static void drawfogdome ( int  farplane)
static
void drawskybox ( int  farplane,
bool  limited 
)
bool drawskylimits ( bool  explicitonly)

References nocolorshader, rendersky(), and Shader::set().

Referenced by drawskybox().

void drawskyoutline ( )
FVARR ( spinsky  ,
720,
,
720   
)
FVARR ( cloudboxalpha  ,
,
,
 
)
FVARR ( spinclouds  ,
720,
,
720   
)
FVARR ( cloudclip  ,
,
0.  5f,
 
)
FVARR ( cloudoffsetx  ,
,
,
 
)
FVARR ( cloudoffsety  ,
,
,
 
)
FVARR ( cloudscrollx  ,
16,
,
16   
)
FVARR ( cloudscrolly  ,
16,
,
16   
)
FVARR ( cloudscale  ,
0.  001,
,
64   
)
FVARR ( spincloudlayer  ,
720,
,
720   
)
FVARR ( cloudheight  ,
1,
0.  2f,
 
)
FVARR ( cloudfade  ,
,
0.  2f,
 
)
FVARR ( cloudalpha  ,
,
,
 
)
FVARR ( fogdomeheight  ,
1,
-0.  5f,
 
)
FVARR ( fogdomemin  ,
,
,
 
)
FVARR ( fogdomemax  ,
,
,
 
)
FVARR ( fogdomeclip  ,
,
,
 
)
HVARFR ( fogdomecolour  ,
,
,
0xFFFFFF  ,
{fogdomecolor=bvec((fogdomecolour >>16)&0xFF,(fogdomecolour >>8)&0xFF, fogdomecolour &0xFF);}   
)
HVARR ( skyboxcolour  ,
,
0xFFFFFF  ,
0xFFFFFF   
)
HVARR ( cloudboxcolour  ,
,
0xFFFFFF  ,
0xFFFFFF   
)
HVARR ( cloudcolour  ,
,
0xFFFFFF  ,
0xFFFFFF   
)
bool limitsky ( )

References editmode, explicitsky, skyarea, and worldsize.

Referenced by drawcubemap(), and gl_drawframe().

void loadsky ( const char *  basename,
Texture texs[6] 
)
Texture* loadskyoverlay ( const char *  basename)
SVARFR ( skybox  ,
""  ,
{if(skybox[0]) loadsky(skybox, sky);}   
)
SVARFR ( cloudbox  ,
""  ,
{if(cloudbox[0]) loadsky(cloudbox, clouds);}   
)
SVARFR ( cloudlayer  ,
""  ,
{if(cloudlayer[0]) cloudoverlay=loadskyoverlay(cloudlayer);}   
)
VAR ( showsky  ,
,
,
 
)
VAR ( clipsky  ,
,
,
 
)
VAR ( clampsky  ,
,
,
 
)
VARNR ( skytexture  ,
useskytexture  ,
,
,
 
)
VARP ( sparklyfix  ,
,
,
 
)
VARR ( yawsky  ,
,
,
360   
)
VARR ( yawclouds  ,
,
,
360   
)
VARR ( yawcloudlayer  ,
,
,
360   
)
VARR ( cloudsubdiv  ,
,
16  ,
64   
)
VARR ( fogdomecap  ,
,
,
 
)
VARR ( fogdomeclouds  ,
,
,
 
)
static int yawskyfaces ( int  faces,
int  yaw,
float  spin = 0 
)
static

Referenced by drawskybox().

Variable Documentation

Texture* cloudoverlay = nullptr

Referenced by drawskybox().

Texture * clouds[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }

Referenced by drawskybox().

int explicitsky = 0

Referenced by limitsky(), and octarender().

bvec fogdomecolor(0, 0, 0)

Referenced by fogdome::draw().

Texture* sky[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }

Referenced by drawenvbox(), and drawskybox().

double skyarea = 0

Referenced by limitsky(), and octarender().