Geno3D
A simple 3D visualisation library, using C++/SFML.
 All Classes Functions Variables
Public Member Functions | Private Attributes | List of all members
Geno3D::ObjScene Class Reference

#include <ObjScene.hpp>

Inheritance diagram for Geno3D::ObjScene:
Geno3D::Scene

Public Member Functions

 ObjScene (std::string filename, float posy, float posz, std::string tex)
 
 ObjScene (std::string filename, float posy, float posz)
 
void init (sf::RenderWindow *window, sf::Vector2i dims) override
 
void draw (float in) override
 
void update (float dt) override
 
void handleInput () override
 

Private Attributes

sf::RenderWindow * window
 The viewport window.
 
Object object
 The mesh object to render.
 
std::shared_ptr< Cameracamera
 The camera used to render.
 
std::vector< std::unique_ptr
< Light > > 
lights
 The lights used in the scene.
 
sf::Vector2i windowSize
 The dimensions of the window.
 

Detailed Description

This class renders a 3D mesh in the viewport.

Constructor & Destructor Documentation

Geno3D::ObjScene::ObjScene ( std::string  filename,
float  posy,
float  posz,
std::string  tex 
)

Construct an object scene from a textured obj file.

Parameters
filenamethe path to the obj file to load
posythe y-position of the camera
poszthe z-position of the camera
texthe path to the texture image
Geno3D::ObjScene::ObjScene ( std::string  filename,
float  posy,
float  posz 
)

Construct an object scene from an obj file.

Parameters
filenamethe path to the obj file to load
posythe y-position of the camera
poszthe z-position of the camera

References camera.

Member Function Documentation

void Geno3D::ObjScene::draw ( float  in)
overridevirtual

Update once per frame. This renders the mesh according to the scene's camera and lights and draws the rendered image to the viewport.

Parameters
inan interpolation factor

Implements Geno3D::Scene.

References camera, lights, window, and windowSize.

void Geno3D::ObjScene::handleInput ( )
overridevirtual

Handle input events such as closing the window. This function is called every frame.

See Also
update()
draw()
Engine::run()

Implements Geno3D::Scene.

References window.

void Geno3D::ObjScene::init ( sf::RenderWindow *  window,
sf::Vector2i  dims 
)
overridevirtual

Set up the scene with information about the render window. This is called internally by the Engine class.

See Also
Engine

Implements Geno3D::Scene.

References camera, lights, window, and windowSize.

void Geno3D::ObjScene::update ( float  dt)
overridevirtual

Update at a "fixed-time" interval. This allows an update which is independent of framerate.

Parameters
dtthe time between consecutive calls of this function
See Also
draw()
Engine::run()

Implements Geno3D::Scene.


The documentation for this class was generated from the following files: