• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ target_camera类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中target_camera的典型用法代码示例。如果您正苦于以下问题:C++ target_camera类的具体用法?C++ target_camera怎么用?C++ target_camera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了target_camera类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:40167459,项目名称:set08116,代码行数:34,代码来源:44_Diffuse_Light_2.cpp


示例2: load_content

bool load_content() {
  geom.set_type(GL_TRIANGLE_STRIP);
  // Create quad data
  // Positions
  vector<vec3> positions{vec3(-1.0f, -1.0f, 0.0f), vec3(1.0f, -1.0f, 0.0f), vec3(-1.0f, 1.0f, 0.0f),
                         vec3(1.0f, 1.0f, 0.0f)};
  // Colours
  vector<vec4> colours{vec4(1.0f, 0.0f, 0.0f, 1.0f), vec4(1.0f, 0.0f, 0.0f, 1.0f), vec4(1.0f, 0.0f, 0.0f, 1.0f),
                       vec4(1.0f, 0.0f, 0.0f, 1.0f)};
  // Add to the geometry
  geom.add_buffer(positions, BUFFER_INDEXES::POSITION_BUFFER);
  geom.add_buffer(colours, BUFFER_INDEXES::COLOUR_BUFFER);

  // Load in shaders
  eff.add_shader("shaders/basic.vert", GL_VERTEX_SHADER);
  eff.add_shader("shaders/basic.frag", GL_FRAGMENT_SHADER);
  // Build effect
  eff.build();

  // Set camera properties
  cam.set_position(vec3(10.0f, 10.0f, 10.0f));
  cam.set_target(vec3(0.0f, 0.0f, 0.0f));
  auto aspect = static_cast<float>(renderer::get_screen_width()) / static_cast<float>(renderer::get_screen_height());
  cam.set_projection(quarter_pi<float>(), aspect, 2.414f, 1000.0f);
  return true;
}
开发者ID:dooglz,项目名称:set08116,代码行数:26,代码来源:17_Full_Transformation.cpp


示例3: load_content

bool load_content() {
  // *********************************
  // Create a sphere

  // Create box geometry for skybox

  // Scale box by 100 - allows a distance

  // Load the cubemap  - create array of six filenames +x, -x, +y, -y, +z, -z


  // Create cube_map

  // Load in tarnish texture

  // Load in environment map shader


  // Build effect

  // Load in skybox effect


  // Build effect

  // *********************************
  // Set camera properties
  cam.set_position(vec3(0.0f, 0.0f, 10.0f));
  cam.set_projection(quarter_pi<float>(), renderer::get_screen_aspect(), 0.1f, 1000.0f);
  return true;
}
开发者ID:40167459,项目名称:set08116,代码行数:31,代码来源:59_Tarnished_Object.cpp


示例4: 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;
}
开发者ID:40167459,项目名称:set08116,代码行数:26,代码来源:28_Repeat_Textures.cpp


示例5: 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;
}
开发者ID:Zoeoeh,项目名称:Coursework-ComputerGraphics,代码行数:25,代码来源:main.cpp


示例6: load_content

bool load_content() {
  // Create mesh object, cheating and using the mesh builder for now
  m = mesh(geometry_builder::create_box());
  // Scale geometry
  m.get_transform().scale = vec3(10.0f);

  // Load in dissolve shader
  eff.add_shader("33_Dissolve/dissolve.vert", GL_VERTEX_SHADER);
  eff.add_shader("33_Dissolve/dissolve.frag", GL_FRAGMENT_SHADER);

  // Build effect
  eff.build();

  // Load in textures
  tex = texture("textures/checker.png");
  dissolve = texture("textures/blend_map2.jpg");

  // Set camera properties
  cam.set_position(vec3(30.0f, 30.0f, 30.0f));
  cam.set_target(vec3(0.0f, 0.0f, 0.0f));
  auto aspect = static_cast<float>(renderer::get_screen_width()) / static_cast<float>(renderer::get_screen_height());
  cam.set_projection(quarter_pi<float>(), aspect, 2.414f, 1000.0f);

  return true;
}
开发者ID:40167459,项目名称:set08116,代码行数:25,代码来源:33_Dissolve.cpp


