Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

digitalfreak

who've read chap13 of LaMothe's Tricks 3D book?

This topic is 5482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

take a look at the Bsp_Build_Tree() function on pages 1335~1345,here''s a question: on page 1340,when it trys to build temp_wall,why don''t just memcpy from next_wall?

Share this post


Link to post
Share on other sites
Advertisement
You''ll probably have better luck getting comments if you paste the code of the function that trys to build temp_wall rather than refering to page numbers. Use [source] [/source] tags to enclose the code.

Share this post


Link to post
Share on other sites
temp_wall = (BSPNODEV1_PTR)malloc(sizeof(BSPNODEV1));

// set links
temp_wall->front = NULL;
temp_wall->back = NULL;
temp_wall->link = NULL;

// poly normal is the same
temp_wall->wall.normal = next_wall->wall.normal;
temp_wall->wall.nlength = next_wall->wall.nlength;

// poly color is the same
temp_wall->wall.color = next_wall->wall.color;

// poly material is the same
temp_wall->wall.mati = next_wall->wall.mati;

// poly texture is the same
temp_wall->wall.texture = next_wall->wall.texture;

// poly attributes are the same
temp_wall->wall.attr = next_wall->wall.attr;

// poly states are the same
temp_wall->wall.state = next_wall->wall.state;

temp_wall->id = next_wall->id + WALL_SPLIT_ID;

temp_wall and next_wall are of same type,so what don''t just memcpy next_wall to temp_wall instead of setting all the individual feilds of temp_wall?

Share this post


Link to post
Share on other sites
yeah, it looks like it's the same, except for the links (they are set to NULL) and the wall_id. So it's not the same . And you don't even need a memcpy.

*temp_wall = *next_wall;
temp_wall->id = next_wall->id + WALL_SPLIT_ID;
temp_wall->front = NULL;
temp_wall->back = NULL;
temp_wall->link = NULL;

It is not necessarly faster that way, and it's more prone to bugs.

For a tutorial, it is better to detail stuff like he did, to clear out any confusions.

[edited by - oliii on November 16, 2003 7:30:19 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!