本文整理汇总了C++中SkyBox::init_data方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyBox::init_data方法的具体用法?C++ SkyBox::init_data怎么用?C++ SkyBox::init_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkyBox
的用法示例。
在下文中一共展示了SkyBox::init_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void init()
{
init_gl();
srand(time(NULL));
gameclock = new Timer();
gameMouse = new Mouse();
//use kent's skybox
skybox.init_data();
skybox.init_VAO();
skybox.init_VBO();
skybox.init_shader();
skybox.init_texture_map();
// load my shader
quadShader = new Shader("glsl/quad_vshader.glsl","glsl/quad_fshader.glsl");
// load textures
brickTexture = new Texture2D("Brick.bmp");
treeTexture = new Texture2D("trees.bmp");
//generat meshes
brickMesh = new TriMesh();
makeBrickMesh(brickMesh);
treeMesh = new TriMesh();
makeTreeMesh(treeMesh);
// creat tree and wall voa's
treeVAO = new VertexArrayObject(treeMesh, treeTexture, quadShader);
wallVAO = new VertexArrayObject(brickMesh, brickTexture, quadShader);
// rotate camera to point into the level
Camera::GetInstance()->transform.rotateY(-90 - 45,ROTATE_GLOBAL);
//10 random trees
for(int i = 0; i < 10; i++)
{
vec4 pos;
pos.w = 1;
float rot = 0;
pos.x = rand()%900;
pos.x /= 100;
pos.z = rand()%900;
pos.z /= 100;
rot = rand()%9000;
rot /= 100;
trees.push_back(Transform());
trees[trees.size() - 1].position = pos;
trees[trees.size() - 1].rotateY(rot, ROTATE_GLOBAL);
}
//z- wall
for(int i = 0; i < 10; i++)
{
walls.push_back(Transform());
walls[walls.size() - 1].position.z = -0.5;
walls[walls.size() - 1].position.x = i;
}
//z+ wall
for(int i = 0; i < 10; i++)
{
walls.push_back(Transform());
walls[walls.size() - 1].position.z = 9.5;
walls[walls.size() - 1].position.x = i;
}
//x- wall
for(int i = 0; i < 10; i++)
{
walls.push_back(Transform());
walls[walls.size() - 1].position.x = -0.5;
walls[walls.size() - 1].position.z = i;
walls[walls.size() - 1].rotateY(90,ROTATE_GLOBAL);
}
//x+ wall
for(int i = 0; i < 10; i++)
{
walls.push_back(Transform());
walls[walls.size() - 1].position.x = 9.5;
walls[walls.size() - 1].position.z = i;
walls[walls.size() - 1].rotateY(90,ROTATE_GLOBAL);
}
//y- floor
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < 10; j++)
{
walls.push_back(Transform());
walls[walls.size() - 1].position.y = -0.5;
//.........这里部分代码省略.........