move renderlights stuff into renderlights header

This commit is contained in:
q66 2020-06-23 00:23:13 +02:00
parent a0ae98f6b0
commit 3df90e1755
5 changed files with 60 additions and 54 deletions

View file

@ -5,6 +5,8 @@
#include <shared/geom.hh>
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);

View file

@ -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 &center, float radius);
extern int calcbbrsmsplits(const ivec &bbmin, const ivec &bbmax);
extern int calcspherersmsplits(const vec &center, 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<vec2> 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

View file

@ -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<vec2> msaapositions;
int aow = -1, aoh = -1;
GLuint aofbo[4] = { 0, 0, 0, 0 }, aotex[4] = { 0, 0, 0, 0 }, aonoisetex = 0;

View file

@ -1,9 +1,12 @@
#ifndef ENGINE_RENDERLIGHTS_HH
#define ENGINE_RENDERLIGHTS_HH
#include <shared/gl.hh>
#include <shared/tools.hh>
#include <shared/geom.hh>
#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<vec2> 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 &center, float radius);
int calcbbrsmsplits(const ivec &bbmin, const ivec &bbmax);
int calcspherersmsplits(const vec &center, 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

View file

@ -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"