update rigging
This commit is contained in:
parent
d4460928e5
commit
50f9bd508a
@ -36,7 +36,7 @@ vn 1.0000 -0.0000 0.0000
|
|||||||
vn -0.0000 -0.0000 1.0000
|
vn -0.0000 -0.0000 1.0000
|
||||||
vn -1.0000 -0.0000 -0.0000
|
vn -1.0000 -0.0000 -0.0000
|
||||||
vn 0.0000 0.0000 -1.0000
|
vn 0.0000 0.0000 -1.0000
|
||||||
usemtl blocks/lamp
|
usemtl $0
|
||||||
s off
|
s off
|
||||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||||
f 5/5/2 8/6/2 7/7/2 6/8/2
|
f 5/5/2 8/6/2 7/7/2 6/8/2
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
# Blender MTL File: 'None'
|
|
||||||
# Material Count: 1
|
|
||||||
|
|
||||||
newmtl Material
|
|
||||||
Ns 96.078431
|
|
||||||
Ka 1.000000 1.000000 1.000000
|
|
||||||
Kd 0.640000 0.640000 0.640000
|
|
||||||
Ks 0.500000 0.500000 0.500000
|
|
||||||
Ke 0.000000 0.000000 0.000000
|
|
||||||
Ni 1.000000
|
|
||||||
d 1.000000
|
|
||||||
illum 2
|
|
||||||
@ -15,7 +15,7 @@ function on_fall()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function on_trigger_enter(index, oid)
|
function on_trigger_enter(index, oid)
|
||||||
if ready then
|
if ready and oid == 0 then
|
||||||
entity:despawn()
|
entity:despawn()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -214,8 +214,10 @@ assetload::postfunc assetload::model(
|
|||||||
auto model = obj::parse(path.u8string(), text).release();
|
auto model = obj::parse(path.u8string(), text).release();
|
||||||
return [=](Assets* assets) {
|
return [=](Assets* assets) {
|
||||||
for (auto& mesh : model->meshes) {
|
for (auto& mesh : model->meshes) {
|
||||||
auto filename = TEXTURES_FOLDER+"/"+mesh.texture;
|
if (mesh.texture.find('$') == std::string::npos) {
|
||||||
loader->add(AssetType::texture, filename, mesh.texture, nullptr);
|
auto filename = TEXTURES_FOLDER+"/"+mesh.texture;
|
||||||
|
loader->add(AssetType::texture, filename, mesh.texture, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assets->store(std::unique_ptr<model::Model>(model), name);
|
assets->store(std::unique_ptr<model::Model>(model), name);
|
||||||
};
|
};
|
||||||
|
|||||||
10
src/objects/rigging.cpp
Normal file
10
src/objects/rigging.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "rigging.hpp"
|
||||||
|
|
||||||
|
using namespace rigging;
|
||||||
|
|
||||||
|
RigNode::RigNode(size_t index, std::string name, std::vector<std::unique_ptr<RigNode>> subnodes)
|
||||||
|
: index(index), name(std::move(name)), subnodes(std::move(subnodes)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RigConfig::RigConfig(std::unique_ptr<RigNode> root) : root(std::move(root)) {
|
||||||
|
}
|
||||||
@ -5,7 +5,9 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace rigging {
|
namespace rigging {
|
||||||
struct Rig;
|
struct Rig;
|
||||||
@ -15,19 +17,33 @@ namespace rigging {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class RigNode {
|
class RigNode {
|
||||||
uint index;
|
size_t index;
|
||||||
|
std::string name;
|
||||||
std::vector<std::unique_ptr<RigNode>> subnodes;
|
std::vector<std::unique_ptr<RigNode>> subnodes;
|
||||||
public:
|
public:
|
||||||
RigNode(uint index);
|
RigNode(size_t index, std::string name, std::vector<std::unique_ptr<RigNode>> subnodes);
|
||||||
|
|
||||||
|
size_t getIndex() const {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& getSubnodes() const {
|
||||||
|
return subnodes;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class RigConfig {
|
class RigConfig {
|
||||||
std::unique_ptr<RigNode> root;
|
std::unique_ptr<RigNode> root;
|
||||||
|
std::unordered_map<std::string, size_t> indices;
|
||||||
|
std::vector<RigNode*> nodes;
|
||||||
|
public:
|
||||||
|
RigConfig(std::unique_ptr<RigNode> root);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Rig {
|
struct Rig {
|
||||||
RigConfig* config;
|
RigConfig* config;
|
||||||
Pose pose;
|
Pose pose;
|
||||||
|
std::vector<std::string> textures;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user