add entity models rigging draft
This commit is contained in:
parent
c9fc4a85b8
commit
5a01eca780
@ -248,7 +248,7 @@ void PlayerController::update(float delta, bool input, bool pause) {
|
|||||||
if (input) {
|
if (input) {
|
||||||
updateInteraction();
|
updateInteraction();
|
||||||
if (Events::jactive("player.drop")) {
|
if (Events::jactive("player.drop")) {
|
||||||
level->entities->drop(player->camera->position, player->camera->front*10.0f+player->hitbox->velocity);
|
level->entities->drop(player->camera->position, player->camera->front*8.0f+glm::vec3(0, 2, 0)+player->hitbox->velocity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player->selection.vox.id = BLOCK_VOID;
|
player->selection.vox.id = BLOCK_VOID;
|
||||||
|
|||||||
@ -25,7 +25,8 @@ void Entities::drop(glm::vec3 pos, glm::vec3 vel) {
|
|||||||
glm::vec3 size(1);
|
glm::vec3 size(1);
|
||||||
registry.emplace<EntityId>(entity, static_cast<entityid_t>(1));
|
registry.emplace<EntityId>(entity, static_cast<entityid_t>(1));
|
||||||
registry.emplace<Transform>(entity, pos, size/4.0f, glm::mat3(1.0f));
|
registry.emplace<Transform>(entity, pos, size/4.0f, glm::mat3(1.0f));
|
||||||
registry.emplace<Hitbox>(entity, pos, size/2.0f);
|
registry.emplace<Hitbox>(entity, pos,
|
||||||
|
glm::vec3(size.x*0.2f, size.y*0.5f, size.z*0.2f));
|
||||||
|
|
||||||
auto& hitbox = registry.get<Hitbox>(entity);
|
auto& hitbox = registry.get<Hitbox>(entity);
|
||||||
hitbox.velocity = vel;
|
hitbox.velocity = vel;
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class Level;
|
|||||||
class Assets;
|
class Assets;
|
||||||
class ModelBatch;
|
class ModelBatch;
|
||||||
class Frustum;
|
class Frustum;
|
||||||
|
class Rig;
|
||||||
|
|
||||||
class Entity {
|
class Entity {
|
||||||
entt::registry& registry;
|
entt::registry& registry;
|
||||||
|
|||||||
34
src/objects/rigging.hpp
Normal file
34
src/objects/rigging.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef OBJECTS_SKELETON_HPP_
|
||||||
|
#define OBJECTS_SKELETON_HPP_
|
||||||
|
|
||||||
|
#include "../typedefs.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
namespace rigging {
|
||||||
|
struct Rig;
|
||||||
|
|
||||||
|
struct Pose {
|
||||||
|
std::vector<glm::mat4> matrices;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RigNode {
|
||||||
|
uint index;
|
||||||
|
std::vector<std::unique_ptr<RigNode>> subnodes;
|
||||||
|
public:
|
||||||
|
RigNode(uint index);
|
||||||
|
};
|
||||||
|
|
||||||
|
class RigConfig {
|
||||||
|
std::unique_ptr<RigNode> root;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Rig {
|
||||||
|
RigConfig* config;
|
||||||
|
Pose pose;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OBJECTS_SKELETON_HPP_
|
||||||
Loading…
x
Reference in New Issue
Block a user