blob: 0821b41b05bcf2384f68f95ba16c362dee91cb1b (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Hardware Texels
//
// Contains texture data that was encoded with the map. The initial use case
// is for per-texel lightmaps to allow static props to match the lighting
// of the surrounding BSP geometry.
//
//=============================================================================//
#ifndef HARDWARETEXELS_H
#define HARDWARETEXELS_H
#ifdef _WIN32
#pragma once
#endif
#include "bitmap/imageformat.h"
#include "datamap.h"
// valve hardware texels
#define VHT_VERSION 0
namespace HardwareTexels
{
#pragma pack(1)
// ------------------------------------------------------------------------------------------------
struct MeshHeader_t
{
DECLARE_BYTESWAP_DATADESC();
// this mesh is part of this lod
unsigned int m_nLod;
// starting at this offset
unsigned int m_nOffset;
// this mesh consumes this many bytes
unsigned int m_nBytes;
// with this width and height
unsigned int m_nWidth;
unsigned int m_nHeight;
unsigned int m_nUnused[3];
};
// ------------------------------------------------------------------------------------------------
struct FileHeader_t
{
DECLARE_BYTESWAP_DATADESC();
// file version as defined by VHV_VERSION
int m_nVersion;
// must match checkSum in the .mdl header
unsigned int m_nChecksum;
// all texels are encoded in the same format
// This is a value from ImageFormat.
unsigned int m_nTexelFormat;
// Number of meshes
int m_nMeshes;
inline MeshHeader_t *pMesh( int nMesh ) const
{
Assert(nMesh < m_nMeshes);
return (MeshHeader_t *)(((byte *)this) + sizeof(FileHeader_t)) + nMesh;
};
inline void *pTexelBase( int nMesh ) const
{
return (void *)((byte *)this + pMesh( nMesh )->m_nOffset);
};
unsigned int m_nUnused[4];
};
#pragma pack()
}; // end namespace
#endif // HARDWARETEXELS_H
|