slowly getting tracktion again
This commit is contained in:
parent
a5dea1ede1
commit
dd23fa811a
29 changed files with 685 additions and 380 deletions
45
src/scene/tests/pwscene_test_traverser.cpp
Normal file
45
src/scene/tests/pwscene_test_traverser.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <pw/core/vector.hpp>
|
||||
#include <pw/core/serialize.hpp>
|
||||
#include <pw/scene/node.hpp>
|
||||
#include <pw/scene/transform.hpp>
|
||||
#include <pw/scene/nodepath.hpp>
|
||||
//#include <pw/scene/traverser.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
struct test_visitor : pw::node::visitor {
|
||||
virtual void enter(pw::node *n) override;
|
||||
virtual void leave(pw::node *n) override;
|
||||
};
|
||||
|
||||
void test_visitor::enter(pw::node *n)
|
||||
{
|
||||
std::cout << n->name() << " " << n->is_leaf() << std::endl;
|
||||
}
|
||||
|
||||
void test_visitor::leave(pw::node *n)
|
||||
{
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
using namespace pw;
|
||||
|
||||
node::ref root(std::make_shared<node>("root"));
|
||||
root->add_child(std::make_shared<node>("sub-1"));
|
||||
|
||||
node::ref sub_2_1 = std::make_shared<node>("sub-2-1");
|
||||
|
||||
root->add_child(std::make_shared<node>("sub-2"))->add_child(std::make_shared<node>("sub-2-1"));
|
||||
root->add_child(std::make_shared<node>("sub-3"))->add_child(sub_2_1);
|
||||
|
||||
std::cout << "sub-2-1 parent count: " << sub_2_1->parents().size() << std::endl;
|
||||
|
||||
test_visitor tv;
|
||||
|
||||
root->visit(tv);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue