-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathLightwaveImporter.h
118 lines (93 loc) · 2.2 KB
/
LightwaveImporter.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// LightwaveImporter.h: interface for the CLightwaveImporter class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_LIGHTWAVEIMPORTER_H__B79CCE6A_195B_47AD_91FE_7F684CA2CDB2__INCLUDED_)
#define AFX_LIGHTWAVEIMPORTER_H__B79CCE6A_195B_47AD_91FE_7F684CA2CDB2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "VisibleBsp.h"
#define OBJ_VERT_MAX 20000//0xFFFF
#define OBJ_INDEX_MAX 20000//0xFFFF
typedef struct
{
UINT StartPolygon;
UINT EndPolygon;
UINT PortalIndexList[50];
UINT NumPortals;
UINT PvsIndex;
UINT BoundingBox;
}BSP_LEAF;
typedef struct
{
UINT IsLeaf;
UINT PlaneIndex;
UINT FrontNode;
int BackNode;
UINT BoundingBox;
}BSP_NODE;
typedef struct
{
float PointOnPlane[3];
float Normal[3];
}BSP_PLANE;
typedef struct
{
float vector[3];
UINT index;
}VERTEX_UNK;
typedef struct
{
float vector[3];
}VERT_NORM;
typedef struct
{
float normal[3];
float unknown;
}NORMAL_UNK;
typedef struct
{
float unk1[3];
USHORT unk2[4];
}BSP1;
typedef struct STRUCT_OBJ_SUBMESH_INFO
{
UINT VertCount;
COMPRESSED_BSP_VERT *pVert;
UINT IndexCount;
TRI_INDICES *pIndex;
}OBJ_SUBMESH_INFO;
typedef struct STRUCT_BSP_COLL_INDEX
{
UINT CollisionIndex;
UINT VisibleMeshIndex;
UINT VisibleVertexIndex;
}BSP_COLL_INDEX;
#define SUBMESH_COUNT 1000
class CLightwaveImporter
{
public:
void UpdateCollisionMesh(void);
void SaveCollisionVertFormat(CString filename);
void LoadImportedDataIntoBsp(void);
BOOL VerifyAgainstLoadedMap(void);
void ReadTriangleIndex(CString str, USHORT *pIndex);
void UpdateXboxSubmeshList(void);
void Cleanup(void);
void ParseObjFile(void);
CLightwaveImporter();
virtual ~CLightwaveImporter();
void OpenObjFile(CString path);
protected:
BOOL DoVertsMatch(float *pV1, float *pV2);
void ReadVertex(CString str, float *pVert);
CStdioFile m_ObjFile;
float m_CurrentVerts[OBJ_VERT_MAX][3];
USHORT m_CurrentIndices[OBJ_INDEX_MAX][3];
UINT m_CurrentVertCount;
UINT m_CurrentIndicesCount;
UINT m_CurrentMeshCount;
BOOL m_bFirstPass;
OBJ_SUBMESH_INFO m_Mesh[SUBMESH_COUNT];
};
#endif // !defined(AFX_LIGHTWAVEIMPORTER_H__B79CCE6A_195B_47AD_91FE_7F684CA2CDB2__INCLUDED_)