mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 04:28:37 +00:00
TETRAEDGE: Handle invertNormals for Syberia 2 characters
This commit is contained in:
parent
ebfa1e91cc
commit
8e057462db
@ -371,14 +371,17 @@ bool Character::loadModel(const Common::String &mname, bool unused) {
|
||||
|
||||
_model->setName(mname);
|
||||
_model->setScale(_characterSettings._defaultScale);
|
||||
if (_characterSettings._invertNormals)
|
||||
_model->invertNormals();
|
||||
|
||||
for (auto &mesh : _model->meshes())
|
||||
mesh->setVisible(true);
|
||||
|
||||
// Set all mouthes not visible by default
|
||||
// Set all mouthes, eyes, etc not visible by default
|
||||
_model->setVisibleByName("_B_", false);
|
||||
// Set all eyes not visible by default
|
||||
_model->setVisibleByName("_Y_", false);
|
||||
_model->setVisibleByName("_M_", false);
|
||||
_model->setVisibleByName("_E_", false);
|
||||
|
||||
// Note: game loops through "faces" here, but it only ever uses the default ones.
|
||||
_model->setVisibleByName(_characterSettings._defaultEyes, true);
|
||||
|
@ -137,6 +137,20 @@ TeTRS TeModel::getBone(TeIntrusivePtr<TeModelAnimation> anim, uint num) {
|
||||
return _bones[num]._trs;
|
||||
}
|
||||
|
||||
void TeModel::invertNormals() {
|
||||
for (auto mesh : meshes()) {
|
||||
for (uint i = 0; i < mesh->numIndexes() / 3; i++) {
|
||||
ushort idx0 = mesh->index(i);
|
||||
ushort idx2 = mesh->index(i + 2);
|
||||
mesh->setIndex(i, idx2);
|
||||
mesh->setIndex(i, idx0);
|
||||
}
|
||||
for (uint i = 0; i < mesh->numVerticies(); i++) {
|
||||
mesh->setNormal(i, -mesh->normal(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TeMatrix4x4 TeModel::lerpElementsMatrix(uint weightsNum, const Common::Array<TeMatrix4x4> &matricies) {
|
||||
TeMatrix4x4 retval;
|
||||
// Start with a 0 matrix.
|
||||
|
@ -98,6 +98,7 @@ public:
|
||||
int findOrAddWeights(const Common::Array<weightElement> &weights);
|
||||
void forceMatrix(const TeMatrix4x4 &matrix);
|
||||
TeTRS getBone(TeIntrusivePtr<TeModelAnimation> anim, uint num);
|
||||
void invertNormals();
|
||||
|
||||
/* Align the stream to the nearest 4 byte boudary*/
|
||||
static void loadAlign(Common::SeekableReadStream &stream);
|
||||
|
@ -76,6 +76,8 @@ public:
|
||||
}
|
||||
|
||||
void rotate(const TeQuaternion &rot);
|
||||
|
||||
TeVector3f32 operator-() { return TeVector3f32(-x(), -y(), -z()); }
|
||||
};
|
||||
|
||||
TeVector3f32 operator^(const TeVector3f32 &left, const TeVector3f32 &right);
|
||||
|
Loading…
Reference in New Issue
Block a user