Unified identifyer mechanism (tested and confirmed to produce unique

integer < MAX_INT)
This commit is contained in:
brunoherbelin
2020-08-20 20:51:42 +02:00
parent d7f6461415
commit 13867e2192
5 changed files with 20 additions and 22 deletions

View File

@@ -19,15 +19,12 @@
#include <ctime>
#include <algorithm>
int Node::node_counter = 0;
// Node
Node::Node() : initialized_(false), visible_(true), refcount_(0)
{
// create unique id
id_ = ++node_counter;
// auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
// id_ = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count() % 100000000;
auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
id_ = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count() % 1000000000;
transform_ = glm::identity<glm::mat4>();
scale_ = glm::vec3(1.f);