mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
f2e7606f1b
Some checks are pending
Build / 🖥️ Windows (push) Waiting to run
Build / 🐧 Linux (push) Waiting to run
Build / 🍎 MacOS (push) Waiting to run
Lint / 📝 Formatting (push) Waiting to run
Lint / 📝 Required Checks (push) Waiting to run
Lint / 📝 Optional Checks (push) Waiting to run
This adds a feature to `build_actor` to support importing skeletons and animations from .glb files. Multiple animations are handled and will use the name in the GLB. The default `viewer` process will end up playing back the first animation. There are a few limitations: - You can only have around 100 bones. It is technically possibly to have slightly more, but certain animations may fail to compress when there are more than ~100 bones. - Currently, all animations have 60 keyframes per second. This is a higher quality than what is normally used. If animation size becomes problematic, we could make this customizable somehow. - There is no support for the `align` bone. --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "common/util/gltf_util.h"
|
|
|
|
#include "goalc/build_actor/jak1/build_actor.h"
|
|
|
|
struct MercExtractData {
|
|
gltf_util::TexturePool tex_pool;
|
|
std::vector<u32> new_indices;
|
|
std::vector<tfrag3::PreloadedVertex> new_vertices;
|
|
std::vector<math::Vector<u8, 4>> new_colors;
|
|
std::vector<math::Vector3f> normals;
|
|
std::vector<gltf_util::JointsAndWeights> joints_and_weights;
|
|
tfrag3::MercModel new_model;
|
|
};
|
|
|
|
// Data produced by loading a replacement model
|
|
struct MercSwapData {
|
|
std::vector<u32> new_indices;
|
|
std::vector<tfrag3::MercVertex> new_vertices;
|
|
std::vector<tfrag3::Texture> new_textures;
|
|
tfrag3::MercModel new_model;
|
|
};
|
|
|
|
void extract(const std::string& name,
|
|
MercExtractData& out,
|
|
const tinygltf::Model& model,
|
|
const std::vector<gltf_util::NodeWithTransform>& all_nodes,
|
|
u32 index_offset,
|
|
u32 vertex_offset,
|
|
u32 tex_offset);
|
|
void merc_convert(MercSwapData& out, const MercExtractData& in);
|
|
MercSwapData load_merc_model(u32 current_idx_count,
|
|
u32 current_vtx_count,
|
|
u32 current_tex_count,
|
|
const std::string& path,
|
|
const std::string& name);
|
|
std::vector<jak1::CollideMesh> gen_collide_mesh_from_model(
|
|
const tinygltf::Model& model,
|
|
const std::vector<gltf_util::NodeWithTransform>& all_nodes,
|
|
int joint_idx); |