Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Functions | Variables
grass.cpp File Reference
#include <SDL_opengl.h>
#include <math.h>
#include <algorithm>
#include "inexor/engine/glemu.hpp"
#include "inexor/engine/glexts.hpp"
#include "inexor/engine/lightmap.hpp"
#include "inexor/engine/octaedit.hpp"
#include "inexor/engine/octree.hpp"
#include "inexor/engine/rendergl.hpp"
#include "inexor/engine/renderva.hpp"
#include "inexor/engine/shader.hpp"
#include "inexor/engine/water.hpp"
#include "inexor/network/SharedVar.hpp"
#include "inexor/shared/command.hpp"
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_types.hpp"
#include "inexor/shared/cube_vector.hpp"
#include "inexor/shared/ents.hpp"
#include "inexor/shared/geom.hpp"
#include "inexor/shared/tools.hpp"
#include "inexor/texture/slot.hpp"
#include "inexor/texture/texture.hpp"
#include "inexor/util/legacy_time.hpp"

Classes

struct  grasswedge
 
struct  grassvert
 
struct  grassgroup
 

Macros

#define NUMGRASSWEDGES   8
 
#define NUMGRASSOFFSETS   32
 
#define GRASSVERT(n, tcv, modify)
 

Functions

 VARP (grass, 0, 0, 1)
 
 VAR (dbggrass, 0, 0, 1)
 
 VARP (grassdist, 0, 256, 10000)
 
 FVARP (grasstaper, 0, 0.2, 1)
 
 FVARP (grassstep, 0.5, 2, 8)
 
 VARP (grassheight, 1, 4, 64)
 
 VARR (grassanimmillis, 0, 3000, 60000)
 
 FVARR (grassanimscale, 0, 0.03f, 1)
 
static void animategrass ()
 
 VARR (grassscale, 1, 2, 64)
 
 HVARFR (grasscolour, 0, 0xFFFFFF, 0xFFFFFF,{if(!grasscolour) grasscolour=0xFFFFFF;grasscolor=bvec((grasscolour >>16)&0xFF,(grasscolour >>8)&0xFF, grasscolour &0xFF);})
 
 FVARR (grassalpha, 0, 1, 1)
 
static void gengrassquads (grassgroup *&group, const grasswedge &w, const grasstri &g, Texture *tex)
 
static void gengrassquads (vtxarray *va)
 
static bool comparegrassgroups (const grassgroup &x, const grassgroup &y)
 
void generategrass ()
 
void rendergrass ()
 
void cleanupgrass ()
 

Variables

static struct grasswedge grasswedges [NUMGRASSWEDGES] = { 0, 1, 2, 3, 4, 5, 6, 7 }
 
static vector< grassvertgrassverts
 
static GLuint grassvbo = 0
 
static int grassvbosize = 0
 
static vector< grassgroupgrassgroups
 
static float grassoffsets [NUMGRASSOFFSETS] = { -1 }
 
static float grassanimoffsets [NUMGRASSOFFSETS]
 
static int lastgrassanim = -1
 
bvec grasscolor (255, 255, 255)
 

Class Documentation

struct grassvert
Class Members
bvec4 color
vec2 lm
vec pos
vec2 tc
struct grassgroup
Class Members
float dist
int lmtex
int numquads
int offset
int tex
const grasstri * tri

Macro Definition Documentation

#define GRASSVERT (   n,
  tcv,
  modify 
)
Value:
{ \
grassvert &gv = grassverts.add(); \
gv.pos = p##n; \
gv.color = color; \
gv.tc = vec2(tc##n, tcv); \
gv.lm = lm##n; \
modify; \
}
2-dimensional float vectors
Definition: geom.hpp:38
static vector< grassvert > grassverts
Definition: grass.cpp:60
static void color(const bvec &v, uchar alpha=255)
Definition: glemu.hpp:71

Referenced by gengrassquads().

#define NUMGRASSOFFSETS   32
#define NUMGRASSWEDGES   8

Referenced by generategrass(), and gengrassquads().

Function Documentation

static void animategrass ( )
static
void cleanupgrass ( )

References glDeleteBuffers_, grassvbo, and grassvbosize.

Referenced by cleanupva().

static bool comparegrassgroups ( const grassgroup x,
const grassgroup y 
)
inlinestatic

References grassgroup::dist.

Referenced by generategrass().

FVARP ( grasstaper  ,
,
0.  2,
 
)
FVARP ( grassstep  ,
0.  5,
,
 
)
FVARR ( grassanimscale  ,
,
0.  03f,
 
)
FVARR ( grassalpha  ,
,
,
 
)
void generategrass ( )
static void gengrassquads ( grassgroup *&  group,
const grasswedge w,
const grasstri g,
Texture tex 
)
static
static void gengrassquads ( vtxarray va)
static
HVARFR ( grasscolour  ,
,
0xFFFFFF  ,
0xFFFFFF  ,
{if(!grasscolour) grasscolour=0xFFFFFF;grasscolor=bvec((grasscolour >>16)&0xFF,(grasscolour >>8)&0xFF, grasscolour &0xFF);}   
)
void rendergrass ( )
VAR ( dbggrass  ,
,
,
 
)
VARP ( grass  ,
,
,
 
)
VARP ( grassdist  ,
,
256  ,
10000   
)
VARP ( grassheight  ,
,
,
64   
)
VARR ( grassanimmillis  ,
,
3000  ,
60000   
)
VARR ( grassscale  ,
,
,
64   
)

Variable Documentation

float grassanimoffsets[NUMGRASSOFFSETS]
static

Referenced by animategrass(), and gengrassquads().

bvec grasscolor(255, 255, 255)

Referenced by gengrassquads().

vector<grassgroup> grassgroups
static
float grassoffsets[NUMGRASSOFFSETS] = { -1 }
static
GLuint grassvbo = 0
static
int grassvbosize = 0
static

Referenced by cleanupgrass(), and generategrass().

vector<grassvert> grassverts
static
struct grasswedge grasswedges[NUMGRASSWEDGES] = { 0, 1, 2, 3, 4, 5, 6, 7 }
static

Referenced by generategrass(), and gengrassquads().

int lastgrassanim = -1
static

Referenced by animategrass(), and gengrassquads().