if you read the book programming role playing games,you must remember the function as below:
if(Size > m_MaxSize && Num > m_MaxPolygons) {
for(i=0;i<(unsigned long)((m_TreeType==QUADTREE)?4:8);i++) {
if(Size > m_MaxSize && Num > m_MaxPolygons) {
for(i=0;i<(unsigned long)((m_TreeType==QUADTREE)?4:8);i++) {
XOff = (((i % 2) < 1) ? -1.0f : 1.0f) * (Size / 4.0f);
ZOff = (((i % 4) < 2) ? -1.0f : 1.0f) * (Size / 4.0f);
YOff = (((i % 8) < 4) ? -1.0f : 1.0f) * (Size / 4.0f);
// See if any polygons in new node bounding box
if(CountPolygons(XPos+XOff,YPos+YOff,ZPos+ZOff,Size/2.0f)) {
Node->Nodes = new sNode(); // Create new child node
// Sort the polygons with the new child node
SortNode(Node->Nodes,XPos+XOff,YPos+YOff,ZPos+ZOff,Size/2.0f);
}
}
// See if any polygons in new node bounding box
if(CountPolygons(XPos+XOff,YPos+YOff,ZPos+ZOff,Size/2.0f)) {
Node->Nodes = new sNode(); // Create new child node
// Sort the polygons with the new child node
SortNode(Node->Nodes,XPos+XOff,YPos+YOff,ZPos+ZOff,Size/2.0f);
}
}
Ok so jog your mind what 's mean with thease code?:
if(Size > m_MaxSize && Num > m_MaxPolygons) {
for(i=0;i<(unsigned long)((m_TreeType==QUADTREE)?4:8);i++) {
XOff = (((i % 2) < 1) ? -1.0f : 1.0f) * (Size / 4.0f);
ZOff = (((i % 4) < 2) ? -1.0f : 1.0f) * (Size / 4.0f);
YOff = (((i % 8) < 4) ? -1.0f : 1.0f) * (Size / 4.0f);
please explain thease code to me special on how to caculate the xOff and ZOff and YOff value,tell me where they come?
Developing a advanced 3D game engine
If you got that from a book it should explain in there. Reread the chapters carefully. It helps me if I take notes as a read to make sure my eyes don't gloss over and I stay alert and focused on what I'm reading.
Your guys don't know the expalin of thease code is so rude for me,I read that section again again,but no words can give me a way to slove it understand it!so don,t delay my time,just to explain it that is all!
Here's the thing... without the code we can't explain. Software is highly context specific. We're not going to go out to buy the book just to answer your question either. Is there a URL provided in the book that you could use to contact the author?
Your guys don't know the expalin of thease code is so rude for me,I read that section again again,but no words can give me a way to slove it understand it!so don,t delay my time,just to explain it that is all!
The way I see it no one in this thread tries to "delay your time". I see nice people trying to help you. Perhaps you should reconsider the way you communicate with the helpful people. After all they are helping you without getting paid for it(and that is a very noble thing to do). Also you should use Landlocked's advice.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement