载入中...
搜索中...
未找到
VrmRuntime.h
浏览该文件的文档.
1#pragma once
2#include <glm/glm.hpp>
3#include <memory>
4#include <unordered_map>
6#include "common/ECS.h"
7
8namespace eve::animation {
9class AnimSkeleton;
10class AnimPlayer;
11class AnimSkin;
12class AnimPose;
13} // namespace eve::animation
14namespace eve::model3d {
15class ModelData;
16}
17namespace eve::graphics {
18class Graphics;
19class Mesh;
20class Material;
21class Shader;
22class Texture;
23} // namespace eve::graphics
24namespace eve::avatar {
25class AvatarInstance;
26struct VrmSurface;
27
28// Private import transaction and runtime owner. ECS projections are always resolved by generation.
31public:
39 void animate(AvatarInstance& avatar, animation::AnimPose& pose, float dt);
41 void sync(AvatarInstance& avatar, const glm::mat4& world, bool visible);
43 void morphs(AvatarInstance& avatar);
45 void gaze(AvatarInstance& avatar, animation::AnimPose& pose, const glm::mat4& world, bool enabled, glm::vec3 target,
46 float weight);
47 std::weak_ptr<const void> providerLifetime;
49 std::unique_ptr<model3d::ModelData> model;
50 std::unique_ptr<animation::AnimSkeleton> skeleton;
51 std::unique_ptr<animation::AnimPlayer> player;
52 std::vector<int> nodeBones;
53 std::map<int, std::array<float, 3>> rotations;
55 struct Part {
56 ecs::EntityHandle entity, outline;
57 graphics::Mesh* mesh = nullptr;
58 int sourceMesh = -1, node = -1, material = -1;
59 std::unique_ptr<animation::AnimSkin> skin;
60 std::vector<float> cpu;
61 };
62 std::vector<Part> parts;
63 std::vector<std::unique_ptr<VrmSurface>> surfaces;
64 std::vector<graphics::Texture*> textures;
65 glm::mat4 world{1};
66 float time = 0;
67
68private:
69 struct Particle {
70 glm::vec3 current{}, previous{};
71 bool initialized = false;
72 };
73 std::vector<std::vector<Particle>> particles_;
74 std::unordered_map<std::string, float> gazeWeights_;
75 void springs(animation::AnimPose& pose, float dt);
76};
77} // namespace eve::avatar
LogicalId target
eve::EntitySpatialPose pose
graphics::Canvas * previous
std::string path
Definition PlayHost.cpp:110
double current
bool visible
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
Unified avatar instance. Kind is a string: "image" | "live2d" | "vroid". Script-facing API avoids ove...
VrmRuntime public API.
Definition VrmRuntime.h:30
static eve::Result< std::unique_ptr< VrmRuntime > > prepare(std::string_view path)
Prepare.
std::vector< int > nodeBones
Definition VrmRuntime.h:52
std::unique_ptr< animation::AnimSkeleton > skeleton
Definition VrmRuntime.h:50
void animate(AvatarInstance &avatar, animation::AnimPose &pose, float dt)
Animate.
std::vector< std::unique_ptr< VrmSurface > > surfaces
Definition VrmRuntime.h:63
void morphs(AvatarInstance &avatar)
Morphs.
std::vector< graphics::Texture * > textures
Definition VrmRuntime.h:64
void gaze(AvatarInstance &avatar, animation::AnimPose &pose, const glm::mat4 &world, bool enabled, glm::vec3 target, float weight)
Gaze.
Definition VrmMotion.cpp:32
std::vector< Part > parts
Definition VrmRuntime.h:62
std::map< int, std::array< float, 3 > > rotations
Definition VrmRuntime.h:53
void sync(AvatarInstance &avatar, const glm::mat4 &world, bool visible)
Synchronizes .
std::weak_ptr< const void > providerLifetime
Definition VrmRuntime.h:47
std::unique_ptr< model3d::ModelData > model
Definition VrmRuntime.h:49
std::unique_ptr< animation::AnimPlayer > player
Definition VrmRuntime.h:51
VrmRuntime()
Constructs a VrmRuntime.
~VrmRuntime()
Releases VrmRuntime resources.
GPU mesh handle (+ optional CPU morph targets).
Definition Mesh.h:25
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
bool enabled
Validated VRM schema data. Unknown optional fields are ignored; unknown versions fail.
Definition VrmDocument.h:88
std::unique_ptr< animation::AnimSkin > skin
Definition VrmRuntime.h:59
ecs::EntityHandle outline
Definition VrmRuntime.h:56
std::vector< float > cpu
Definition VrmRuntime.h:60
ecs::EntityHandle entity
Definition VrmRuntime.h:56