Factor out more resources.
+ Use QOpenGLShader to get compiled shader code in TreeView. + Remove last remaining Qt resources dependency in libqtk. + shaders.h in libqtk to define default GLSL shader programs.
This commit is contained in:
@@ -17,6 +17,8 @@ if (QTK_GUI_SCENE)
|
||||
qtkscene.cpp qtkscene.h
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt6_add_big_resources(QTK_GUI_SOURCES "${QTK_RESOURCES}/resources.qrc")
|
||||
else()
|
||||
# The scene will use a default skybox with no models or examples.
|
||||
# Models can be added by click-and-dragging an .obj into the scene.
|
||||
@@ -24,6 +26,11 @@ else()
|
||||
qtkmainwindow.cpp qtkmainwindow.h qtkmainwindow.ui
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt6_add_big_resources(
|
||||
QTK_GUI_SOURCES
|
||||
"${QTK_RESOURCES}/minimal_resources.qrc"
|
||||
)
|
||||
endif()
|
||||
|
||||
qt_add_executable(qtk_gui ${QTK_GUI_SOURCES})
|
||||
|
||||
@@ -10,17 +10,9 @@
|
||||
|
||||
#include "qtkmainwindow.h"
|
||||
|
||||
#ifdef QTK_GUI_SCENE
|
||||
#include "qtkscene.h"
|
||||
using AppScene = QtkScene;
|
||||
#else
|
||||
using AppScene = EmptyScene;
|
||||
#endif
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(resources);
|
||||
|
||||
initResources();
|
||||
QApplication a(argc, argv);
|
||||
|
||||
auto window = MainWindow::getMainWindow();
|
||||
|
||||
@@ -62,6 +62,27 @@ class EmptyScene : public Qtk::Scene
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Conditionally include the QtkScene header if the example is enabled.
|
||||
* Set AppScene type to use in main() for creating the scene.
|
||||
* Define helper function to initialize Qt resources for the application.
|
||||
* These resources are different based on if the example is enabled.
|
||||
*/
|
||||
#ifdef QTK_GUI_SCENE
|
||||
#include "qtkscene.h"
|
||||
using AppScene = QtkScene;
|
||||
inline void initResources()
|
||||
{
|
||||
Q_INIT_RESOURCE(resources);
|
||||
}
|
||||
#else
|
||||
using AppScene = EmptyScene;
|
||||
inline void initResources()
|
||||
{
|
||||
Q_INIT_RESOURCE(minimal_resources);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MainWindow class to provide an example of using a QtkWidget within a Qt
|
||||
* window application.
|
||||
|
||||
@@ -42,8 +42,8 @@ void QtkScene::init()
|
||||
// Clone qtk-resources if it doesn't already exist.
|
||||
QDir repoDir("resources/");
|
||||
if (!repoDir.exists()) {
|
||||
qDebug() << "Cloning qtk-resources repository to '"
|
||||
<< repoDir.absolutePath() << "'...";
|
||||
qDebug() << "Cloning qtk-resources repository to " << repoDir.absolutePath()
|
||||
<< "...";
|
||||
|
||||
// Run git clone
|
||||
QProcess gitProcess;
|
||||
|
||||
Reference in New Issue
Block a user