本文整理汇总了C++中IDerivedObject::Eval方法的典型用法代码示例。如果您正苦于以下问题:C++ IDerivedObject::Eval方法的具体用法?C++ IDerivedObject::Eval怎么用?C++ IDerivedObject::Eval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDerivedObject
的用法示例。
在下文中一共展示了IDerivedObject::Eval方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessGeoBlocks
void MaxAWDExporter::ProcessGeoBlocks()
{
AWDTriGeom *geoBlock;
AWDBlockIterator *it;
int proccessed=0;
it = new AWDBlockIterator(awd->get_mesh_data_blocks());
UpdateProgressBar(MAXAWD_PHASE_PROCESS_GEOMETRY, (double)proccessed/(double)awd->get_mesh_data_blocks()->get_num_blocks());
INodeTab lNodes;
while ((geoBlock = (AWDTriGeom * ) it->next()) != NULL){
INode * node = (INode *)INodeToGeoBlockCache->Get(geoBlock);
if (node==NULL){
AWDMessageBlock * newWarning = new AWDMessageBlock(geoBlock->get_name(), "ERROR: Could not find the INode for this AWDGeometry.");
awd->get_message_blocks()->append(newWarning);
return;
}
lNodes.AppendNode( node );
}
IGameScene* _pIgame = NULL;
_pIgame = GetIGameInterface();
_pIgame->InitialiseIGame( lNodes );
it->reset();
while ((geoBlock = (AWDTriGeom * ) it->next()) != NULL){
INode * node = (INode *)INodeToGeoBlockCache->Get(geoBlock);
if (node==NULL){
AWDMessageBlock * newWarning = new AWDMessageBlock(geoBlock->get_name(), "ERROR: Could not find the INode for this AWDGeometry.");
awd->get_message_blocks()->append(newWarning);
}
else{
int exportThis=false;
IGameObject * gobj = NULL;
IGameMesh * igame_mesh = NULL;
gobj = GetIGameInterface()->GetIGameNode(node)->GetIGameObject();
if(gobj->GetIGameType()==IGameObject::IGAME_MESH){
igame_mesh = (IGameMesh*)gobj;
if (igame_mesh!=NULL){
igame_mesh->InitializeData();
if(igame_mesh->GetNumberOfFaces()>0){
exportThis=true;
}
}
}
if (exportThis){
Object *obj;
obj = node->GetObjectRef();
int skinIdx;
ObjectState os;
IDerivedObject *derivedObject = NULL;
skinIdx = IndexOfSkinMod(node->GetObjectRef(), &derivedObject);
if (skinIdx >= 0) {
// Flatten all modifiers up to but not including
// the skin modifier.
// to do: get the correct time for the neutral-pose
os = derivedObject->Eval(0, skinIdx + 1);
}
else {
// Flatten entire modifier stack
// to do: get the correct time for the neutral-pose
os = node->EvalWorldState(maxInterface->GetTime());
}
obj = os.obj;
ISkin *skin = NULL;
if (derivedObject != NULL && skinIdx >= 0) {
Modifier *mod = derivedObject->GetModifier(skinIdx);
skin = (ISkin *)mod->GetInterface(I_SKIN);
}
ExportTriGeom(geoBlock,obj,node,skin, igame_mesh);
RETURN_IF_ERROR;
}
}
proccessed++;
UpdateProgressBar(MAXAWD_PHASE_PROCESS_GEOMETRY, (double)proccessed/(double)awd->get_mesh_data_blocks()->get_num_blocks());
}
delete it;
_pIgame->ReleaseIGame();
}
示例2: extractTriangleGeometry
//.........这里部分代码省略.........
vpoly->getNormal( &vpolyn.x, &vpolyn.y, &vpolyn.z );
vn += vpolyn;
}
}
// normalize
float lensqr = vn.lengthSquared();
if ( lensqr > Float::MIN_VALUE )
vn *= 1.f / Math::sqrt(lensqr);
else
vn = Vector3(0,0,0);
vmad->addValue( vert->index(), poly->index(), vn.begin(), 3 );
}
}
// re-export mesh points in non-deformed pose if Skin modifier present
// NOTE: 3ds Mesh must not be used after this, because collapsing can invalidate it
if ( skin )
{
// evaluate derived object before Skin modifier
TimeValue time = 0;
bool evalNext = false;
bool evalDone = false;
::ObjectState os;
::Object* obj = node->GetObjectRef();
while ( obj->SuperClassID() == GEN_DERIVOB_CLASS_ID && !evalDone )
{
IDerivedObject* derivedObj = static_cast<IDerivedObject*>(obj);
for ( int modStack = 0 ; modStack < derivedObj->NumModifiers() ; ++modStack )
{
if ( evalNext )
{
os = derivedObj->Eval( time, modStack );
evalDone = true;
break;
}
Modifier* mod = derivedObj->GetModifier(modStack);
if ( mod->ClassID() == SKIN_CLASSID )
evalNext = true;
}
obj = derivedObj->GetObjRef();
}
// evaluate possible non-derived object
if ( evalNext && !evalDone )
{
os = obj->Eval( time );
evalDone = true;
}
// convert to TriObject and get points
if ( evalDone && os.obj->CanConvertToType( Class_ID(TRIOBJ_CLASS_ID,0) ) )
{
Debug::println( " Evaluating object {0} before Skin modifier", nodeName );
// get TriObject
std::auto_ptr<TriObject> triAutoDel(0);
TriObject* tri = static_cast<TriObject*>( os.obj->ConvertToType( time, Class_ID(TRIOBJ_CLASS_ID,0) ) );
if ( tri != os.obj )
triAutoDel = std::auto_ptr<TriObject>( tri );
// get mesh points before Skin is applied
//Debug::println( " Original collapsed mesh has {0} points, before Skin modifier {1} points", mesh->getNumVerts(), tri->mesh.getNumVerts() );
require( gm->vertices() == tri->mesh.getNumVerts() );