Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


7zSuperiorCompressionServ

Member Since 19 Oct 2012
Offline Last Active Feb 22 2015 01:14 AM

Posts I've Made

In Topic: [Quake 3 BSP Rendering] Questions on Bezier Patches

22 December 2014 - 05:03 PM

Nevermind, I just figured it out. In case anyone else is stumped in the future, here's the solution:
 
// The amount of increments we need to make for each dimension, so we have the (potentially) shared points between patches
int stepWidth = ( face->size[ 0 ] - 1 ) / 2;
int stepHeight = ( face->size[ 1 ] - 1 ) / 2;

int c = 0;
for ( int i = 0; i < face->size[ 0 ]; i += stepWidth )
	for ( int j = 0; j < face->size[ 1 ]; j += stepHeight )
		patchRenderer.controlPoints[ c++ ] = &map->vertexes[ face->vertexOffset + j * face->size[ 0 ] + i ];	
				
patchRenderer.Tesselate( subdivLevel );
patchRenderer.Render();
stepWidth and stepHeight specify how much their respective iterators need to be incremented by in order to find the correct control point for each patch. If there are multiple patches for a face, these iterations will land on the correct control points which are shared between patches.

In Topic: What to know in order to write a mesh parser?

19 October 2012 - 03:31 PM

What sorts of meshes are you trying to parse? Terrain/large static structures should be handled differently from character models and small props. You probably need octree for the first but not for the others.
Start simple - write loader that generates single object/buffer. Once this works you may try octrees.


I haven't even gotten to that point yet. I guess I've been thinking character models as well as terrain and large static structures. I'll probably continue just working through these tutorials until I've at least grasped the basics, and then work towards mesh parsing from there.

Just so I understand this correctly:

The file format will contain the vertex/geometry/fragment data, as well as, probably, which primitives (likely triangles, I'd imagine) to use as a basis for rendering the mesh. Once I have the mesh data structure taken care of in my C++ code, I could simply parse the file, store the vertex data in c-style structures or something like glm::vec4, and then pass those to my renderer in a loop - correct?

If that's the case, I assume that this wouldn't really take much math at all apart from a good understanding of the matrices, etc involved (unless, of course, I was using physics to do this, which will likely be a while from now).

I appreciate the advice.

PARTNERS