Assimp IOSystem for Qt Resource paths
This commit is contained in:
@@ -15,11 +15,9 @@ set(
|
||||
debugconsole.cpp debugconsole.ui
|
||||
toolbox.cpp toolbox.ui
|
||||
treeview.cpp treeview.ui
|
||||
qtkmainwindow.cpp qtkmainwindow.ui
|
||||
)
|
||||
set(
|
||||
QTK_PLUGIN_LIBRARY_HEADERS
|
||||
qtkmainwindow.h
|
||||
qtkwidget.h
|
||||
debugconsole.h
|
||||
toolbox.h
|
||||
@@ -53,16 +51,16 @@ install(
|
||||
# Qtk Widget Collection Plugin
|
||||
################################################################################
|
||||
# Create a Qt Designer plugin for a collection of widgets from our library.
|
||||
qt_add_plugin(qtk-collection)
|
||||
qt_add_plugin(qtk_collection STATIC)
|
||||
target_sources(
|
||||
qtk-collection PRIVATE
|
||||
qtk_collection PRIVATE
|
||||
widgetplugincollection.cpp widgetplugincollection.h
|
||||
widgetplugin.cpp widgetplugin.h
|
||||
)
|
||||
target_link_libraries(qtk-collection PUBLIC qtk-plugin-library)
|
||||
target_link_libraries(qtk_collection PUBLIC qtk-plugin-library)
|
||||
|
||||
install(
|
||||
TARGETS qtk-collection
|
||||
TARGETS qtk_collection
|
||||
RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
||||
BUNDLE DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
||||
@@ -75,10 +73,11 @@ install(
|
||||
set(
|
||||
QTK_APP_SOURCES
|
||||
examplescene.cpp examplescene.h
|
||||
qtkmainwindow.cpp qtkmainwindow.h qtkmainwindow.ui
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt6_add_resources(QTK_APP_SOURCES "${QTK_RESOURCES}/resources.qrc")
|
||||
qt6_add_big_resources(QTK_APP_SOURCES "${QTK_RESOURCES}/resources.qrc")
|
||||
configure_file(
|
||||
resources.h.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/resources.h"
|
||||
@@ -105,10 +104,10 @@ install(
|
||||
|
||||
qt_generate_deploy_app_script(
|
||||
TARGET qtk-main
|
||||
FILENAME_VARIABLE deploy_script
|
||||
FILENAME_VARIABLE QTK_DEPLOY_SCRIPT
|
||||
NO_UNSUPPORTED_PLATFORM_ERROR
|
||||
)
|
||||
install(SCRIPT ${deploy_script})
|
||||
install(SCRIPT ${QTK_DEPLOY_SCRIPT})
|
||||
|
||||
if(WIN32)
|
||||
get_target_property(_qt6_qmake_location Qt6::qmake IMPORTED_LOCATION)
|
||||
|
||||
@@ -41,7 +41,8 @@ void ExampleScene::init() {
|
||||
myCube->setColor(RED);
|
||||
addObject(myCube);
|
||||
|
||||
auto mySpartan = new Model("My spartan", PATH("/models/spartan/spartan.obj"));
|
||||
auto mySpartan =
|
||||
new Model("My spartan", ":/models/models/spartan/spartan.obj");
|
||||
mySpartan->getTransform().setTranslation(0.0f, 0.5f, 0.0f);
|
||||
mySpartan->getTransform().setScale(0.5f);
|
||||
addObject(mySpartan);
|
||||
@@ -79,35 +80,30 @@ void ExampleScene::init() {
|
||||
// 3D Model loading
|
||||
|
||||
auto model = addObject(
|
||||
new Qtk::Model("backpack", PATH("/models/backpack/backpack.obj")));
|
||||
auto test = PATH("/models/backpack/backpack.obj");
|
||||
new Qtk::Model("backpack", ":/models/models/backpack/backpack.obj"));
|
||||
// Sometimes model textures need flipped in certain directions
|
||||
model->flipTexture("diffuse.jpg", false, true);
|
||||
model->getTransform().setTranslation(0.0f, 0.0f, -10.0f);
|
||||
|
||||
model = addObject(new Qtk::Model("bird", PATH("/models/bird/bird.obj")));
|
||||
model = addObject(new Qtk::Model("bird", ":/models/models/bird/bird.obj"));
|
||||
model->getTransform().setTranslation(2.0f, 2.0f, -10.0f);
|
||||
// Sometimes the models are very large
|
||||
model->getTransform().scale(0.0025f);
|
||||
model->getTransform().rotate(-110.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
model = addObject(new Qtk::Model("lion", PATH("/models/lion/lion.obj")));
|
||||
model->getTransform().setTranslation(-3.0f, -1.0f, -10.0f);
|
||||
model->getTransform().scale(0.15f);
|
||||
|
||||
model = addObject(
|
||||
new Qtk::Model("alien", PATH("/models/alien-hominid/alien.obj")));
|
||||
new Qtk::Model("alien", ":/models/models/alien-hominid/alien.obj"));
|
||||
model->getTransform().setTranslation(2.0f, -1.0f, -5.0f);
|
||||
model->getTransform().scale(0.15f);
|
||||
|
||||
model =
|
||||
addObject(new Qtk::Model("scythe", PATH("/models/scythe/scythe.obj")));
|
||||
addObject(new Qtk::Model("scythe", ":/models/models/scythe/scythe.obj"));
|
||||
model->getTransform().setTranslation(-6.0f, 0.0f, -10.0f);
|
||||
model->getTransform().rotate(-90.0f, 1.0f, 0.0f, 0.0f);
|
||||
model->getTransform().rotate(90.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
model = addObject(
|
||||
new Qtk::Model("masterChief", PATH("/models/spartan/spartan.obj")));
|
||||
new Qtk::Model("masterChief", ":/models/models/spartan/spartan.obj"));
|
||||
model->getTransform().setTranslation(-1.5f, 0.5f, -2.0f);
|
||||
|
||||
|
||||
@@ -233,7 +229,7 @@ void ExampleScene::init() {
|
||||
|
||||
/* Test alien Model with phong lighting and specular mapping. */
|
||||
model = addObject(new Qtk::Model(
|
||||
"alienTest", PATH("/models/alien-hominid/alien.obj"),
|
||||
"alienTest", ":/models/models/alien-hominid/alien.obj",
|
||||
":/shaders/model-specular.vert", ":/shaders/model-specular.frag"));
|
||||
model->getTransform().setTranslation(3.0f, -1.0f, 10.0f);
|
||||
model->getTransform().scale(0.15f);
|
||||
@@ -259,7 +255,7 @@ void ExampleScene::init() {
|
||||
|
||||
/* Test spartan Model with phong lighting, specular and normal mapping. */
|
||||
model = addObject(new Qtk::Model(
|
||||
"spartanTest", PATH("/models/spartan/spartan.obj"),
|
||||
"spartanTest", ":/models/models/spartan/spartan.obj",
|
||||
":/shaders/model-normals.vert", ":/shaders/model-normals.frag"));
|
||||
model->getTransform().setTranslation(0.0f, -1.0f, 10.0f);
|
||||
model->getTransform().scale(2.0f);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef QTK_RESOURCES_H_IN_H
|
||||
#define QTK_RESOURCES_H_IN_H
|
||||
|
||||
#define RESOURCES "@CMAKE_SOURCE_DIR@/resources"
|
||||
|
||||
#define PATH(a) RESOURCES a
|
||||
// Not currently in use, but will be in the future.
|
||||
|
||||
#endif // QTK_RESOURCES_H_IN_H
|
||||
|
||||
Reference in New Issue
Block a user