Add capybara

This commit is contained in:
2026-06-21 22:38:11 +02:00
parent d534e57ad2
commit 7e5536a02f
10 changed files with 153 additions and 45 deletions
+16 -9
View File
@@ -122,12 +122,13 @@ void LightKeeper::customInit() {
const auto CharObj = std::make_shared<GameObject>("Character");
auto charModel = ModelLoader::LoadSkinnedModel(
AssetFS::GetInstance().GetFullPath("engine://char2.fbx").generic_string()
AssetFS::GetInstance().GetFullPath("engine://cotw-capybara-male/source/capybara.fbx").generic_string()
);
const auto charMeshID = meshCache.addMesh(gfxDevice, charModel.meshes[0]);
const auto charTextureID = gfxDevice.loadImageFromFile(AssetFS::GetInstance().GetFullPath("engine://textures/T_T.png"));
const auto charTextureID = gfxDevice.loadImageFromFile(AssetFS::GetInstance().GetFullPath("engine://cotw-capybara-male/textures/capybara_male_light_brown_dif.ddsc.DECA.RE.png"));
// const auto charTextureID = gfxDevice.loadImageFromFile(AssetFS::GetInstance().GetFullPath("engine://char.jpg"));
const auto charMaterialID = materialCache.addMaterial(gfxDevice, {
.baseColor = glm::vec3(1.f),
.diffuseTexture = charTextureID,
@@ -141,18 +142,24 @@ void LightKeeper::customInit() {
const auto animator = CharObj->AddComponent<Animator>();
animator->setSkeleton(std::move(charModel.skeleton));
std::string firstAnimationName;
for (auto& clip : charModel.animations) {
spdlog::info("Loaded animation: '{}' ({:.2f}s)", clip.name, clip.duration);
if (firstAnimationName.empty())
firstAnimationName = clip.name;
animator->addClip(std::make_shared<SkeletalAnimation>(std::move(clip)));
}
for (const auto& clip : charModel.animations)
spdlog::info("Loaded animation: '{}' ({:.2f}s)", clip.name, clip.duration);
if (!firstAnimationName.empty()) {
spdlog::info("Playing animation: '{}'", firstAnimationName);
animator->play(firstAnimationName);
}
if (!charModel.animations.empty())
// animator->play("Armature|Armature|mixamo.com");
// // animator->play(charModel.animations[0].name);
animator->play("Armature|Armature|Armature|main");
// or: animator->play("Run", 0.2f); // 0.2s cross-fade
animator->play("capybara_canter_fwd_01|capybara_walk_fwd_01");
CharObj->GetTransform().SetWorldPosition(glm::vec3(0.f, 0.f, 0.f));
// CharObj->GetTransform().SetWorldScale(0.01f, 0.01f, 0.01f);