本文整理汇总了C++中Aggregate::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ Aggregate::Close方法的具体用法?C++ Aggregate::Close怎么用?C++ Aggregate::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aggregate
的用法示例。
在下文中一共展示了Aggregate::Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildScene
//.........这里部分代码省略.........
}
else if( scene.object == NULL ) scene.object = obj;
break;
case envmap_plugin:
env = (Envmap*)plg;
// If an environment map is set before any object is created, use it as
// the background.
if( obj == NULL ) scene.envmap = env;
break;
case rasterizer_plugin:
if( scene.rasterize != NULL )
{
cerr << "Error: More than one rasterizer specified. Line "
<< line_num << ": "
<< input_line << endl;
return false;
}
scene.rasterize = (Rasterizer *)plg;
break;
}
continue;
}
// Now look for all the other stuff... materials, camera, lights, etc.
ParamReader get( input_line );
if( get["eye"] && get[camera.eye] ) continue;
if( get["lookat"] && get[camera.lookat] ) continue;
if( get["up"] && get[camera.up] ) continue;
if( get["vpdist"] && get[camera.vpdist] ) continue;
if( get["x_res"] && get[camera.x_res] ) continue;
if( get["y_res"] && get[camera.y_res] ) continue;
if( get["x_win"] && get[camera.x_win] ) continue;
if( get["y_win"] && get[camera.y_win] ) continue;
if( get["ambient"] && get[material.ambient] ) continue;
if( get["diffuse"] && get[material.diffuse] ) continue;
if( get["specular"] && get[material.specular] ) continue;
if( get["emission"] && get[material.emission] ) continue;
if( get["reflectivity"] && get[material.reflectivity] ) continue;
if( get["translucency"] && get[material.translucency] ) continue;
if( get["Phong_exp"] && get[material.Phong_exp] ) continue;
if( get["ref_index"] && get[material.ref_index] ) continue;
// If no object is defined at this point, it's an error.
if( obj == NULL )
{
cerr << "Error reading scene file; No object defined at line "
<< line_num << ": "
<< input_line << endl;
return false;
}
// Look for an end statement that closes the current aggregate. This allows us to nest aggregates.
if( get["end"] )
{
if( agg == NULL )
{
cerr << "Error: end statement found outside an aggregate object at line "
<< line_num << ": "
<< input_line << endl;
return false;
}
// Go back to adding objects to the parent object (if there is one).
agg->Close(); // Signal the aggregate that it is now complete.
Object *closed_agg = agg;
agg = agg->parent;
if( agg != NULL )
{
material = *(agg->material);
mat = agg->material;
shd = agg->shader;
env = agg->envmap;
agg->AddChild( closed_agg ); // Add the agg that just ended.
}
continue;
}
// If nothing matched, it's an error. Print a warning and continue processing.
cerr << "Warning: Unrecognized or ill-formed command at line "
<< line_num << ": "
<< input_line << endl;
}
if( agg != NULL )
{
cerr << "Error: Top-most aggregate object has no 'end' statement." << endl;
return false;
}
cout << "done." << endl;
return true;
}