Simplified Node id

This commit is contained in:
brunoherbelin
2020-08-12 22:09:38 +02:00
parent 675856d57c
commit 3d77642d3b
2 changed files with 6 additions and 2 deletions

View File

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

View File

@@ -41,6 +41,7 @@ class Group;
*/ */
class Node { class Node {
static int node_counter;
int id_; int id_;
bool initialized_; bool initialized_;