mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 00:53:46 +00:00
Core/Misc: update g3dlite lib (#2904)
* Core/Misc: update g3dlite lib * update Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
26
deps/g3dlite/source/MeshBuilder.cpp
vendored
26
deps/g3dlite/source/MeshBuilder.cpp
vendored
@@ -36,7 +36,7 @@ void MeshBuilder::commit(std::string& n, Array<int>& indexArray, Array<Vector3>&
|
||||
close = minEdgeLen * 0.1;
|
||||
}
|
||||
|
||||
MeshAlg::computeWeld(triList, outvertexArray, toNew, toOld, close);
|
||||
MeshAlg::computeWeld(triList, outvertexArray, toNew, toOld, (float)close);
|
||||
|
||||
// Construct triangles
|
||||
for (int t = 0; t < triList.size(); t += 3) {
|
||||
@@ -62,19 +62,21 @@ void MeshBuilder::centerTriList() {
|
||||
|
||||
computeBounds(vmin, vmax);
|
||||
|
||||
Vector3 diagonal = vmax - vmin;
|
||||
double scale = max(max(diagonal.x, diagonal.y), diagonal.z) / 2;
|
||||
const Vector3 diagonal = vmax - vmin;
|
||||
float scale = max(max(diagonal.x, diagonal.y), diagonal.z) / 2.0f;
|
||||
debugAssert(scale > 0);
|
||||
|
||||
Vector3 translation = vmin + diagonal / 2;
|
||||
const Vector3 translation = vmin + diagonal / 2.0f;
|
||||
|
||||
// Center and scale all vertices in the input list
|
||||
int v;
|
||||
|
||||
//Matrix3 rot90 = Matrix3::fromAxisAngle(Vector3::UNIT_Y, toRadians(180)) * Matrix3::fromAxisAngle(Vector3::UNIT_X, toRadians(90));
|
||||
for (v = 0; v < triList.size(); ++v) {
|
||||
triList[v] = (triList[v] - translation) / scale;
|
||||
//triList[v] = rot90 * triList[v];
|
||||
if (scaleAndCenter) {
|
||||
//Matrix3 rot90 = Matrix3::fromAxisAngle(Vector3::UNIT_Y, toRadians(180)) * Matrix3::fromAxisAngle(Vector3::UNIT_X, toRadians(90));
|
||||
for (v = 0; v < triList.size(); ++v) {
|
||||
triList[v] = (triList[v] - translation) / scale;
|
||||
//triList[v] = rot90 * triList[v];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +96,9 @@ void MeshBuilder::computeBounds(Vector3& min, Vector3& max) {
|
||||
void MeshBuilder::addTriangle(const Vector3& a, const Vector3& b, const Vector3& c) {
|
||||
triList.append(a, b, c);
|
||||
|
||||
if (_twoSided) {
|
||||
triList.append(c, b, a);
|
||||
}
|
||||
if (_twoSided) {
|
||||
triList.append(c, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +109,7 @@ void MeshBuilder::addQuad(const Vector3& a, const Vector3& b, const Vector3& c,
|
||||
|
||||
|
||||
void MeshBuilder::addTriangle(const Triangle& t) {
|
||||
addTriangle(t.vertex(0), t.vertex(1), t.vertex(2));
|
||||
addTriangle(t.vertex(0), t.vertex(1), t.vertex(2));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user