[SD3] first commit with SD3 inplace - not complete yet

This commit is contained in:
Antz 2016-03-27 20:47:30 +01:00 committed by Antz
parent 35415eb738
commit afc2df2f7d
603 changed files with 222771 additions and 1729 deletions

View file

@ -600,7 +600,7 @@ namespace MMAP
bool isM2 = instance.name.find(".m2") != instance.name.npos || instance.name.find(".M2") != instance.name.npos;
// transform data
float scale = instance.iScale;
float Scale = instance.iScale;
G3D::Matrix3 rotation = G3D::Matrix3::fromEulerAnglesXYZ(G3D::pi() * instance.iRot.z / -180.f, G3D::pi() * instance.iRot.x / -180.f, G3D::pi() * instance.iRot.y / -180.f);
Vector3 position = instance.iPos;
position.x -= 32 * GRID_SIZE;
@ -616,7 +616,7 @@ namespace MMAP
(*it).getMeshData(tempVertices, tempTriangles, liquid);
// first handle collision mesh
transform(tempVertices, transformedVertices, scale, rotation, position);
transform(tempVertices, transformedVertices, Scale, rotation, position);
int offset = meshData.solidVerts.size() / 3;
@ -663,7 +663,7 @@ namespace MMAP
for (uint32 y = 0; y < vertsY; ++y)
{
vert = Vector3(corner.x + x * GRID_PART_SIZE, corner.y + y * GRID_PART_SIZE, data[y * vertsX + x]);
vert = vert * rotation * scale + position;
vert = vert * rotation * Scale + position;
vert.x *= -1.f;
vert.y *= -1.f;
liqVerts.push_back(vert);
@ -713,12 +713,12 @@ namespace MMAP
}
/**************************************************************************/
void TerrainBuilder::transform(vector<Vector3>& source, vector<Vector3>& transformedVertices, float scale, G3D::Matrix3& rotation, Vector3& position)
void TerrainBuilder::transform(vector<Vector3>& source, vector<Vector3>& transformedVertices, float Scale, G3D::Matrix3& rotation, Vector3& position)
{
for (vector<Vector3>::iterator it = source.begin(); it != source.end(); ++it)
{
// apply tranform, then mirror along the horizontal axes
Vector3 v((*it) * rotation * scale + position);
Vector3 v((*it) * rotation * Scale + position);
v.x *= -1.f;
v.y *= -1.f;
transformedVertices.push_back(v);

View file

@ -101,7 +101,7 @@ namespace MMAP
// vert and triangle methods
static void transform(vector<G3D::Vector3>& original, vector<G3D::Vector3>& transformed,
float scale, G3D::Matrix3& rotation, G3D::Vector3& position);
float Scale, G3D::Matrix3& rotation, G3D::Vector3& position);
static void copyVertices(vector<G3D::Vector3>& source, G3D::Array<float>& dest);
static void copyIndices(vector<VMAP::MeshTriangle>& source, G3D::Array<int>& dest, int offest, bool flip);
static void copyIndices(G3D::Array<int>& src, G3D::Array<int>& dest, int offset);

View file

@ -151,9 +151,9 @@ ModelInstance::ModelInstance(MPQFile& f, const char* ModelInstName, uint32 mapID
pos = fixCoords(Vec3D(ff[0], ff[1], ff[2]));
f.read(ff, 12);
rot = Vec3D(ff[0], ff[1], ff[2]);
f.read(&scale, 4);
// scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float?
sc = scale / 1024.0f;
f.read(&Scale, 4);
// Scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float?
sc = Scale / 1024.0f;
char tempname[512];
sprintf(tempname, "%s/%s", szWorkDirWmo, ModelInstName);

View file

@ -72,7 +72,7 @@ class ModelInstance
uint32 id;
Vec3D pos, rot;
unsigned int d1, scale;
unsigned int d1, Scale;
float w, sc;
ModelInstance() {}

View file

@ -542,7 +542,7 @@ WMOInstance::WMOInstance(MPQFile& f, const char* WmoInstName, uint32 mapID, uint
pos2 = fixCoords(pos2);
pos3 = fixCoords(pos3);
float scale = 1.0f;
float Scale = 1.0f;
uint32 flags = MOD_HAS_BOUND;
if (tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
@ -554,7 +554,7 @@ WMOInstance::WMOInstance(MPQFile& f, const char* WmoInstName, uint32 mapID, uint
fwrite(&id, sizeof(uint32), 1, pDirfile);
fwrite(&pos, sizeof(float), 3, pDirfile);
fwrite(&rot, sizeof(float), 3, pDirfile);
fwrite(&scale, sizeof(float), 1, pDirfile);
fwrite(&Scale, sizeof(float), 1, pDirfile);
fwrite(&pos2, sizeof(float), 3, pDirfile);
fwrite(&pos3, sizeof(float), 3, pDirfile);
uint32 nlen = strlen(WmoInstName);