Implement Transform propagation in flecs
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include "flycam.h"
|
||||
|
||||
#include "components/name.h"
|
||||
#include "components/transform.h"
|
||||
#include "transform/transform.h"
|
||||
#include "core/camera.h"
|
||||
#include "core/light.h"
|
||||
#include "window/window.h"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <asset/asset_manager.h>
|
||||
#include <flecs.h>
|
||||
#include <asset/asset.h>
|
||||
#include <input/input.h>
|
||||
#include <log/log.h>
|
||||
#include <transform/transform.h>
|
||||
#include <window/window.h>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <flecs.h>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
@@ -16,12 +17,7 @@ int main()
|
||||
world.import <Window::WindowModule>();
|
||||
world.import <Input::InputModule>();
|
||||
world.import <Asset::AssetModule>();
|
||||
|
||||
Asset::AssetManager manager;
|
||||
manager.register_asset_type<int>(world);
|
||||
auto handle0 = manager.load<int>(world, "hi");
|
||||
auto handle1 = manager.load<int>(world, "hi");
|
||||
auto handle2 = manager.load<int>(world, "hi2");
|
||||
world.import <TransformModule>();
|
||||
|
||||
#ifndef NDEBUG
|
||||
world.import <flecs::stats>();
|
||||
@@ -59,6 +55,13 @@ int main()
|
||||
.kind(flecs::PostUpdate)
|
||||
.each([](std::shared_ptr<GLFWwindow>& glfw_window) { glfwSwapBuffers(glfw_window.get()); });
|
||||
|
||||
auto parent = world.entity("TestParent").add<Transform>().add<GlobalTransform>();
|
||||
parent.get_mut<Transform>()->translation += glm::vec3(1.0);
|
||||
|
||||
auto child = world.entity("TestChild").add<Transform>().add<GlobalTransform>();
|
||||
child.get_mut<Transform>()->translation += glm::vec3(1.0);
|
||||
child.child_of(parent);
|
||||
|
||||
while (world.progress()) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user