Skip to content

Commit

Permalink
[geom] Rework geometry ports a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Nov 16, 2022
1 parent 8fee847 commit 675ecf3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
22 changes: 11 additions & 11 deletions src/ossia/dataflow/data_copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ struct move_data
void operator()(geometry_port& out, geometry_port& in)
{
// OPTIMIZEME
if(out.flags & geometry_port::dirty_meshes)
in.meshes = std::move(out.meshes);
if(out.flags & geometry_port::dirty_transform)
in.transform = out.transform;
// if(out.flags & geometry_port::dirty_meshes)
in.meshes = out.meshes; //std::move(out.meshes);
// if(out.flags & geometry_port::dirty_transform)
in.transform = out.transform;
in.flags = out.flags;
out.flags = {};
}
Expand Down Expand Up @@ -157,14 +157,14 @@ struct copy_data
void operator()(const geometry_port& out, geometry_port& in)
{
// Called in init_node_visitor::copy, when copying from a node to another
if(out.flags & geometry_port::dirty_meshes)
in.meshes = out.meshes;
if(out.flags & geometry_port::dirty_transform)
in.transform = out.transform;
//if(out.flags & geometry_port::dirty_meshes)
in.meshes = out.meshes;
//if(out.flags & geometry_port::dirty_transform)
in.transform = out.transform;
in.flags = out.flags;
}

void operator()(const mesh_list& out, geometry_port& in)
void operator()(const mesh_list_ptr& out, geometry_port& in)
{
// Called in copy_data_pos below
in.meshes = out;
Expand All @@ -173,8 +173,8 @@ struct copy_data
void operator()(const geometry_port& out, geometry_delay_line& in)
{
// Called in env_writer, when copying from a node to a delay line
if(out.flags & geometry_port::dirty_meshes)
in.meshes.push_back(out.meshes);
// if(out.flags & geometry_port::dirty_meshes)
in.meshes.push_back(out.meshes);
}
};

Expand Down
12 changes: 5 additions & 7 deletions src/ossia/dataflow/geometry_port.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,13 @@ struct geometry
struct mesh_list
{
std::vector<geometry> meshes;
int64_t dirty_index{};
};

using mesh_list_ptr = std::shared_ptr<mesh_list>;
struct transform3d
{
float matrix[16]{
1., 0., 0., 0.,
0., 1., 0., 0.,
0., 0., 1., 0.,
0., 0., 0., 1.,
1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1.,
};
};

Expand All @@ -118,14 +116,14 @@ struct OSSIA_EXPORT geometry_port

void clear();

mesh_list meshes;
mesh_list_ptr meshes;
transform3d transform;
uint8_t flags{};
};

struct geometry_delay_line
{
std::vector<mesh_list> meshes;
std::vector<mesh_list_ptr> meshes;
};

}

0 comments on commit 675ecf3

Please sign in to comment.