• Create Account

# Developing a advanced 3D game engine

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

### #1granberg  Members   -  Reputation: 56

Like
-2Likes
Like

Posted 23 May 2011 - 11:26 AM

if you read the book programming role playing games,you must remember the function as below:
if(Size > m_MaxSize && Num > m_MaxPolygons) {
if(Size > m_MaxSize && Num > m_MaxPolygons) {
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[i] = new sNode(); // Create new child node

// Sort the polygons with the new child node
SortNode(Node->Nodes[i],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[i] = new sNode(); // Create new child node

// Sort the polygons with the new child node
SortNode(Node->Nodes[i],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) {
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?

### #2 landlocked   Members   -  Reputation: 103

Like
1Likes
Like

Posted 23 May 2011 - 12:08 PM

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.
Always strive to be better than yourself.

### #3ryan20fun  Members   -  Reputation: 2363

Like
0Likes
Like

Posted 23 May 2011 - 12:10 PM

can you use the code tags please
it makes it easyer to read your post

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

### #4granberg  Members   -  Reputation: 56

Like
-9Likes
Like

Posted 23 May 2011 - 12:22 PM

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!

### #5 landlocked   Members   -  Reputation: 103

Like
2Likes
Like

Posted 23 May 2011 - 12:44 PM

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?
Always strive to be better than yourself.

### #6scgames  Members   -  Reputation: 2078

Like
0Likes
Like

Posted 23 May 2011 - 04:24 PM

Looks like this is a cross-post.

@The OP: I provided an answer in your other thread.

### #7DarkRonin  Members   -  Reputation: 1068

Like
0Likes
Like

Posted 24 May 2011 - 12:57 AM

Its a double cross post. He has the same question in two other posts too.
Win32 Developer
One Of Them - Martial arts game that is mid development.

### #8Dwarf King  Crossbones+   -  Reputation: 2124

Like
1Likes
Like

Posted 24 May 2011 - 05:34 AM

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.

"The only thing that interferes with my learning is my education"

Albert Einstein

"It is a miracle that curiosity survives formal education"

Albert Einstein

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS