diff --git a/src/engine/aa.hh b/src/engine/aa.hh index dcf09e0..0d37976 100644 --- a/src/engine/aa.hh +++ b/src/engine/aa.hh @@ -5,6 +5,8 @@ #include +enum { AA_UNUSED = 0, AA_LUMA, AA_MASKED, AA_SPLIT, AA_SPLIT_LUMA, AA_SPLIT_MASKED }; + extern matrix4 nojittermatrix; void setaavelocityparams(GLenum tmu = GL_TEXTURE0); diff --git a/src/engine/engine.hh b/src/engine/engine.hh index 297bd4d..fa1b9d3 100644 --- a/src/engine/engine.hh +++ b/src/engine/engine.hh @@ -11,56 +11,4 @@ extern physent *camera1; // special ent that acts as camera, same extern int worldscale, worldsize; extern int xtraverts, xtravertsva; -// renderlights - -extern int calcshadowinfo(const extentity &e, vec &origin, float &radius, vec &spotloc, int &spotangle, float &bias); -extern void rendershadowatlas(); -extern bool useradiancehints(); -extern void renderradiancehints(); -extern void clearradiancehintscache(); -extern void cleanuplights(); -extern void workinoq(); - -extern int calcbbcsmsplits(const ivec &bbmin, const ivec &bbmax); -extern int calcspherecsmsplits(const vec ¢er, float radius); -extern int calcbbrsmsplits(const ivec &bbmin, const ivec &bbmax); -extern int calcspherersmsplits(const vec ¢er, float radius); - -extern int transparentlayer; - -extern int gw, gh, gdepthformat, ghasstencil; -extern GLuint gdepthtex, gcolortex, gnormaltex, gglowtex, gdepthrb, gstencilrb; -extern int msaasamples, msaalight; -extern GLuint msdepthtex, mscolortex, msnormaltex, msglowtex, msdepthrb, msstencilrb; -extern vector msaapositions; -enum { AA_UNUSED = 0, AA_LUMA, AA_MASKED, AA_SPLIT, AA_SPLIT_LUMA, AA_SPLIT_MASKED }; - -extern void cleanupgbuffer(); -extern void initgbuffer(); -extern bool usepacknorm(); -extern void maskgbuffer(const char *mask); -extern void bindgdepth(); -extern void preparegbuffer(bool depthclear = true); -extern void rendergbuffer(bool depthclear = true); -extern void shadesky(); -extern void shadegbuffer(); -extern void shademinimap(const vec &color = vec(-1, -1, -1)); -extern void shademodelpreview(int x, int y, int w, int h, bool background = true, bool scissor = false); -extern void rendertransparent(); -extern void renderao(); -extern void loadhdrshaders(int aa = AA_UNUSED); -extern void processhdr(GLuint outfbo = 0, int aa = AA_UNUSED); -extern void copyhdr(int sw, int sh, GLuint fbo, int dw = 0, int dh = 0, bool flipx = false, bool flipy = false, bool swapxy = false); -extern void setuplights(); -extern void setupgbuffer(); -extern GLuint shouldscale(); -extern void doscale(GLuint outfbo = 0); -extern bool debuglights(); -extern void cleanuplights(); - -extern int avatarmask; -extern bool useavatarmask(); -extern void enableavatarmask(); -extern void disableavatarmask(); - #endif diff --git a/src/engine/renderlights.cc b/src/engine/renderlights.cc index f1e94d1..0b335f0 100644 --- a/src/engine/renderlights.cc +++ b/src/engine/renderlights.cc @@ -21,7 +21,8 @@ #define CHANGE_SHADERS 0 int gw = -1, gh = -1, bloomw = -1, bloomh = -1, lasthdraccum = 0; -GLuint gfbo = 0, gdepthtex = 0, gcolortex = 0, gnormaltex = 0, gglowtex = 0, gdepthrb = 0, gstencilrb = 0; +GLuint gfbo = 0, gdepthtex = 0, gcolortex = 0, gnormaltex = 0, gglowtex = 0; +static GLuint gdepthrb = 0, gstencilrb = 0; bool gdepthinit = false; int scalew = -1, scaleh = -1; GLuint scalefbo[2] = { 0, 0 }, scaletex[2] = { 0, 0 }; @@ -30,7 +31,8 @@ int hdrclear = 0; GLuint refractfbo = 0, refracttex = 0; GLenum bloomformat = 0, hdrformat = 0, stencilformat = 0; bool hdrfloat = false; -GLuint msfbo = 0, msdepthtex = 0, mscolortex = 0, msnormaltex = 0, msglowtex = 0, msdepthrb = 0, msstencilrb = 0, mshdrfbo = 0, mshdrtex = 0, msrefractfbo = 0, msrefracttex = 0; +GLuint msfbo = 0, msdepthtex = 0, mscolortex = 0, msnormaltex = 0, msglowtex = 0; +static GLuint msdepthrb = 0, msstencilrb = 0, mshdrfbo = 0, mshdrtex = 0, msrefractfbo = 0, msrefracttex = 0; vector msaapositions; int aow = -1, aoh = -1; GLuint aofbo[4] = { 0, 0, 0, 0 }, aotex[4] = { 0, 0, 0, 0 }, aonoisetex = 0; diff --git a/src/engine/renderlights.hh b/src/engine/renderlights.hh index 23cea9c..f6d8b17 100644 --- a/src/engine/renderlights.hh +++ b/src/engine/renderlights.hh @@ -1,9 +1,12 @@ #ifndef ENGINE_RENDERLIGHTS_HH #define ENGINE_RENDERLIGHTS_HH +#include #include #include +#include "aa.hh" + #define LIGHTTILE_MAXW 16 #define LIGHTTILE_MAXH 16 @@ -59,4 +62,54 @@ static inline bool bbinsidespot(const vec &origin, const vec &dir, int spot, con extern matrix4 worldmatrix, screenmatrix; +struct extentity; // FIXME + +extern int transparentlayer; +extern int gw, gh, ghasstencil; +extern GLuint gdepthtex, gcolortex, gnormaltex, gglowtex; +extern GLuint msdepthtex, mscolortex, msnormaltex, msglowtex; +extern int msaasamples, msaalight; +extern vector msaapositions; + +int calcshadowinfo(const extentity &e, vec &origin, float &radius, vec &spotloc, int &spotangle, float &bias); +void rendershadowatlas(); +bool useradiancehints(); +void renderradiancehints(); +void clearradiancehintscache(); +void cleanuplights(); +void workinoq(); + +int calcbbcsmsplits(const ivec &bbmin, const ivec &bbmax); +int calcspherecsmsplits(const vec ¢er, float radius); +int calcbbrsmsplits(const ivec &bbmin, const ivec &bbmax); +int calcspherersmsplits(const vec ¢er, float radius); + +void cleanupgbuffer(); +void initgbuffer(); +bool usepacknorm(); +void maskgbuffer(const char *mask); +void bindgdepth(); +void preparegbuffer(bool depthclear = true); +void rendergbuffer(bool depthclear = true); +void shadesky(); +void shadegbuffer(); +void shademinimap(const vec &color = vec(-1, -1, -1)); +void shademodelpreview(int x, int y, int w, int h, bool background = true, bool scissor = false); +void rendertransparent(); +void renderao(); +void loadhdrshaders(int aa = AA_UNUSED); +void processhdr(GLuint outfbo = 0, int aa = AA_UNUSED); +void copyhdr(int sw, int sh, GLuint fbo, int dw = 0, int dh = 0, bool flipx = false, bool flipy = false, bool swapxy = false); +void setuplights(); +void setupgbuffer(); +GLuint shouldscale(); +void doscale(GLuint outfbo = 0); +bool debuglights(); + +extern int avatarmask; + +bool useavatarmask(); +void enableavatarmask(); +void disableavatarmask(); + #endif diff --git a/src/engine/stain.cc b/src/engine/stain.cc index 42c4d29..42f2264 100644 --- a/src/engine/stain.cc +++ b/src/engine/stain.cc @@ -2,6 +2,7 @@ #include "main.hh" // initing, loadprogress #include "material.hh" #include "rendergl.hh" +#include "renderlights.hh" #include "rendermodel.hh" // loadmapmodel #include "stain.hh" #include "texture.hh"