aboutsummaryrefslogtreecommitdiff
path: root/tool_src/BspLib/ObjectBinFormat.h
blob: 08103187905bc7c3f5b33da87ea9a93f8b1e1044 (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
//-----------------------------------------------------------------------------
//	BSPLIB HEADER: ObjectBinFormat.h
//
//  Copyright (c) 1998-1999 by Markus Hadwiger
//  All Rights Reserved.
//-----------------------------------------------------------------------------

#ifndef _OBJECTBINFORMAT_H_
#define _OBJECTBINFORMAT_H_

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


BSPLIB_NAMESPACE_BEGIN


// BspObject capable of writing itself in binary format -----------------------
//
class ObjectBinFormat : public BspObject, public virtual SystemIO {

public:

	// output formats
	enum {
		BINFORMAT_ODT,		// ODT (old format: single object)
		BINFORMAT_OD2,		// OD2 (new format: scene/tree)
	};

public:
	ObjectBinFormat( BspObject& object ) : BspObject( object ) { }
	~ObjectBinFormat() { }
	int			WriteDataToFile( const char *filename, int format );

private:
	void		ODT_CalcAffineMapping( Face& face, dword *dmatrx );
	byte *		ODT_CreateEngineObject( int& memblocksize );
	byte *		ODT_CreateFileObject( int& memblocksize, byte *engineobj );

	void		OD2_CalcAffineMapping( Face& face, dword *dmatrx );
	byte *		OD2_CreateEngineObject( int& memblocksize );
	byte *		OD2_CreateFileObject( int& memblocksize, byte *engineobj );

private:
	static char	line[]; // scratchpad
};


BSPLIB_NAMESPACE_END


#endif // _OBJECTBINFORMAT_H_