ScummVM API documentation
body.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef TWINE_PARSER_BODY_H
23
#define TWINE_PARSER_BODY_H
24
25
#include "common/array.h"
26
#include "common/memstream.h"
27
#include "common/stream.h"
28
#include "twine/parser/anim.h"
29
#include "twine/parser/bodytypes.h"
30
#include "twine/parser/parser.h"
31
#include "twine/shared.h"
32
33
namespace
TwinE
{
34
36
struct
AnimTimerDataStruct
{
37
const
KeyFrame
*ptr =
nullptr
;
38
int32 time = 0;
// keyframe time
39
};
40
41
class
BodyData
:
public
Parser
{
42
private
:
43
void
loadVertices(
Common::SeekableReadStream
&stream);
44
void
loadBones(
Common::SeekableReadStream
&stream);
45
void
loadNormals(
Common::SeekableReadStream
&stream);
46
void
loadPolygons(
Common::SeekableReadStream
&stream);
47
void
loadLines(
Common::SeekableReadStream
&stream);
48
void
loadSpheres(
Common::SeekableReadStream
&stream);
49
50
Common::Array<BodyPolygon>
_polygons;
51
Common::Array<BodyVertex>
_vertices;
52
Common::Array<BodySphere>
_spheres;
53
Common::Array<BodyNormal>
_normals;
54
Common::Array<BodyLine>
_lines;
55
Common::Array<BodyBone>
_bones;
56
57
BoneFrame
_boneStates[560];
58
59
protected
:
60
void
reset()
override
;
61
62
public
:
63
bool
animated =
false
;
64
AnimTimerDataStruct
_animTimerData;
65
66
BoundingBox
bbox;
67
int16 offsetToData = 0;
68
69
inline
bool
isAnimated()
const
{
70
return
animated;
71
}
72
73
inline
uint getNumBones()
const
{
74
return
_bones.
size
();
75
}
76
77
inline
uint getNumVertices()
const
{
78
return
_vertices.
size
();
79
}
80
81
BoneFrame
*getBoneState(int16 boneIdx) {
82
return
&_boneStates[boneIdx];
83
}
84
85
const
BoneFrame
*getBoneState(int16 boneIdx)
const
{
86
return
&_boneStates[boneIdx];
87
}
88
89
const
Common::Array<BodyPolygon>
&getPolygons()
const
{
90
return
_polygons;
91
}
92
93
const
Common::Array<BodyVertex>
&getVertices()
const
{
94
return
_vertices;
95
}
96
97
const
Common::Array<BodySphere>
&getSpheres()
const
{
98
return
_spheres;
99
}
100
101
const
Common::Array<BodyNormal>
&getNormals()
const
{
102
return
_normals;
103
}
104
105
const
BodyNormal
&getNormal(int16 normalIdx)
const
{
106
return
_normals[normalIdx];
107
}
108
109
const
Common::Array<BodyLine>
&getLines()
const
{
110
return
_lines;
111
}
112
113
const
Common::Array<BodyBone>
&getBones()
const
{
114
return
_bones;
115
}
116
117
const
BodyBone
&getBone(int16 boneIdx)
const
{
118
return
_bones[boneIdx];
119
}
120
121
bool
loadFromStream(
Common::SeekableReadStream
&stream,
bool
lba1)
override
;
122
};
123
124
}
// End of namespace TwinE
125
126
#endif
Common::Array
Definition:
array.h:52
TwinE::BodyNormal
Definition:
bodytypes.h:67
TwinE::AnimTimerDataStruct
Definition:
body.h:36
Common::SeekableReadStream
Definition:
stream.h:745
TwinE
Definition:
achievements_tables.h:27
Common::Array::size
size_type size() const
Definition:
array.h:315
TwinE::BoneFrame
Definition:
anim.h:38
TwinE::Parser
Definition:
parser.h:32
TwinE::BoundingBox
Axis aligned bounding box.
Definition:
shared.h:191
TwinE::KeyFrame
Definition:
anim.h:46
TwinE::BodyBone
Definition:
bodytypes.h:54
TwinE::BodyData
Definition:
body.h:41
engines
twine
parser
body.h
Generated on Tue Feb 18 2025 09:20:45 for ScummVM API documentation by
1.8.13