From ae5dc840fda2f82e7b5d497569e033c1a7a23f8e Mon Sep 17 00:00:00 2001 From: Marcus Hudritsch Date: Fri, 5 Jul 2024 19:20:57 +0200 Subject: [PATCH] Added docs and fixed typos --- README.md | 2 +- apps/source/App.h | 1 + apps/source/CVCapture.h | 2 +- apps/source/sm/Event.h | 30 ++++++++++- apps/source/sm/EventData.h | 13 ++++- apps/source/sm/StateMachine.cpp | 55 ++++++++++++++++----- apps/source/sm/StateMachine.h | 41 +++++++++++---- apps/source/wai/FeatureExtractorFactory.cpp | 35 +++++++++---- apps/source/wai/WAIAppTest.h | 12 +++-- apps/source/wai/WAIMapStorage.h | 3 +- docs/pages/SLProject.md | 4 +- modules/math/source/SLAlgo.h | 13 +++-- modules/utils/source/CustomLog.h | 2 + modules/utils/source/FileLog.cpp | 10 ++-- modules/utils/source/FileLog.h | 5 +- modules/utils/source/FtpUtils.cpp | 4 +- modules/utils/source/Utils.h | 2 +- modules/wai/source/WAIMath.h | 19 +++---- 18 files changed, 189 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index c611e049..c879bebe 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Build & Deploy Docs](https://github.com/cpvrlab/SLProject4/actions/workflows/deploy-pages.yml/badge.svg)](https://github.com/cpvrlab/SLProject4/actions/workflows/deploy-pages.yml) -SL stands for Scene Library. It is developed at the Berne University of Applied Sciences (BFH) in Switzerland and is used for student projects in the cpvrLab. The various applications show what you can learn in three semesters about 3D computer graphics in real-time rendering and ray tracing. The framework is built in C++ and OpenGL ES and can be built for Windows, Linux, macOS (Intel & arm64), Android, Apple iOS, and WebAssembly-enabled browsers. The framework can render alternatively with Ray Tracing and Path Tracing, which provides high-quality transparencies, reflections, and soft shadows. For a complete feature list see the [SLProject4 wiki](https://github.com/cpvrlab/SLProject4/wiki). +SL stands for Scene Library. It is developed at the Bern University of Applied Sciences (BFH) in Switzerland and is used for student projects in the cpvrLab. The various applications show what you can learn in three semesters about 3D computer graphics in real-time rendering and ray tracing. The framework is built in C++ and OpenGL ES and can be built for Windows, Linux, macOS (Intel & arm64), Android, Apple iOS, and WebAssembly-enabled browsers. The framework can render alternatively with Ray Tracing and Path Tracing, which provides high-quality transparencies, reflections, and soft shadows. For a complete feature list see the [SLProject4 wiki](https://github.com/cpvrlab/SLProject4/wiki). ## How to get the SLProject4 diff --git a/apps/source/App.h b/apps/source/App.h index 12189d8f..f18e3ead 100644 --- a/apps/source/App.h +++ b/apps/source/App.h @@ -52,6 +52,7 @@ typedef void (*OnGuiBuildCallback)(SLScene* s, SLSceneView* sv); typedef void (*OnGuiLoadConfigCallback)(SLint dotsPerInch); typedef void (*OnGuiSaveConfigCallback)(); +//! App configuration struct to be passed to the App::run function struct Config { int argc = 0; diff --git a/apps/source/CVCapture.h b/apps/source/CVCapture.h index f878c758..98a5259e 100644 --- a/apps/source/CVCapture.h +++ b/apps/source/CVCapture.h @@ -1,6 +1,6 @@ /** * \file CVCapture - * \brief OpenCV Capture Device + * \brief OpenCV Capture Device * \date Winter 2016 * \remarks Please use clangformat to format the code. See more code style on * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style diff --git a/apps/source/sm/Event.h b/apps/source/sm/Event.h index aabeb3bb..78180598 100644 --- a/apps/source/sm/Event.h +++ b/apps/source/sm/Event.h @@ -1,3 +1,12 @@ +/** + * \file Event.h + * \brief Event class used in the state machine + * \authors Michael Göttlicher + * \copyright http://opensource.org/licenses/GPL-3.0 + * \remarks Please use clangformat to format the code. See more code style on + * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style + */ + #ifndef SM_EVENT_H #define SM_EVENT_H @@ -5,9 +14,20 @@ #include #include +/** + * @brief Collection of classes for a state machine implementation used in the Erleb-AR app. + * @author Micheal Göttlicher + * \copyright http://opensource.org/licenses/GPL-3.0 + * \remarks Please use clangformat to format the code. See more code style on + * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style + */ namespace sm { +//----------------------------------------------------------------------------- +/** + * @brief Event class used in the state machine + */ class Event { public: @@ -30,7 +50,7 @@ class Event _transitions[from] = to; } - // Check if there is a transition to a new state. The current state is used to lookup the new state. + //! Check if there is a transition to a new state. The current state is used to lookup the new state. unsigned int getNewState(unsigned int currentState) { auto it = _transitions.find(currentState); @@ -43,7 +63,12 @@ class Event return EVENT_IGNORED; } } - // get event data that was possibly send with this event. If the function returns nullptr, it contains no data. + /** + * @brief Get event data that was possibly send with this event. + * If the function returns nullptr, it contains no data. + * + * @return EventData* + */ EventData* getEventData() { return _eventData; @@ -61,6 +86,7 @@ class Event std::string _name; std::string _senderInfo; }; +//----------------------------------------------------------------------------- } #endif diff --git a/apps/source/sm/EventData.h b/apps/source/sm/EventData.h index 01f75c3c..b6e574b3 100644 --- a/apps/source/sm/EventData.h +++ b/apps/source/sm/EventData.h @@ -1,15 +1,24 @@ +/** + * \file EventData.h + * \brief Event class used in the state machine + * \authors Michael Göttlicher + * \copyright http://opensource.org/licenses/GPL-3.0 + * \remarks Please use clangformat to format the code. See more code style on + * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style + */ #ifndef SM_EVENT_DATA_H #define SM_EVENT_DATA_H namespace sm { +//----------------------------------------------------------------------------- class EventData { public: virtual ~EventData() {} }; - +//----------------------------------------------------------------------------- class NoEventData : public EventData { public: @@ -17,6 +26,6 @@ class NoEventData : public EventData { } }; - +//----------------------------------------------------------------------------- } #endif diff --git a/apps/source/sm/StateMachine.cpp b/apps/source/sm/StateMachine.cpp index 1acbaea9..dfe29bb8 100644 --- a/apps/source/sm/StateMachine.cpp +++ b/apps/source/sm/StateMachine.cpp @@ -1,3 +1,12 @@ +/** + * \file StateMachinge.cpp + * \brief State Machine Class Implementation + * \authors Michael Göttlicher + * \copyright http://opensource.org/licenses/GPL-3.0 + * \remarks Please use clangformat to format the code. See more code style on + * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style + */ + #include "StateMachine.h" #include @@ -7,11 +16,12 @@ namespace sm { +//----------------------------------------------------------------------------- StateMachine::StateMachine(unsigned int initialStateId) : _currentStateId(initialStateId) { } - +//----------------------------------------------------------------------------- StateMachine::~StateMachine() { for (auto it : _stateActions) @@ -19,7 +29,7 @@ StateMachine::~StateMachine() delete it.second; } }; - +//----------------------------------------------------------------------------- bool StateMachine::update() { sm::EventData* data = nullptr; @@ -34,26 +44,38 @@ bool StateMachine::update() unsigned int newState = e->getNewState(_currentStateId); data = e->getEventData(); - LOG_STATEMACHINE_DEBUG("Event %s received sent by %s", e->name(), e->senderInfo()); + LOG_STATEMACHINE_DEBUG("Event %s received sent by %s", + e->name(), + e->senderInfo()); if (newState != Event::EVENT_IGNORED) { if (_currentStateId != newState) { stateEntry = true; - LOG_STATEMACHINE_DEBUG("State change: %s -> %s", getPrintableState(_currentStateId).c_str(), getPrintableState(newState).c_str()); + LOG_STATEMACHINE_DEBUG("State change: %s -> %s", + getPrintableState(_currentStateId).c_str(), + getPrintableState(newState).c_str()); // inform old state that we will leave it soon auto itStateAction = _stateActions.find(_currentStateId); if (itStateAction != _stateActions.end()) { - itStateAction->second->invokeStateAction(this, data, false, true); + itStateAction->second->invokeStateAction(this, + data, + false, + true); } else { std::stringstream ss; - ss << "You forgot to register state " << getPrintableState(_currentStateId) << "!"; - Utils::exitMsg("StateMachine", ss.str().c_str(), __LINE__, __FILE__); + ss << "You forgot to register state " + << getPrintableState(_currentStateId) + << "!"; + Utils::exitMsg("StateMachine", + ss.str().c_str(), + __LINE__, + __FILE__); } // update state @@ -62,19 +84,29 @@ bool StateMachine::update() auto itStateAction = _stateActions.find(_currentStateId); if (itStateAction != _stateActions.end()) { - itStateAction->second->invokeStateAction(this, data, stateEntry, false); + itStateAction->second->invokeStateAction(this, + data, + stateEntry, + false); } else { std::stringstream ss; - ss << "You forgot to register state " << getPrintableState(_currentStateId) << "!"; - Utils::exitMsg("StateMachine", ss.str().c_str(), __LINE__, __FILE__); + ss << "You forgot to register state " + << getPrintableState(_currentStateId) + << "!"; + Utils::exitMsg("StateMachine", + ss.str().c_str(), + __LINE__, + __FILE__); } stateWasUpdated = true; } else { - LOG_STATEMACHINE_DEBUG("Event %s ignored in state %s", e->name(), getPrintableState(_currentStateId).c_str()); + LOG_STATEMACHINE_DEBUG("Event %s ignored in state %s", + e->name(), + getPrintableState(_currentStateId).c_str()); } delete e; @@ -88,4 +120,5 @@ bool StateMachine::update() return true; } +//----------------------------------------------------------------------------- } diff --git a/apps/source/sm/StateMachine.h b/apps/source/sm/StateMachine.h index 445f3991..689492ad 100644 --- a/apps/source/sm/StateMachine.h +++ b/apps/source/sm/StateMachine.h @@ -1,3 +1,12 @@ +/** + * \file StateMachinge.h + * \brief State Machine Class Declaration + * \authors Michael Göttlicher + * \copyright http://opensource.org/licenses/GPL-3.0 + * \remarks Please use clangformat to format the code. See more code style on + * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style + */ + #ifndef SM_STATE_MACHINE_H #define SM_STATE_MACHINE_H @@ -8,9 +17,9 @@ namespace sm { - +//----------------------------------------------------------------------------- class StateMachine; - +//----------------------------------------------------------------------------- /// @brief Abstract state base class that all states inherit from. class StateBase { @@ -24,9 +33,12 @@ class StateBase * \param stateEntry * \param stateExit */ - virtual void invokeStateAction(StateMachine* sm, const EventData* data, const bool stateEntry, const bool stateExit) const {}; + virtual void invokeStateAction(StateMachine* sm, + const EventData* data, + const bool stateEntry, + const bool stateExit) const {}; }; - +//----------------------------------------------------------------------------- /*! * StateAction takes three template arguments: A state machine class, * a state function event data type (derived from EventData) and a state machine @@ -35,11 +47,18 @@ class StateBase * \tparam Data * \tparam Func */ -template +template class StateAction : public StateBase { public: - virtual void invokeStateAction(StateMachine* sm, const EventData* data, const bool stateEntry, const bool stateExit) const + virtual void invokeStateAction(StateMachine* sm, + const EventData* data, + const bool stateEntry, + const bool stateExit) const { // Downcast the state machine and event data to the correct derived type SM* derivedSM = static_cast(sm); @@ -50,7 +69,7 @@ class StateAction : public StateBase (derivedSM->*Func)(derivedData, stateEntry, stateExit); } }; - +//----------------------------------------------------------------------------- /*! - Transfer id of initial state in constructor of StateMachine - Define state functions like: void (const sm::EventData* data); @@ -69,7 +88,11 @@ class StateMachine : public EventHandler protected: //! register state processing functions from deriving class - template + template void registerState(unsigned int stateId) { assert(_stateActions.find(stateId) == _stateActions.end()); @@ -81,7 +104,7 @@ class StateMachine : public EventHandler std::map _stateActions; }; - +//----------------------------------------------------------------------------- } // namespace SM #endif diff --git a/apps/source/wai/FeatureExtractorFactory.cpp b/apps/source/wai/FeatureExtractorFactory.cpp index a1e4a57a..6859877c 100644 --- a/apps/source/wai/FeatureExtractorFactory.cpp +++ b/apps/source/wai/FeatureExtractorFactory.cpp @@ -5,6 +5,7 @@ using namespace ORB_SLAM2; +//----------------------------------------------------------------------------- FeatureExtractorFactory::FeatureExtractorFactory() { _extractorIdToNames.resize(ExtractorType_Last); @@ -17,8 +18,10 @@ FeatureExtractorFactory::FeatureExtractorFactory() _extractorIdToNames[ExtractorType_FAST_BRIEF_3000] = "FAST-BRIEF-3000"; _extractorIdToNames[ExtractorType_FAST_BRIEF_4000] = "FAST-BRIEF-4000"; } - -std::unique_ptr FeatureExtractorFactory::make(ExtractorType id, const cv::Size& videoFrameSize, int nLevels) +//----------------------------------------------------------------------------- +std::unique_ptr FeatureExtractorFactory::make(ExtractorType id, + const cv::Size& videoFrameSize, + int nLevels) { switch (id) { @@ -50,8 +53,10 @@ std::unique_ptr FeatureExtractorFactory::make(ExtractorType id, con return orbExtractor(1000, nLevels); } } - -std::unique_ptr FeatureExtractorFactory::make(std::string extractorType, const cv::Size& videoFrameSize, int nLevels) +//----------------------------------------------------------------------------- +std::unique_ptr FeatureExtractorFactory::make(std::string extractorType, + const cv::Size& videoFrameSize, + int nLevels) { std::unique_ptr result = nullptr; @@ -66,23 +71,32 @@ std::unique_ptr FeatureExtractorFactory::make(std::string extractor return result; } - +//----------------------------------------------------------------------------- std::unique_ptr FeatureExtractorFactory::orbExtractor(int nf, int nLevels) { float fScaleFactor = 1.2f; int fIniThFAST = 20; int fMinThFAST = 7; - return std::make_unique(nf, fScaleFactor, nLevels, fIniThFAST, fMinThFAST); + return std::make_unique(nf, + fScaleFactor, + nLevels, + fIniThFAST, + fMinThFAST); } - -std::unique_ptr FeatureExtractorFactory::briefExtractor(int nf, int nLevels) +//----------------------------------------------------------------------------- +std::unique_ptr FeatureExtractorFactory::briefExtractor(int nf, + int nLevels) { float fScaleFactor = 1.2f; int fIniThFAST = 20; int fMinThFAST = 7; - return std::make_unique(nf, fScaleFactor, nLevels, fIniThFAST, fMinThFAST); + return std::make_unique(nf, + fScaleFactor, + nLevels, + fIniThFAST, + fMinThFAST); } - +//----------------------------------------------------------------------------- #ifndef TARGET_OS_IOS std::unique_ptr FeatureExtractorFactory::glslExtractor(const cv::Size& videoFrameSize, @@ -103,4 +117,5 @@ std::unique_ptr FeatureExtractorFactory::glslExtractor(const cv::Si bigSigma, smallSigma); } +//----------------------------------------------------------------------------- #endif diff --git a/apps/source/wai/WAIAppTest.h b/apps/source/wai/WAIAppTest.h index f41bbeb7..9031d1a6 100644 --- a/apps/source/wai/WAIAppTest.h +++ b/apps/source/wai/WAIAppTest.h @@ -9,6 +9,7 @@ class SLSceneView; class SENSCamera; +//----------------------------------------------------------------------------- struct AppDirectories { std::string writableDir; @@ -17,8 +18,8 @@ struct AppDirectories std::string vocabularyDir; std::string logFileDir; }; - -// implements app functionality (e.g. scene description, which camera, how to start and use WAISlam) +//----------------------------------------------------------------------------- +//! Implements app functionality (e.g. scene description, which camera, how to start and use WAISlam) class WAIApp : public SLInputEventInterface { public: @@ -26,7 +27,10 @@ class WAIApp : public SLInputEventInterface WAIApp(); - void init(int screenWidth, int screenHeight, int screenDpi, AppDirectories directories); + void init(int screenWidth, + int screenHeight, + int screenDpi, + AppDirectories directories); void initCloseAppCallback(CloseAppCallback cb); void initCamera(SENSCamera* camera); @@ -60,5 +64,5 @@ class WAIApp : public SLInputEventInterface bool _initSceneGraphDone = false; bool _initIntroSceneDone = false; }; - +//----------------------------------------------------------------------------- #endif // WAI_APP_TEST_H \ No newline at end of file diff --git a/apps/source/wai/WAIMapStorage.h b/apps/source/wai/WAIMapStorage.h index 834fec57..957e7c7c 100644 --- a/apps/source/wai/WAIMapStorage.h +++ b/apps/source/wai/WAIMapStorage.h @@ -7,6 +7,7 @@ #include #include +//----------------------------------------------------------------------------- class WAI_API WAIMapStorage { struct MapInfo @@ -99,5 +100,5 @@ class WAI_API WAIMapStorage static void writeCVMatToBinaryFile(FILE* f, const cv::Mat& mat); static cv::Mat loadCVMatFromBinaryStream(uint8_t** data, int rows, int cols, int type); }; - +//----------------------------------------------------------------------------- #endif diff --git a/docs/pages/SLProject.md b/docs/pages/SLProject.md index d1774b0d..d46347f9 100644 --- a/docs/pages/SLProject.md +++ b/docs/pages/SLProject.md @@ -3,7 +3,7 @@

Welcome to the SLProject. SL stands for Scene Library. It is developed at the -Berne University of Applied Sciences (BFH) and is used for student projects in the +Bern University of Applied Sciences (BFH) and is used for student projects in the cpvrLab. The various applications show what you can learn in three semesters about 3D computer graphics in real time rendering and ray tracing. The framework is built in C++ and OpenGL ES and can be built for Windows, @@ -89,5 +89,5 @@ The framework uses beside OpenGL the following external libraries that are also

Author: marcus.hudritsch@bfh.ch
Date: June 2024
-Copyright (c): 2002-2023 Marcus Hudritsch, Kirchrain 18, 2572 Sutz, Switzerland +Copyright (c): 2002-2024 Marcus Hudritsch, Kirchrain 18, 2572 Sutz, Switzerland

diff --git a/modules/math/source/SLAlgo.h b/modules/math/source/SLAlgo.h index 1de4e4fe..7831bb4a 100644 --- a/modules/math/source/SLAlgo.h +++ b/modules/math/source/SLAlgo.h @@ -1,12 +1,12 @@ /** - * \file math/SLAlgo.h + * \file SLAlgo.h * \brief Container for general algorithm functions * \date November * \remarks Please use clangformat to format the code. See more code style on * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style * \authors Michael Goettlicher, Marcus Hudritsch * \copyright http://opensource.org/licenses/GPL-3.0 -*/ + */ #ifndef SLALGO_H #define SLALGO_H @@ -16,6 +16,7 @@ #include //----------------------------------------------------------------------------- +//! Collection of algorithms that may should be integrated into other namespaces namespace SLAlgo { bool estimateHorizon(const SLMat3f& enuRs, const SLMat3f& sRc, SLVec3f& horizon); @@ -26,7 +27,13 @@ T geoDegMinSec2Decimal(int degrees, int minutes, T seconds); //! Latitude Longitude Altitude (LatLonAlt), defined in Degrees, Minutes, Secondes format to decimal template -SLVec3 geoDegMinSec2Decimal(int degreesLat, int minutesLat, T secondsLat, int degreesLon, int minutesLon, T secondsLon, T alt); +SLVec3 geoDegMinSec2Decimal(int degreesLat, + int minutesLat, + T secondsLat, + int degreesLon, + int minutesLon, + T secondsLon, + T alt); }; //----------------------------------------------------------------------------- diff --git a/modules/utils/source/CustomLog.h b/modules/utils/source/CustomLog.h index 676ab658..baf76ea1 100644 --- a/modules/utils/source/CustomLog.h +++ b/modules/utils/source/CustomLog.h @@ -15,6 +15,7 @@ namespace Utils { +//----------------------------------------------------------------------------- //! Logger interface class CustomLog { @@ -22,6 +23,7 @@ class CustomLog virtual void post(const std::string& message) = 0; virtual ~CustomLog() { ; } }; +//----------------------------------------------------------------------------- } #endif diff --git a/modules/utils/source/FileLog.cpp b/modules/utils/source/FileLog.cpp index 8353413a..f438dfe5 100644 --- a/modules/utils/source/FileLog.cpp +++ b/modules/utils/source/FileLog.cpp @@ -5,7 +5,7 @@ * \remarks Please use clangformat to format the code. See more code style on * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style * \copyright http://opensource.org/licenses/GPL-3.0 -*/ + */ #include "FileLog.h" @@ -16,6 +16,7 @@ namespace Utils { +//----------------------------------------------------------------------------- FileLog::FileLog(std::string logDir, bool forceFlush) : _forceFlush(forceFlush) { @@ -32,22 +33,23 @@ FileLog::FileLog(std::string logDir, bool forceFlush) Utils::errorMsg("Utils", msg.c_str(), __LINE__, __FILE__); } } - +//----------------------------------------------------------------------------- FileLog::~FileLog() { _logFile.flush(); _logFile.close(); } - +//----------------------------------------------------------------------------- void FileLog::flush() { _logFile.flush(); } - +//----------------------------------------------------------------------------- void FileLog::post(const std::string& message) { _logFile << message; if (_forceFlush) _logFile.flush(); } +//----------------------------------------------------------------------------- }; diff --git a/modules/utils/source/FileLog.h b/modules/utils/source/FileLog.h index 60c02396..1797e14f 100644 --- a/modules/utils/source/FileLog.h +++ b/modules/utils/source/FileLog.h @@ -5,7 +5,7 @@ * \copyright http://opensource.org/licenses/GPL-3.0 * \remarks Please use clangformat to format the code. See more code style on * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style -*/ + */ #ifndef CPLVRLAB_FILE_LOG_H #define CPLVRLAB_FILE_LOG_H @@ -15,6 +15,8 @@ namespace Utils { +//----------------------------------------------------------------------------- +//! File logging class class FileLog { public: @@ -27,6 +29,7 @@ class FileLog std::ofstream _logFile; bool _forceFlush; }; +//----------------------------------------------------------------------------- }; #endif // CPLVRLAB_FILE_LOG_H diff --git a/modules/utils/source/FtpUtils.cpp b/modules/utils/source/FtpUtils.cpp index a2e2754a..2f622f19 100644 --- a/modules/utils/source/FtpUtils.cpp +++ b/modules/utils/source/FtpUtils.cpp @@ -20,9 +20,8 @@ using namespace std; namespace FtpUtils { //----------------------------------------------------------------------------- -//! Uploads the file to the ftp server. checks if the filename already exists and adds a version number +//! Uploads the file to the ftp server. Checks if the filename already exists and adds a version number /*! - * * \param fileDir * \param fileName * \param ftpHost @@ -110,7 +109,6 @@ bool uploadFileLatestVersion(const string& fileDir, //----------------------------------------------------------------------------- //! Download the file from the ftp server which has the latest version and store it as fileName locally /*! - * * \param fileDir * \param fileName * \param ftpHost diff --git a/modules/utils/source/Utils.h b/modules/utils/source/Utils.h index ff70bd5b..4227616c 100644 --- a/modules/utils/source/Utils.h +++ b/modules/utils/source/Utils.h @@ -283,7 +283,7 @@ unsigned closestPowerOf2(unsigned num); unsigned nextPowerOf2(unsigned num); //----------------------------------------------------------------------------- // clang-format on - +//! Class for holding computer information class ComputerInfos { public: diff --git a/modules/wai/source/WAIMath.h b/modules/wai/source/WAIMath.h index 7e2fbcf9..36ef618e 100644 --- a/modules/wai/source/WAIMath.h +++ b/modules/wai/source/WAIMath.h @@ -3,9 +3,10 @@ #include +//! WAI : Where Am I: Collection of duplicate structs for vectors namespace WAI { - +//----------------------------------------------------------------------------- struct V2 { union @@ -21,7 +22,7 @@ struct V2 }; }; }; - +//----------------------------------------------------------------------------- struct V3 { union @@ -33,7 +34,7 @@ struct V3 }; }; }; - +//----------------------------------------------------------------------------- inline V3 v3(float x, float y, float z) { V3 result; @@ -44,7 +45,7 @@ inline V3 v3(float x, float y, float z) return result; } - +//----------------------------------------------------------------------------- inline V3 subV3(V3 v1, V3 v2) { V3 result; @@ -55,7 +56,7 @@ inline V3 subV3(V3 v1, V3 v2) return result; } - +//----------------------------------------------------------------------------- struct M3x3 { float e[3][3]; @@ -82,7 +83,7 @@ inline M3x3 identityM3x3() return result; } - +//----------------------------------------------------------------------------- inline M3x3 multM3x3(M3x3 m1, M3x3 m2) { M3x3 result = {}; @@ -102,7 +103,7 @@ inline M3x3 multM3x3(M3x3 m1, M3x3 m2) return result; } - +//----------------------------------------------------------------------------- inline V3 multM3x3V3(M3x3 m, V3 v) { V3 result = {}; @@ -117,7 +118,7 @@ inline V3 multM3x3V3(M3x3 m, V3 v) return result; } - +//----------------------------------------------------------------------------- inline M3x3 rotateXM3x3(float theta) { M3x3 result = identityM3x3(); @@ -135,5 +136,5 @@ struct M4x4 float e[4][4]; }; } - +//----------------------------------------------------------------------------- #endif