mirror of
https://github.com/open-goal/jak-project
synced 2026-08-17 21:43:27 -04:00
e6260e48ab
Adds support for exporting animations for foreground models. It's not perfect and doesn't handle the Jak 2/3 animations very well in some cases (scale can often get messed up, especially for the LZO compressed ones, I have no idea what is going on with the data in those art groups sometimes, so that'll have to be revisited later...), but it does a decent job on Jak 1. Additionally, the `build-actor` tool has also been changed to support setting the `master-art-group-name` and `master-art-group-index` fields to allow for custom art groups to link their animations to a different master art group, which lets you add custom animations to vanilla art groups.
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "common/util/gltf_util.h"
|
|
|
|
#include "goalc/build_actor/common/animation_processing.h"
|
|
#include "goalc/build_actor/common/art_types.h"
|
|
#include "goalc/build_level/collide/common/collide_common.h"
|
|
|
|
struct Joint {
|
|
std::string name;
|
|
s32 number;
|
|
int parent;
|
|
math::Matrix4f bind_pose{};
|
|
|
|
Joint(const std::string& name, int number, int parent, math::Matrix4f bind_pose) {
|
|
this->name = name;
|
|
this->number = number;
|
|
this->parent = parent;
|
|
this->bind_pose = bind_pose;
|
|
}
|
|
|
|
size_t generate(DataObjectGenerator& gen) const;
|
|
};
|
|
|
|
extern std::map<int, size_t> g_joint_map;
|
|
|
|
struct BuildActorParams {
|
|
bool gen_collide_mesh = false;
|
|
s8 texture_bucket = -1;
|
|
s32 texture_level = -1;
|
|
s32 joint_channel = -1;
|
|
math::Vector4f trans_offset = {0.f, 0.f, 0.f, 1.f};
|
|
std::vector<float> lod_dist{};
|
|
std::string master_art_group;
|
|
std::map<std::string, int> master_ag_map; // ja name -> master ag slot
|
|
float framerate = 60;
|
|
};
|
|
|
|
struct GltfJoint {
|
|
math::Matrix4f bind_pose_T_w; // inverse bind pose
|
|
std::string name;
|
|
int gltf_node_index = 0;
|
|
int parent = -1;
|
|
std::vector<int> children;
|
|
};
|
|
|
|
tinygltf::Model load_gltf_model(const fs::path& path);
|
|
std::vector<GltfJoint> extract_skeleton(const tinygltf::Model& model, int skin_idx);
|
|
std::vector<Joint> convert_joints(const std::vector<GltfJoint>& gjoints);
|
|
std::vector<anim::CompressedAnim> process_anim(const tinygltf::Model& model,
|
|
const std::vector<GltfJoint>& gjoints,
|
|
const std::string& master_art_group,
|
|
const std::map<std::string, int>& master_ag_map,
|
|
float framerate); |