本文整理汇总了C++中shared_ptr::AddCubeTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::AddCubeTexture方法的具体用法?C++ shared_ptr::AddCubeTexture怎么用?C++ shared_ptr::AddCubeTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::AddCubeTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void TeapotWorld::Init(shared_ptr<Renderer> renderer)
{
renderer->AddShader("full", "full");
renderer->AddShader("skybox", "skybox");
renderer->SetUniform("full|full", 1, 1.f); // specular
renderer->SetUniform("full|full", 2, 128.f); // shininess
shared_ptr<Buffer> cubeVertexBuffer = make_shared<Buffer>();
cubeVertexBuffer->SetData(cubeVerts, 108);
shared_ptr<Object> c = make_shared<Object>();
c->AttachBuffer(0, cubeVertexBuffer);
cube_ = make_shared<RenderObject>();
cube_->object = c;
cube_->program = "skybox|skybox";
cube_->transformation = Matrix::Scale(30, 12, 30);
cube_->colour[0] = cube_->colour[1] = cube_->colour[2] = 1;
cube_->textureBindings.insert(make_pair(0, "environment"));
shared_ptr<Buffer> teapotVertexBuffer = make_shared<Buffer>();
shared_ptr<Buffer> teapotNormalBuffer = make_shared<Buffer>();
teapotVertexBuffer->SetData(teapot_verts, 22176);
teapotNormalBuffer->SetData(teapot_normals, 22176);
shared_ptr<Object> o = make_shared<Object>();
o->AttachBuffer(0, teapotVertexBuffer);
o->AttachBuffer(1, teapotNormalBuffer);
for (unsigned int i = 0; i < 50; ++i)
{
auto teapot = make_shared<RenderObject>();
teapot->object = o;
teapot->program = "full|full";
teapot->colour[0] = RandF(0, 1);
teapot->colour[1] = RandF(0, 1);
teapot->colour[2] = RandF(0, 1);
teapot->textureBindings.insert(make_pair(0, "environment"));
teapots_.push_back(teapot);
rotation_.push_back(Vector(RandF(0, PI), RandF(0, PI), RandF(0, PI)));
position_.push_back(Vector(RandF(-5, 5), RandF(-2, 2), RandF(-5, 5)));
reflectiveness_.push_back(RandF(0, 1));
}
vector<string> environment = { "posx.jpg", "negx.jpg", "posy.jpg", "negy.jpg", "posz.jpg", "negz.jpg" };
renderer->AddCubeTexture("environment", environment);
}