示例7: 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;
}
开发者ID:40167459,项目名称:set08116,代码行数:34,代码来源:33_Dissolve.cpp


示例8: load_content

bool load_content()
{
	// *************
	// Load in model
	// *************
	m = mesh(geometry("..\\resources\\models\\teapot.obj"));
	

	// ***************
	// Load in texture
	// ***************
	tex = texture("..\\resources\\textures\\checked.gif", false, false);
	

	// Load in shaders
	eff.add_shader("..\\resources\\shaders\\simple_texture.vert", GL_VERTEX_SHADER);
	eff.add_shader("..\\resources\\shaders\\simple_texture.frag", GL_FRAGMENT_SHADER);
	// Build effect
	eff.build();

	// Set camera properties
	cam.set_position(vec3(200.0f, 200.0f, 200.0f));
	cam.set_target(vec3(0.0f, 0.0f, 0.0f));
	auto aspect = static_cast<float>(renderer::get_screen_width()) / static_cast<float>(renderer::get_screen_height());
	cam.set_projection(quarter_pi<float>(), aspect, 2.414f, 1000.0f);
	return true;
}
开发者ID:Zoeoeh,项目名称:Coursework-ComputerGraphics,代码行数:27,代码来源:main.cpp


示例9: 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;
}
开发者ID:DelbyPicnic,项目名称:set08116,代码行数:26,代码来源:42_Simple_Ambient_Light.cpp


示例10: 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;
}
开发者ID:40167459,项目名称:set08116,代码行数:60,代码来源:71_Greyscale.cpp


示例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"), 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;
}
开发者ID:40167459,项目名称:set08116,代码行数:35,代码来源:45_Specular_Light.cpp


示例12: update

bool update(float delta_time) {
  // Update camera
  static float x = 0.0f;
  x += delta_time;
  cam.set_position(vec3(10.0f * sinf(x), 10.0f, 10.0f * cosf(x)));
  cam.update(delta_time);
  return true;
}
开发者ID:40167459,项目名称:set08116,代码行数:8,代码来源:34_Simple_Cell_Shading.cpp


示例13: load_content

bool load_content() {
  // *********************************
  // Create shadow map- use screen size
	shadow = shadow_map(renderer::get_screen_width(), renderer::get_screen_height());
  // Create plane mesh
	meshes["plane"] = mesh(geometry_builder::create_plane());
  // Create "teapot" mesh by loading in models/teapot.obj
	meshes["teapot"] = mesh(geometry("models/teapot.obj"));
  // Need to rotate the teapot on x by negative pi/2
	meshes["teapot"].get_transform().rotate(vec3(-90.0, 0.0, 0.0));
  // Scale the teapot - (0.1, 0.1, 0.1)
	meshes["teapot"].get_transform().scale = vec3(0.1,0.1,0.1);
  // ***********************
  // Set materials
  // - all emissive is black
  // - all specular is white
  // - all shininess is 25
  // ***********************
  // White plane
	meshes["plane"].get_material().set_emissive(vec4(0.0f, 0.0f, 0.0f, 1.0f));
	meshes["plane"].get_material().set_diffuse(vec4(1.0f, 1.0f, 1.0f, 1.0f));
	meshes["plane"].get_material().set_specular(vec4(1.0f, 1.0f, 1.0f, 1.0f));
	meshes["plane"].get_material().set_shininess(25.0f);
  // Red teapot
	meshes["teapot"].get_material().set_emissive(vec4(0.0f, 0.0f, 0.0f, 1.0f));
	meshes["teapot"].get_material().set_diffuse(vec4(1.0f, 0.0f, 0.0f, 1.0f));
	meshes["teapot"].get_material().set_specular(vec4(1.0f, 1.0f, 1.0f, 1.0f));
	meshes["teapot"].get_material().set_shininess(25.0f);



  // *********************************

  // Set spot properties
  // Pos (20, 30, 0), White
  // Direction (-1, -1, 0) normalized
  // 50 range, 10 power
  spot.set_position(vec3(20.0f, 30.0f, 0.0f));
  spot.set_light_colour(vec4(1.0f, 1.0f, 1.0f, 1.0f));
  spot.set_direction(normalize(vec3(-1.0f, -1.0f, 0.0f)));
  spot.set_range(50.0f);
  spot.set_power(10.0f);

  // Load in shaders
  shadow_eff.add_shader("50_Spot_Light/spot.vert", GL_VERTEX_SHADER);
  shadow_eff.add_shader("50_Spot_Light/spot.frag", GL_FRAGMENT_SHADER);
  // Build effect
  shadow_eff.build();

  // Set camera properties
  cam.set_position(vec3(0.0f, 20.0f, -30.0f));
  cam.set_target(vec3(0.0f, 0.0f, 0.0f));
  cam.set_projection(quarter_pi<float>(), renderer::get_screen_aspect(), 0.1f, 1000.0f);
  return true;
}
开发者ID:rossco292,项目名称:set08116,代码行数:55,代码来源:53_Shadow_Mapping.cpp


