本文整理汇总了C++中ObjectGroup::addTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectGroup::addTransformation方法的具体用法?C++ ObjectGroup::addTransformation怎么用?C++ ObjectGroup::addTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectGroup
的用法示例。
在下文中一共展示了ObjectGroup::addTransformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/**
* Init the scene and OpenGL state
*
*/
void MyScene::init()
{
_objects[CUBE].load("./data/cube.off");
_objects[PYRAMID].load("./data/pyramid.off");
_objects[DISK].load("./data/disk.off");
_objects[DISKHOLE].load("./data/diskhole.off");
_objects[CYLINDER].load("./data/cylinder.off");
_objects[CONE].load("./data/cone.off");
_objects[SPHERE].load("./data/sphere.off");
_objects[AIRCRAFT].load("./data/aircraft.off");
_objects[VENUS].load("./data/venus.off");
_objects[NEFERTITI].load("./data/nefertiti.off");
Mesh* cone = new Mesh();
cone->load("./data/cone.off");
cone->addTransformation(glTranslatef,0.0,0.0,_radius);
cone->addTransformation(glScalef,0.1, 0.1, 0.5);
Mesh* cylinder = new Mesh();
cylinder->load("./data/cylinder.off");
cylinder->addTransformation(glScalef,0.01, 0.01, 1.0);
ObjectGroup* zArrow = new ObjectGroup();
zArrow->add(cone);
zArrow->add(cylinder);
//zArrow->addTransformation(glScalef, _radius/2, _radius/2, _radius/2);
zArrow->addTransformation(glColor3f, 0, 0, 0.5);
ObjectGroup* xArrow = zArrow->clone();
xArrow->addTransformation(glRotatef, 90, 0, 1, 0);
xArrow->addTransformation(glColor3f, 0.5, 0, 0);
ObjectGroup* yArrow = zArrow->clone();
yArrow->addTransformation(glRotatef, -90, 1, 0, 0);
yArrow->addTransformation(glColor3f, 0, 0.5, 0);
Mesh* centerSphere = new Mesh();
centerSphere->load("./data/sphere.off");
centerSphere->addTransformation(glScalef,0.05, 0.05, 0.05);
centerSphere->addTransformation(glColor3f, 0.5, 0.5, 0.5);
_allObjects = new ObjectGroup();
_allObjects->add(centerSphere);
_allObjects->add(xArrow);
_allObjects->add(yArrow);
_allObjects->add(zArrow);
Mesh* sun = new Mesh();
sun->load("./data/sphere.off");
sun->addTransformation(glScalef, 0.3, 0.3, 0.3);
sun->addTransformation(glColor3f, 0.9, 0.2, 0.0);
_allObjects->add(sun);
ObjectGroup* earthAndMoon = new ObjectGroup();
_earthAndMoonRotator = new ParametrizedRotator(0,0,1);
earthAndMoon->addTransformation(_earthAndMoonRotator);
earthAndMoon->addTransformation(glTranslatef, 2, 0.0, 0.0);
Mesh* earth = new Mesh();
earth->load("./data/sphere.off");
earth->addTransformation(glScalef, 0.1, 0.1, 0.1);
earth->addTransformation(glColor3f, 0.0, 0.2, 0.9);
earthAndMoon->add(earth);
Mesh* moon = new Mesh();
moon->load("./data/sphere.off");
_moonRotator = new ParametrizedRotator(0,0,1);
moon->addTransformation(_moonRotator);
moon->addTransformation(glTranslatef, 0.5, 0.0, 0.0);
moon->addTransformation(glScalef, 0.04, 0.04, 0.04);
moon->addTransformation(glColor3f, 0.3, 0.3, 0.3);
earthAndMoon->add(moon);
_allObjects->add(earthAndMoon);
setDayOfYear(0);
// set antialiased lines
//glEnable(GL_LINE_SMOOTH); // FIXME current MESA driver messes up with antialiasing ...
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glLineWidth(1.5);
}