qtk/app/examplescene.h

78 lines
2.9 KiB
C
Raw Normal View History

/*##############################################################################
## Author: Shaun Reed ##
2022-03-06 16:54:05 +00:00
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
## About: Classes for managing objects and data within a scene ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
##############################################################################*/
#ifndef QTK_EXAMPLE_SCENE_H
#define QTK_EXAMPLE_SCENE_H
#include <camera3d.h>
2022-11-26 18:24:38 +00:00
#include <scene.h>
#include <skybox.h>
#include <QMatrix4x4>
2022-11-26 18:24:38 +00:00
/**
* Example scene using QtkWidget to render 3D models and simple geometry within
* QtOpenGLWidgets. This scene also shows some examples of using GLSL shaders to
* apply the basic lighting techniques leading up to Phong.
*
* The Qtk::Scene base class provides containers for N pointers to MeshRenderer
* and Model objects. We can create and insert as many as we like within this
* child class implementation. This child class does not need to manually draw
* objects inserted into these containers. The child class would only need to
* update uniform or other data that may change per-frame.
* See scene.h and `init()` for more information.
*
* To modify the scene objects should be initialized within the `init()` public
* method. Any required movement or updates should be applied within `draw()` or
* `update()`.
*
* To create your own Scene from scratch see Qtk::Scene.
*/
class ExampleScene : public Qtk::Scene {
2022-11-24 22:26:53 +00:00
public:
2022-11-26 18:24:38 +00:00
/***************************************************************************
* Contructors / Destructors
**************************************************************************/
2022-11-24 22:26:53 +00:00
ExampleScene();
~ExampleScene();
2022-11-26 18:24:38 +00:00
/***************************************************************************
* Inherited Public Overrides
**************************************************************************/
/**
* Initialize objects within the scene
*/
2022-11-24 22:26:53 +00:00
void init() override;
2022-11-26 18:24:38 +00:00
/**
* Called when OpenGL repaints the widget.
*/
2022-11-24 22:26:53 +00:00
void draw() override;
2022-11-26 18:24:38 +00:00
/**
* Called when the Qt `frameSwapped` signal is caught.
* See definition of `QtkWidget::initializeGL()`
*/
2022-11-24 22:26:53 +00:00
void update() override;
private:
2022-11-26 18:24:38 +00:00
/***************************************************************************
* Private Members
**************************************************************************/
// Additional example objects created within this example.
// + The base class Scene manages objects stored within mMeshes or mModels
2022-11-24 22:26:53 +00:00
Qtk::MeshRenderer * mTestPhong {};
Qtk::MeshRenderer * mTestSpecular {};
Qtk::MeshRenderer * mTestDiffuse {};
Qtk::MeshRenderer * mTestAmbient {};
};
2022-11-24 22:26:53 +00:00
#endif // QTK_EXAMPLE_SCENE_H