aboutsummaryrefslogtreecommitdiff
path: root/tool_src/BspLib/SingleFormat.h
blob: 36d7fddde8c8ac49bec1bd7d53e12c3756a9b9b7 (plain)
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
119
//-----------------------------------------------------------------------------
//	BSPLIB HEADER: SingleFormat.h
//
//  Copyright (c) 1997 by Markus Hadwiger
//  All Rights Reserved.
//-----------------------------------------------------------------------------

#ifndef _SINGLEFORMAT_H_
#define _SINGLEFORMAT_H_

// bsplib header files
#include "BspLibDefs.h"
#include "SystemIO.h"
#include "Vertex.h"


BSPLIB_NAMESPACE_BEGIN


// baseclass for single format type file input/output -------------------------
//
class SingleFormatBase {

	friend class SingleFormat;

private:
	SingleFormatBase();
	~SingleFormatBase() { }

protected:
	char	xchangecmd[4];

	Vertex3 AxesDirSwitch;

	double	ObjScaleX;
	double	ObjScaleY;
	double	ObjScaleZ;

	double	NewOriginX;
	double	NewOriginY;
	double	NewOriginZ;

	int		worldlocation_set;
	int		camera_set;
	int		xchange_set;
	int		scalefactors_set;
	int		setorigin_set;

	hprec_t	wm[16];	// world matrix
	hprec_t	vm[16];	// view matrix
};

class SingleFormat : public SingleFormatBase {

protected:

	// section enumeration
	enum {
		_nil,
		_vertices,
		_faces,
		_faceproperties,
		_correspondences,
		_textures,
		_worldlocation,
		_camera,
		_comment,
		_palette,
		_scalefactors,
		_xchange,
		_setorigin,
		_facenormals,

		_num_single_sections
	};

public:
	SingleFormat();
	~SingleFormat() { }

	SingleFormat( const SingleFormat& copyobj );
	SingleFormat& operator =( const SingleFormat& copyobj );

protected:
	String				m_palette_fname;

protected:
	static int			GetSectionId( char *section_name );
	static const char*	GetSectionName( int section_id );

protected:
	static const double PREMOVEORIGIN_X;
	static const double PREMOVEORIGIN_Y;
	static const double PREMOVEORIGIN_Z;

	static const char	_vertices_str[];
	static const char	_faces_str[];
	static const char	_faceproperties_str[];
	static const char	_correspondences_str[];
	static const char	_textures_str[];
	static const char	_worldlocation_str[];
	static const char	_camera_str[];
	static const char	_comment_str[];
	static const char	_palette_str[];
	static const char	_scalefactors_str[];
	static const char	_xchange_str[];
	static const char	_setorigin_str[];
	static const char	_facenormals_str[];

	static const char*	section_strings[];
	static const int	section_ids[];
};


BSPLIB_NAMESPACE_END


#endif // _SINGLEFORMAT_H_