mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-11 08:38:18 +03:00
Temp commit. Glitter Effect Ext Anim
This commit is contained in:
+65
-14
@@ -353,9 +353,9 @@ bool x_pv_game::Ctrl() {
|
||||
wait_load = true;
|
||||
|
||||
if (!wait_load)
|
||||
state = 9;
|
||||
state = 7;
|
||||
} break;
|
||||
case 9: {
|
||||
case 7: {
|
||||
data_struct* x_data = &data_list[DATA_X];
|
||||
|
||||
for (uint32_t& i : objset_load) {
|
||||
@@ -409,10 +409,8 @@ bool x_pv_game::Ctrl() {
|
||||
light_auth_3d_id = auth_3d_data_load_uid(
|
||||
(int32_t)(&i - auth_3d_db->uid.data()), auth_3d_db);
|
||||
auth_3d_data_read_file(&light_auth_3d_id, auth_3d_db);
|
||||
auth_3d_data_set_camera_root_update(&light_auth_3d_id, false);
|
||||
auth_3d_data_set_enable(&light_auth_3d_id, true);
|
||||
auth_3d_data_set_paused(&light_auth_3d_id, false);
|
||||
auth_3d_data_set_visibility(&light_auth_3d_id, true);
|
||||
auth_3d_data_set_enable(&light_auth_3d_id, false);
|
||||
auth_3d_data_set_visibility(&light_auth_3d_id, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -428,10 +426,8 @@ bool x_pv_game::Ctrl() {
|
||||
camera_auth_3d_id = auth_3d_data_load_hash(camera_auth_3d_hash,
|
||||
camera_category_hash, camera_category.c_str(), x_data, &obj_db, &tex_db);
|
||||
auth_3d_data_read_file_modern(&camera_auth_3d_id);
|
||||
auth_3d_data_set_repeat(&camera_auth_3d_id, false);
|
||||
auth_3d_data_set_enable(&camera_auth_3d_id, true);
|
||||
auth_3d_data_set_paused(&camera_auth_3d_id, false);
|
||||
auth_3d_data_set_visibility(&camera_auth_3d_id, true);
|
||||
auth_3d_data_set_enable(&camera_auth_3d_id, false);
|
||||
auth_3d_data_set_visibility(&camera_auth_3d_id, false);
|
||||
}
|
||||
|
||||
for (auto i : effchrpv_auth_3d_names) {
|
||||
@@ -454,7 +450,44 @@ bool x_pv_game::Ctrl() {
|
||||
effchrpv_auth_3d_mot_ids.insert({ hash, id });
|
||||
}
|
||||
|
||||
state = 8;
|
||||
} break;
|
||||
case 8: {
|
||||
bool wait_load = false;
|
||||
|
||||
for (auto i : pv_auth_3d_ids)
|
||||
if (!auth_3d_data_check_id_loaded(&i.second))
|
||||
wait_load = true;
|
||||
|
||||
for (auto i : stage_auth_3d_ids)
|
||||
if (!auth_3d_data_check_id_loaded(&i.second))
|
||||
wait_load = true;
|
||||
|
||||
if (!auth_3d_data_check_id_loaded(&light_auth_3d_id))
|
||||
wait_load = true;
|
||||
|
||||
if (!auth_3d_data_check_id_loaded(&camera_auth_3d_id))
|
||||
wait_load = true;
|
||||
|
||||
for (auto i : effchrpv_auth_3d_ids)
|
||||
if (!auth_3d_data_check_id_loaded(&i.second))
|
||||
wait_load = true;
|
||||
|
||||
for (auto i : stage_auth_3d_ids)
|
||||
if (!auth_3d_data_check_id_loaded(&i.second))
|
||||
wait_load = true;
|
||||
|
||||
for (auto i : effchrpv_auth_3d_mot_ids)
|
||||
if (!auth_3d_data_check_id_loaded(&i.second))
|
||||
wait_load = true;
|
||||
|
||||
if (!wait_load)
|
||||
state = 9;
|
||||
} break;
|
||||
case 9: {
|
||||
{
|
||||
data_struct* x_data = &data_list[DATA_X];
|
||||
|
||||
dsc dsc_mouth;
|
||||
dsc dsc_scene;
|
||||
dsc dsc_system;
|
||||
@@ -697,6 +730,18 @@ bool x_pv_game::Ctrl() {
|
||||
|
||||
x_pv_game_stage_effect_ctrl(this);
|
||||
|
||||
auth_3d_data_set_enable(&light_auth_3d_id, true);
|
||||
auth_3d_data_set_camera_root_update(&light_auth_3d_id, false);
|
||||
auth_3d_data_set_paused(&light_auth_3d_id, false);
|
||||
auth_3d_data_set_repeat(&camera_auth_3d_id, false);
|
||||
auth_3d_data_set_visibility(&light_auth_3d_id, true);
|
||||
|
||||
auth_3d_data_set_enable(&camera_auth_3d_id, true);
|
||||
auth_3d_data_set_camera_root_update(&light_auth_3d_id, true);
|
||||
auth_3d_data_set_paused(&camera_auth_3d_id, false);
|
||||
auth_3d_data_set_repeat(&camera_auth_3d_id, false);
|
||||
auth_3d_data_set_visibility(&camera_auth_3d_id, true);
|
||||
|
||||
if (pv_id == 826) {
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
bone_database* aft_bone_data = &aft_data->data_ft.bone_data;
|
||||
@@ -745,11 +790,15 @@ bool x_pv_game::Ctrl() {
|
||||
}
|
||||
}
|
||||
|
||||
if (pv_id == 826) {
|
||||
/*if (pv_id == 826) {
|
||||
extern int32_t global_ctrl_frames;
|
||||
global_ctrl_frames = 10;
|
||||
global_ctrl_frames = 5110;
|
||||
}
|
||||
else
|
||||
else if (pv_id == 822) {
|
||||
extern int32_t global_ctrl_frames;
|
||||
global_ctrl_frames = 2600;
|
||||
}
|
||||
else*/
|
||||
pause = true;
|
||||
} break;
|
||||
case 10: {
|
||||
@@ -769,8 +818,10 @@ bool x_pv_game::Ctrl() {
|
||||
frame = (int32_t)frame_float;
|
||||
time = (int64_t)round(frame_float * (100000.0 / 60.0) * 10000.0);
|
||||
|
||||
if (pv_id == 826 && frame == 10)
|
||||
/*if (pv_id == 826 && frame == 5110)
|
||||
pause = true;
|
||||
else if (pv_id == 822 && frame == 2600)
|
||||
pause = true;*/
|
||||
|
||||
while (dsc_data_ptr != dsc_data_ptr_end
|
||||
&& x_pv_game_dsc_process(this, time))
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace Glitter {
|
||||
flags = (EffectInstFlag)0;
|
||||
random = 0;
|
||||
min_color = vec4u_null;
|
||||
ext_anim_scale = vec3_null;
|
||||
some_scale = -1.0f;
|
||||
|
||||
if (appear_now)
|
||||
data.appear_time = 0;
|
||||
@@ -68,7 +70,6 @@ namespace Glitter {
|
||||
: EffectInst(GPM_VAL, GLT_VAL, eff, id, emission, appear_now) {
|
||||
random_ptr = &GPM_VAL->random;
|
||||
ext_anim = 0;
|
||||
ext_anim_scale = vec3_null;
|
||||
|
||||
if (~eff->data.flags & EFFECT_LOCAL && data.ext_anim) {
|
||||
F2EffectInst::ExtAnim* inst_ext_anim = new F2EffectInst::ExtAnim;
|
||||
@@ -394,10 +395,8 @@ namespace Glitter {
|
||||
if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) {
|
||||
rob_chara* rob_chr = rob_chara_array_get(chara_id);
|
||||
if (rob_chr) {
|
||||
mat = rob_chr->data.adjust_data.mat;
|
||||
|
||||
vec3 scale;
|
||||
mat4_get_scale(&mat, &scale);
|
||||
mat4_get_scale(&rob_chr->data.adjust_data.mat, &scale);
|
||||
vec3_sub_scalar(scale, 1.0f, ext_anim_scale);
|
||||
ext_anim_scale.z = 0.0f;
|
||||
enum_or(flags, EFFECT_INST_HAS_EXT_ANIM_SCALE);
|
||||
@@ -590,7 +589,6 @@ namespace Glitter {
|
||||
mat_rot_eff_rot = mat4_identity;
|
||||
random_shared.XReset();
|
||||
ext_anim = 0;
|
||||
ext_anim_scale = vec3_null;
|
||||
render_scene = {};
|
||||
|
||||
if (data.flags & EFFECT_USE_SEED)
|
||||
@@ -680,37 +678,37 @@ namespace Glitter {
|
||||
}
|
||||
|
||||
void XEffectInst::Ctrl(GPM, GLT, float_t delta_frame, float_t emission) {
|
||||
mat4 mat;
|
||||
vec3 trans;
|
||||
vec3 rot;
|
||||
vec3 scale;
|
||||
|
||||
GetExtAnim();
|
||||
if (flags & EFFECT_INST_GET_EXT_ANIM_THEN_UPDATE && !GPM_VAL->draw_all)
|
||||
return;
|
||||
|
||||
GetValue();
|
||||
trans = translation;
|
||||
rot = rotation;
|
||||
vec3_mult_scalar(this->scale, scale_all, scale);
|
||||
|
||||
mat4 mat;
|
||||
if (flags & EFFECT_INST_HAS_EXT_ANIM_TRANS && ext_anim) {
|
||||
vec3 ext_trans;
|
||||
ext_trans = ext_anim->translation;
|
||||
mat4_translate_mult(&ext_anim->mat, ext_trans.x, ext_trans.y, ext_trans.z, &mat);
|
||||
mat4_normalize_rotation(&mat, &mat_rot);
|
||||
mat4_normalize_rotation(&ext_anim->mat, &mat_rot);
|
||||
mat4_clear_trans(&mat_rot, &mat_rot);
|
||||
mat4_rot(&mat_rot, rot.x, rot.y, rot.z, &mat_rot_eff_rot);
|
||||
|
||||
vec3 ext_trans = ext_anim->translation;
|
||||
mat4_translate_mult(&ext_anim->mat, ext_trans.x, ext_trans.y, ext_trans.z, &mat);
|
||||
vec3 trans = translation;
|
||||
mat4_translate_mult(&mat, trans.x, trans.y, trans.z, &mat);
|
||||
}
|
||||
else {
|
||||
mat_rot = mat4_identity;
|
||||
mat4_rotate(rot.x, rot.y, rot.z, &mat_rot_eff_rot);
|
||||
vec3 trans = translation;
|
||||
mat4_translate(trans.x, trans.y, trans.z, &mat);
|
||||
}
|
||||
|
||||
vec3 rot = rotation;
|
||||
vec3 scale;
|
||||
vec3_mult_scalar(this->scale, scale_all, scale);
|
||||
|
||||
mat4_rotate(rot.x, rot.y, rot.z, &mat_rot_eff_rot);
|
||||
|
||||
mat4_rot(&mat, rot.x, rot.y, rot.z, &mat);
|
||||
mat4_scale_rot(&mat, scale.x, scale.y, scale.z, &this->mat);
|
||||
|
||||
for (XEmitterInst*& i : emitters)
|
||||
if (i)
|
||||
i->Ctrl(GPM_VAL, this, delta_frame);
|
||||
@@ -894,6 +892,7 @@ namespace Glitter {
|
||||
SetExtAnim(&temp, 0, 0, set_flags);
|
||||
}
|
||||
else if (flags & EFFECT_INST_GET_EXT_ANIM_MAT) {
|
||||
mat4 m = mat4_identity ;
|
||||
mat4 temp;
|
||||
mat4* mat = 0;
|
||||
if (ext_anim->a3da_id != -1)
|
||||
@@ -914,10 +913,17 @@ namespace Glitter {
|
||||
return;
|
||||
}
|
||||
|
||||
mat4_get_scale(mat, &scale);
|
||||
vec3_sub_scalar(scale, 1.0f, ext_anim_scale);
|
||||
ext_anim_scale.z = 0.0f;
|
||||
enum_or(flags, EFFECT_INST_HAS_EXT_ANIM_SCALE);
|
||||
int32_t chara_id = auth_3d_data_get_chara_id(ext_anim->a3da_id);
|
||||
if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) {
|
||||
rob_chara* rob_chr = rob_chara_array_get(ext_anim->chara_index);
|
||||
if (rob_chr) {
|
||||
vec3 scale;
|
||||
mat4_get_scale(&rob_chr->data.adjust_data.mat, &scale);
|
||||
vec3_sub_scalar(scale, 1.0f, ext_anim_scale);
|
||||
ext_anim_scale.z = 0.0f;
|
||||
enum_or(flags, EFFECT_INST_HAS_EXT_ANIM_SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ext_anim->mesh_name) {
|
||||
if (ext_anim->mesh_index == -1)
|
||||
@@ -929,12 +935,12 @@ namespace Glitter {
|
||||
ext_anim->object_hash, ext_anim->mesh_index);
|
||||
if (mesh) {
|
||||
vec3* trans = &mesh->bounding_sphere.center;
|
||||
SetExtAnim(mat, 0, trans, true);
|
||||
SetExtAnim(&m, mat, trans, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
SetExtAnim(mat, 0, 0, true);
|
||||
SetExtAnim(&m, mat, 0, true);
|
||||
|
||||
}
|
||||
else if (ext_anim->object_hash != hash_murmurhash_empty) {
|
||||
@@ -1012,7 +1018,7 @@ namespace Glitter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XEffectInst::SetExtAnim(mat4* a2, mat4* a3, vec3* trans, bool set_flags) {
|
||||
EffectInstFlag flags = this->flags;
|
||||
if (a2) {
|
||||
@@ -1022,7 +1028,7 @@ namespace Glitter {
|
||||
|
||||
if (flags & EFFECT_INST_EXT_ANIM_TRANS_ONLY) {
|
||||
ext_anim->mat = mat4_identity;
|
||||
ext_anim->translation = *(vec3*)&mat.row3;
|
||||
mat4_get_translation(&mat, &ext_anim->translation);
|
||||
}
|
||||
else
|
||||
ext_anim->mat = mat;
|
||||
|
||||
@@ -773,6 +773,8 @@ namespace Glitter {
|
||||
size_t id;
|
||||
uint32_t random;
|
||||
vec4u min_color;
|
||||
vec3 ext_anim_scale;
|
||||
float_t some_scale;
|
||||
|
||||
EffectInst(GPM, GLT, Effect* eff,
|
||||
size_t id, float_t emission, bool appear_now);
|
||||
@@ -820,7 +822,6 @@ namespace Glitter {
|
||||
std::vector<F2EmitterInst*> emitters;
|
||||
Random* random_ptr;
|
||||
ExtAnim* ext_anim;
|
||||
vec3 ext_anim_scale;
|
||||
F2RenderScene render_scene;
|
||||
|
||||
F2EffectInst(GPM, GLT, Effect* eff, size_t id, float_t emission, bool appear_now);
|
||||
@@ -872,7 +873,6 @@ namespace Glitter {
|
||||
mat4 mat_rot_eff_rot;
|
||||
Random random_shared;
|
||||
ExtAnim* ext_anim;
|
||||
vec3 ext_anim_scale;
|
||||
XRenderScene render_scene;
|
||||
|
||||
XEffectInst(GPM, Effect* eff, size_t id, float_t emission, bool appear_now);
|
||||
@@ -1256,7 +1256,7 @@ namespace Glitter {
|
||||
F2EmitterInst* emit_inst, int32_t dup_count, int32_t count);
|
||||
void Free();
|
||||
void FreeData();
|
||||
bool GetExtAnimScale(vec3* ext_anim_scale);
|
||||
bool GetExtAnimScale(vec3* ext_anim_scale, float_t* some_scale);
|
||||
|
||||
static mat4 RotateToEmitPosition(F2RenderGroup* rend_group,
|
||||
RenderElement* rend_elem, vec3* vec);
|
||||
@@ -1283,7 +1283,7 @@ namespace Glitter {
|
||||
void Free();
|
||||
void FreeData();
|
||||
bool GetEmitterScale(vec3* emitter_scale);
|
||||
bool GetExtAnimScale(vec3* ext_anim_scale);
|
||||
bool GetExtAnimScale(vec3* ext_anim_scale, float_t* some_scale);
|
||||
|
||||
static mat4 RotateMeshToEmitPosition(XRenderGroup* rend_group,
|
||||
RenderElement* rend_elem, vec3* vec, vec3* trans);
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace Glitter {
|
||||
DeleteBuffers(true);
|
||||
}
|
||||
|
||||
bool F2RenderGroup::GetExtAnimScale(vec3* ext_anim_scale) {
|
||||
bool F2RenderGroup::GetExtAnimScale(vec3* ext_anim_scale, float_t* some_scale) {
|
||||
if (!particle)
|
||||
return false;
|
||||
|
||||
@@ -303,6 +303,8 @@ namespace Glitter {
|
||||
|
||||
if (ext_anim_scale)
|
||||
*ext_anim_scale = effect_inst->ext_anim_scale;
|
||||
if (some_scale)
|
||||
*some_scale = effect_inst->some_scale;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -625,7 +627,7 @@ namespace Glitter {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XRenderGroup::GetExtAnimScale(vec3* ext_anim_scale) {
|
||||
bool XRenderGroup::GetExtAnimScale(vec3* ext_anim_scale, float_t* some_scale) {
|
||||
if (!particle)
|
||||
return false;
|
||||
|
||||
@@ -646,6 +648,8 @@ namespace Glitter {
|
||||
|
||||
if (ext_anim_scale)
|
||||
*ext_anim_scale = effect_inst->ext_anim_scale;
|
||||
if (some_scale)
|
||||
*some_scale = effect_inst->some_scale;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -635,8 +635,12 @@ namespace Glitter {
|
||||
}
|
||||
|
||||
vec3 ext_anim_scale;
|
||||
if (rend_group->GetExtAnimScale(&ext_anim_scale)) {
|
||||
vec2_add(*(vec2*)&ext_anim_scale, vec2_identity, *(vec2*)&ext_anim_scale);
|
||||
float_t some_scale = 0.0f;
|
||||
if (rend_group->GetExtAnimScale(&ext_anim_scale, &some_scale)) {
|
||||
if (some_scale <= 0.0f)
|
||||
some_scale = 1.0f;
|
||||
|
||||
vec2_add_scalar(*(vec2*)&ext_anim_scale, some_scale, *(vec2*)&ext_anim_scale);
|
||||
x_vec.x *= ext_anim_scale.x;
|
||||
y_vec.y *= ext_anim_scale.y;
|
||||
}
|
||||
@@ -1449,12 +1453,19 @@ namespace Glitter {
|
||||
}
|
||||
|
||||
vec3 ext_anim_scale;
|
||||
if (rend_group->GetExtAnimScale(&ext_anim_scale)) {
|
||||
float_t some_scale = 0.0f;
|
||||
if (rend_group->GetExtAnimScale(&ext_anim_scale, &some_scale)) {
|
||||
if (!has_scale) {
|
||||
emit_scale = vec3_identity;
|
||||
has_scale = true;
|
||||
}
|
||||
vec3_add(emit_scale, ext_anim_scale, emit_scale);
|
||||
|
||||
if (some_scale >= 0.0f) {
|
||||
vec3_add_scalar(ext_anim_scale, some_scale, ext_anim_scale);
|
||||
vec3_mult(emit_scale, ext_anim_scale, emit_scale);
|
||||
}
|
||||
else
|
||||
vec3_add(emit_scale, ext_anim_scale, emit_scale);
|
||||
}
|
||||
|
||||
render_context* rctx = (render_context*)GPM_VAL->rctx;
|
||||
@@ -1786,11 +1797,15 @@ namespace Glitter {
|
||||
emitter_local = true;
|
||||
}
|
||||
|
||||
vec3 ext_scale;
|
||||
if (rend_group->GetExtAnimScale(&ext_scale)) {
|
||||
vec2_add(*(vec2*)&ext_scale, vec2_identity, *(vec2*)&ext_scale);
|
||||
x_vec.x *= ext_scale.x;
|
||||
y_vec.y *= ext_scale.y;
|
||||
vec3 ext_anim_scale;
|
||||
float_t some_scale = 0.0f;
|
||||
if (rend_group->GetExtAnimScale(&ext_anim_scale, &some_scale)) {
|
||||
if (some_scale <= 0.0f)
|
||||
some_scale = 1.0f;
|
||||
|
||||
vec2_add_scalar(*(vec2*)&ext_anim_scale, some_scale, *(vec2*)&ext_anim_scale);
|
||||
x_vec.x *= ext_anim_scale.x;
|
||||
y_vec.y *= ext_anim_scale.y;
|
||||
}
|
||||
|
||||
if (rend_group->draw_type != DIRECTION_BILLBOARD) {
|
||||
|
||||
+28
-10
@@ -1833,6 +1833,15 @@ bool auth_3d_data_check_category_loaded(uint32_t category_hash) {
|
||||
return auth_3d_data_struct_check_category_loaded(auth_3d_data, category_hash);
|
||||
}
|
||||
|
||||
bool auth_3d_data_check_id_loaded(int32_t* id) {
|
||||
if (*id >= 0 && ((*id & 0x7FFF) < AUTH_3D_DATA_COUNT)) {
|
||||
auth_3d* auth = &auth_3d_data->data[*id & 0x7FFF];
|
||||
if (auth->id == *id)
|
||||
return auth->state == 2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
auth_3d* auth_3d_data_get_auth_3d(int32_t id) {
|
||||
int32_t index = 0;
|
||||
while (auth_3d_data->data[index].id != id)
|
||||
@@ -1882,18 +1891,14 @@ int32_t auth_3d_data_get_auth_3d_id(uint32_t file_name_hash, uint32_t object_has
|
||||
continue;
|
||||
|
||||
auth_3d* auth = &auth_3d_data->data[i & 0x7FFF];
|
||||
if (auth->id != i || !auth->enable
|
||||
|| (file_name_hash != hash_murmurhash_empty && auth->hash != file_name_hash))
|
||||
if (auth->id != i || !auth->enable)
|
||||
continue;
|
||||
|
||||
int32_t obj_hrc_index = auth_3d_get_auth_3d_object_hrc_index_by_hash(
|
||||
auth, object_hash, instance);
|
||||
if (obj_hrc_index >= 0) {
|
||||
if (object_index)
|
||||
*object_index = obj_hrc_index;
|
||||
if (hrc)
|
||||
*hrc = true;
|
||||
return i;
|
||||
bool ret = false;
|
||||
if (file_name_hash != hash_murmurhash_empty) {
|
||||
if (auth->hash != file_name_hash)
|
||||
continue;
|
||||
ret = true;
|
||||
}
|
||||
|
||||
int32_t obj_index = auth_3d_get_auth_3d_object_index_by_hash(
|
||||
@@ -1905,6 +1910,19 @@ int32_t auth_3d_data_get_auth_3d_id(uint32_t file_name_hash, uint32_t object_has
|
||||
*hrc = false;
|
||||
return i;
|
||||
}
|
||||
|
||||
int32_t obj_hrc_index = auth_3d_get_auth_3d_object_hrc_index_by_hash(
|
||||
auth, object_hash, instance);
|
||||
if (obj_hrc_index >= 0) {
|
||||
if (object_index)
|
||||
*object_index = obj_hrc_index;
|
||||
if (hrc)
|
||||
*hrc = true;
|
||||
return i;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -796,6 +796,7 @@ extern void auth_3d_data_init();
|
||||
extern bool auth_3d_data_check_id_not_empty(int32_t* id);
|
||||
extern bool auth_3d_data_check_category_loaded(const char* category_name);
|
||||
extern bool auth_3d_data_check_category_loaded(uint32_t category_hash);
|
||||
extern bool auth_3d_data_check_id_loaded(int32_t* id);
|
||||
extern auth_3d* auth_3d_data_get_auth_3d(int32_t id);
|
||||
extern int32_t auth_3d_data_get_auth_3d_id(object_info obj_info,
|
||||
int32_t* object_index, bool* hrc, int32_t instance);
|
||||
|
||||
+35
-35
@@ -64,7 +64,7 @@ struct obj_mesh_header {
|
||||
obj_vertex_format_file format;
|
||||
uint32_t size_vertex;
|
||||
uint32_t num_vertex;
|
||||
int64_t vertex_array[20];
|
||||
int64_t vertex[20];
|
||||
uint32_t vertex_flags;
|
||||
};
|
||||
|
||||
@@ -166,9 +166,9 @@ static void obj_classic_read_skin_block_osage(obj_skin_block_osage* b,
|
||||
stream* s, char** str);
|
||||
static void obj_classic_write_skin_block_osage(obj_skin_block_osage* b,
|
||||
stream* s, std::vector<std::string>& strings, std::vector<int64_t>& string_offsets, int64_t* nodes_offset);
|
||||
static void obj_classic_read_vertex(obj* obj, stream* s, int64_t* vertex_array, obj_mesh* mesh,
|
||||
static void obj_classic_read_vertex(obj* obj, stream* s, int64_t* vertex, obj_mesh* mesh,
|
||||
int64_t base_offset, uint32_t num_vertex, obj_vertex_format_file vertex_format_file);
|
||||
static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array, obj_mesh* mesh,
|
||||
static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex, obj_mesh* mesh,
|
||||
int64_t base_offset, uint32_t* num_vertex, obj_vertex_format_file* vertex_format_file, uint32_t* size_vertex);
|
||||
static void obj_set_modern_read_inner(obj_set* os, stream* s);
|
||||
static void obj_set_modern_write_inner(obj_set* os, stream* s);
|
||||
@@ -228,10 +228,10 @@ static void obj_modern_read_skin_block_osage(obj_skin_block_osage* b,
|
||||
stream* s, uint32_t header_length, char** str, bool is_x);
|
||||
static void obj_modern_write_skin_block_osage(obj_skin_block_osage* b,
|
||||
stream* s, std::vector<std::string>& strings, std::vector<int64_t>& string_offsets, bool is_x);
|
||||
static void obj_modern_read_vertex(obj* obj, stream* s, int64_t* vertex_array, obj_mesh* mesh,
|
||||
static void obj_modern_read_vertex(obj* obj, stream* s, int64_t* vertex, obj_mesh* mesh,
|
||||
const uint32_t attrib_flags, uint32_t num_vertex, uint32_t size_vertex);
|
||||
static void obj_modern_write_vertex(obj* obj, stream* s, bool is_x,
|
||||
int64_t* vertex_array, obj_mesh* mesh, uint32_t* attrib_flags,
|
||||
int64_t* vertex, obj_mesh* mesh, uint32_t* attrib_flags,
|
||||
uint32_t* num_vertex, uint32_t* size_vertex, f2_struct* ovtx);
|
||||
static void obj_skin_block_node_free(obj_skin_block_node* b);
|
||||
static uint32_t obj_skin_strings_get_string_index(std::vector<std::string>& vec, const char* str);
|
||||
@@ -673,7 +673,7 @@ static void obj_classic_read_model(obj* obj, stream* s, int64_t base_offset) {
|
||||
mh.num_vertex = io_read_int32_t(s);
|
||||
|
||||
for (uint32_t j = 0; j < 20; j++)
|
||||
mh.vertex_array[j] = io_read_int32_t(s);
|
||||
mh.vertex[j] = io_read_int32_t(s);
|
||||
|
||||
mesh->attrib.w = io_read_uint32_t(s);
|
||||
mh.vertex_flags = io_read_uint32_t(s);
|
||||
@@ -727,7 +727,7 @@ static void obj_classic_read_model(obj* obj, stream* s, int64_t base_offset) {
|
||||
}
|
||||
}
|
||||
|
||||
obj_classic_read_vertex(obj, s, mh.vertex_array, mesh,
|
||||
obj_classic_read_vertex(obj, s, mh.vertex, mesh,
|
||||
base_offset, mh.num_vertex, mh.format);
|
||||
}
|
||||
}
|
||||
@@ -820,7 +820,7 @@ static void obj_classic_write_model(obj* obj, stream* s, int64_t base_offset) {
|
||||
}
|
||||
}
|
||||
|
||||
obj_classic_write_vertex(obj, s, mh->vertex_array,
|
||||
obj_classic_write_vertex(obj, s, mh->vertex,
|
||||
mesh, base_offset, &mh->num_vertex, &mh->format, &mh->size_vertex);
|
||||
|
||||
for (uint32_t j = 0; j < mesh->num_submesh; j++) {
|
||||
@@ -875,7 +875,7 @@ static void obj_classic_write_model(obj* obj, stream* s, int64_t base_offset) {
|
||||
io_write_int32_t(s, mh->num_vertex);
|
||||
|
||||
for (uint32_t j = 0; j < 20; j++)
|
||||
io_write_int32_t(s, (int32_t)mh->vertex_array[j]);
|
||||
io_write_int32_t(s, (int32_t)mh->vertex[j]);
|
||||
|
||||
io_write_uint32_t(s, mesh->attrib.w);
|
||||
io_write_uint32_t(s, mh->vertex_flags);
|
||||
@@ -2641,7 +2641,7 @@ static void obj_classic_write_skin_block_osage(obj_skin_block_osage* b,
|
||||
}
|
||||
}
|
||||
|
||||
static void obj_classic_read_vertex(obj* obj, stream* s, int64_t* vertex_array, obj_mesh* mesh,
|
||||
static void obj_classic_read_vertex(obj* obj, stream* s, int64_t* vertex, obj_mesh* mesh,
|
||||
int64_t base_offset, uint32_t num_vertex, obj_vertex_format_file vertex_format_file) {
|
||||
obj_vertex_format vertex_format = OBJ_VERTEX_FORMAT_NONE;
|
||||
if (vertex_format_file & OBJ_VERTEX_FORMAT_FILE_POSITION)
|
||||
@@ -2689,7 +2689,7 @@ static void obj_classic_read_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
if (~vertex_format_file & attribute)
|
||||
continue;
|
||||
|
||||
io_set_position(s, base_offset + vertex_array[i], SEEK_SET);
|
||||
io_set_position(s, base_offset + vertex[i], SEEK_SET);
|
||||
switch (attribute) {
|
||||
case OBJ_VERTEX_FORMAT_FILE_POSITION:
|
||||
for (uint32_t j = 0; j < num_vertex; j++) {
|
||||
@@ -2791,7 +2791,7 @@ static void obj_classic_read_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
mesh->vertex_format = vertex_format;
|
||||
}
|
||||
|
||||
static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array, obj_mesh* mesh,
|
||||
static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex, obj_mesh* mesh,
|
||||
int64_t base_offset, uint32_t* num_vertex, obj_vertex_format_file* vertex_format_file, uint32_t* size_vertex) {
|
||||
obj_vertex_data* vtx = mesh->vertex;
|
||||
uint32_t _num_vertex = mesh->num_vertex;
|
||||
@@ -2863,7 +2863,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
*size_vertex = _size_vertex;
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_POSITION) {
|
||||
vertex_array[0] = io_get_position(s) - base_offset;
|
||||
vertex[0] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].position.x);
|
||||
io_write_float_t(s, vtx[i].position.y);
|
||||
@@ -2872,7 +2872,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_NORMAL) {
|
||||
vertex_array[1] = io_get_position(s) - base_offset;
|
||||
vertex[1] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].normal.x);
|
||||
io_write_float_t(s, vtx[i].normal.y);
|
||||
@@ -2881,7 +2881,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_TANGENT) {
|
||||
vertex_array[2] = io_get_position(s) - base_offset;
|
||||
vertex[2] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].tangent.x);
|
||||
io_write_float_t(s, vtx[i].tangent.y);
|
||||
@@ -2891,7 +2891,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_BINORMAL) {
|
||||
vertex_array[3] = io_get_position(s) - base_offset;
|
||||
vertex[3] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].binormal.x);
|
||||
io_write_float_t(s, vtx[i].binormal.y);
|
||||
@@ -2900,7 +2900,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_TEXCOORD0) {
|
||||
vertex_array[4] = io_get_position(s) - base_offset;
|
||||
vertex[4] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].texcoord0.x);
|
||||
io_write_float_t(s, vtx[i].texcoord0.y);
|
||||
@@ -2908,7 +2908,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_BONE_WEIGHT) {
|
||||
vertex_array[10] = io_get_position(s) - base_offset;
|
||||
vertex[10] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].bone_weight.x);
|
||||
io_write_float_t(s, vtx[i].bone_weight.y);
|
||||
@@ -2918,7 +2918,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_BONE_INDEX) {
|
||||
vertex_array[11] = io_get_position(s) - base_offset;
|
||||
vertex[11] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, (float_t)vtx[i].bone_index.x);
|
||||
io_write_float_t(s, (float_t)vtx[i].bone_index.y);
|
||||
@@ -2928,7 +2928,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_TEXCOORD1) {
|
||||
vertex_array[5] = io_get_position(s) - base_offset;
|
||||
vertex[5] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].texcoord1.x);
|
||||
io_write_float_t(s, vtx[i].texcoord1.y);
|
||||
@@ -2936,7 +2936,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_TEXCOORD2) {
|
||||
vertex_array[6] = io_get_position(s) - base_offset;
|
||||
vertex[6] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].texcoord2.x);
|
||||
io_write_float_t(s, vtx[i].texcoord2.y);
|
||||
@@ -2944,7 +2944,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_TEXCOORD3) {
|
||||
vertex_array[7] = io_get_position(s) - base_offset;
|
||||
vertex[7] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].texcoord3.x);
|
||||
io_write_float_t(s, vtx[i].texcoord3.y);
|
||||
@@ -2952,7 +2952,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_COLOR0) {
|
||||
vertex_array[8] = io_get_position(s) - base_offset;
|
||||
vertex[8] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].color0.x);
|
||||
io_write_float_t(s, vtx[i].color0.y);
|
||||
@@ -2962,7 +2962,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_COLOR1) {
|
||||
vertex_array[9] = io_get_position(s) - base_offset;
|
||||
vertex[9] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].color1.x);
|
||||
io_write_float_t(s, vtx[i].color1.y);
|
||||
@@ -2972,7 +2972,7 @@ static void obj_classic_write_vertex(obj* obj, stream* s, int64_t* vertex_array,
|
||||
}
|
||||
|
||||
if (_vertex_format_file & OBJ_VERTEX_FORMAT_FILE_UNKNOWN) {
|
||||
vertex_array[12] = io_get_position(s) - base_offset;
|
||||
vertex[12] = io_get_position(s) - base_offset;
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
io_write_float_t(s, vtx[i].unknown.x);
|
||||
io_write_float_t(s, vtx[i].unknown.y);
|
||||
@@ -3562,10 +3562,10 @@ static void obj_modern_read_model(obj* obj, stream* s, int64_t base_offset,
|
||||
|
||||
if (!is_x)
|
||||
for (uint32_t j = 0; j < 20; j++)
|
||||
mh.vertex_array[j] = io_read_offset_f2(s, 0);
|
||||
mh.vertex[j] = io_read_offset_f2(s, 0);
|
||||
else
|
||||
for (uint32_t j = 0; j < 20; j++)
|
||||
mh.vertex_array[j] = io_read_offset_x(s);
|
||||
mh.vertex[j] = io_read_offset_x(s);
|
||||
|
||||
mesh->attrib.w = io_read_uint32_t_stream_reverse_endianness(s);
|
||||
mh.vertex_flags = io_read_uint32_t_stream_reverse_endianness(s);
|
||||
@@ -3630,7 +3630,7 @@ static void obj_modern_read_model(obj* obj, stream* s, int64_t base_offset,
|
||||
}
|
||||
}
|
||||
|
||||
obj_modern_read_vertex(obj, s_ovtx, mh.vertex_array, mesh,
|
||||
obj_modern_read_vertex(obj, s_ovtx, mh.vertex, mesh,
|
||||
mh.vertex_flags, mh.num_vertex, mh.size_vertex);
|
||||
}
|
||||
}
|
||||
@@ -3897,7 +3897,7 @@ static void obj_modern_write_model(obj* obj, stream* s,
|
||||
}
|
||||
}
|
||||
|
||||
obj_modern_write_vertex(obj, &s_ovtx, is_x, mh->vertex_array, mesh,
|
||||
obj_modern_write_vertex(obj, &s_ovtx, is_x, mh->vertex, mesh,
|
||||
&mh->vertex_flags, &mh->num_vertex, &mh->size_vertex, ovtx);
|
||||
}
|
||||
|
||||
@@ -4005,10 +4005,10 @@ static void obj_modern_write_model(obj* obj, stream* s,
|
||||
|
||||
if (!is_x)
|
||||
for (uint32_t j = 0; j < 20; j++)
|
||||
io_write_offset_f2(s, mh->vertex_array[j], 0);
|
||||
io_write_offset_f2(s, mh->vertex[j], 0);
|
||||
else
|
||||
for (uint32_t j = 0; j < 20; j++)
|
||||
io_write_offset_x(s, mh->vertex_array[j]);
|
||||
io_write_offset_x(s, mh->vertex[j]);
|
||||
|
||||
io_write_uint32_t(s, mesh->attrib.w);
|
||||
io_write_uint32_t(s, mh->vertex_flags);
|
||||
@@ -6549,7 +6549,7 @@ static void obj_modern_write_skin_block_osage(obj_skin_block_osage* b,
|
||||
}
|
||||
}
|
||||
|
||||
static void obj_modern_read_vertex(obj* obj, stream* s, int64_t* vertex_array, obj_mesh* mesh,
|
||||
static void obj_modern_read_vertex(obj* obj, stream* s, int64_t* vertex, obj_mesh* mesh,
|
||||
const uint32_t vertex_flags, uint32_t num_vertex, uint32_t size_vertex) {
|
||||
obj_vertex_format vertex_format = (obj_vertex_format)(OBJ_VERTEX_FORMAT_POSITION
|
||||
| OBJ_VERTEX_FORMAT_NORMAL
|
||||
@@ -6565,7 +6565,7 @@ static void obj_modern_read_vertex(obj* obj, stream* s, int64_t* vertex_array, o
|
||||
else if (vertex_flags == 0x04)
|
||||
enum_or(vertex_format, OBJ_VERTEX_FORMAT_BONE_DATA);
|
||||
|
||||
int64_t vtx_offset = vertex_array[13];
|
||||
int64_t vtx_offset = vertex[13];
|
||||
|
||||
bool has_tangents = false;
|
||||
obj_vertex_data* vtx = force_malloc_s(obj_vertex_data, num_vertex);
|
||||
@@ -6666,7 +6666,7 @@ static void obj_modern_read_vertex(obj* obj, stream* s, int64_t* vertex_array, o
|
||||
}
|
||||
|
||||
static void obj_modern_write_vertex(obj* obj, stream* s, bool is_x,
|
||||
int64_t* vertex_array, obj_mesh* mesh, uint32_t* vertex_flags,
|
||||
int64_t* vertex, obj_mesh* mesh, uint32_t* vertex_flags,
|
||||
uint32_t* num_vertex, uint32_t* size_vertex, f2_struct* ovtx) {
|
||||
|
||||
obj_vertex_data* vtx = mesh->vertex;
|
||||
@@ -6714,7 +6714,7 @@ static void obj_modern_write_vertex(obj* obj, stream* s, bool is_x,
|
||||
}
|
||||
|
||||
bool has_tangents = false;
|
||||
vertex_array[13] = io_get_position(s);
|
||||
vertex[13] = io_get_position(s);
|
||||
for (uint32_t i = 0; i < _num_vertex; i++) {
|
||||
vec3 position = vtx[i].position;
|
||||
io_write_float_t(s, position.x);
|
||||
|
||||
+10
-10
@@ -322,7 +322,7 @@ bool txp_set::produce_enrs(enrs* enrs) {
|
||||
}
|
||||
|
||||
bool txp_set::unpack_file(void* data, bool big_endian) {
|
||||
uint32_t sign;
|
||||
uint32_t signature;
|
||||
uint32_t tex_count;
|
||||
txp* tex;
|
||||
txp_mipmap* tex_mipmap;
|
||||
@@ -336,11 +336,11 @@ bool txp_set::unpack_file(void* data, bool big_endian) {
|
||||
return false;
|
||||
|
||||
if (big_endian)
|
||||
sign = load_reverse_endianness_uint32_t((void*)data);
|
||||
signature = load_reverse_endianness_uint32_t((void*)data);
|
||||
else
|
||||
sign = *(uint32_t*)data;
|
||||
signature = *(uint32_t*)data;
|
||||
|
||||
if (sign != 0x03505854)
|
||||
if (signature != 0x03505854)
|
||||
return false;
|
||||
|
||||
set_d = (size_t)data;
|
||||
@@ -353,14 +353,14 @@ bool txp_set::unpack_file(void* data, bool big_endian) {
|
||||
for (size_t i = 0; i < tex_count; i++) {
|
||||
if (big_endian) {
|
||||
d = set_d + (size_t)load_reverse_endianness_uint32_t((uint32_t*)(set_d + 12) + i);
|
||||
sign = load_reverse_endianness_uint32_t((void*)d);
|
||||
signature = load_reverse_endianness_uint32_t((void*)d);
|
||||
}
|
||||
else {
|
||||
d = set_d + (size_t)((uint32_t*)(set_d + 12))[i];
|
||||
sign = *(uint32_t*)d;
|
||||
signature = *(uint32_t*)d;
|
||||
}
|
||||
|
||||
if (sign != 0x04505854 && sign != 0x05505854) {
|
||||
if (signature != 0x04505854 && signature != 0x05505854) {
|
||||
textures.pop_back();
|
||||
continue;
|
||||
}
|
||||
@@ -375,7 +375,7 @@ bool txp_set::unpack_file(void* data, bool big_endian) {
|
||||
}
|
||||
|
||||
tex = &textures[i - (tex_count - textures.size())];
|
||||
tex->has_cube_map = sign == 0x05505854;
|
||||
tex->has_cube_map = signature == 0x05505854;
|
||||
tex->mipmaps_count = info & 0xFF;
|
||||
tex->array_size = (info >> 8) & 0xFF;
|
||||
|
||||
@@ -389,11 +389,11 @@ bool txp_set::unpack_file(void* data, bool big_endian) {
|
||||
for (size_t k = 0; k < tex->mipmaps_count; k++, tex_mipmap++) {
|
||||
if (big_endian) {
|
||||
mipmap_d = d + (size_t)load_reverse_endianness_uint32_t((uint32_t*)(d + 12) + j * mipmaps_count + k);
|
||||
sign = load_reverse_endianness_uint32_t((void*)mipmap_d);
|
||||
signature = load_reverse_endianness_uint32_t((void*)mipmap_d);
|
||||
}
|
||||
else {
|
||||
mipmap_d = d + (size_t)((uint32_t*)(d + 12))[j * mipmaps_count + k];
|
||||
sign = *(uint32_t*)mipmap_d;
|
||||
signature = *(uint32_t*)mipmap_d;
|
||||
}
|
||||
|
||||
if (big_endian) {
|
||||
|
||||
Reference in New Issue
Block a user