Clean up example code.

+ Fix spartan path.
+ Fix triangle draw mode.
This commit is contained in:
2025-03-08 10:29:35 -05:00
parent 68bfff7bcd
commit 32641acd8d
5 changed files with 51 additions and 59 deletions

View File

@@ -58,6 +58,8 @@ void Scene::draw() {
mInit = true;
}
// Check if there were new models added that still need to be loaded.
// This is for objects added at runtime via click-and-drag events, etc.
while(!mModelLoadQueue.empty()) {
auto modelSpec = mModelLoadQueue.front();
// Load the model and add it to the scene.

View File

@@ -53,7 +53,7 @@ namespace Qtk {
Scene();
virtual ~Scene();
~Scene() override;
/*************************************************************************
* Public Methods
@@ -73,10 +73,13 @@ namespace Qtk {
/**
* Function called to update the QOpenGLWidget. Does not trigger a redraw.
*
* This method can translate or rotate objects to simulate movement.
* Calling this several times will still result in only one repaint.
*
* It's very possible a client will not want to move objects in the scene
* using this method. This is intentially not pure virtual.
*/
virtual void update() {}
virtual void update() { }
void loadModel(const QUrl & url) {
auto fileName = url.fileName().replace(".obj", "").toStdString();
@@ -239,30 +242,6 @@ namespace Qtk {
/* Track count of objects with same initial name. */
std::unordered_map<std::string, uint64_t> mObjectCount;
};
class SceneEmpty : public Scene {
public:
void init() override { setSceneName("Empty Scene"); }
void draw() override { Scene::draw(); }
void update() override { Scene::update(); }
};
class SceneInterface : public Scene {
public:
explicit SceneInterface(Scene * scene) : mScene(scene) {}
void init() override { mScene->init(); }
void draw() override { mScene->draw(); }
void update() override { mScene->update(); }
protected:
Scene * mScene;
};
} // namespace Qtk
#endif // QTK_SCENE_H