-
Notifications
You must be signed in to change notification settings - Fork 2
/
LightmapManager.h
60 lines (46 loc) · 1.41 KB
/
LightmapManager.h
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
55
56
57
58
59
60
//-----------------------------------------------------------------------------
// File:
//
// Desc:
//
// Copyright (c) 2002 Dan
//-----------------------------------------------------------------------------
#ifndef _LIGHTMAPMANANGER_H_
#define _LIGHTMAPMANANGER_H_
#include <fstream>
using namespace std;
typedef struct _BLOCK_SECTOR
{
bool bLeftIsOccupied, bRightIsOccupied;
} BLOCK_SECTOR;
typedef struct _LIGHTMAP
{
int iLightmapBlockIndex;
int iResolution;
BLOCK_SECTOR BlockSector;
float fU[ 4 ];
float fV[ 4 ];
} LIGHTMAP;
class CLightmapManager
{
public:
CLightmapManager();
virtual ~CLightmapManager();
bool Init();
bool Release();
bool Invalidate( LIGHTMAP* lm );
bool Open( const char* strFile, ifstream &in );
bool Save( const char* strFile, ofstream &out );
unsigned int GetTextureGL( const int iIndex ) { return m_pLightmapBlocks[ iIndex ]; }
private:
int GetNumLightmapBlocks() const { return m_iNumLightmapBlocks; }
void SetNumLightmapBlocks( const int iNum ) { m_iNumLightmapBlocks = iNum; }
bool ReleaseLightmap( const int iIndex );
bool CreateLightmap( const unsigned char* pLightmapData, const int iIndex );
const int LIGHTMAP_WIDTH, LIGHTMAP_HEIGHT;
const int BLOCK_WIDTH, BLOCK_HEIGHT;
int m_iNumLightmapBlocks;
unsigned int* m_pLightmapBlocks;
BLOCK_SECTOR m_OccupancyGrid[ 32 ][ 32 ];
};
#endif