本文整理汇总了C++中Floor::setNormalsMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Floor::setNormalsMap方法的具体用法?C++ Floor::setNormalsMap怎么用?C++ Floor::setNormalsMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor::setNormalsMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/*
This function is called before entering the main rendering loop.
Use it for all your initialisation stuff
*/
void init(GLWrapper *glw)
{
printInstructions();
textureLoad = textureLoader();
/* Set the object transformation controls to their initial values */
x = 0;
y = 0;
z = 0;
angle_x = 0;
angle_y = angle_z = 0;
angle_inc_x = angle_inc_y = angle_inc_z = 0;
scale = 0.33f;
aspect_ratio = 1.3333f;
colourmode = 0;
weather = 0;
px, py, pz = 0;
// Generate index (name) for one vertex array object
glGenVertexArrays(1, &vao);
// Create the vertex array object and make it current
glBindVertexArray(vao);
/* Define the Blending function */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GLfloat vertexColours[] =
{
0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f
};
/* Create the colours buffer for the cube */
glGenBuffers(1, &colourObject);
glBindBuffer(GL_ARRAY_BUFFER, colourObject);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexColours), vertexColours, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
/* Load and create our monkey object*/
birchTree.load_obj("birch_tree.obj");
walls.createRoom(roomLength, roomHeight);
walls.setTexture(textureLoad.loadTexture("images/brickwork_texture.png", program));
walls.setNormalsMap(textureLoad.loadNormals("images/brickwork_normal_map.png", program));
flooring.createFloor(roomLength, roomHeight);
flooring.setTexture(textureLoad.loadTexture("images/masonry_wall_texture.png", program));
flooring.setNormalsMap(textureLoad.loadNormals("images/masonry_wall_normal_map.png", program));
//sky.createSky();
createPlanters();
/* Calculate vertex normals using cross products from the surrounding faces*/
/* A better way to do this would be to generate the vertex normals in Blender and
/* then extract the vertex normals from the face definitions and use that to create an
/* accurate array of veretx normals */
birchTree.smoothNormals();
birchTree.createObject();
tree2 = tree3 = tree4 = tree5 = tree6 = tree6 = tree8 = tree9 = birchTree;
/* Load and build the vertex and fragment shaders */
try
{
particle_program = glw->LoadShader("particle_object.vert", "particle_object.frag");
program = glw->LoadShader("terrain.vert", "terrain.frag");
}
catch (std::exception &e)
{
std::cout << "Caught exception: " << e.what() << std::endl;
std::cin.ignore();
exit(0);
}
/* Define uniforms to send to vertex shader */
modelID = glGetUniformLocation(program, "model");
colourmodeID = glGetUniformLocation(particle_program, "weather");
viewID = glGetUniformLocation(program, "view");
projectionID = glGetUniformLocation(program, "projection");
/* Define the texture behaviour parameters */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//.........这里部分代码省略.........