Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualDracoLacertae

Posted 31 January 2013 - 03:30 PM

I took a look at your source.  What does 'Object.cpp/hpp' represent?  Since you're storing the vertices inside the quadtree itself, I think you can drop Object completely.  There will be a point where you will want to place things on your quadtree grid (characters, portals into buildings or caves), but you should have your own 'entity' class defined somewhere else.

 

I notice when you create the child nodes, you are using a fixed offset like center.z+34.  Is it really fixed, shouldn't the next level down use half the offset and so forth?

 

I also notice you set the center values for the 4 children as only being (center.x, center.z)  +   (0,0), (34,0), (34,34) and (0,34).  Shouldn't some of them be '-'.   None of the children should be 0,0: The center of the child will not be the center of the current node.  Look at this:

 

-------------  

|  ,  |  ,  |

|     |     |

|- - -* - - |    

|  ,  |  ,  |

|     |     |

-------------  

 

The * is the center of the current node, and the comma's are the center of the children nodes.

 

What you did was this:

 

 

------,-----,

|     |     |

|     |     |

|- - -*,- - ,  

|     |     |

|     |     |

-------------

 

 

I hope this helps!


#1DracoLacertae

Posted 31 January 2013 - 03:26 PM

I took a look at your source.  What does 'Object.cpp/hpp' represent?  Since you're storing the vertices inside the quadtree itself, I think you can drop Object completely.  There will be a point where you will want to place things on your quadtree grid (characters, portals into buildings or caves), but you should have your own 'entity' class defined somewhere else.

 

I notice when you create the child nodes, you are using a fixed offset like center.z+34.  Is it really fixed, shouldn't the next level down use half the offset and so forth?

 

I also notice you set the center values for the 4 children as only being (center.x, center.z)  +   (0,0), (34,0), (34,34) and (0,34).  Shouldn't some of them be '-'.   None of the children should be 0,0: The center of the child will not be the center of the current node.  Look at this:

 

-------------

|  ,  |  ,  |

|     |     |

|- - -* - - |

|  ,  |  ,  |

|     |     |

-------------

 

The * is the center of the current node, and the comma's are the center of the children nodes.

 

I hope this helps!


PARTNERS