本文整理汇总了C++中target_camera::get_view方法的典型用法代码示例。如果您正苦于以下问题:C++ target_camera::get_view方法的具体用法?C++ target_camera::get_view怎么用?C++ target_camera::get_view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类target_camera
的用法示例。
在下文中一共展示了target_camera::get_view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
bool render()
{
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(
eff.get_uniform_location("MVP"),
1,
GL_FALSE,
value_ptr(MVP));
// Bind and set texture
renderer::bind(tex, 0);
glUniform1i(eff.get_uniform_location("tex"), 0);
// Render mesh
renderer::render(m);
return true;
}
示例2: render
bool render() {
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), // Location of uniform
1, // Number of values - 1 mat4
GL_FALSE, // Transpose the matrix?
value_ptr(MVP)); // Pointer to matrix data
// *********************************
// Bind texture to renderer
renderer::bind(tex, 1);
// Set the texture value for the shader here
glUniform1i(eff.get_uniform_location(" tex"), 0);
// *********************************
// Render the mesh
renderer::render(m);
return true;
}
示例3: render
bool render() {
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), // Location of uniform
1, // Number of values - 1 mat4
GL_FALSE, // Transpose the matrix?
value_ptr(MVP)); // Pointer to matrix data
// *********************************
// Set the dissolve_factor uniform value
// Bind the two textures - use different index for each
// Set the uniform values for textures - use correct index
// *********************************
// Set UV_scroll uniform, adds cool movent (Protip: This is a super easy way to do fire effects;))
glUniform2fv(eff.get_uniform_location("UV_SCROLL"), 1, value_ptr(uv_scroll));
// Render the mesh
renderer::render(m);
return true;
}
示例4: render
bool render() {
// Render meshes
for (auto &e : meshes) {
auto m = e.second;
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// *********************************
// Set material colour - all objects red
glUniform4fv(eff.get_uniform_location("material_colour"), 1, value_ptr(vec4(1.0f, 0.0f, 0.0f, 1.0f)));
// Set ambient intensity - (0.3, 0.3, 0.3, 1.0)
glUniform4fv(eff.get_uniform_location("ambient_intensity"), 1, value_ptr(vec4(0.3f, 0.3f, 0.3f, 1.0)));
// *********************************
// Render mesh
renderer::render(m);
}
return true;
}
示例5: render
bool render() {
// Render meshes
for (auto &e : meshes) {
auto m = e.second;
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// *********************************
// Set M matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("M"), 1, GL_FALSE, value_ptr(m.get_transform().get_transform_matrix()));
// Set N matrix uniform - remember - 3x3 matrix
glUniformMatrix3fv(eff.get_uniform_location("N"), 1, GL_FALSE, value_ptr(m.get_transform().get_normal_matrix()));
// Set material colour - specular material is white
glUniform4fv(eff.get_uniform_location("material_colour"), 1, value_ptr(vec4(1.0f, 1.0f, 1.0f, 1.0f)));
// Set shininess - Use 50.0f
glUniform1f(eff.get_uniform_location("shininess"), 50.0f);
// Set light colour - (1.0, 1.0, 1.0, 1.0)
glUniform4fv(eff.get_uniform_location("light_colour"), 1, value_ptr(vec4(1.0f, 1.0f, 1.0f, 1.0f)));
// Set light direction- (1.0, 1.0, -1.0)
glUniform3fv(eff.get_uniform_location("light_dir"), 1, value_ptr(vec3(1.0f, 1.0f, -1.0f)));
// Set eye position - Get this from active camera
glUniform3fv(eff.get_uniform_location("eye_pos"), 1, value_ptr(vec3(cam.get_position())));
// *********************************
// Render mesh
renderer::render(m);
}
return true;
}
示例6: render
bool render() {
// Render meshes
for (auto &e : meshes) {
auto m = e.second;
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), // Location of uniform
1, // Number of values - 1 mat4
GL_FALSE, // Transpose the matrix?
value_ptr(MVP)); // Pointer to matrix data
// *********************************
// Set N matrix uniform - remember - 3x3 matrix
glUniformMatrix3fv(eff.get_uniform_location("N"), 1, GL_FALSE, value_ptr(m.get_transform().get_transform_matrix()));
// Set material colour - all objects red
glUniform4fv(eff.get_uniform_location("material_colour"), 1, value_ptr(vec4(1.0f, 0.0f, 0.0f, 1.0f)));
// Set light colour- (1.0, 1.0, 1.0, 1.0)
glUniform4fv(eff.get_uniform_location("light_colour"), 1, value_ptr(vec4(1.0f, 1.0f, 1.0f, 1.0f)));
// Set light direction - (1.0, 1.0, -1.0)
glUniform3fv(eff.get_uniform_location("light_dir"), 1, value_ptr(vec3(1.0f, 1.0f, -1.0f)));
// *********************************
// Render mesh
renderer::render(m);
}
return true;
}
示例7: render
bool render() {
// *********************************
// Set render target to frame buffer
renderer::set_render_target(frame);
// Clear frame
renderer::clear();
// *********************************
// Render meshes
for (auto &e : meshes) {
auto m = e.second;
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// Create MV matrix
auto MV = V * M;
// Set MV matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MV"), 1, GL_FALSE, value_ptr(MV));
// Set M matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("M"), 1, GL_FALSE, value_ptr(M));
// Set N matrix uniform
glUniformMatrix3fv(eff.get_uniform_location("N"), 1, GL_FALSE, value_ptr(m.get_transform().get_normal_matrix()));
// Bind material
renderer::bind(m.get_material(), "mat");
// Bind light
renderer::bind(light, "light");
// Bind texture
renderer::bind(tex, 0);
// Set tex uniform
glUniform1i(eff.get_uniform_location("tex"), 0);
// Set eye position
glUniform3fv(eff.get_uniform_location("eye_pos"), 1, value_ptr(cam.get_position()));
// Render mesh
renderer::render(m);
}
// *********************************
// Set render target back to the screen
renderer::set_render_target();
// Bind Tex effect
renderer::bind(tex_eff);
// MVP is now the identity matrix
auto MVP = glm::mat4();
// Set MVP matrix uniform
glUniformMatrix4fv(tex_eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// Bind texture from frame buffer
renderer::bind(frame.get_frame(), 0);
// Set the tex uniform
glUniform1i(tex_eff.get_uniform_location("tex"), 0);
// Render the screen quad
renderer::render(screen_quad);
// *********************************
return true;
}
示例8: render
bool render() {
// Bind effect
renderer::bind(eff);
// Create MVP matrix
mat4 M = eulerAngleXZ(theta, rho);
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// Render geometry
renderer::render(geom);
return true;
}
示例9: render
bool render() {
// Bind effect
renderer::bind(eff);
// Create MVP matrix
mat4 M(1.0f);
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// *********************************
// Render the mesh here
renderer::render(m);
// *********************************
return true;
}
示例10: render
bool render() {
// Bind effect
renderer::bind(eff);
// Create MVP matrix
mat4 M(1.0f);
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), // Location of uniform
1, // Number of values - 1 mat4
GL_FALSE, // Transpose the matrix?
value_ptr(MVP)); // Pointer to matrix data
// Render geometry
renderer::render(geom);
return true;
}
示例11: render
bool render() {
// Render meshes
for (auto &e : meshes) {
auto m = e.second;
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), // Location of uniform
1, // Number of values - 1 mat4
GL_FALSE, // Transpose the matrix?
value_ptr(MVP)); // Pointer to matrix data
// *********************************
// Set M matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("M"), 1, GL_FALSE, value_ptr(M));
// Set N matrix uniform - remember - 3x3 matrix
glUniformMatrix3fv(eff.get_uniform_location("N"),
1,
GL_FALSE,
value_ptr(m.get_transform().get_normal_matrix()));
// Bind material
renderer::bind(m.get_material(), "mat");
// Bind light
renderer::bind(light, "point");
// Bind texture
renderer::bind(tex, 0);
// Set tex uniform
glUniform1i(eff.get_uniform_location("tex"), 0);
// Set eye position- Get this from active camera
glUniform3fv(eff.get_uniform_location("eye_pos"), 1, value_ptr(cam.get_position()));
// Render mesh
renderer::render(m);
// *********************************
}
return true;
}
示例12: render
bool render() {
// Bind effect
renderer::bind(eff);
mat4 S, R, M;
// *********************************
// Create rotation matrix and scale matrix
// Set M to be the combination of scale and rotation - make sure you have the correct order
R = rotate(mat4(1.0f), theta, vec3(0.0f, 0.0f, 1.0f));
S = scale(mat4(1.0f), vec3(s, s, s));
M = R * S;
// *********************************
// Create MVP matrix
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// Render geometry
renderer::render(geom);
return true;
}
示例13: render
bool render() {
// Bind effect
renderer::bind(eff);
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// *********************************
// Bind texture to renderer
// Set the texture value for the shader here
// *********************************
// Render the mesh
renderer::render(m);
return true;
}
示例14: render
bool render() {
// Bind effect
renderer::bind(eff);
mat4 T, R, S, M;
// *********************************
// Create transformation matrices
// ******************************
// Combine matrices to set M - remember multiplication order
// *********************************
// Create MVP matrix
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(eff.get_uniform_location("MVP"), 1, GL_FALSE, value_ptr(MVP));
// Render geometry
renderer::render(geom);
return true;
}
示例15: render
bool render() {
// *********************************
// Set render target to shadow map
// Clear depth buffer bit
// Set render mode to cull face
// *********************************
// Bind shader
renderer::bind(shadow_eff);
// Render meshes
for (auto &e : meshes) {
auto m = e.second;
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
// View matrix taken from shadow map
// *********************************
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(shadow_eff.get_uniform_location("MVP"), // Location of uniform
1, // Number of values - 1 mat4
GL_FALSE, // Transpose the matrix?
value_ptr(MVP)); // Pointer to matrix data
// Render mesh
renderer::render(m);
}
// *********************************
// Set render target back to the screen
// Set cull face to back
// *********************************
// Bind shader
renderer::bind(main_eff);
// Render meshes
for (auto &e : meshes) {
auto m = e.second;
// Create MVP matrix
auto M = m.get_transform().get_transform_matrix();
auto V = cam.get_view();
auto P = cam.get_projection();
auto MVP = P * V * M;
// Set MVP matrix uniform
glUniformMatrix4fv(main_eff.get_uniform_location("MVP"), // Location of uniform
1, // Number of values - 1 mat4
GL_FALSE, // Transpose the matrix?
value_ptr(MVP)); // Pointer to matrix data
// Set M matrix uniform
glUniformMatrix4fv(main_eff.get_uniform_location("M"), 1, GL_FALSE, value_ptr(M));
// Set N matrix uniform
glUniformMatrix3fv(main_eff.get_uniform_location("N"), 1, GL_FALSE,
value_ptr(m.get_transform().get_normal_matrix()));
// *********************************
// Set light transform
// Bind material
// Bind spot lights
// Bind texture
// Set tex uniform
// Set eye position
// Bind shadow map texture - use texture unit 1
// Render mesh
// *********************************
}
return true;
}