示例14: load_content

bool load_content() {
  // Create cube data - eight corners
  // Positions
  vector<vec3> positions{
      // *********************************
      // Add the position data for cube corners here (8 total)



      // *********************************
  };
  // Colours
  vector<vec4> colours;
  for (auto i = 0; i < positions.size(); ++i) {
    colours.push_back(vec4((i + 1) % 2, 0.0f, i % 2, 1.0f));
  }
  // Create the index buffer
  vector<GLuint> indices{
      // *********************************
      // Add index information here - 3 per triangle, 6 per face, 12 triangles
      // Front

      // Back

      // Right

      // Left

      // Top

      // Bottom

      // *********************************
  };
  // Add to the geometry
  geom.add_buffer(positions, BUFFER_INDEXES::POSITION_BUFFER);
  geom.add_buffer(colours, BUFFER_INDEXES::COLOUR_BUFFER);
  // ****************************
  // Add index buffer to geometry
  // ****************************
  geom.add_index_buffer(indices);

  // Load in shaders
  eff.add_shader("shaders/basic.vert", GL_VERTEX_SHADER);
  eff.add_shader("shaders/basic.frag", GL_FRAGMENT_SHADER);
  // Build effect
  eff.build();

  // Set camera properties
  cam.set_position(vec3(10.0f, 10.0f, 10.0f));
  cam.set_target(vec3(0.0f, 0.0f, 0.0f));
  auto aspect = static_cast<float>(renderer::get_screen_width()) / static_cast<float>(renderer::get_screen_height());
  cam.set_projection(quarter_pi<float>(), aspect, 2.414f, 1000.0f);
  return true;
}
开发者ID:dooglz,项目名称:set08116,代码行数:55,代码来源:22_Indexed_Cube.cpp


示例15: 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;
}
开发者ID:dooglz,项目名称:set08116,代码行数:14,代码来源:22_Indexed_Cube.cpp


示例16: update

bool update(float delta_time) {
  // *********************************
  // Use keyboard to change camera location
  // 1 - (50, 10, 50)
	if (glfwGetKey(renderer::get_window(), GLFW_KEY_UP)) {
		cam.set_position(vec3(50.0f, 10.0f, 50.0f));
	}


  // 2 - (-50, 10, 50)



  // 3 - (-50, 10, -50)



  // 4 - (50, 10, -50)



  // Update the camera

  // *********************************

  return true;
}
开发者ID:rossco292,项目名称:set08116,代码行数:27,代码来源:37_Target_Camera.cpp


示例17: 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;
}
开发者ID:40167459,项目名称:set08116,代码行数:16,代码来源:24_Meshes.cpp


示例18: update

