15#include <glm/gtc/matrix_transform.hpp>
16#include <glm/gtc/quaternion.hpp>
24void pushRenderable3D(
const SceneNode &
n,
void *target) {
25 auto *r =
static_cast<Renderable3D *
>(target);
26 auto t = r->transform();
35 t->sx = glm::length(c0);
36 t->sy = glm::length(c1);
37 t->sz = glm::length(c2);
38 if (t->sx > 1e-8f) c0 /= t->sx;
39 if (t->sy > 1e-8f) c1 /= t->sy;
40 if (t->sz > 1e-8f) c2 /= t->sz;
42 glm::mat3 rot(c0, c1, c2);
43 glm::quat q = glm::quat_cast(rot);
44 glm::vec3 euler = glm::eulerAngles(q);
49 r->meshRenderer()->visible =
n.visible;
52void pushRenderable2D(
const SceneNode &
n,
void *target) {
53 auto *r =
static_cast<Renderable2D *
>(target);
54 auto t = r->transform();
55 const glm::mat4 &
w =
n.world;
61 t->sx = glm::length(c0);
62 t->sy = glm::length(c1);
63 if (t->sx > 1e-8f) c0 /= t->sx;
65 t->rot = std::atan2(c0.y, c0.x);
67 r->sprite()->visible =
n.visible;
70void pushCamera3D(
const SceneNode &
n,
void *target) {
71 auto *
c =
static_cast<Camera3D *
>(target);
72 c->setEye(
n.world[3][0],
n.world[3][1],
n.world[3][2]);
77bool entityAlive(
const void *target) {
78 return ecs::is_entity_visible(
static_cast<const ecs::Entity *
>(
static_cast<const T *
>(target)));
84 {
"renderable2d", &pushRenderable2D,
nullptr, &entityAlive<Renderable2D>});
86 {
"renderable3d", &pushRenderable3D,
nullptr, &entityAlive<Renderable3D>});
88 {
"camera3d", &pushCamera3D,
nullptr, &entityAlive<Camera3D>});
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
int registerLinkKind(const LinkOps &ops)
Retained scene node (arena). Conceptual GameObject; isomorphic to eve::ui::UINode.