summaryrefslogtreecommitdiffstats
path: root/src/render/Glass.h
blob: 0c715c27329edd2f85478d6e3406d4688c1d9089 (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
51
52
53
54
#pragma once

class CEntity;

class CFallingGlassPane : public CMatrix
{
public:
	CVector m_vecMoveSpeed;
	CVector m_vecTurn;
	uint32 m_nTimer;
	float m_fGroundZ;
	float m_fStep;
	uint8 m_nTriIndex;
	bool m_bActive;
	bool m_bShattered;

	CFallingGlassPane()  { }
	~CFallingGlassPane() { }

	void Update(void);
	void Render(void);
};

#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CFallingGlassPane, 0x70);
#endif

enum
{
	NUM_GLASSTRIANGLES = 5,
};

class CGlass
{
	static uint32 NumGlassEntities;
	static CEntity *apEntitiesToBeRendered[NUM_GLASSENTITIES];
	static CFallingGlassPane aGlassPanes[NUM_GLASSPANES];
public:
	static void Init(void);
	static void Update(void);
	static void Render(void);
	static CFallingGlassPane *FindFreePane(void);
	static void GeneratePanesForWindow(uint32 type, CVector pos, CVector up, CVector right, CVector speed, CVector point, float moveSpeed, bool cracked, bool explosion);
	static void AskForObjectToBeRenderedInGlass(CEntity *entity);
	static void RenderEntityInGlass(CEntity *entity);
	static int32 CalcAlphaWithNormal(CVector *normal);
	static void RenderHiLightPolys(void);
	static void RenderShatteredPolys(void);
	static void RenderReflectionPolys(void);
	static void WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, CVector point, bool explosion);
	static void WindowRespondsToSoftCollision(CEntity *entity, float amount);
	static void WasGlassHitByBullet(CEntity *entity, CVector point);
	static void WindowRespondsToExplosion(CEntity *entity, CVector point);
};