本文整理汇总了C++中CModel::BoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ CModel::BoundingBox方法的具体用法?C++ CModel::BoundingBox怎么用?C++ CModel::BoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CModel
的用法示例。
在下文中一共展示了CModel::BoundingBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, const char *argv[] )
{
// reads model into global glb_model;
ON::Begin();
ON_TextLog error_log;
ON_BOOL32 bOK;
int window_width = 500;
int window_height = 500;
//double port_aspect = ((double)window_width)/((double)window_height);
// read the file into model
if ( argc != 2 ) {
printf("Syntax: %s filename.3dm\n",argv[0] );
return 0;
}
const char* sFileName = argv[1];
printf("\nFile: %s\n", sFileName );
// read the file
CModel model;
if ( !model.Read( sFileName, &error_log ) )
{
// read failed
error_log.Print("Unable to read file %s\n",sFileName);
return 1;
}
glb_model = &model;
// set bbox = world bounding box of all the objects
model.m_bbox = model.BoundingBox();
if ( !model.m_bbox.IsValid() )
{
// nothing to look at in this model
return 2;
}
// set model.m_view
if ( model.m_settings.m_views.Count() > 0 )
{
// use first viewport projection in file
double angle;
model.m_view.m_vp = model.m_settings.m_views[0].m_vp;
model.m_view.m_target = model.m_settings.m_views[0].m_target;
model.m_view.m_vp.GetCameraAngle( &angle );
model.m_view.m_vp.Extents( angle, model.m_bbox );
}
else
{
GetDefaultView( model.m_bbox, model.m_view );
}
// If needed, enlarge frustum so its aspect matches the window's aspect.
// Since the Rhino file does not store the far frustum distance in the
// file, viewports read from a Rhil file need to have the frustum's far
// value set by inspecting the bounding box of the geometry to be
// displayed.
///////////////////////////////////////////////////////////////////
//
// GL stuff starts here
//
for(;;) {
#if defined(ON_EXAMPLE_GL_USE_GLAUX)
wchar_t sWindowTitleString[256];
#endif
#if defined(ON_EXAMPLE_GL_USE_GLUT)
char sWindowTitleString[256];
#endif
sWindowTitleString[255] = 0;
if ( argv[0] && argv[0][0] )
{
int i;
for ( i = 0; i < 254 && argv[0][i]; i++ )
sWindowTitleString[i] = argv[0][i];
sWindowTitleString[i] = 0;
}
#if defined(ON_EXAMPLE_GL_USE_GLAUX)
auxInitPosition( 0, 0, window_width, window_height );
auxInitDisplayMode( AUX_SINGLE | AUX_RGB | AUX_DEPTH );
auxInitWindow( sWindowTitleString );
// register event handler functions
auxIdleFunc( 0 );
auxReshapeFunc( myGLAUX_Reshape );
auxMouseFunc( AUX_LEFTBUTTON, AUX_MOUSEDOWN, myGLAUX_MouseLeftEvent );
auxMouseFunc( AUX_LEFTBUTTON, AUX_MOUSEUP, myGLAUX_MouseLeftEvent );
auxMouseFunc( AUX_MIDDLEBUTTON, AUX_MOUSEDOWN, myGLAUX_MouseMiddleEvent );
auxMouseFunc( AUX_MIDDLEBUTTON, AUX_MOUSEUP, myGLAUX_MouseMiddleEvent );
auxMouseFunc( AUX_RIGHTBUTTON, AUX_MOUSEDOWN, myGLAUX_MouseRightEvent );
auxMouseFunc( AUX_RIGHTBUTTON, AUX_MOUSEUP, myGLAUX_MouseRightEvent );
auxKeyFunc( AUX_LEFT, myKeyLeftArrowEvent );
auxKeyFunc( AUX_RIGHT, myKeyRightArrowEvent );
auxKeyFunc( AUX_UP, myKeyUpArrowEvent );
auxKeyFunc( AUX_DOWN, myKeyDownArrowEvent );
//.........这里部分代码省略.........