Game Development Reference
In-Depth Information
pt++;
}
obj=obj->m_next;
}
}
void CToon3DDoc::UpdateChildObjects(CToon3DObject *parent,
double time)
{
if (!m_selScene) return;
CToon3DObject *obj=m_selScene->objList.m_next;
while(obj){
if (obj->m_parent==parent){
obj->SetTime(time);
obj->Transform();
UpdateChildObjects(obj, time);
}
obj=obj->m_next;
}
}
A CToon3DObject has an integer value called m_type that sets the type
of the object. It can be:
OBJECT_TYPE_NULL
An object with a single vertex used as
a type of simple control
OBJECT_TYPE_NORMAL
A standard object
OBJECT_TYPE_CONTROL
A control object for a bendy object
OBJECT_TYPE_MORPH
A morph object used to deform a mesh
OBJECT_TYPE_TARGET
A target object deformed by control
objects
Notice in the code how the world vertex and normal positions for each
vertex in an object that is being deformed by controls are zeroed at the
beginning of the transformations and divided through by weights at the
end. This ensures the correct display with the minimum of redundancy.
Notice also that the code includes a call to the member function of
'CToon3DObject', 'SetTime'. This is where the animation data for an
object are used to set the position, orientation and scale at a certain time
in a scene or action. In the next chapter on keyframe animation, we will
look at this function call in detail.
Search Nedrilad ::




Custom Search