mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
Some clarifications.
This commit is contained in:
parent
9213e46d2f
commit
faf3226a1b
4 changed files with 54 additions and 30 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
local_settings:
|
local_settings:
|
||||||
dependencies:
|
dependencies:
|
||||||
- pvt.lzwdgc.polygon4.data_manager: master
|
- pvt.lzwdgc.polygon4.data_manager.data_manager: master
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include <buffer.h>
|
#include <buffer.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
std::string version();
|
std::string version();
|
||||||
|
|
@ -77,20 +79,20 @@ std::string vertex::printTex() const
|
||||||
void damage_model::load(const buffer &b)
|
void damage_model::load(const buffer &b)
|
||||||
{
|
{
|
||||||
READ(b, n_polygons);
|
READ(b, n_polygons);
|
||||||
polygons.resize(n_polygons);
|
model_polygons.resize(n_polygons);
|
||||||
READ(b, unk8);
|
READ(b, unk8);
|
||||||
READ(b, name);
|
READ(b, name);
|
||||||
for (auto &t : polygons)
|
for (auto &t : model_polygons)
|
||||||
READ(b, t);
|
READ(b, t);
|
||||||
READ(b, unk6);
|
READ(b, unk6);
|
||||||
READ(b, flags);
|
READ(b, flags);
|
||||||
READ(b, n_vertex);
|
READ(b, n_vertex);
|
||||||
vertices.resize(n_vertex);
|
vertices.resize(n_vertex);
|
||||||
READ(b, n_triangles);
|
READ(b, n_triangles);
|
||||||
triangles.resize(n_triangles);
|
damage_triangles.resize(n_triangles / 3);
|
||||||
for (auto &v : vertices)
|
for (auto &v : vertices)
|
||||||
v.load(b, flags);
|
v.load(b, flags);
|
||||||
for (auto &t : triangles)
|
for (auto &t : damage_triangles)
|
||||||
READ(b, t);
|
READ(b, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,7 +102,7 @@ void animation::load(const buffer &b)
|
||||||
READ(b, name);
|
READ(b, name);
|
||||||
for (auto &s : segments)
|
for (auto &s : segments)
|
||||||
s.loadHeader(b);
|
s.loadHeader(b);
|
||||||
if (segments[0].n)
|
//if (segments[0].n)
|
||||||
for (auto &s : segments)
|
for (auto &s : segments)
|
||||||
s.loadData(b);
|
s.loadData(b);
|
||||||
}
|
}
|
||||||
|
|
@ -118,8 +120,8 @@ void animation::segment::loadData(const buffer &b)
|
||||||
return;
|
return;
|
||||||
if (unk0)
|
if (unk0)
|
||||||
{
|
{
|
||||||
triangles.resize(n);
|
model_polygons.resize(n);
|
||||||
for (auto &t : triangles)
|
for (auto &t : model_polygons)
|
||||||
READ(b, t);
|
READ(b, t);
|
||||||
}
|
}
|
||||||
unk2.resize(n);
|
unk2.resize(n);
|
||||||
|
|
@ -174,16 +176,18 @@ std::string block::printObj(const std::string &mtl_name) const
|
||||||
s += "\n";
|
s += "\n";
|
||||||
|
|
||||||
if (n_triangles)
|
if (n_triangles)
|
||||||
for (int i = 0; i <= n_triangles - 3; i += 3)
|
|
||||||
{
|
{
|
||||||
auto x = to_string(triangles[i] + 1);
|
for (auto &t : triangles)
|
||||||
auto y = to_string(triangles[i + 2] + 1);
|
{
|
||||||
auto z = to_string(triangles[i + 1] + 1);
|
auto x = to_string(t.x + 1);
|
||||||
|
auto y = to_string(t.y + 1);
|
||||||
|
auto z = to_string(t.z + 1);
|
||||||
x += "/" + x;
|
x += "/" + x;
|
||||||
y += "/" + y;
|
y += "/" + y;
|
||||||
z += "/" + z;
|
z += "/" + z;
|
||||||
s += "f " + x + " " + y + " " + z + "\n";
|
s += "f " + x + " " + y + " " + z + "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s += "\n";
|
s += "\n";
|
||||||
s += "\n";
|
s += "\n";
|
||||||
|
|
@ -200,7 +204,6 @@ void block::load(const buffer &b)
|
||||||
READ_STRING(b, tex3);
|
READ_STRING(b, tex3);
|
||||||
READ_STRING(b, tex4);
|
READ_STRING(b, tex4);
|
||||||
READ(b, LODs);
|
READ(b, LODs);
|
||||||
READ(b, unk1);
|
|
||||||
READ(b, unk2);
|
READ(b, unk2);
|
||||||
READ(b, unk3);
|
READ(b, unk3);
|
||||||
READ(b, size);
|
READ(b, size);
|
||||||
|
|
@ -221,7 +224,7 @@ void block::load(const buffer &b)
|
||||||
READ(data, material);
|
READ(data, material);
|
||||||
|
|
||||||
// unk
|
// unk
|
||||||
READ(data, unk_flags0);
|
READ(data, effect);
|
||||||
READ(data, unk7);
|
READ(data, unk7);
|
||||||
READ(data, unk9);
|
READ(data, unk9);
|
||||||
READ(data, unk10);
|
READ(data, unk10);
|
||||||
|
|
@ -243,7 +246,7 @@ void block::load(const buffer &b)
|
||||||
READ(data, n_triangles);
|
READ(data, n_triangles);
|
||||||
if (triangles_mult_7 && (flags & F_UNK0) && !unk11)
|
if (triangles_mult_7 && (flags & F_UNK0) && !unk11)
|
||||||
n_triangles *= 7;
|
n_triangles *= 7;
|
||||||
triangles.resize(n_triangles);
|
triangles.resize(n_triangles / 3);
|
||||||
for (auto &v : vertices)
|
for (auto &v : vertices)
|
||||||
v.load(data, flags);
|
v.load(data, flags);
|
||||||
for (auto &t : triangles)
|
for (auto &t : triangles)
|
||||||
|
|
@ -255,6 +258,14 @@ void block::load(const buffer &b)
|
||||||
for (auto &dm : damage_models)
|
for (auto &dm : damage_models)
|
||||||
dm.load(data);
|
dm.load(data);
|
||||||
|
|
||||||
|
string s = "extraction error: block #" + std::string(name);
|
||||||
|
if (!data.eof())
|
||||||
|
{
|
||||||
|
cerr << s << "\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unknown how to proceed
|
||||||
if (!data.eof() && triangles_mult_7)
|
if (!data.eof() && triangles_mult_7)
|
||||||
{
|
{
|
||||||
// unknown end of block
|
// unknown end of block
|
||||||
|
|
@ -264,7 +275,7 @@ void block::load(const buffer &b)
|
||||||
READ(data, t);
|
READ(data, t);
|
||||||
}
|
}
|
||||||
if (!data.eof())
|
if (!data.eof())
|
||||||
throw std::logic_error("extraction error: block #" + std::string(name));
|
throw std::logic_error(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void model::load(const buffer &b)
|
void model::load(const buffer &b)
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,15 @@ enum class BlockType : uint32_t
|
||||||
ParticleEmitter
|
ParticleEmitter
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class EffectType : uint32_t
|
||||||
|
{
|
||||||
|
Texture = 0x0,
|
||||||
|
TextureWithGlareMap = 0x1,
|
||||||
|
TextureWithGlareMapAndMask = 0x32,
|
||||||
|
AlphaTextureDoubleSided = 0x6,
|
||||||
|
MaterialOnly = 0x14,
|
||||||
|
};
|
||||||
|
|
||||||
struct Vector4
|
struct Vector4
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
|
|
@ -84,7 +93,12 @@ struct vertex
|
||||||
std::string printTex() const;
|
std::string printTex() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef uint16_t triangle;
|
struct triangle
|
||||||
|
{
|
||||||
|
uint16_t x;
|
||||||
|
uint16_t y;
|
||||||
|
uint16_t z;
|
||||||
|
};
|
||||||
|
|
||||||
struct animation
|
struct animation
|
||||||
{
|
{
|
||||||
|
|
@ -100,7 +114,7 @@ struct animation
|
||||||
uint32_t unk0;
|
uint32_t unk0;
|
||||||
uint32_t unk1;
|
uint32_t unk1;
|
||||||
|
|
||||||
std::vector<triangle> triangles;
|
std::vector<uint16_t> model_polygons;
|
||||||
std::vector<unk_float6> unk2;
|
std::vector<unk_float6> unk2;
|
||||||
|
|
||||||
void loadHeader(const buffer &b);
|
void loadHeader(const buffer &b);
|
||||||
|
|
@ -119,21 +133,21 @@ struct damage_model
|
||||||
uint32_t n_polygons;
|
uint32_t n_polygons;
|
||||||
float unk8[3];
|
float unk8[3];
|
||||||
char name[0x3C];
|
char name[0x3C];
|
||||||
std::vector<uint16_t> polygons;
|
std::vector<uint16_t> model_polygons;
|
||||||
uint8_t unk6;
|
uint8_t unk6;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint32_t n_vertex;
|
uint32_t n_vertex;
|
||||||
uint32_t n_triangles;
|
uint32_t n_triangles;
|
||||||
std::vector<vertex> vertices;
|
std::vector<vertex> vertices;
|
||||||
std::vector<uint16_t> triangles;
|
std::vector<triangle> damage_triangles;
|
||||||
|
|
||||||
virtual void load(const buffer &b);
|
virtual void load(const buffer &b);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct material
|
struct material
|
||||||
{
|
{
|
||||||
Vector4 ambient;
|
|
||||||
Vector4 diffuse;
|
Vector4 diffuse;
|
||||||
|
Vector4 ambient;
|
||||||
Vector4 specular;
|
Vector4 specular;
|
||||||
Vector4 emissive;
|
Vector4 emissive;
|
||||||
float power;
|
float power;
|
||||||
|
|
@ -176,8 +190,7 @@ struct block
|
||||||
} _;
|
} _;
|
||||||
uint32_t LODs;
|
uint32_t LODs;
|
||||||
};
|
};
|
||||||
uint32_t unk1;
|
uint32_t unk2[3];
|
||||||
uint32_t unk2[2];
|
|
||||||
uint32_t unk3;
|
uint32_t unk3;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint32_t unk4[10];
|
uint32_t unk4[10];
|
||||||
|
|
@ -187,7 +200,7 @@ struct block
|
||||||
material material;
|
material material;
|
||||||
|
|
||||||
//unk (anim + transform settings?)
|
//unk (anim + transform settings?)
|
||||||
uint32_t unk_flags0;
|
EffectType effect;
|
||||||
uint32_t unk7;
|
uint32_t unk7;
|
||||||
float unk9;
|
float unk9;
|
||||||
uint32_t unk10;
|
uint32_t unk10;
|
||||||
|
|
@ -206,7 +219,7 @@ struct block
|
||||||
uint32_t n_vertex;
|
uint32_t n_vertex;
|
||||||
uint32_t n_triangles;
|
uint32_t n_triangles;
|
||||||
std::vector<vertex> vertices;
|
std::vector<vertex> vertices;
|
||||||
std::vector<uint16_t> triangles;
|
std::vector<triangle> triangles;
|
||||||
|
|
||||||
// animations
|
// animations
|
||||||
std::vector<animation> animations;
|
std::vector<animation> animations;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue