本文整理汇总了C++中SkyBox::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyBox::setPosition方法的具体用法?C++ SkyBox::setPosition怎么用?C++ SkyBox::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkyBox
的用法示例。
在下文中一共展示了SkyBox::setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MaterialSkyBox
Scene *SceneBuilder::build() {
PRINT_GL_ERROR();
Camera *camera = new Camera();
PRINT_GL_ERROR();
// camera->setMouse(QCursor::pos().x(), QCursor::pos().y());
camera->setMouse(0, 0);
camera->reset();
PRINT_GL_ERROR();
SkyBox *skyBox = new SkyBox(
new MaterialSkyBox(new TextureCube("data/resources/cubemaps/miramar/")));
PRINT_GL_ERROR();
skyBox->setPosition(camera->getPosition());
PRINT_GL_ERROR();
// SUN
Texture::resetUnit();
PRINT_GL_ERROR();
Texture *sunDiffuse = Texture::newFromNextUnit();
PRINT_GL_ERROR();
Texture *sunAlpha = Texture::newFromNextUnit();
PRINT_GL_ERROR();
sunDiffuse->load("data/resources/maps/sun/sun_1k.png");
PRINT_GL_ERROR();
sunDiffuse->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
PRINT_GL_ERROR();
sunDiffuse->init();
PRINT_GL_ERROR();
sunAlpha->load("data/resources/maps/sun/sun_1k_alpha.png");
PRINT_GL_ERROR();
sunAlpha->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
PRINT_GL_ERROR();
sunAlpha->init();
PRINT_GL_ERROR();
MaterialSun *sunMat = new MaterialSun(sunDiffuse, sunAlpha);
PRINT_GL_ERROR();
Sun *sun = new Sun(sunMat);
PRINT_GL_ERROR();
// GROUND
Texture::resetUnit();
// diffuses
Texture *groundMoss = Texture::newFromNextUnit();
Texture *groundEarth = Texture::newFromNextUnit();
Texture *groundShatter = Texture::newFromNextUnit();
groundMoss->load("data/resources/maps/ground/moss.png");
groundMoss->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
groundMoss->init();
groundEarth->load("data/resources/maps/ground/earth.png");
groundEarth->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
groundEarth->init();
groundShatter->load("data/resources/maps/ground/shatter.png");
groundShatter->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
groundShatter->init();
PRINT_GL_ERROR();
// normals
Texture *groundNormalMoss = Texture::newFromNextUnit();
Texture *groundNormalEarth = Texture::newFromNextUnit();
Texture *groundNormalShatter = Texture::newFromNextUnit();
groundNormalMoss->load("data/resources/maps/ground/moss_normal.png");
groundNormalMoss->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
groundNormalMoss->init();
groundNormalEarth->load("data/resources/maps/ground/earth_normal.png");
groundNormalEarth->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
groundNormalEarth->init();
groundNormalShatter->load("data/resources/maps/ground/shatter_normal.png");
groundNormalShatter->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
groundNormalShatter->init();
PRINT_GL_ERROR();
// init
MaterialGround *groundMat = new MaterialGround(
groundMoss, groundEarth, groundShatter, groundNormalMoss,
groundNormalEarth, groundNormalShatter);
Ground *ground =
new Ground("data/resources/heightmaps/heightmap.png", groundMat);
PRINT_GL_ERROR();
// ROCK 1
Texture::resetUnit();
PRINT_GL_ERROR();
Texture *rock1Diffuse = Texture::newFromNextUnit();
Texture *rock1Alpha = Texture::newFromNextUnit();
Mesh *rock1 = ObjLoader::loadObj("data/resources/meshes/rock1/rock1.obj");
rock1Diffuse->load("data/resources/maps/rock1/rock1_1k.png");
rock1Diffuse->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
rock1Diffuse->init();
rock1Alpha->load("data/resources/maps/noalpha.png");
rock1Alpha->setFilters(GL_NEAREST, GL_NEAREST);
rock1Alpha->init();
((MaterialBasic *)(rock1->getMaterial()))->setDiffuse(rock1Diffuse);
((MaterialBasic *)(rock1->getMaterial()))->setAlpha(rock1Alpha);
rock1->setPosition(Vector3(-3, 0.5, 0));
rock1->setScale(Vector3(0.6, 0.6, 0.6));
rock1->setScale(Vector3(0.0, 0.0, 0.0));
rock1->setScaleRdn(0.2);
rock1->setHeightRdn(0.5);
rock1->setPourcentage(0.2);
rock1->setInstanceType(Mesh::INSTANCE_ROCK);
rock1->setRangeScale(0.4);
createInstances(rock1, ground, NB_INSTANCE * rock1->getPourcentage());
//.........这里部分代码省略.........