QuadTree should segfault less frequently.
authorDavid Gow <[email protected]>
Wed, 6 Aug 2014 03:56:03 +0000 (11:56 +0800)
committerDavid Gow <[email protected]>
Wed, 6 Aug 2014 03:56:03 +0000 (11:56 +0800)
Still gives incorrect results w/ GPU transform.

src/document.cpp

index 8fc4c9a..7c49074 100644 (file)
@@ -90,9 +90,9 @@ void Document::Save(const string & filename)
 
 void Document::GenBaseQuadtree()
 {
-       m_quadtree.nodes.push_back(QuadTreeNode{QUADTREE_EMPTY, 1, QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QTC_UNKNOWN, 0, 1});
-       m_quadtree.nodes.push_back(QuadTreeNode{QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QTC_UNKNOWN, 1, ObjectCount()});
+       m_quadtree.nodes.push_back(QuadTreeNode{QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QTC_UNKNOWN, 0, ObjectCount()});
        m_quadtree.root_id = 0;
+       GenQuadNode(0, QTC_TOP_LEFT);
 }
 
 QuadTreeIndex Document::GenQuadNode(QuadTreeIndex parent, QuadTreeNodeChildren type)
@@ -108,6 +108,7 @@ QuadTreeIndex Document::GenQuadNode(QuadTreeIndex parent, QuadTreeNodeChildren t
                        m_objects.bounds.push_back(TransformToQuadChild(m_objects.bounds[i], type));
                        m_objects.types.push_back(m_objects.types[i]);
                        m_objects.data_indices.push_back(m_objects.data_indices[i]);
+                       m_count++;
                }
        }
        m_quadtree.nodes[new_index].object_end = m_objects.bounds.size();

UCC git Repository :: git.ucc.asn.au