1 #ifndef __RES_VOXEL_H
2 #define __RES_VOXEL_H
3 
4 #include "doomdef.h"
5 
6 // [RH] Voxels from Build
7 
8 #define MAXVOXMIPS 5
9 
10 struct kvxslab_t
11 {
12 	BYTE		ztop;			// starting z coordinate of top of slab
13 	BYTE		zleng;			// # of bytes in the color array - slab height
14 	BYTE		backfacecull;	// low 6 bits tell which of 6 faces are exposed
15 	BYTE		col[1/*zleng*/];// color data from top to bottom
16 };
17 
18 struct FVoxelMipLevel
19 {
20 	FVoxelMipLevel();
21 	~FVoxelMipLevel();
22 
23 	int			SizeX;
24 	int			SizeY;
25 	int			SizeZ;
26 	fixed_t		PivotX;		// 24.8 fixed point
27 	fixed_t		PivotY;		// ""
28 	fixed_t		PivotZ;		// ""
29 	int			*OffsetX;
30 	short		*OffsetXY;
31 	BYTE		*SlabData;
32 };
33 
34 struct FVoxel
35 {
36 	int LumpNum;
37 	int NumMips;
38 	int VoxelIndex;			// Needed by GZDoom
39 	BYTE *Palette;
40 	FVoxelMipLevel Mips[MAXVOXMIPS];
41 
42 	FVoxel();
43 	~FVoxel();
44 	void Remap();
45 	void RemovePalette();
46 };
47 
48 struct FVoxelDef
49 {
50 	FVoxel *Voxel;
51 	int PlacedSpin;			// degrees/sec to spin actors without MF_DROPPED set
52 	int DroppedSpin;		// degrees/sec to spin actors with MF_DROPPED set
53 	int VoxeldefIndex;		// Needed by GZDoom
54 	fixed_t Scale;
55 	angle_t AngleOffset;	// added to actor's angle to compensate for wrong-facing voxels
56 };
57 
58 extern TDeletingArray<FVoxel *> Voxels;	// used only to auto-delete voxels on exit.
59 extern TDeletingArray<FVoxelDef *> VoxelDefs;
60 
61 FVoxel *R_LoadKVX(int lumpnum);
62 FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin);
63 void R_InitVoxels();
64 
65 #endif
66