PittrieLoad: File Details

Download 2877

Syntax Highlighting

  1. int main() {
  2. 	// Create a renderer instance.
  3. 	sg::Renderer renderer;
  4.  
  5. 	// Create the root node.
  6. 	sg::Node::Ptr root = sg::Node::create();
  7.  
  8. 	// Create a transformation node.
  9. 	sg::Transform::Ptr transform = sg::Transform::create(
  10. 		sf::Vector3f( 1, 2, 3 ), // Translate by +1, +2, +3.
  11. 		sf::Vector3f( 10, 20, 30 ), // Rotate by 10°, 20°, 30°,
  12. 		sf::Vector3f( 1.5f, 1.5f, 1.5f ) // Scale by factor 1.5.
  13. 	);
  14.  
  15. 	root->add_child( transform );
  16.  
  17. 	// Create a visual object.
  18. 	sg::StaticObject::Ptr static_obj = sg::StaticObject::create( renderer );
  19. 	static_obj->set_buffer_object( ... ); // Set the buffer object, i.e. the mesh.
  20. 	static_obj->set_texture( ... ); // Set used texture.
  21.  
  22. 	transform->add_child( static_obj );
  23.  
  24. 	// Create a sun.
  25. 	sg::Sun::Ptr sun = sg::Sun::create( renderer );
  26. 	sun->set_sun_color( sf::Color( ... ) );
  27. 	sun->set_distance( 50 );
  28. 	sun->set_time_of_day( 0.3f );
  29.  
  30. 	root->add_child( sun );
  31.  
  32. 	// Update the scene graph.
  33. 	root->update();
  34.  
  35. 	// Render scene.
  36. 	renderer.render();
  37. }
  38.  

File Details

Field Value
Link http://www.pitload.org/2877
File Name 2877
File size 1.01kB
MIME type text/x-c++src
Age 12w 3d
MD5 44e54266172603b3a8249c2431d566b4
SHA1 69008ae3f7d03ef1f26fdcc86cfcc996e3552d01
Downloads 6
Rating 0/5
Your rating Please login to rate this file.

Please report this file if you think it is against the rules or violates the law.