Skip to content

Instantly share code, notes, and snippets.

@TheFloatingBrain
Created June 7, 2022 05:39
Show Gist options
  • Save TheFloatingBrain/ef73e5d4b34c49dd40b86aad8b82e7d0 to your computer and use it in GitHub Desktop.
Save TheFloatingBrain/ef73e5d4b34c49dd40b86aad8b82e7d0 to your computer and use it in GitHub Desktop.
A test to run with dimension3d compiled as a conan package.
#include <iostream>
#include <vector>
#include <dim/dimension3D.hpp>
int main( int argc, char** args )
{
std::cout << "Beggining Proper\n";
const dim::Vector2int size( 960, 640 );
dim::Window::open( "Dimension3D", 960, 640 );
std::cout << "SUCCESS: Window Initialized\n";
dim::Scene scene( "Scene" );
scene.set_controller( dim::OrbitController() );
dim::PerspectiveCamera camera;
camera.set_position( dim::Vector3( 1.f, 1.f, 3.f ) );
scene.set_camera( camera );
scene.add_light( dim::DirectionalLight( dim::Vector3( -1.f, -1.f, 0.f ) ) );
std::vector< dim::Object > objects;
objects.push_back( dim::Object{
dim::Mesh::Cube(),
dim::Material(
dim::Color( 0.f, 0.f, 1.f ),
0.1f, 0.5f, 0.5f, 30.f
),
} );
while( dim::Window::running )
{
sf::Event event;
while( dim::Window::poll_event( event ) ) {
dim::Window::check_events( event );
scene.check_events( event );
}
dim::Window::clear();
dim::Window::update();
for( dim::Object& object : objects )
scene.draw( object );
scene.get_controller().update( scene, camera );
scene.display();
dim::Window::display();
}
dim::shut_down();
std::cout << "Ending Proper.\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment