Message 1 of 4
Understanding Mesh Control Points
Not applicable
01-05-2018
11:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to write some code to export a scene. I'm looking at ExportScene03 in the samples. I'm trying to understand why control points are repeated in the control point array. From the example:
lControlPoints[0] = lControlPoint0; lControlPoints[1] = lControlPoint1; lControlPoints[2] = lControlPoint2; lControlPoints[3] = lControlPoint3; lControlPoints[4] = lControlPoint1; lControlPoints[5] = lControlPoint5; lControlPoints[6] = lControlPoint6; lControlPoints[7] = lControlPoint2; lControlPoints[8] = lControlPoint5; lControlPoints[9] = lControlPoint4; lControlPoints[10] = lControlPoint7; lControlPoints[11] = lControlPoint6; lControlPoints[12] = lControlPoint4; lControlPoints[13] = lControlPoint0; lControlPoints[14] = lControlPoint3; lControlPoints[15] = lControlPoint7; lControlPoints[16] = lControlPoint3; lControlPoints[17] = lControlPoint2; lControlPoints[18] = lControlPoint6; lControlPoints[19] = lControlPoint7; lControlPoints[20] = lControlPoint1; lControlPoints[21] = lControlPoint0; lControlPoints[22] = lControlPoint4; lControlPoints[23] = lControlPoint5;
Later in the example, every four points are added as a polygon:
// Array of polygon vertices.
int lPolygonVertices[] = { 0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15,
16, 17, 18, 19,
20, 21, 22, 23 };
...
// Create polygons. Assign texture and texture UV indices.
for(i = 0; i < 6; i++)
{
//we won't use the default way of assigning textures, as we have
//textures on more than just the default (diffuse) channel.
lMesh->BeginPolygon(-1, -1, false);
for(j = 0; j < 4; j++)
{
//this function points
lMesh->AddPolygon(lPolygonVertices[i*4 + j]); // Control point index.
...
}
lMesh->EndPolygon ();
}
Since we're making a cube, in reality there are only 8 vertices. Could this example have been modified to only load the 8 vertices as control points and selectively address them when forming the polygons? Do polygon vertices need to reference consecutive control points?
Thanks,