diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d3e549..6b6a604 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,11 +12,19 @@ if(TARGET ${PROJECT_NAME}) return() endif() -set(QT_VERSION_MAJOR 5) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Test REQUIRED) - +find_package(QT NAMES Qt5 Qt6 COMPONENTS Core REQUIRED) include(submodules/QuasarAppLib/CMake/QuasarApp.cmake) +if (NOT ${QT_VERSION_MAJOR} EQUAL 5) + message("The ${PROJECT_NAME} support only qt5. please rebuild this project with qt6") + initAll() + addDoc(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.conf) + + return() +endif() + +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Test REQUIRED) + if (DEFINED TARGET_PLATFORM_TOOLCHAIN) if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32") initAll() diff --git a/src/Core/Crawl/day.h b/src/Core/Crawl/day.h index 6ac569b..a3e4a08 100644 --- a/src/Core/Crawl/day.h +++ b/src/Core/Crawl/day.h @@ -20,8 +20,32 @@ template <class Sun, class Moon> /** * @brief The Day class is template wrapper for the moon and sun objects. * The moon and sun objects moving around world center for imitation of the day. + * + * ### Integration on the world. + * You need to add one object of this class in the IWorld::initWorldRules method. + * **Example:** + * + * ```cpp + * CRAWL::WorldRule *World::initWorldRules() { + + using Day = CRAWL::Day<CRAWL::Sun, CRAWL::Moon>; + + return new CRAWL::WorldRule { + {0, { + {registerObject<Day>(), 1}, + } + }, + {1000, { + {registerObject<Day>(), 1}, + } + }, + }; +} + * ``` * @note All objects will be moving around this objects with radius. The Radius by default is 2000. * @note This class automaticly sets ligth force for the light objects. + * + * */ class Day: public IWorldItem, public Claster { diff --git a/src/Core/Crawl/defaultlight.h b/src/Core/Crawl/defaultlight.h index 4764537..50c14e2 100644 --- a/src/Core/Crawl/defaultlight.h +++ b/src/Core/Crawl/defaultlight.h @@ -14,7 +14,9 @@ namespace CRAWL { /** - * @brief The DefaultLight class This is default implementation of the wirld light. + * @brief The DefaultLight class This is default implementation of the world light. + * This object create uniform illumination for all world. + * For integration This object yo worl see the IWorld::initWorldRules method */ class DefaultLight final: public IWorldLight { diff --git a/src/Core/Crawl/iworldlight.h b/src/Core/Crawl/iworldlight.h index 74d33c5..50dac42 100644 --- a/src/Core/Crawl/iworldlight.h +++ b/src/Core/Crawl/iworldlight.h @@ -18,6 +18,28 @@ namespace CRAWL { * You need to create own qml file with light. * * @note If you wnat to create a new qml file the you need to inherit from the Light.qml file. + * + * ### Integration on the world. + * You need to add one object of this class in the IWorld::initWorldRules method. + * **Example:** + * + * ```cpp + * CRAWL::WorldRule *World::initWorldRules() { + + return new CRAWL::WorldRule { + {0, { + {registerObject<MyLightObject>(), 1}, + } + }, + {1000, { + {registerObject<MyLightObject>(), 1}, + } + }, + }; +} + * ``` + * + * For integration This object you world see the IWorld::initWorldRules method */ class CRAWL_EXPORT IWorldLight: public ClasterItem { @@ -30,6 +52,7 @@ class CRAWL_EXPORT IWorldLight: public ClasterItem Q_PROPERTY(float shadowBias READ shadowBias WRITE setShadowBias NOTIFY shadowBiasChanged) public: + IWorldLight(const QString& name, const QString& viewTempalte = "qrc:/CrawlModule/Light.qml", QObject *ptr = nullptr);