本文整理汇总了C++中MeshDocument::bbox方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshDocument::bbox方法的具体用法?C++ MeshDocument::bbox怎么用?C++ MeshDocument::bbox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshDocument
的用法示例。
在下文中一共展示了MeshDocument::bbox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decorateDoc
void DecorateBackgroundPlugin::decorateDoc(QAction *a, MeshDocument &m, RichParameterSet * parset,GLArea *gla, QPainter *, GLLogStream &)
{
static QString lastname("unitialized");
switch(ID(a))
{
case DP_SHOW_CUBEMAPPED_ENV :
{
if(!cm.IsValid() || (lastname != cubemapFileName ) )
{
qDebug( "Current CubeMapPath Dir: %s ",qPrintable(cubemapFileName));
glewInit();
bool ret = cm.Load(qPrintable(cubemapFileName));
lastname=cubemapFileName;
if(! ret ) return;
//QMessageBox::warning(gla,"Cubemapped background decoration","Warning unable to load cube map images: " + cubemapFileName );
cm.radius=10;
}
if(!cm.IsValid()) return;
Matrix44f tr;
glGetv(GL_MODELVIEW_MATRIX,tr);
// Remove the translation from the current matrix by simply padding the last column of the matrix
tr.SetColumn(3,Point4f(0,0,0,1.0));
//Remove the scaling from the the current matrix by adding an inverse scaling matrix
float scale = 1.0/pow(tr.Determinant(),1.0f/3.0f);
Matrix44f Scale;
Scale.SetDiagonal(scale);
tr=tr*Scale;
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
cm.DrawEnvCube(tr);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
} break;
case DP_SHOW_GRID :
{
emit this->askViewerShot("me");
Box3f bb=m.bbox();
float scaleBB = parset->getFloat(BoxRatioParam());
float majorTick = parset->getFloat(GridMajorParam());
float minorTick = parset->getFloat(GridMinorParam());
bool gridSnap = parset->getBool(GridSnapParam());
bool backFlag = parset->getBool(GridBackParam());
bool shadowFlag = parset->getBool(ShowShadowParam());
Color4b backColor = parset->getColor4b(GridColorBackParam());
Color4b frontColor = parset->getColor4b(GridColorFrontParam());
bb.Offset((bb.max-bb.min)*(scaleBB-1.0));
DrawGriddedCube(*m.mm(),bb,majorTick,minorTick,gridSnap,backFlag,shadowFlag,backColor,frontColor,gla);
} break;
}
}
示例2: renderingFromLightSetup
void ShadowMapping::renderingFromLightSetup(MeshDocument& md, GLArea* gla){
Box3m bb = md.bbox();
Point3m center = bb.Center();
Scalarm diag = bb.Diag();
GLfloat lP[4];
glGetLightfv(GL_LIGHT0, GL_POSITION, lP);
vcg::Point3f light = -vcg::Point3f(lP[0],lP[1],lP[2]);
vcg::Matrix44f tm = gla->trackball.Matrix();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-(diag/2),
diag/2,
-(diag/2),
diag/2,
-(diag/2),
diag/2);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
vcg::Point3f u, v;
//mi seleziona automaticamente un upvector che mi eviti casi degeneri...nel caso vada bene 010 sceglie quello
vcg::GetUV(light, u, v, vcg::Point3f(0,-1,0));
glLoadIdentity();
gluLookAt(0, 0, 0, light[0], light[1], light[2], v[0], v[1], v[2]);
//get the rotation matrix from the trackball
vcg::Matrix44f rotation;
vcg::Similarityf track = gla->trackball.track;
track.rot.ToMatrix(rotation);
glMultMatrixf(rotation.transpose().V());
//traslate the model in the center
glTranslatef(-center[0],-center[1],-center[2]);
}