michael.zhang Posted October 25, 2010 Share Posted October 25, 2010 Hi, Is dynamic allocation of vectors / maps possible? What is the syntax for this? Michael Link to comment
Guest extaliones Posted October 28, 2010 Share Posted October 28, 2010 You can use Unigine::Vector and Unigine::Map class. You have to include #include <core/scripts/array.h> file. int grid_num = 3; Unigine::Vector grid_nodes[0]; /* */ void init() { forloop(int i = 0; grid_num) { grid_nodes.append(new Unigine::Vector(grid_num)); grid_nodes_temp.append(new Unigine::Vector(grid_num)); } } /* */ void shutdown() { forloop(int i = 0; grid_num) { forloop(int j = 0; grid_num) { delete grid_nodes[i].get(j); } } } Link to comment
michael.zhang Posted October 28, 2010 Author Share Posted October 28, 2010 Right, I know that the Vector and Map classes exists, and behave like classes. However, if existing code uses basic vectors and maps, and I'd like to construct a vector externally and assign it, I would need dynamic allocation. I guess this is not possible. Any chance of this being added? Dynamic allocation... is pretty useful? Alright, well thanks for the response! :) Link to comment
Recommended Posts