File: model_header.h

package info (click to toggle)
megaglest 3.13.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 13,416 kB
  • sloc: cpp: 144,271; ansic: 11,861; sh: 3,233; perl: 1,904; python: 1,751; objc: 142; asm: 42; makefile: 22
file content (121 lines) | stat: -rw-r--r-- 2,207 bytes parent folder | download | duplicates (5)
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
120
121
// ==============================================================
//	This file is part of Glest Shared Library (www.glest.org)
//
//	Copyright (C) 2001-2008 MartiƱo Figueroa
//
//	You can redistribute this code and/or modify it under 
//	the terms of the GNU General Public License as published 
//	by the Free Software Foundation; either version 2 of the 
//	License, or (at your option) any later version
// ==============================================================

#ifndef _SHARED_GRAPHICTYPES_MODELHEADER_H_
#define _SHARED_GRAPHICTYPES_MODELHEADER_H_

#include "data_types.h"
#include "leak_dumper.h"

using Shared::Platform::uint8;
using Shared::Platform::uint16;
using Shared::Platform::uint32;
using Shared::Platform::float32;

namespace Shared{ namespace Graphics{

#pragma pack(push, 1) 

struct FileHeader{
	uint8 id[3];
	uint8 version;
};

//version 4

struct ModelHeader{
	uint16 meshCount;
	uint8 type;
};

enum ModelType{
	mtMorphMesh	
};

enum MeshPropertyFlag{
	mpfCustomColor= 1,
	mpfTwoSided= 2,
	mpfNoSelect= 4,
	mpfGlow= 8
};

enum MeshTexture{
	mtDiffuse,
	mtSpecular,
	mtNormal,
	mtReflection,
	mtColorMask,

	meshTextureCount
};

const int meshTextureChannelCount[]= {-1, 1, 3, 1, 1};

const uint32 meshNameSize= 64;
const uint32 mapPathSize= 64;

struct MeshHeader{
	uint8 name[meshNameSize];
	uint32 frameCount;
	uint32 vertexCount;
	uint32 indexCount;
	float32 diffuseColor[3];
	float32 specularColor[3];
	float32 specularPower;
	float32 opacity;
	uint32 properties;
	uint32 textures;
};

#pragma pack(pop) 

//version 3

//front faces are clockwise faces
struct ModelHeaderV3{
	uint32 meshCount;
};

enum MeshPropertyV3{
	mp3NoTexture= 1,
	mp3TwoSided= 2,
	mp3CustomColor= 4
};

struct MeshHeaderV3{
	uint32 vertexFrameCount;
	uint32 normalFrameCount;
	uint32 texCoordFrameCount;
	uint32 colorFrameCount;
	uint32 pointCount;
	uint32 indexCount;
	uint32 properties;
	uint8 texName[64];
};

//version 2

struct MeshHeaderV2{
	uint32 vertexFrameCount;
	uint32 normalFrameCount;
	uint32 texCoordFrameCount;
	uint32 colorFrameCount;
	uint32 pointCount;
	uint32 indexCount;
	uint8 hasTexture;
	uint8 primitive;
	uint8 cullFace;
	uint8 texName[64];
};

}}//end namespace

#endif