summaryrefslogtreecommitdiffstats
path: root/src/renderer/PointLights.h
blob: 827200b9b2da32994ae79817832e57c82643dd42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

class CRegisteredPointLight
{
public:
	CVector coors;
	CVector dir;
	float radius;
	float red;
	float green;
	float blue;
	int8 type;
	int8 fogType;
	bool castExtraShadows;
};
VALIDATE_SIZE(CRegisteredPointLight, 0x2C);

class CPointLights
{
public:
	static int16 NumLights;
	static CRegisteredPointLight aLights[NUMPOINTLIGHTS];
	static CVector aCachedMapReads[32];
	static float aCachedMapReadResults[32];
	static int32 NextCachedValue;

	enum {
		LIGHT_POINT,
		LIGHT_DIRECTIONAL,
		LIGHT_DARKEN,	// no effects at all
		// these have only fog, otherwise no difference?
		// only used by CEntity::ProcessLightsForEntity it seems
		// and there used together with fog type
		LIGHT_FOGONLY_ALWAYS,
		LIGHT_FOGONLY,
	};
	enum {
		FOG_NONE,
		FOG_NORMAL,	// taken from Foggyness
		FOG_ALWAYS
	};

	static void Init(void);
	static void InitPerFrame(void);
	static void AddLight(uint8 type, CVector coors, CVector dir, float radius, float red, float green, float blue, uint8 fogType, bool castExtraShadows);
	static float GenerateLightsAffectingObject(Const CVector *objCoors);
	static void RemoveLightsAffectingObject(void);
	static void RenderFogEffect(void);
	static bool ProcessVerticalLineUsingCache(CVector coors, float *groundZ);
};