Jump to content
  • Advertisement

Archived

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

Rudan

Quake 3 BSP

This topic is 6154 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

This question is mostly for someone who has written a Q3 bsp viewer since it probably requires some knowledge of the file format, but anyone who thinks they can help is of course welcome to answer... I thought this code should print the bounding box of the leaf that point[3] is in, but it doesn''t seem to work.
int currentNode = 0;

	while(TRUE)
	{	
		float point[3] = {0,0,0};

		float plane[4];

		plane[0] = lanes[nodes[currentNode].plane].normal[0];
		plane[1] = lanes[nodes[currentNode].plane].normal[1];
		plane[2] = lanes[nodes[currentNode].plane].normal[2];
		plane[3] = planes[nodes[currentNode].plane].dist;

		if(point[0] * plane[0] + point[1] * plane[1] + point[2] * plane[2] >= plane[3])
			currentNode = nodes[currentNode].children[0];
		else
			currentNode = nodes[currentNode].children[1];

		if(currentNode < 0)
		{
			FILE *debug = fopen("debug.txt", "w");
			fprintf(debug, "%d %d %d\n", leaves[-currentNode].mins[0], leaves[-currentNode].mins[1], leaves[-currentNode].mins[2]);
			fprintf(debug, "%d %d %d", leaves[-currentNode].maxs[0], leaves[-currentNode].maxs[1], leaves[-currentNode].maxs[2]);
			fclose(debug);
			
			break;
		}
 
I''d really appriciate if anyone took the time to read through this code, and see if they find anything strange... (This may be completely out of line, since this is the first time I''m working with bsp''s). Thanks

Share this post


Link to post
Share on other sites
Advertisement
Don''t mind this, I solved it. It should be -(currentNode+1) instead of only -currentNode. And that took several hours figuring out...

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!