Game Development Reference
In-Depth Information
if (plyindex>obj->numpolygons){
tmp.Format("Face index %i(%i)
out of range when reading normals list.",
return FALSE;
//Set the face normal
obj->plys[plyindex].normal[0] = atof(tokens[2].name);
obj->plys[plyindex].normal[1] = atof(tokens[4].name);
obj->plys[plyindex].normal[2] =-atof(tokens[3].name);
//Now read the three vertex normals
for (j=0;j<3;j++){
if (!FindToken(file,line,"MESH_VERTEXNORMAL",-1,
end)) return FALSE;
if (ParseTokens(line,tokens,5)<5) return FALSE;
index = obj->plys[plyindex].p[atoi(tokens[1].name)];
if (index>obj->numpoints) return FALSE;
obj->pts[index].nx = atof(tokens[2].name);
obj->pts[index].ny = atof(tokens[4].name);
obj->pts[index].nz =-atof(tokens[3].name);
return TRUE;
All the animation in Toon3D uses TCB curves. ASE files include Bezier
curves. This simple animation reader makes no attempt to convert Bezier
curves to TCB, it simply takes the raw data. Curve smoothing is ignored.
Since Bezier curves are not interpolating, that is they do not usually go
through the control points, the results will be in error. I leave it for you to
create a good Bezier to TCB converter. It would probably be better to add
a flag to the interpolator in the engine to say whether the data are in TCB
or Bezier format and then interpolate using a different mechanism rather
than attempt to convert the curves. A full read would then need to handle
the incoming and outgoing tangents in the Bezier handler and the scale
axis and scale angle components in a scale key value.
Search Nedrilad ::

Custom Search