Hey
void create_tree (Entity_data& entity_data, int id /* position */ )
{
std::vector<float> vertices =
{
-0.8f, -0.8f, 0.0f, 1.0f, 0.0f, 0.0f, // Vertex 1 (position and color)
0.0f, 0.8f, 0.0f, 0.0f, 1.0f, 0.0f, // Vertex 2 (position and color)
0.8f, -0.8f, 0.0f, 0.0f, 0.0f, 1.0f // Vertex 3 (position and color)
};
entity_data.entity_vec.push_back ( id );
RenderObject obj = RenderObject ( vertices );
entity_data.render_map.emplace ( id, obj );
}
int main ( )
{
Entity_data entity_data;
Engine engine = Engine ( entity_data ) ;
create_tree ( engine.get_entity_data() , 1 /* id */ );
engine.run ( );
}
Engine::Engine ( Entity_data& entity_data ) : entity_data(entity_data)
{
for ( auto& a : this->entity_data.render_map[1].get_vertices() )
{
std::cout << a << std::endl;
}
}
So from the above, when i use the create tree function, i expect in the constructor (and any call after calling the engine constructor) to print the data i emplace in the map.
but for some reason its null and idk why??
any more info i can give lmk.
just trying to figure out what the loop in constructor ( ii have also made loops after the c onstructor example in main after the create_tree with a get_entity_data from the engine function and nothing still.
thanks.