public List <OctreeNode> findNodes(selectionDel filterfunc, Chunk primaryChunk) { List <OctreeNode> nodes = new List <OctreeNode>(); Octree_FindNodes(root, filterfunc, nodes, primaryChunk); return(nodes); }
private void Octree_FindNodes(OctreeNode node, selectionDel func, List <OctreeNode> nodes, Chunk primaryChunk) { if (node == null) { return; } Vector3 max = node.min + new Vector3(node.size, node.size, node.size); //if (this != primaryChunk) //{ if (!func(node.min, max)) { return; } //} if (node.type == OctreeNodeType.Node_Leaf || node.type == OctreeNodeType.Node_Psuedo) { //* OctreeNode newNode = new OctreeNode(); newNode.children = node.children; newNode.min = node.min; newNode.size = node.size; newNode.type = node.type; newNode.drawInfo = node.drawInfo; //*/ nodes.Add(newNode); } else { for (int i = 0; i < 8; i++) { Octree_FindNodes(node.children[i], func, nodes, primaryChunk); } } }
public List <OctreeNode> FindSeamNodes(Chunk chunk, List <Chunk> seamChunks) { Vector3 baseChunkMin = chunk.min; Vector3 seamValues = baseChunkMin + new Vector3(octreeSize, octreeSize, octreeSize); selectionDel[] selectionFuncs = new selectionDel[8] { delegate(Vector3 min, Vector3 max) { return(max.x == seamValues.x || max.y == seamValues.y || max.z == seamValues.z); //return seamValues.x <= max.x || //seamValues.y <= max.y || //seamValues.z <= max.z; }, delegate(Vector3 min, Vector3 max) { return(min.x == seamValues.x); //return seamValues.x >= min.x; }, delegate(Vector3 min, Vector3 max) { return(min.z == seamValues.z); //return seamValues.z >= min.z; }, delegate(Vector3 min, Vector3 max) { return(min.x == seamValues.x && min.z == seamValues.z); //return seamValues.x >= min.x && //seamValues.z >= min.z; }, delegate(Vector3 min, Vector3 max) { return(min.y == seamValues.y); //return seamValues.y >= min.y; }, delegate(Vector3 min, Vector3 max) { return(min.x == seamValues.x && min.y == seamValues.y); //return seamValues.x <= min.x && //seamValues.y <= min.y; }, delegate(Vector3 min, Vector3 max) { return(min.y == seamValues.y && min.z == seamValues.z); //return seamValues.y <= min.y && //seamValues.z <= min.z; }, delegate(Vector3 min, Vector3 max) { return(min.x == seamValues.x && min.y == seamValues.y && min.z == seamValues.z); //return seamValues.x >= min.x && //seamValues.y >= min.y && //seamValues.z >= min.z; } }; List <OctreeNode> seamNodes = new List <OctreeNode>(); for (int i = 0; i < seamChunks.Count; i++) { Chunk c = seamChunks[i]; if (c != null) { List <OctreeNode> chunkNodes = c.findNodes(selectionFuncs[i], chunk); for (int j = 0; j < chunkNodes.Count; j++) { seamNodes.Add(chunkNodes[j]); } } } return(seamNodes); }
public List<OctreeNode> FindSeamNodes(Chunk chunk, List<Chunk> seamChunks) { Vector3 baseChunkMin = chunk.min; Vector3 seamValues = baseChunkMin + new Vector3(octreeSize, octreeSize, octreeSize); selectionDel[] selectionFuncs = new selectionDel[8] { delegate(Vector3 min, Vector3 max) { return max.x == seamValues.x || max.y == seamValues.y || max.z == seamValues.z; //return seamValues.x <= max.x || //seamValues.y <= max.y || //seamValues.z <= max.z; }, delegate(Vector3 min, Vector3 max) { return min.x == seamValues.x; //return seamValues.x >= min.x; }, delegate(Vector3 min, Vector3 max) { return min.z == seamValues.z; //return seamValues.z >= min.z; }, delegate(Vector3 min, Vector3 max) { return min.x == seamValues.x && min.z == seamValues.z; //return seamValues.x >= min.x && //seamValues.z >= min.z; }, delegate(Vector3 min, Vector3 max) { return min.y == seamValues.y; //return seamValues.y >= min.y; }, delegate(Vector3 min, Vector3 max) { return min.x == seamValues.x && min.y == seamValues.y; //return seamValues.x <= min.x && //seamValues.y <= min.y; }, delegate(Vector3 min, Vector3 max) { return min.y == seamValues.y && min.z == seamValues.z; //return seamValues.y <= min.y && //seamValues.z <= min.z; }, delegate(Vector3 min, Vector3 max) { return min.x == seamValues.x && min.y == seamValues.y && min.z == seamValues.z; //return seamValues.x >= min.x && //seamValues.y >= min.y && //seamValues.z >= min.z; } }; List<OctreeNode> seamNodes = new List<OctreeNode>(); for (int i = 0; i < seamChunks.Count; i++) { Chunk c = seamChunks[i]; if (c != null) { List<OctreeNode> chunkNodes = c.findNodes(selectionFuncs[i], chunk); for (int j = 0; j < chunkNodes.Count; j++) seamNodes.Add(chunkNodes[j]); } } return seamNodes; }
private void Octree_FindNodes(OctreeNode node, selectionDel func, List<OctreeNode> nodes, Chunk primaryChunk) { if (node == null) return; Vector3 max = node.min + new Vector3(node.size, node.size, node.size); //if (this != primaryChunk) //{ if(!func(node.min, max)) return; //} if (node.type == OctreeNodeType.Node_Leaf || node.type == OctreeNodeType.Node_Psuedo) { //* OctreeNode newNode = new OctreeNode(); newNode.children = node.children; newNode.min = node.min; newNode.size = node.size; newNode.type = node.type; newNode.drawInfo = node.drawInfo; //*/ nodes.Add(newNode); } else { for (int i = 0; i < 8; i++) Octree_FindNodes(node.children[i], func, nodes, primaryChunk); } }
public List<OctreeNode> findNodes(selectionDel filterfunc, Chunk primaryChunk) { List<OctreeNode> nodes = new List<OctreeNode>(); Octree_FindNodes(root, filterfunc, nodes, primaryChunk); return nodes; }