bool update(float delta_time) {
  // Accumulate time
  total_time += delta_time;
  // Update the scale - base on sin wave
  s = 1.0f + sinf(total_time);
  // Multiply by 5
  s *= 5.0f;
  // Increment theta - half a rotation per second
  theta += pi<float>() * delta_time;
  // Check if key is pressed
  if (glfwGetKey(renderer::get_window(), GLFW_KEY_UP)) {
    pos += vec3(0.0f, 0.0f, -5.0f) * delta_time;
  }
  if (glfwGetKey(renderer::get_window(), GLFW_KEY_DOWN)) {
    pos += vec3(0.0f, 0.0f, 5.0f) * delta_time;
  }
  if (glfwGetKey(renderer::get_window(), GLFW_KEY_LEFT)) {
    pos += vec3(-5.0f, 0.0f, 0.0f) * delta_time;
  }
  if (glfwGetKey(renderer::get_window(), GLFW_KEY_RIGHT)) {
    pos += vec3(5.0f, 0.0f, 0.0f) * delta_time;
  }
  // Update the camera
  cam.update(delta_time);
  return true;
}
开发者ID:dooglz,项目名称:set08116,代码行数:26,代码来源:17_Full_Transformation.cpp


示例19: 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;
}
开发者ID:Eloh666,项目名称:Computer-Graphics,代码行数:17,代码来源:03_Quads.cpp


示例20: load_content

bool load_content() {
  // Create plane mesh
  meshes["plane"] = mesh(geometry_builder::create_plane());

  // Create scene
  meshes["box"] = mesh(geometry_builder::create_box());
  meshes["tetra"] = mesh(geometry_builder::create_tetrahedron());
  meshes["pyramid"] = mesh(geometry_builder::create_pyramid());
  meshes["disk"] = mesh(geometry_builder::create_disk(20));
  meshes["cylinder"] = mesh(geometry_builder::create_cylinder(20, 20));
  meshes["sphere"] = mesh(geometry_builder::create_sphere(20, 20));
  meshes["torus"] = mesh(geometry_builder::create_torus(20, 20, 1.0f, 5.0f));

  // Transform objects
  meshes["box"].get_transform().scale = vec3(5.0f, 5.0f, 5.0f);
  meshes["box"].get_transform().translate(vec3(-10.0f, 2.5f, -30.0f));
  meshes["tetra"].get_transform().scale = vec3(4.0f, 4.0f, 4.0f);
  meshes["tetra"].get_transform().translate(vec3(-30.0f, 10.0f, -10.0f));
  meshes["pyramid"].get_transform().scale = vec3(5.0f, 5.0f, 5.0f);
  meshes["pyramid"].get_transform().translate(vec3(-10.0f, 7.5f, -30.0f));
  meshes["disk"].get_transform().scale = vec3(3.0f, 1.0f, 3.0f);
  meshes["disk"].get_transform().translate(vec3(-10.0f, 11.5f, -30.0f));
  meshes["disk"].get_transform().rotate(vec3(half_pi<float>(), 0.0f, 0.0f));
  meshes["cylinder"].get_transform().scale = vec3(5.0f, 5.0f, 5.0f);
  meshes["cylinder"].get_transform().translate(vec3(-25.0f, 2.5f, -25.0f));
  meshes["sphere"].get_transform().scale = vec3(2.5f, 2.5f, 2.5f);
  meshes["sphere"].get_transform().translate(vec3(-25.0f, 10.0f, -25.0f));
  meshes["torus"].get_transform().translate(vec3(-25.0f, 10.0f, -25.0f));
  meshes["torus"].get_transform().rotate(vec3(half_pi<float>(), 0.0f, 0.0f));

  // Load texture
  tex = texture("textures/checker.png");

  // Load in shaders
  eff.add_shader("27_Texturing_Shader/simple_texture.vert", GL_VERTEX_SHADER);
  eff.add_shader("27_Texturing_Shader/simple_texture.frag", GL_FRAGMENT_SHADER);

  // Build effect
  eff.build();

  // Set camera properties
  cam.set_position(vec3(50.0f, 10.0f, 50.0f));
  cam.set_target(vec3(0.0f, 0.0f, 0.0f));
  cam.set_projection(quarter_pi<float>(), renderer::get_screen_aspect(), 0.1f, 1000.0f);
  return true;
}
开发者ID:rossco292,项目名称:set08116,代码行数:46,代码来源:37_Target_Camera.cpp



注:本文中的target_camera类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ task类代码示例发布时间:2022-05-31
下一篇:
C++ taglist_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap