-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from zenustech/LSLTQL
cihou zhouhang
- Loading branch information
Showing
15 changed files
with
560 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule OpenSim
deleted from
6faaed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
#include <iostream> | ||
#include <limits> | ||
#include <array> | ||
|
||
/** | ||
* @class <ElasticModel> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <zeno/zeno.h> | ||
#include <zeno/logger.h> | ||
#include <zeno/ListObject.h> | ||
#include <zeno/NumericObject.h> | ||
#include <zeno/PrimitiveObject.h> | ||
#include <zeno/utils/UserData.h> | ||
#include <zeno/StringObject.h> | ||
|
||
|
||
#include <igl/readDMAT.h> | ||
#include <igl/column_to_quats.h> | ||
|
||
#include "skinning_iobject.h" | ||
|
||
namespace{ | ||
using namespace zeno; | ||
|
||
struct ReadPoseFrame : zeno::INode { | ||
virtual void apply() override { | ||
auto res = std::make_shared<PosesAnimationFrame>(); | ||
auto bones = get_input<zeno::PrimitiveObject>("bones"); | ||
auto dmat_path = get_input<zeno::StringObject>("dmat_path")->get(); | ||
|
||
Eigen::MatrixXd Q; | ||
igl::readDMAT(dmat_path,Q); | ||
|
||
if(bones->lines.size() != Q.rows()/4 || Q.rows() % 4 != 0){ | ||
std::cout << "THE DIMENSION OF BONES DOES NOT MATCH POSES " << bones->lines.size() << "\t" << Q.rows() << std::endl; | ||
throw std::runtime_error("THE DIMENSION OF BONES DOES NOT MATCH POSES"); | ||
} | ||
|
||
igl::column_to_quats(Q,res->posesFrame); | ||
set_output("posesFrame",std::move(res)); | ||
} | ||
}; | ||
|
||
ZENDEFNODE(ReadPoseFrame, { | ||
{{"readpath","dmat_path"},"bones"}, | ||
{"posesFrame"}, | ||
{}, | ||
{"Skinning"}, | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <zeno/zeno.h> | ||
#include <zeno/logger.h> | ||
#include <zeno/ListObject.h> | ||
#include <zeno/NumericObject.h> | ||
#include <zeno/PrimitiveObject.h> | ||
#include <zeno/utils/UserData.h> | ||
#include <zeno/StringObject.h> | ||
|
||
#include "skinning_iobject.h" | ||
|
||
namespace{ | ||
using namespace zeno; | ||
|
||
struct MakeEmptyBones : zeno::INode { | ||
virtual void apply() override { | ||
auto root = get_input<zeno::NumericObject>("root")->get<zeno::vec3f>(); | ||
auto res = std::make_shared<zeno::PrimitiveObject>(); | ||
|
||
res->resize(1); | ||
res->verts[0] = root; | ||
|
||
set_output("bones",std::move(res)); | ||
} | ||
}; | ||
|
||
ZENDEFNODE(MakeEmptyBones, { | ||
{"root"}, | ||
{"bones"}, | ||
{}, | ||
{"Skinning"}, | ||
}); | ||
|
||
struct AddBone : zeno::INode { | ||
virtual void apply() override { | ||
auto bones = get_input<zeno::PrimitiveObject>("bones"); | ||
auto node = get_input<zeno::NumericObject>("node")->get<zeno::vec3f>(); | ||
auto connect_to = get_input<zeno::NumericObject>("conn_to")->get<int>(); | ||
|
||
int idx = bones->size(); | ||
|
||
bones->verts.emplace_back(node); | ||
bones->lines.emplace_back(connect_to,idx); | ||
|
||
set_output("bones_out",bones); | ||
} | ||
}; | ||
|
||
ZENDEFNODE(AddBone, { | ||
{"bones","node","conn_to"}, | ||
{"bones_out"}, | ||
{}, | ||
{"Skinning"}, | ||
}); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#include <zeno/zeno.h> | ||
#include <zeno/logger.h> | ||
#include <zeno/ListObject.h> | ||
#include <zeno/NumericObject.h> | ||
#include <zeno/PrimitiveObject.h> | ||
#include <zeno/utils/UserData.h> | ||
#include <zeno/StringObject.h> | ||
|
||
#include <igl/readOBJ.h> | ||
#include <igl/readTGF.h> | ||
#include <igl/readMESH.h> | ||
|
||
#include "skinning_iobject.h" | ||
|
||
namespace{ | ||
using namespace zeno; | ||
|
||
struct LoadTFGPrimitiveFromFile : zeno::INode { | ||
virtual void apply() override { | ||
auto res = std::make_shared<zeno::PrimitiveObject>(); | ||
auto tfg_path = get_input<zeno::StringObject>("tfg")->get(); | ||
|
||
Eigen::MatrixXd C; | ||
Eigen::MatrixXi BE; | ||
igl::readTGF(tfg_path,C,BE); | ||
|
||
assert(C.cols() == 3); | ||
assert(BE.cols() == 2); | ||
|
||
|
||
// auto& parents = res->add_attr<int>("parents"); | ||
res->resize(C.rows()); | ||
auto& pos = res->attr<zeno::vec3f>("pos"); | ||
auto& segs = res->lines; | ||
segs.resize(BE.rows()); | ||
|
||
for(size_t i = 0;i < C.rows();++i) | ||
pos[i] = zeno::vec3f(C.row(i)[0],C.row(i)[1],C.row(i)[2]); | ||
for(size_t i = 0;i < BE.rows();++i) | ||
segs[i] = zeno::vec2i(BE.row(i)[0],BE.row(i)[1]); | ||
|
||
// Eigen::VectorXi P; | ||
// igl::directed_edge_parents(BE,P); | ||
|
||
// std::cout << "BE : " << std::endl << BE << std::endl; | ||
// std::cout << "P : " << std::endl << P.transpose() << std::endl; | ||
|
||
// std::cout << "P : " << P.rows() << "\t" << P.cols() << std::endl; | ||
// std::cout << "parents : " << parents.size() << std::endl; | ||
|
||
// for(size_t i = 0;i < parents.size();++i) | ||
// parents[i] = P[i]; | ||
|
||
set_output("res",std::move(res)); | ||
} | ||
}; | ||
|
||
ZENDEFNODE(LoadTFGPrimitiveFromFile, { | ||
{{"readpath","tfg"}}, | ||
{"res"}, | ||
{}, | ||
{"Skinning"}, | ||
}); | ||
|
||
struct ReadMesh : zeno::INode { | ||
virtual void apply() override { | ||
auto res = std::make_shared<PrimitiveObject>(); | ||
auto mesh_path = get_input<zeno::StringObject>("mesh")->get(); | ||
|
||
Eigen::MatrixXd V; | ||
Eigen::MatrixXi T,F; | ||
igl::readMESH(mesh_path,V,T,F); | ||
|
||
// we only support 3d simplex volumetric meshing | ||
assert(V.cols() == 3 && T.cols() == 4 && F.cols() == 3); | ||
|
||
res->resize(V.rows()); | ||
for(size_t i = 0;i < V.rows();++i) | ||
res->verts[i] = zeno::vec3f(V.row(i)[0],V.row(i)[1],V.row(i)[2]); | ||
for(size_t i = 0;i < T.rows();++i) | ||
res->quads.emplace_back(T.row(i)[0],T.row(i)[1],T.row(i)[2],T.row(i)[3]); | ||
|
||
for(size_t i = 0;i < res->quads.size();++i){ | ||
auto tet = res->quads[i]; | ||
res->tris.emplace_back(tet[0],tet[1],tet[2]); | ||
res->tris.emplace_back(tet[1],tet[3],tet[2]); | ||
res->tris.emplace_back(tet[0],tet[2],tet[3]); | ||
res->tris.emplace_back(tet[0],tet[3],tet[1]); | ||
} | ||
|
||
set_output("res",std::move(res)); | ||
} | ||
}; | ||
|
||
ZENDEFNODE(ReadMesh, { | ||
{{"readpath","mesh"}}, | ||
{"res"}, | ||
{}, | ||
{"Skinning"}, | ||
}); | ||
|
||
}; |
Oops, something went wrong.