header for dynlight

master
Daniel Kolesa 2020-06-10 01:52:46 +02:00
parent 2749bda141
commit 0be4009cb6
5 changed files with 29 additions and 21 deletions

View File

@ -1,3 +1,5 @@
#include "dynlight.hh"
#include "pvs.hh"
#include "renderva.hh"
@ -52,8 +54,8 @@ struct dynlight
}
};
vector<dynlight> dynlights;
vector<dynlight *> closedynlights;
static vector<dynlight> dynlights;
static vector<dynlight *> closedynlights;
void adddynlight(const vec &o, float radius, const vec &color, int fade, int peak, int flags, float initradius, const vec &initcolor, physent *owner, const vec &dir, int spot)
{
@ -78,7 +80,7 @@ void adddynlight(const vec &o, float radius, const vec &color, int fade, int pea
dynlights.insert(insert, d);
}
void cleardynlights()
static void cleardynlights()
{
int faded = -1;
loopv(dynlights) if(lastmillis<dynlights[i].expire) { faded = i; break; }

View File

@ -0,0 +1,23 @@
#ifndef ENGINE_DYNLIGHT_HH
#define ENGINE_DYNLIGHT_HH
#include <shared/geom.hh>
struct physent;
enum
{
DL_SHRINK = 1<<8,
DL_EXPAND = 1<<9,
DL_FLASH = 1<<10
};
void adddynlight(const vec &o, float radius, const vec &color, int fade = 0, int peak = 0, int flags = 0, float initradius = 0, const vec &initcolor = vec(0, 0, 0), physent *owner = NULL, const vec &dir = vec(0, 0, 0), int spot = 0);
void dynlightreaching(const vec &target, vec &color, vec &dir, bool hud = false);
void removetrackeddynlights(physent *owner = NULL);
void updatedynlights();
int finddynlights();
bool getdynlight(int n, vec &o, float &radius, vec &color, vec &dir, int &spot, int &flags);
#endif

View File

@ -87,12 +87,6 @@ extern void destroyva(vtxarray *va, bool reparent = true);
extern void updatevabb(vtxarray *va, bool force = false);
extern void updatevabbs(bool force = false);
// dynlight
extern void updatedynlights();
extern int finddynlights();
extern bool getdynlight(int n, vec &o, float &radius, vec &color, vec &dir, int &spot, int &flags);
// command
extern hashnameset<ident> idents;
extern int identflags;

View File

@ -1,6 +1,7 @@
#include "renderlights.hh"
#include "aa.hh"
#include "dynlight.hh"
#include "main.hh" // initwarning
#include "material.hh"
#include "octaedit.hh" // editmode

View File

@ -109,18 +109,6 @@ extern void fatal(const char *s, ...) PRINTFARGS(1, 2);
struct VSlot;
// dynlight
enum
{
DL_SHRINK = 1<<8,
DL_EXPAND = 1<<9,
DL_FLASH = 1<<10
};
extern void adddynlight(const vec &o, float radius, const vec &color, int fade = 0, int peak = 0, int flags = 0, float initradius = 0, const vec &initcolor = vec(0, 0, 0), physent *owner = NULL, const vec &dir = vec(0, 0, 0), int spot = 0);
extern void dynlightreaching(const vec &target, vec &color, vec &dir, bool hud = false);
extern void removetrackeddynlights(physent *owner = NULL);
// rendergl
extern physent *camera1;
extern vec worldpos, camdir, camright, camup;