25 #include "glm/mat4x4.hpp" 26 #include "glm/gtc/matrix_transform.hpp" 27 #include "glm/gtx/matrix_interpolation.hpp" 54 using ::Aurora::GFF4File;
55 using ::Aurora::GFF4Struct;
108 const GFF4Struct &rmlTop = rml.getTopLevel();
110 float roomPos[3] = { 0.0f, 0.0f, 0.0f };
111 rmlTop.getVector3(
kGFF4Position, roomPos[0], roomPos[1], roomPos[2]);
113 float roomOrient[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
114 rmlTop.getVector4(
kGFF4Orientation, roomOrient[0], roomOrient[1], roomOrient[2], roomOrient[3]);
117 glm::mat4 roomTransform;
119 roomTransform = glm::translate(roomTransform, glm::vec3(roomPos[0], roomPos[1], roomPos[2]));
121 if (roomOrient[0] != 0 || roomOrient[1] != 0 || roomOrient[2] != 0)
122 roomTransform = glm::rotate(roomTransform,
124 glm::vec3(roomOrient[0], roomOrient[1], roomOrient[2]));
129 _models.reserve(models.size());
131 for (GFF4List::const_iterator m = models.begin(); m != models.end(); ++m) {
132 if (!*m || ((*m)->getLabel() !=
kMDLID))
137 float pos[3] = { 0.0f, 0.0f, 0.0f };
140 float orient[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
141 (*m)->getVector4(
kGFF4Orientation, orient[0], orient[1], orient[2], orient[3]);
152 glm::mat4 modelTransform(roomTransform);
154 modelTransform = glm::translate(modelTransform, glm::vec3(pos[0], pos[1], pos[2]));
156 if (orient[0] != 0 || orient[1] != 0 || orient[2] != 0)
157 modelTransform = glm::rotate(modelTransform,
159 glm::vec3(orient[0], orient[1], orient[2]));
161 pos[0] = modelTransform[3][0];
162 pos[1] = modelTransform[3][1];
163 pos[2] = modelTransform[3][2];
166 glm::axisAngle(modelTransform, axis, orient[3]);
173 model->
setOrientation(orient[0], orient[1], orient[2], orient[3]);
174 model->
setScale(scale, scale, scale);
179 for (Models::iterator m =
_models.begin(); m !=
_models.end(); ++m)
184 for (Models::iterator m =
_models.begin(); m !=
_models.end(); ++m)
#define ResMan
Shortcut for accessing the sound manager.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
static const uint32 kMDLID
A class holding an UTF-8 string.
bool indexOptionalArchive(const Common::UString &file, uint32 priority, const std::vector< byte > &password, Common::ChangeID *changeID)
A room in a Dragon Age: Origins area.
Utility templates and functions for working with strings and streams.
Room(const Aurora::GFF4Struct &room)
Exception that provides a stack of explanations.
static const uint32 kRMLID
void deindexResources(Common::ChangeID &changeID)
Remove previously added resources from the ResourceManager.
std::vector< const GFF4Struct * > GFF4List
Handling version V4.0/V4.1 of BioWare's GFFs (generic file format).
Basic exceptions to throw.
void setOrientation(float x, float y, float z, float angle)
Set the current orientation of the model.
const char * c_str() const
Return the (utf8 encoded) string data.
void load(const Aurora::GFF4Struct &room)
Utility templates and functions.
The global events manager.
static const uint32 kVersion40
void setPosition(float x, float y, float z)
Set the current position of the model.
#define EventMan
Shortcut for accessing the events manager.
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
void status(const char *s,...)
static float rad2deg(float rad)
Graphics::Aurora::Model * loadModelObject(const Common::UString &resref, const Common::UString &texture)
static float deg2rad(float deg)
void loadLayout(const Common::UString &roomFile)
void setScale(float x, float y, float z)
Set the current scale of the model.
The global resource manager for Aurora resources.
Generic Aurora engines model functions.