Parcourir la source

Code formatting and documentation.

Iñigo Valentin il y a 4 ans
Parent
commit
b093743e2d
100 fichiers modifiés avec 5278 ajouts et 3224 suppressions
  1. 1 13
      CIBuild/linux/dependencies.sh
  2. 20 4
      QGearsMain/include/LuaIncludes.h
  3. 33 7
      QGearsMain/include/QGearsGameState.h
  4. 22 30
      QGearsMain/include/QGearsPrerequisites.h
  5. 169 30
      QGearsMain/include/common/File.h
  6. 87 12
      QGearsMain/include/common/FileSystem.h
  7. 94 22
      QGearsMain/include/common/LzsFile.h
  8. 264 74
      QGearsMain/include/common/QGearsApplication.h
  9. 248 75
      QGearsMain/include/common/QGearsManualObject.h
  10. 66 51
      QGearsMain/include/common/QGearsResource.h
  11. 56 36
      QGearsMain/include/common/QGearsStringUtil.h
  12. 173 39
      QGearsMain/include/common/TypeDefine.h
  13. 19 9
      QGearsMain/include/common/make_unique.h
  14. 187 51
      QGearsMain/include/core/particles/Particle.h
  15. 22 8
      QGearsMain/include/core/particles/ParticleAdditionalData.h
  16. 247 45
      QGearsMain/include/core/particles/ParticleEmitter.h
  17. 76 22
      QGearsMain/include/core/particles/ParticleEmitterDictionary.h
  18. 1 1
      QGearsMain/include/core/particles/ParticleEmitterFactory.h
  19. 30 9
      QGearsMain/include/core/particles/ParticleEmitterTranslator.h
  20. 218 134
      QGearsMain/include/core/particles/ParticlePool.h
  21. 222 145
      QGearsMain/include/core/particles/ParticlePoolMap.h
  22. 113 24
      QGearsMain/include/core/particles/ParticleRenderer.h
  23. 63 27
      QGearsMain/include/core/particles/ParticleRendererFactory.h
  24. 30 9
      QGearsMain/include/core/particles/ParticleRendererTranslator.h
  25. 114 24
      QGearsMain/include/core/particles/ParticleSystem.h
  26. 56 14
      QGearsMain/include/core/particles/ParticleSystemFactory.h
  27. 193 60
      QGearsMain/include/core/particles/ParticleSystemManager.h
  28. 28 9
      QGearsMain/include/core/particles/ParticleSystemTranslator.h
  29. 57 15
      QGearsMain/include/core/particles/ParticleSystemTranslatorManager.h
  30. 207 55
      QGearsMain/include/core/particles/ParticleTechnique.h
  31. 30 9
      QGearsMain/include/core/particles/ParticleTechniqueTranslator.h
  32. 34 11
      QGearsMain/include/core/particles/ParticleVisual.h
  33. 33 12
      QGearsMain/include/core/particles/emitters/ParticlePointEmitter.h
  34. 51 24
      QGearsMain/include/core/particles/emitters/ParticlePointEmitterFactory.h
  35. 41 22
      QGearsMain/include/core/particles/renderer/ParticleEntityAdditionalData.h
  36. 102 23
      QGearsMain/include/core/particles/renderer/ParticleEntityRenderer.h
  37. 48 23
      QGearsMain/include/core/particles/renderer/ParticleEntityRendererFactory.h
  38. 1 1
      QGearsMain/include/data/QGearsCameraMatrixFile.h
  39. 1 1
      QGearsMain/include/data/QGearsFLevelFileSerializer.h
  40. 3 3
      QGearsMain/include/data/QGearsLGPArchive.h
  41. 1 1
      QGearsMain/include/data/QGearsLGPArchiveFactory.h
  42. 10 10
      QGearsMain/include/data/QGearsLZSDataStream.h
  43. 2 2
      QGearsMain/include/data/worldmap/MapFile.h
  44. 2 2
      QGearsMain/include/data/worldmap/MapFileManager.h
  45. 2 2
      QGearsMain/include/data/worldmap/MapFileSerializer.h
  46. 2 2
      QGearsMain/include/data/worldmap/TxzFile.h
  47. 2 2
      QGearsMain/include/data/worldmap/TxzFileManager.h
  48. 2 2
      QGearsMain/include/data/worldmap/TxzFileSerializer.h
  49. 1 1
      QGearsMain/include/map/QGearsBackground2DFile.h
  50. 2 2
      QGearsMain/include/modules/worldmap/WorldMapModule.h
  51. 22 0
      QGearsMain/include/vgears_version.h
  52. 22 0
      QGearsMain/include/vgears_version.h.in
  53. 67 68
      QGearsMain/src/Main.cpp
  54. 14 25
      QGearsMain/src/QGearsGameState.cpp
  55. 72 103
      QGearsMain/src/common/File.cpp
  56. 34 47
      QGearsMain/src/common/FileSystem.cpp
  57. 62 87
      QGearsMain/src/common/LzsFile.cpp
  58. 160 191
      QGearsMain/src/common/QGearsApplication.cpp
  59. 164 235
      QGearsMain/src/common/QGearsManualObject.cpp
  60. 14 27
      QGearsMain/src/common/QGearsResource.cpp
  61. 21 41
      QGearsMain/src/common/QGearsStringUtil.cpp
  62. 30 43
      QGearsMain/src/common/TypeDefine.cpp
  63. 27 28
      QGearsMain/src/core/particles/Particle.cpp
  64. 84 87
      QGearsMain/src/core/particles/ParticleEmitter.cpp
  65. 39 29
      QGearsMain/src/core/particles/ParticleEmitterDictionary.cpp
  66. 70 40
      QGearsMain/src/core/particles/ParticleEmitterTranslator.cpp
  67. 32 46
      QGearsMain/src/core/particles/ParticleRenderer.cpp
  68. 67 39
      QGearsMain/src/core/particles/ParticleRendererTranslator.cpp
  69. 54 70
      QGearsMain/src/core/particles/ParticleSystem.cpp
  70. 37 25
      QGearsMain/src/core/particles/ParticleSystemFactory.cpp
  71. 156 162
      QGearsMain/src/core/particles/ParticleSystemManager.cpp
  72. 44 29
      QGearsMain/src/core/particles/ParticleSystemTranslator.cpp
  73. 43 29
      QGearsMain/src/core/particles/ParticleSystemTranslatorManager.cpp
  74. 175 295
      QGearsMain/src/core/particles/ParticleTechnique.cpp
  75. 36 23
      QGearsMain/src/core/particles/ParticleTechniqueTranslator.cpp
  76. 21 16
      QGearsMain/src/core/particles/ParticleVisual.cpp
  77. 18 12
      QGearsMain/src/core/particles/emitters/ParticlePointEmitter.cpp
  78. 116 127
      QGearsMain/src/core/particles/renderer/ParticleEntityRenderer.cpp
  79. 18 9
      QGearsMain/src/core/particles/renderer/ParticleEntityRendererDictionary.cpp
  80. 4 4
      QGearsMain/src/data/QGearsCameraMatrixFile.cpp
  81. 5 5
      QGearsMain/src/data/QGearsFLevelFileSerializer.cpp
  82. 7 7
      QGearsMain/src/data/QGearsHRCFile.cpp
  83. 7 7
      QGearsMain/src/data/QGearsHRCMeshLoader.cpp
  84. 1 1
      QGearsMain/src/data/QGearsLGPArchive.cpp
  85. 5 5
      QGearsMain/src/data/QGearsLGPArchiveSerializer.cpp
  86. 8 8
      QGearsMain/src/data/QGearsLZSDataStream.cpp
  87. 2 2
      QGearsMain/src/data/worldmap/MapFile.cpp
  88. 2 2
      QGearsMain/src/data/worldmap/MapFileManager.cpp
  89. 2 2
      QGearsMain/src/data/worldmap/MapFileSerializer.cpp
  90. 2 2
      QGearsMain/src/data/worldmap/TxzFile.cpp
  91. 2 2
      QGearsMain/src/data/worldmap/TxzFileManager.cpp
  92. 2 2
      QGearsMain/src/data/worldmap/TxzFileSerializer.cpp
  93. 3 3
      QGearsMain/src/map/QGearsBackground2DFile.cpp
  94. 2 2
      QGearsMain/src/modules/worldmap/WorldMapModule.cpp
  95. 3 3
      QGearsMain/src/viewer/ViewerModule.cpp
  96. 1 1
      Tests/QGearsMain/src/test_QGearsLGPArchive.cpp
  97. 5 5
      Tests/QGearsMain/src/test_QGearsLZSDataStream.cpp
  98. 3 9
      debian/changelog
  99. 5 6
      debian/control
  100. 2 4
      debian/copyright

+ 1 - 13
CIBuild/linux/dependencies.sh

@@ -1,13 +1 @@
-sudo apt-get install boost1.55
-sudo apt-get install libvorbis-dev
-sudo apt-get install libalut-dev
-sudo apt-get install libfreetype6-dev
-sudo apt-get install libfreeimage-dev
-sudo apt-get install zlib1g-dev
-sudo apt-get install libzzip-dev
-sudo apt-get install libois-dev
-sudo apt-get install libglu-dev
-sudo apt-get install libqt4-dev
-sudo apt-get install libpng
-wget https://github.com/paulsapps/Ogre1.9/releases/download/1.9.0/ogre-build_1.9.0-1_amd64.deb
-sudo dpkg -i ogre-build_1.9.0-1_amd64.deb
+sudo apt-get install libogre-1.12-dev libtinyxml-dev boost1.55 libvorbis-dev libalut-dev libfreetype6-dev libfreeimage-dev zlib1g-dev libzzip-dev libois-dev libglu-dev libqt5core5a libqt5widgets5 libpng

+ 20 - 4
QGearsMain/include/LuaIncludes.h

@@ -1,6 +1,24 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/**
+ * This file wraps the LUA includes for platform specific build workarounds.
+ */
+
 #pragma once
 
-// Wraps the LUA includes for platform specific build workarounds
 #ifdef __APPLE__
 // Something in the Apple headers seems to #define nil as __NULL 
 // this then causes a build error in luabind:
@@ -15,9 +33,7 @@
 #include <luabind/luabind.hpp>
 #include <luabind/yield_policy.hpp>
 
-
-extern "C"
-{
+extern "C"{
     #include "lua.h"
     #include <lualib.h>
     #include <lauxlib.h>

+ 33 - 7
QGearsMain/include/QGearsGameState.h

@@ -1,15 +1,41 @@
-#ifndef __QGearsGameState_H__
-#define __QGearsGameState_H__
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-namespace QGears
-{
-    enum GAME_STATE
-    {
+#pragma once
+
+namespace QGears{
+
+    /**
+     * Indicators for the game state.
+     */
+    enum GAME_STATE{
+
+        /**
+         * The game is ready to be quit and can exit in the next loop pass.
+         */
         G_EXIT,
+
+        /**
+         * The game is running normally.
+         */
         G_GAME
     };
 
+    /**
+     * Global application status indicator.
+     */
     extern GAME_STATE g_ApplicationState;
 }
 
-#endif // __QGearsGameState_H__

+ 22 - 30
QGearsMain/include/QGearsPrerequisites.h

@@ -1,30 +1,25 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
-
-Copyright (c) 2013-07-30 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __QGearsPrerequisites_H__
-#define __QGearsPrerequisites_H__
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/**
+ * This file import prerequisites.
+ *
+ * Conditioned for different platforms.
+ */
+
+#pragma once
 
 #include <OgrePrerequisites.h>
 
@@ -34,11 +29,8 @@ THE SOFTWARE.
 #   else
 #       define _QGearsExport __declspec(dllimport)
 #   endif
-#elif defined ( OGRE_GCC_VISIBILITY )
+#elif defined (OGRE_GCC_VISIBILITY)
 #   define _QGearsExport  __attribute__ ((visibility("default")))
 #else
 #   define _QGearsExport
 #endif
-
-
-#endif // __QGearsPrerequisites_H__

+ 169 - 30
QGearsMain/include/common/File.h

@@ -1,38 +1,177 @@
-#ifndef FILE_H
-#define FILE_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-#include <OgreString.h>
+#pragma once
 
+#include <OgreString.h>
 #include "common/TypeDefine.h"
 
+/**
+ * Represents a file.
+ */
+class File{
 
-class File
-{
-public:
-    File( const Ogre::String& file );
-    File( const File* pFile );
-    File( const File* pFile, u32 offset, u32 length );
-    File( const u8* pBuffer, u32 offset, u32 length );
-    virtual ~File();
-
-    void WriteFile( const Ogre::String& file ) const;
-    const Ogre::String& GetFileName() const;
-    u32 GetFileSize() const;
-    void GetFileBuffer( u8* pBuffer, const u32 &start, const u32 &length ) const;
-    u8 GetU8( u32 offset ) const;
-    u16 GetU16LE( u32 offset ) const;
-    u32 GetU32LE( u32 offset ) const;
-    u8 readU8();
-    u16 readU16LE();
-    u32 readU32LE();
-
-protected:
-    Ogre::String m_FileName;
-    u32 m_offset;
-    u8* m_Buffer;
-    u32 m_BufferSize;
-};
+    public:
+
+        /**
+         * Opens a file.
+         *
+         * @param file[in] Path to the file.
+         */
+        File(const Ogre::String& file);
+
+        /**
+         * Opens a file.
+         *
+         * @param file[in] Pointer to the file.
+         */
+        File(const File* file);
+
+        /**
+         * Loads a file fragment.
+         *
+         * @param file[in] Pointer to the file.
+         * @param offset[in] Offset to the data to load.
+         * @param length[in] Length of the data to load.
+         */
+        File(const File* file, u32 offset, u32 length);
+
+        /**
+         * Loads a file fragment from a buffer.
+         *
+         * @param buffer[in] Pointer to the buffer to load from.
+         * @param offset[in] Offset to the data to load.
+         * @param length[in] Length of the data to load.
+         */
+        File(const u8* buffer, u32 offset, u32 length);
+
+        /**
+         * Destructor.
+         */
+        virtual ~File();
+
+        /**
+         * Writes the contents of the buffer to a file.
+         *
+         * @param file Path of the file to save
+         */
+        void WriteFile(const Ogre::String& file) const;
+
+        /**
+         * Retrieves the file name.
+         *
+         * @The file name, without path.
+         */
+        const Ogre::String& GetFileName() const;
+
+        /**
+         * Retrieves the file size.
+         *
+         * @return File size, in bytes.
+         */
+        u32 GetFileSize() const;
 
+        /**
+         * Loads a buffer with the file data.
+         *
+         * @param buffer[out] Pointer to the buffer to load.
+         * @param start[in] Offset to the data to load.
+         * @param length[in] Length of the data to load.
+         */
+        void GetFileBuffer(
+          u8* buffer, const u32 &start, const u32 &length
+        ) const;
 
+        /**
+         * Retrieves a pointer to a byte address in the file.
+         *
+         * @param offset[in] The offset to the requested address.
+         */
+        u8 GetU8(u32 offset) const;
 
-#endif // FILE_H
+        /**
+         * Retrieves a pointer to a two-byte address in the file.
+         *
+         * The data must b considered to be in little endian.
+         *
+         * @param offset[in] The offset to the requested address.
+         */
+        u16 GetU16LE(u32 offset) const;
+
+        /**
+         * Retrieves a pointer to a four-byte address in the file.
+         *
+         * The data must b considered to be in little endian.
+         *
+         * @param offset[in] The offset to the requested address.
+         */
+        u32 GetU32LE(u32 offset) const;
+
+        /**
+         * Reads a byte from the file.
+         *
+         * Advances the current offset by one byte.
+         *
+         * @return The data in the byte in the current offset of the file.
+         */
+        u8 readU8();
+
+        /**
+         * Reads two bytes from the file (little endian).
+         *
+         * Advances the current offset by two bytes.
+         *
+         * @return Two bytes of data from the current offset of the file.
+         */
+        u16 readU16LE();
+
+        /**
+         * Reads four bytes from the file (little endian).
+         *
+         * Advances the current offset by four byte.
+         *
+         * @return Four bytes of data from the current offset of the file.
+         */
+        u32 readU32LE();
+
+    protected:
+
+        /**
+         * The file name.
+         */
+        Ogre::String file_name_;
+
+        /**
+         * Current offset of the file.
+         *
+         * Default is 0. Can be set on instantiation with {@see
+         * File(const File* file, u32 offset, u32 length)} or {@see
+         * File(const u8* buffer, u32 offset, u32 length)} and advanced with
+         * {@see readU8}, {@see readU16LE} or {@see readU32LE}
+         */
+        u32 offset_;
+
+        /**
+         * The file buffer.
+         *
+         * It contains the file data.
+         */
+        u8* buffer_;
+
+        /**
+         * The allocated size of {@see buffer_}.
+         */
+        u32 buffer_size_;
+};

+ 87 - 12
QGearsMain/include/common/FileSystem.h

@@ -1,17 +1,92 @@
-#ifndef FILESYSTEM_H
-#define FILESYSTEM_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreString.h>
 
-class FileSystem
-{
-public:
-    FileSystem() = delete;
-    static unsigned int GetFileSize(const Ogre::String& path);
-    static bool         ReadFile(const Ogre::String &path, void* buffer, const unsigned int start, const unsigned int length);
-    static bool         WriteFile(const Ogre::String &path, const void* buffer, const unsigned int length);
-    static bool         WriteNewFile(const Ogre::String &path, const void* buffer, const unsigned int length);
-    static bool         RemoveFile(const Ogre::String &path);
+/**
+ * Static class which allows filesystem manipulation
+ */
+class FileSystem{
+
+    public:
+
+        /**
+         * Destructor.
+         */
+        FileSystem() = delete;
+
+        /**
+         * Retrieves a file size.
+         *
+         * @param path[in] Path to the file.
+         * @return File size, in bytes. 0 on error.
+         */
+        static unsigned int GetFileSize(const Ogre::String& path);
+
+        /**
+         * Reads a file contents and saves them to a buffer.
+         *
+         * @param path[in] Path to the file to read.
+         * @param buffer[out] The buffer to populate with file data.
+         * @param start[in] Offset at which to start reading.
+         * @param lenght[in] Size of the data to read, in bytes.
+         * @return True if the file was successfully read, false on error.
+         */
+        static bool ReadFile(
+          const Ogre::String &path, void* buffer,
+          const unsigned int start, const unsigned int length
+        );
+
+        /**
+         * Writes the contents of a buffer to a file.
+         *
+         * The file must exists, and the new data will be appended at the end.
+         *
+         * @param path[in] Path to the file to write.
+         * @param buffer[in] Buffer with the data.
+         * @param length[in] Size of the data to write, in bytes.
+         * @return True if the file was successfully written, false on error.
+         */
+        static bool WriteFile(
+          const Ogre::String &path, const void* buffer,
+          const unsigned int length
+        );
+
+        /**
+         * Writes the contents of a buffer to new a file.
+         *
+         * If the file exists, it will be deleted before adding the new data.
+         *
+         * @param path[in] Path to the file to write.
+         * @param buffer[in] Buffer with the data.
+         * @param length[in] Size of the data to write, in bytes.
+         * @return True if the file was successfully written, false on error.
+         */
+        static bool WriteNewFile(
+          const Ogre::String &path, const void* buffer,
+          const unsigned int length
+        );
+
+        /**
+         * Deletes a file.
+         *
+         * @param path Path to the file to delete.
+         * @return True if the file was successfully deleted, false on error.
+         */
+        static bool RemoveFile(const Ogre::String &path);
 };
 
-#endif // FILESYSTEM_H

+ 94 - 22
QGearsMain/include/common/LzsFile.h

@@ -1,30 +1,102 @@
-#ifndef LZS_FILE_H
-#define LZS_FILE_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
+#pragma once
+
+#include <vector>
 #include "common/File.h"
 #include "common/TypeDefine.h"
-#include <vector>
 
-class LzsFile : public File
-{
-public:
-    LzsFile(const Ogre::String& file);
-    LzsFile(File* pFile);
-    LzsFile(File* pFile, u32 offset, u32 length);
-    LzsFile(const u8* pBuffer, u32 offset, u32 length);
-    virtual ~LzsFile();
-
-private:
-    void ExtractLzs();
-    friend class LzsBuffer;
-};
+/**
+ * Represents an LZS file.
+ *
+ * More info about lzs fromat: {@link
+ * https://wiki.ffrtt.ru/index.php?title=FF7/LZSS_format}
+ */
+class LzsFile : public File{
+
+    public:
+
+        /**
+         * Opens a lzs file and extracts it's contents
+         *
+         * @param file[in] Path to the file.
+         */
+        LzsFile(const Ogre::String& file);
+
+        /**
+         * Opens a lzs file and extracts it's contents
+         *
+         * @param file[in] Pointer to the file.
+         */
+        LzsFile(File* file);
+
+        /**
+         * Opens a lzs file fragment and extracts it's contents
+         *
+         * @param file[in] Path to the file.
+         * @param offset[in] Offset to the file contents a which to start
+         * reading.
+         * @param ength[in] Length of the data to read from the file, in bytes.
+         */
+        LzsFile(File* file, u32 offset, u32 length);
 
-class LzsBuffer
-{
-public:
-    LzsBuffer() = delete;
-    static std::vector<QGears::uint8> Decompress(const std::vector<QGears::uint8>& buffer);
+        /**
+         * Opens a lzs file fragment from a buffer and extracts it's contents
+         *
+         * @param file[in] Pointer to the buffer which holds the data.
+         * @param offset[in] Offset to the buffer contents a which to start
+         * reading.
+         * @param ength[in] Length of the data to read, in bytes.
+         */
+        LzsFile(const u8* buffer, u32 offset, u32 length);
+
+        /**
+         * Destructor.
+         */
+        virtual ~LzsFile();
+
+    private:
+
+        /**
+         * Extracts the file contents to the buffer.
+         */
+        void ExtractLzs();
+
+        friend class LzsBuffer;
 };
 
+/**
+ * A buffer forr the contents of a lzs file.
+ */
+class LzsBuffer{
 
-#endif // LZS_FILE_H
+    public:
+
+        /**
+         * No costructor.
+         */
+        LzsBuffer() = delete;
+
+        /**
+         * Decompresses lzs data in a buffer.
+         *
+         * @param buffer[in] Buffer with the data of the lzs file.
+         * @return Decompressed data.
+         */
+        static std::vector<QGears::uint8> Decompress(
+          const std::vector<QGears::uint8>& buffer
+        );
+};

+ 264 - 74
QGearsMain/include/common/QGearsApplication.h

@@ -1,84 +1,274 @@
 /*
------------------------------------------------------------------------------
-Copyright (c) 19.10.2013 Tobias Peters <tobias.peters@kreativeffekt.at>
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-This file is part of Q-Gears
-
-Q-Gears is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.0 (GPLv2) of the License.
-
-Q-Gears is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
------------------------------------------------------------------------------
-*/
-#ifndef __QGearsApplication_H__
-#define __QGearsApplication_H__
+#pragma once
 
 #include <OgreRoot.h>
 #include <OgreOverlaySystem.h>
 #include <memory>
 #include "TypeDefine.h"
 
-namespace QGears
-{
-    class Application : public Ogre::Singleton<Application>
-    {
-    public:
-        Application(Ogre::String pluginsFileName, Ogre::String resourcesFile, Ogre::String logFileName)
-            : m_plugins_filename(pluginsFileName), m_resources_filename(resourcesFile), m_log_filename(logFileName)
-        {
-
-        }
-        Application( int argc, char *argv[] );
-        virtual ~Application();
-        bool                initOgre( bool hideWindow = false );
-        Ogre::Root*         getRoot( void );
-        Ogre::RenderWindow* getRenderWindow( void );
-        const String&       getResourcesFilename( void );
-        Ogre::ResourceGroupManager* ResMgr() { return mResMgr; }
-    protected:
-        String  getWindowTitle( void ) const;
-        bool    processCommandLine( int argc, char *argv[] );
-        void    registerArchiveFactories( void );
-        void    loadResourcesConfig( void );
-        void    initComponents( void );
-        void    destroyComponents( void );
-        void    createResourceManagers( void );
-        void    destroyResourceManagers( void );
-
-    private:
-        typedef std::vector<std::shared_ptr<Ogre::ResourceManager>> ResourceManagerVector;
-
-
-        static const char*      CLI_SECTION_GENERIC;
-        static const char*      CLI_HELP;
-        static const char*      CLI_HELP_DESCRIPTION;
-        static const char*      CLI_CONFIG_FILE;
-        static const char*      CLI_CONFIG_FILE_DESCRIPTION;
-        static const char*      CLI_LOG_FILE;
-        static const char*      CLI_LOG_FILE_DESCRIPTION;
-        static const char*      CLI_PLUGINS_FILE;
-        static const char*      CLI_PLUGINS_FILE_DESCRIPTION;
-        static const char*      CLI_RESOURCES_FILE;
-        static const char*      CLI_RESOURCES_FILE_DESCRIPTION;
-
-        int     m_argc = 0;
-        char  **m_argv = nullptr;
-        String  m_config_filename;
-        String  m_log_filename;
-        String  m_plugins_filename;
-        String  m_resources_filename;
-
-        bool m_initialized = false;
-        std::unique_ptr<Ogre::Root> m_root;
-        std::unique_ptr<Ogre::OverlaySystem> m_overlay_system;
-        Ogre::RenderWindow* m_render_window = nullptr; // Not owned
-        ResourceManagerVector m_resource_managers;
-        Ogre::ResourceGroupManager* mResMgr = nullptr; // Not owned
+/**
+ * The V-Gears main applicacion
+ */
+namespace QGears{
+
+    class Application : public Ogre::Singleton<Application>{
+
+        public:
+
+            /**
+             * Constructor.
+             *
+             * @param pluginsFileName[in] Path to the plugins file.
+             * @param resourcesFile[in] Path to the resources file.
+             * @param logFileName[in] Path to the log file.
+             */
+            Application(
+              Ogre::String pluginsFileName,
+              Ogre::String resourcesFile, Ogre::String logFileName
+            ): plugins_filename_(pluginsFileName),
+               resources_filename_(resourcesFile), log_filename_(logFileName)
+            {}
+
+            /**
+             * Constructor.
+             *
+             * @param argc[in] Number of command line arguments.
+             * @param argv[in] List of command line arguments.
+             */
+            Application(int argc, char *argv[]);
+
+            /**
+             * Destructor.
+             */
+            virtual ~Application();
+
+            /**
+             * Initializes the Ogre rendering system.
+             *
+             * @param hideWindow[in] True to not show the main window, false to
+             * show it.
+             * @return True if the system was succesfully initiated, false
+             * if there were errors or it was already initialized.
+             */
+            bool initOgre(bool hideWindow = false);
+
+            /**
+             * Retrieves the Ogre system main component.
+             *
+             * @return Pointer to the Ogre main component.
+             */
+            Ogre::Root* getRoot(void);
+
+            /**
+             * Retrieves the Ogre main window.
+             *
+             * @return Pointer to the Ogre window.
+             */
+            Ogre::RenderWindow* getRenderWindow(void);
+
+            /**
+             * Retrieves the Ogre resources file name.
+             *
+             * @return Ogre resource configuration file name.
+             */
+            const String& getResourcesFilename(void);
+
+            /**
+             * Retrieves the Ogre resource manager.
+             *
+             * @return Pointer to the Ogre resource manager.
+             */
+            Ogre::ResourceGroupManager* ResMgr() {return res_mgr_;}
+
+        protected:
+
+            /**
+             * Retrieves the main window title.
+             *
+             * @return Th windo title.
+             */
+            String getWindowTitle(void) const;
+
+            /**
+             * Processes command line arguments.
+             *
+             * @param argc[in] Number of command line arguments.
+             * @param argv[in] List of command line arguments.
+             * @return True if all arguments were successfully processed, false
+             * on error
+             */
+            bool processCommandLine(int argc, char *argv[]);
+
+            /**
+             * Registers an {@see LGPArchiveFactory} with the Ogre archive
+             * manager
+             */
+            void registerArchiveFactories(void);
+
+            /**
+             * Loads the resource configuration from  the file.
+             */
+            void loadResourcesConfig(void);
+
+            /**
+             * Initializes components.
+             *
+             * Initializes the TexCodec component and the resource manager.
+             */
+            void initComponents(void);
+
+            /**
+             * Unloads components.
+             *
+             * Unoads the TexCodec component and the resource manager.
+             */
+            void destroyComponents(void);
+
+            /**
+             * Initializes the resource manager.
+             */
+            void createResourceManagers(void);
+
+            /**
+             * Unloads the resource manager.
+             */
+            void destroyResourceManagers(void);
+
+        private:
+
+            /**
+             * List of resource managers.
+             */
+            typedef std::vector<std::shared_ptr<Ogre::ResourceManager>>
+              ResourceManagerVector;
+
+            /**
+             * String for the command line help text.
+             */
+            static const char* CLI_SECTION_GENERIC;
+
+            /**
+             * String for the command line arguments.
+             */
+            static const char* CLI_HELP;
+
+            /**
+             * String for the command line help text.
+             */
+            static const char* CLI_HELP_DESCRIPTION;
+
+            /**
+             * String for the command line arguments.
+             */
+            static const char* CLI_CONFIG_FILE;
+
+            /**
+             * String for the command line help text.
+             */
+            static const char* CLI_CONFIG_FILE_DESCRIPTION;
+
+            /**
+             * String for the command line arguments.
+             */
+            static const char* CLI_LOG_FILE;
+
+            /**
+             * String for the command line help text.
+             */
+            static const char* CLI_LOG_FILE_DESCRIPTION;
+
+            /**
+             * String for the command line arguments.
+             */
+            static const char* CLI_PLUGINS_FILE;
+
+            /**
+             * String for the command line help text.
+             */
+            static const char* CLI_PLUGINS_FILE_DESCRIPTION;
+
+            /**
+             * String for the command line arguments.
+             */
+            static const char* CLI_RESOURCES_FILE;
+
+            /**
+             * String for the command line help text.
+             */
+            static const char* CLI_RESOURCES_FILE_DESCRIPTION;
+
+            /**
+             * Number of arguments assed by command line.
+             */
+            int _argc = 0;
+
+            /**
+             * List of arguments passed by command line.
+             */
+            char **_argv = nullptr;
+
+            /**
+             * Path to the configuration file.
+             */
+            String config_filename_;
+
+            /**
+             * Path to the log file.
+             */
+            String log_filename_;
+
+            /**
+             * Path to the plugin configuration file.
+             */
+            String plugins_filename_;
+
+            /**
+             * Path to the resource configuration file.
+             */
+            String resources_filename_;
+
+            /**
+             * Flag for initialization status.
+             */
+            bool _initialized = false;
+
+            /**
+             * Ogre main component..
+             */
+            std::unique_ptr<Ogre::Root> _root;
+
+            /**
+             *The ogre overlay system.
+             */
+            std::unique_ptr<Ogre::OverlaySystem> _overlay_system;
+
+            /**
+             * The Ogre main window.
+             */
+            Ogre::RenderWindow* _render_window = nullptr; // Not owned
+
+            /**
+             * List of Ogre resource managers.
+             */
+            ResourceManagerVector _resource_managers;
+
+            /**
+             * Ogre resource group manager.
+             */
+            Ogre::ResourceGroupManager* res_mgr_ = nullptr; // Not owned
     };
 }
-
-#endif // __QGearsApplication_H__

+ 248 - 75
QGearsMain/include/common/QGearsManualObject.h

@@ -1,104 +1,277 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
-
-Copyright (c) 2013-08-14 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __QGearsManualObject_H__
-#define __QGearsManualObject_H__
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#pragma once
 
 #include <OgreColourValue.h>
 #include <OgreMesh.h>
 #include <OgreSubMesh.h>
 #include <Ogre.h>
-
 #include "common/TypeDefine.h"
 
-namespace QGears
-{
-    /*
-     * When parsing files this is used to create the rendering engine object, e.g when we see a bone
-     * in the file we are parsing then call bone() to add one.
+namespace QGears{
+
+    /**
+     * A manually handled object.
+     *
+     * When parsing files this is used to create the rendering engine object.
+     * E.g. when a bone is found in the file being parsed, then bone() is
+     * called to add it.
      */
-    class ManualObject
-    {
+    class ManualObject{
+
         public:
-            explicit ManualObject( Ogre::Mesh *mesh );
+
+            /**
+             * Constructor.
+             *
+             * @param mesh[in] The object mesh
+             */
+            explicit ManualObject(Ogre::Mesh *mesh);
+
+            /**
+             * Destructor.
+             */
             virtual ~ManualObject();
 
-            enum BufferBinding
-            {
-                BB_POSITION
-              , BB_NORMAL
-              , BB_COLOUR
-              , BB_TEXTURE
-              , BINDING_COUNT
+            /**
+             * Buffer indexes for object properties.
+             */
+            enum BufferBinding{
+
+                /**
+                 * Object position.
+                 */
+                BB_POSITION,
+
+                /**
+                 * Object normal.
+                 */
+                BB_NORMAL,
+
+                /**
+                 * Object colour.
+                 */
+                BB_COLOUR,
+
+                /**
+                 * Object texture.
+                 */
+                BB_TEXTURE,
+
+                /**
+                 * Number of binds for the object.
+                 */
+                BINDING_COUNT
             };
 
-            virtual void begin( const String &name, const String &material_name
-                               ,size_t vertex_count, size_t index_count );
+            /**
+             * Begins creating a object section.
+             *
+             * It doesn't set position, normal or texture.
+             *
+             * @param name[in] Name for the object.
+             * @param material_name[in] Name of the object's material.
+             * @param vertex_count[in] Number of vertices in the object.
+             * @param index_count[in]
+             * @todo Undestand and document index_count.
+             */
+            virtual void begin(
+              const String &name, const String &material_name,
+              size_t vertex_count, size_t index_count
+            );
+
+            /**
+             * Sets the object position.
+             *
+             * @param position[in] Position vector.
+             * @todo It applies to the object or the current section?
+             */
+            virtual void position(const Ogre::Vector3 &position);
+
+            /**
+             * Sets the object normal vector.
+             *
+             * @param normal[in] Normal vector.
+             * @todo It applies to the object or the current section?
+             */
+            virtual void normal(const Ogre::Vector3 &normal);
+
+            /**
+             * Sets the object colour.
+             *
+             * @param colour Object colour.
+             * @todo It applies to the object or the current section?
+             */
+            virtual void colour(const Ogre::ColourValue &colour);
+
+            /**
+             * Sets the object texture coordinates.
+             *
+             * @param texture_coordinate[in] Coordinate vector.
+             * @todo It applies to the object or the current section?
+             */
+            virtual void textureCoord(const Ogre::Vector2 &texture_coordinate);
 
-            virtual void position( const Ogre::Vector3 &position );
-            virtual void normal( const Ogre::Vector3 &normal );
-            virtual void colour( const Ogre::ColourValue &colour );
-            virtual void textureCoord( const Ogre::Vector2 &texture_coordinate );
+            /**
+             * Sets the object index.
+             *
+             * @param idx[in] Object index.
+             * @todo It applies to the object or the current section?
+             */
             virtual void index( const uint32 idx );
-            virtual void bone( const uint32 idx, const uint16 bone_handle
-                              ,const Ogre::Real weight = 1 );
 
+            /**
+             * Adds a bone to the object.
+             *
+             * @param idx[in] Index of the vertex index to add the bone to.
+             * @param bone_handle[in] Index of the bone objct.
+             * @param weight[in] Bone weight. In most cases, 1 is ok.
+             * @todo It applies to the object or the current section?
+             */
+            virtual void bone(
+              const uint32 idx, const uint16 bone_handle,
+              const Ogre::Real weight = 1
+            );
+
+            /**
+             * End the current section.
+             *
+             * A section must have been started with {@see begin}
+             *
+             * @throws Ogre::Exception::ERR_INVALIDPARAMS if a section has not
+             * been started.
+             */
             virtual void end();
 
         protected:
+
+            /**
+             * Creates a buffer
+             *
+             * @param binding[in] Buffer binding.
+             * @param type[in] Type Buffer type.
+             * @param semantic[in] Buffer semantic.
+             * @todo I'm no really sure what this function does...
+             */
             template<typename BufferType>
-            BufferType*     createBuffer( const BufferBinding binding, Ogre::VertexElementType type, Ogre::VertexElementSemantic semantic);
-            virtual void    createPositionBuffer();
-            virtual void    createNormalBuffer();
-            virtual void    createColourBuffer();
-            virtual void    createTextureCoordinateBuffer();
-            virtual void    createIndexBuffer();
-            virtual void    resetBuffers();
+            BufferType* createBuffer(
+              const BufferBinding binding, Ogre::VertexElementType type,
+              Ogre::VertexElementSemantic semantic
+            );
+
+            /**
+             * Creates a position buffer in {@see BB_POSITION}.
+             */
+            virtual void createPositionBuffer();
+
+            /**
+             * Creates a normal buffer in {@see BB_NORMAL}.
+             */
+            virtual void createNormalBuffer();
 
+            /**
+             * Creates a colour buffer in {@see BB_COLOUR}.
+             */
+            virtual void createColourBuffer();
+
+            /**
+             * Creates a texture coordinate buffer in {@see BB_TEXTURE}.
+             */
+            virtual void createTextureCoordinateBuffer();
+
+            /**
+             * Creates a index buffer in {@see BB_INDEX}.
+             */
+            virtual void createIndexBuffer();
+
+            /**
+             * Resets all buffers in {@see BufferBinding}.
+             */
+            virtual void resetBuffers();
+
+            /**
+             * Resets any of the buffers in {@see BufferBinding}.
+             *
+             * @param buffer Buffer to reset.
+             */
             template<typename BufferSharedPtr>
-                    void    resetBuffer( BufferSharedPtr &buffer ) const;
+            void resetBuffer(BufferSharedPtr &buffer) const;
 
         private:
-            Ogre::Mesh     *m_mesh;
-            Ogre::SubMesh  *m_section;
-
-            Ogre::AxisAlignedBox    m_bbox;
-            Ogre::Real              m_radius;
 
             typedef Ogre::HardwareVertexBufferSharedPtr VertexBuffer;
-            typedef Ogre::HardwareIndexBufferSharedPtr  IndexBuffer;
-            VertexBuffer    m_vertex_buffers[BINDING_COUNT];
-            IndexBuffer     m_index_buffer;
-            Ogre::Vector3  *m_position;
-            Ogre::Vector3  *m_normal;
-            uint32         *m_colour;
-            Ogre::Vector2  *m_texture_coordinate;
-            uint16         *m_index;
-
-            const Ogre::VertexElementType colour_type;
+            typedef Ogre::HardwareIndexBufferSharedPtr IndexBuffer;
+
+            /**
+             * The object mesh.
+             */
+            Ogre::Mesh *_mesh;
+
+            /**
+             * The currently open section.
+             */
+            Ogre::SubMesh *_section;
+
+            /**
+             * @todo
+             */
+            Ogre::AxisAlignedBox _bbox;
+
+            /**
+             * @todo
+             */
+            Ogre::Real _radius;
+
+            /**
+             * The object vetex buffer.
+             */
+            VertexBuffer _vertex_buffers[BINDING_COUNT];
+
+            /**
+             * The index buffer.
+             */
+            IndexBuffer _indexbuffer_;
+
+            /**
+             * The position buffer.
+             */
+            Ogre::Vector3 *_position;
+
+            /**
+             * The normal buffer.
+             */
+            Ogre::Vector3 *_normal;
+
+            /**
+             * The colour buffer.
+             */
+            uint32 *colour_;
+
+            /**
+             * The texture buffer.
+             */
+            Ogre::Vector2 *_texture_coordinate;
+
+            /**
+             * The object index.
+             */
+            uint16 *_index;
+
+            /**
+             * The colour type.
+             */
+            const Ogre::VertexElementType colour_type_;
     };
 }
-
-#endif // __QGearsManualObject_H__

+ 66 - 51
QGearsMain/include/common/QGearsResource.h

@@ -1,62 +1,77 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
-
-Copyright (c) 2013-08-26 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __QGearsResource_H__
-#define __QGearsResource_H__
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreDataStream.h>
 #include <OgreResource.h>
 #include <OgreResourceGroupManager.h>
-
 #include "common/TypeDefine.h"
 #include "QGearsPrerequisites.h"
 
-namespace QGears
-{
-    class _QGearsExport Resource : public Ogre::Resource
-    {
-    public:
-        Resource(Ogre::ResourceManager *creator
-            , const String &name, Ogre::ResourceHandle handle
-            , const String &group, bool isManual
-            , Ogre::ManualResourceLoader *loader) :
-            Ogre::Resource(creator, name, handle, group, isManual, loader)
-        {
-        }
-
-        virtual ~Resource() = default;
-
-    protected:
-        virtual Ogre::DataStreamPtr openResource()
-        {
-            // LAst parameter to true to throw an exception. Change when ready.
-            return Ogre::ResourceGroupManager::getSingleton().openResource(mName, mGroup, this, false);
-        }
-
-    private:
+namespace QGears{
+
+    /**
+     * A resource.
+     */
+    class _QGearsExport Resource : public Ogre::Resource{
+
+        public:
+
+            /**
+             * Constructor.
+             *
+             * Initializes a resource.
+             *
+             * @param creator[in] The resource manager that handles the
+             * resource creation.
+             * @param name[in] A name for the resource.
+             * @param handle[in] Ogre object that will handle the resource.
+             * @param group[in] Name of the group to include the resource in.
+             * @pram manual[in] Indicates if the resource is a {@see
+             * QGearsManualObject}.
+             * @param loader[in] Ogre resource loader for the resource.
+             */
+            Resource(
+              Ogre::ResourceManager *creator, const String &name,
+              Ogre::ResourceHandle handle, const String &group,
+              bool manual, Ogre::ManualResourceLoader *loader
+            ): Ogre::Resource(creator, name, handle, group, manual, loader)
+            {}
+
+            /**
+             * Destructor.
+             */
+            virtual ~Resource() = default;
+
+        protected:
+
+            /**
+             * Opens the resource.
+             *
+             * @return A pointer to the resource.
+             */
+            virtual Ogre::DataStreamPtr openResource(){
+                // Last parameter to true to throw an exception.
+                // Change when ready.
+                return Ogre::ResourceGroupManager::getSingleton().openResource(
+                  mName, mGroup, this, false
+                );
+            }
+
+        private:
     };
 }
 
-#endif // __QGearsResource_H__

+ 56 - 36
QGearsMain/include/common/QGearsStringUtil.h

@@ -1,42 +1,62 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
-
-Copyright (c) 2013-08-17 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __QGearsStringUtil_H__
-#define __QGearsStringUtil_H__
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include "common/TypeDefine.h"
 
-namespace QGears
-{
-    class StringUtil : public Ogre::StringUtil
-    {
-    public:
-        static void splitPath( const String &qualifiedName, String &outPath );
-        static void splitBase( const String &qualifiedName, String &outBasename );
-        static void splitFull( const String &qualifiedName, String &outBasename );
+namespace QGears{
+
+    /**
+     * Static class for common string manipulations.
+     */
+    class StringUtil : public Ogre::StringUtil{
+
+        public:
+
+            /**
+             * Extract a file path.
+             *
+             * Extracts a file path from a fully qualified file name (i.e: full
+             * filepath + filename).
+             *
+             * @param nameame[in] Fully qualified file name.
+             * @param path[out] Path to the file, without the file name.
+             */
+            static void splitPath(const String &name, String &path);
+
+            /**
+             * Extract a file name without extension.
+             *
+             * Extracts a file name, without the file extension, from a fully
+             * qualified file name (i.e: full filepath + filename).
+             *
+             * @param name[in] Fully qualified file name.
+             * @param basename[out] File name, without extension.
+             */
+            static void splitBase(const String &name, String &basename);
+
+            /**
+             * Extract a file name without extension.
+             *
+             * Extracts a file name, without the file extension, from a full
+             * file name without path.
+             *
+             * @param name[in] File name.
+             * @param basename[out] File name, without extension.
+             */
+            static void splitFull(const String &name, String &basename);
     };
 }
-
-#endif // __QGearsStringUtil_H__

+ 173 - 39
QGearsMain/include/common/TypeDefine.h

@@ -1,71 +1,205 @@
-#ifndef TYPE_DEFINE_H
-#define TYPE_DEFINE_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgrePlatform.h>
 #include <OgreString.h>
 
-typedef Ogre::uint8  u8;
+typedef Ogre::uint8 u8;
 typedef Ogre::uint16 u16;
 typedef Ogre::uint32 u32;
-
-typedef Ogre::int8  s8;
+typedef Ogre::int8 s8;
 typedef Ogre::int16 s16;
 typedef Ogre::int32 s32;
 
-#define BEGIN_QGEARS namespace QGears {
-#define END_QGEARS }
+namespace QGears{
 
-namespace QGears
-{
-    typedef Ogre::uchar  uchar;
-    typedef Ogre::uint8  uint8;
+    typedef Ogre::uchar uchar;
+    typedef Ogre::uint8 uint8;
     typedef Ogre::uint16 uint16;
     typedef Ogre::uint32 uint32;
-
-    typedef Ogre::int8  sint8;
+    typedef Ogre::int8 sint8;
     typedef Ogre::int16 sint16;
     typedef Ogre::int32 sint32;
-
     typedef Ogre::String String;
 
-    struct ColorComponents
-    {
+    /**
+     * Color components.
+     */
+    struct ColorComponents{
+
+        /**
+         * Blue component of the color.
+         */
         uint8 blue;
+
+        /**
+         * Green component of the color.
+         */
         uint8 green;
+
+        /**
+         * Red component of the color.
+         */
         uint8 red;
+
+        /**
+         * Alpha component of the color.
+         */
         uint8 alpha;
     };
 
-    union ColorA8R8G8B8
-    {
+    /**
+     * @todo: Understand and document.
+     */
+    union ColorA8R8G8B8{
         ColorComponents comp;
         uint32 all;
     };
 
-    struct Pixel
-    {
+    /**
+     * Pixel coordinates.
+     */
+    struct Pixel{
+
+        /**
+         * X coordinate of the pixel.
+         */
         sint16 x;
+
+        /**
+         * Y coordinate of the pixel.
+         */
         sint16 y;
     };
 
-    extern const String    EXT_MATERIAL;
-    extern const String    EXT_MESH;
-    extern const String    EXT_SKELETON;
-    extern const String    EXT_CONFIG;
-    extern const String    EXT_LOG;
-
-    extern const String    EXT_P;
-    extern const String    EXT_PLY;
-    extern const String    EXT_RSD;
-    extern const String    EXT_TIM;
-    extern const String    EXT_TEX;
-
-    extern const String    EXT_TRIGGERS;
-    extern const String    EXT_BACKGROUND;
-    extern const String    EXT_CAMERA_MATRIX;
-    extern const String    EXT_MODEL_LIST;
-    extern const String    EXT_PALETTE;
-    extern const String    EXT_WALKMESH;
+    /**
+     * Extension for material files.
+     */
+    extern const String EXT_MATERIAL;
+
+    /**
+     * Extension for mesh files.
+     */
+    extern const String EXT_MESH;
+
+    /**
+     * Extension for skeleton files.
+     */
+    extern const String EXT_SKELETON;
+
+    /**
+     * Extension for configuration files.
+     */
+    extern const String EXT_CONFIG;
+
+    /**
+     * Extension for log files.
+     */
+    extern const String EXT_LOG;
+
+    /**
+     * Extension for P files.
+     *
+     * P files are binary files containing data which form 3D model. The files
+     * specifies model's vertices, polygons, colors, texture coordinates and
+     * model sub-groups. The files do not specify references to the texture
+     * files, animations, model skeleton or anything else.
+     *
+     * P-files are used as parts of field models, battle models, battle
+     * locations on PC version of FF7.
+     */
+    extern const String EXT_P;
+
+    /**
+     * Extension for PLY files.
+     *
+     * PLY file contain polygon data.
+     */
+    extern const String EXT_PLY;
+
+    /**
+     * Exteesion for RSD files.
+     *
+     * RSD files are product of the original Playstation Psy-Q 3D development
+     * libraries. They are often expoted by 3D modelers when converting from an
+     * LWO or DXF file to something more understandable by the PSX. It is in
+     * ascii, making it easy to edit by hand. When a 3D editor does an export,
+     * four text files are actually created, .rsd, .ply, .mat, and .grp. These
+     * can then be "compiled" into a binary .rsd file for the PSX.
+     *
+     * In the PC version of Final Fantasy 7, the text .rsd file is used while
+     * the other files were "compiled" into Polygon(.p) format.
+     */
+    extern const String EXT_RSD;
+
+    /**
+     * Extension for TIM files.
+     *
+     * TIM files are a standard image file format for the Sony PlayStation. The
+     * file structure closely mimics the way textures are managed in the frame
+     * buffer by the GPU. TIM files are little endian-based.
+     */
+    extern const String EXT_TIM;
+
+    /**
+     * Extension for TEX files.
+     *
+     * TEX files are the PC's version of Final Fantasy VII texture files.
+     */
+    extern const String EXT_TEX;
+
+    /**
+     * Extension for trigger files.
+     *
+     * Triggers are located in fields maps.
+     */
+    extern const String EXT_TRIGGERS;
+
+    /**
+     * Extension for background files.
+     *
+     * Backgrounds are located in field maps.
+     */
+    extern const String EXT_BACKGROUND;
+
+    /**
+     * Extension for cam matrix files.
+     *
+     * Camera matrices are located in field maps.
+     */
+    extern const String EXT_CAMERA_MATRIX;
+
+    /**
+     * Extension for model list files.
+     *
+     * Model lists are a part of field maps.
+     */
+    extern const String EXT_MODEL_LIST;
+
+    /**
+     * Extension for palette files.
+     */
+    extern const String EXT_PALETTE;
+
+    /**
+     * Extension for walkmesh files.
+     *
+     * Walkmeshes are part of field maps.
+     */
+    extern const String EXT_WALKMESH;
 }
 
-#endif // TYPE_DEFINE_H

+ 19 - 9
QGearsMain/include/common/make_unique.h

@@ -1,17 +1,27 @@
-#ifndef _MAKE_UNIQUE_
-#define _MAKE_UNIQUE_
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <memory>
 
 #ifndef _MSC_VER
-namespace std
-{
+namespace std{
     template<typename T, typename ...Args>
-    std::unique_ptr<T> make_unique( Args&& ...args )
-    {
-        return std::unique_ptr<T>( new T( std::forward<Args>(args)... ) );
+    std::unique_ptr<T> make_unique(Args&& ...args){
+        return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
     }
 }
 #endif
-
-#endif // _MAKE_UNIQUE_

+ 187 - 51
QGearsMain/include/core/particles/Particle.h

@@ -1,60 +1,196 @@
-#ifndef PARTICLE_H
-#define PARTICLE_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgrePrerequisites.h>
 #include <Ogre.h>
 
 #include "ParticleAdditionalData.h"
 
-
-
 class ParticleEmitter;
 
-
-
-class Particle
-{
-public:
-    enum ParticleType
-    {
-        PT_VISUAL,
-        PT_EMITTER
-    };
-
-    Particle();
-    virtual ~Particle() = 0;
-
-    virtual void InitForEmission() {};
-    virtual void InitForExpiration() {};
-
-    virtual void Update(Ogre::Real time_elapsed);
-
-    virtual void CopyAttributesTo(Particle* particle);
-
-    ParticleType GetParticleType() const {return m_ParticleType;};
-
-    void SetParentEmitter(ParticleEmitter* parent_emitter) {m_ParentEmitter = parent_emitter;};
-    ParticleEmitter* GetParentEmitter() const {return m_ParentEmitter;};
-
-    void SetEnabled(bool enabled) {m_Enabled = enabled;};
-    bool IsEnabled() const {return m_Enabled;};
-
-    void SetEmittable(bool emittable) {m_Emittable = emittable;};
-    bool IsEmittable() const {return m_Emittable;};
-
-    ParticleAdditionalData* additional_data;
-    Ogre::Vector3           position;
-    Ogre::Vector3           direction;
-    float                   time_to_live;
-    float                   total_time_to_live;
-
-protected:
-    ParticleEmitter*    m_ParentEmitter;
-    ParticleType        m_ParticleType;
-    bool                m_Enabled;
-    bool                m_Emittable;
+/**
+ * A particle.
+ *
+ * Particles are emitted by one {@see ParticleEmitter}.
+ */
+class Particle{
+
+    public:
+
+        /**
+         * Types of particles.
+         */
+        enum ParticleType{
+
+            /**
+             * A visual particle.
+             */
+            PT_VISUAL,
+
+            /**
+             * @todo Document.
+             */
+            PT_EMITTER
+        };
+
+        /**
+         * Constructor.
+         */
+        Particle();
+
+        /**
+         * Destructor.
+         */
+        virtual ~Particle() = 0;
+
+        /**
+         * Initializes the particle.
+         *
+         * It makes it ready for emission.
+         */
+        virtual void InitForEmission(){};
+
+        /**
+         * Initializes the particle.
+         *
+         * It makes it ready for expiration.
+         * @todo: Document this properly.
+         */
+        virtual void InitForExpiration(){};
+
+        /**
+         * Updates the particle.
+         *
+         * Updates it position based on the time lived by the particle.
+         *
+         * @param time_elapsed[in] Time lived by the particle.
+         */
+        virtual void Update(Ogre::Real time_elapsed);
+
+        /**
+         * Copies the particle attributes to another particle.
+         *
+         * @param particle[out] The particl to copy the atttributes to.
+         */
+        virtual void CopyAttributesTo(Particle* particle);
+
+        /**
+         * Retrieves the particle type.
+         *
+         * @return The particle type.
+         */
+        ParticleType GetParticleType() const {return particle_type_;};
+
+        /**
+         * Sets the particle emitter.
+         *
+         * @param parent_emitter[in] The emitter for the particle.
+         * @todo Check if parent_emitter is an in or out parameter.
+         */
+        void SetParentEmitter(ParticleEmitter* parent_emitter){
+            parent_emitter_ = parent_emitter;
+        };
+
+        /**
+         * Retrieves the particle emitter.
+         *
+         * @return The emitter.
+         */
+        ParticleEmitter* GetParentEmitter() const {return parent_emitter_;};
+
+        /**
+         * Enables or disables the particle
+         *
+         * @param enabled[in] True to enable the particle, false to disable it.
+         */
+        void SetEnabled(bool enabled) {enabled_ = enabled;};
+
+        /**
+         * Checks if the particle is enabled.
+         *
+         * @return True if the particle is enabled, false otherwise.
+         */
+        bool IsEnabled() const {return enabled_;};
+
+        /**
+         * Toggles the particle emitability.
+         *
+         * @param emittable[in] True to make the particle emittable, false to
+         * prevent it to be emitted.
+         */
+        void SetEmittable(bool emittable) {emittable_ = emittable;};
+
+        /**
+         * Checks if the particle can be emitted.
+         *
+         * @return True if the particle can be emitted, false if it can't.
+         */
+        bool IsEmittable() const {return emittable_;};
+
+        /**
+         * Additional data for the particle.
+         */
+        ParticleAdditionalData* additional_data;
+
+        /**
+         * The particle position.
+         */
+        Ogre::Vector3 position;
+
+        /**
+         * The direction that the particle is or will be emitted to.
+         */
+        Ogre::Vector3 direction;
+
+        /**
+         * The particle duration.
+         *
+         * @todo Seconds? Milliseconds? Frames?
+         * @todo Differenche with total_time_to_live?
+         */
+        float time_to_live;
+
+        /**
+         * The particle duration.
+         *
+         * @todo Seconds? Milliseconds? Frames?
+         * @todo Differenche with time_to_live?
+         */
+        float total_time_to_live;
+
+    protected:
+
+        /**
+         * The particle emitter.
+         */
+        ParticleEmitter* parent_emitter_;
+
+        /**
+         * The particle type.
+         */
+        ParticleType particle_type_;
+
+        /**
+         * Indicates if the particle is enabled.
+         */
+        bool enabled_;
+
+        /**
+         * Indicates if the particl can be emitted.
+         */
+        bool emittable_;
 };
-
-
-
-#endif // PARTICLE_H

+ 22 - 8
QGearsMain/include/core/particles/ParticleAdditionalData.h

@@ -1,13 +1,27 @@
-#ifndef PARTICLE_ADDITIONAL_DATA_H
-#define PARTICLE_ADDITIONAL_DATA_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
+#pragma once
 
+/**
+ * Additional data for a particle
+ */
+struct ParticleAdditionalData{
 
-struct ParticleAdditionalData
-{
+    /**
+     * Toggles the particle visibility.
+     */
     virtual void SetVisible(bool visible) = 0;
 };
-
-
-
-#endif // PARTICLE_ADDITIONAL_DATA_H

+ 247 - 45
QGearsMain/include/core/particles/ParticleEmitter.h

@@ -1,74 +1,276 @@
-#ifndef PARTICLE_EMITTER_H
-#define PARTICLE_EMITTER_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-#include <OgreStringInterface.h>
+#pragma once
 
+#include <OgreStringInterface.h>
 #include "Particle.h"
 #include "ParticleEmitterDictionary.h"
 
+class ParticleTechnique;
 
+/**
+ * A particle emitter.
+ */
+class ParticleEmitter : public Ogre::StringInterface, public Particle{
 
-class ParticleTechnique;
+    public:
 
+        /**
+         * Constructor.
+         */
+        ParticleEmitter();
 
+        /**
+         * Destructor.
+         */
+        virtual ~ParticleEmitter();
 
-class ParticleEmitter : public Ogre::StringInterface, public Particle
-{
-public:
-    ParticleEmitter();
-    virtual ~ParticleEmitter();
+        /**
+         * Copies attributes to other particle emmiter.
+         *
+         * @param emitter[out] The particle emmite to copy the attributes to.
+         */
+        virtual void CopyAttributesTo(ParticleEmitter* emitter);
 
-    virtual void CopyAttributesTo(ParticleEmitter* emitter);
+        /**
+         * @todo Understand and document.
+         */
+        virtual void InitForEmission();
 
-    virtual void InitForEmission();
+        /**
+         * Calculates how many particles are to be emitted in a given time.
+         *
+         * @param time_elapsed[in] The elapsed time since the emitter has been
+         * emitting.
+         * @todo Understand and document.
+         */
+        virtual int CalculateRequestedParticles(Ogre::Real time_elapsed);
 
-    virtual int CalculateRequestedParticles(Ogre::Real time_elapsed);
-    virtual void InitParticleForEmission(Particle* particle);
+        /**
+         * Initializes a article to be emmited.
+         *
+         * @param particle[out] The particle to be initialized.
+         */
+        virtual void InitParticleForEmission(Particle* particle);
 
-    void SetParentTechnique(ParticleTechnique* tech) {m_ParentTechnique = tech;};
-    ParticleTechnique* GetParentTechnique() const {return m_ParentTechnique;};
+        /**
+         * Sets the parent technique for emitter.
+         *
+         * @param tech[in] Technique.
+         * @todo Understand and document.
+         */
+        void SetParentTechnique(ParticleTechnique* tech){
+            parent_technique_ = tech;
+        };
 
-    void SetName(const Ogre::String& name) {m_Name = name;};
-    const Ogre::String& GetName() const {return m_Name;};
+        /**
+         * Retrieves the parent technique of the emitter.
+         *
+         * @return Technique.
+         * @todo Understand and document.
+         */
+        ParticleTechnique* GetParentTechnique() const {
+            return parent_technique_;
+        };
 
-    void SetEmitterType(const Ogre::String& emitter_type) {m_EmitterType = emitter_type;};
-    const Ogre::String& GetEmitterType() const {return m_EmitterType;};
+        /**
+         * Set a name for the emitter.
+         *
+         * @param name[in] Name for the emitter.
+         */
+        void SetName(const Ogre::String& name){name_ = name;};
 
-    void SetEmitsName(const Ogre::String& emitsName);
-    const Ogre::String& GetEmitsName() const {return m_EmitsName;};
+        /**
+         * Retrieves the emitter name.
+         *
+         * @return Emitter name.
+         */
+        const Ogre::String& GetName() const{return name_;};
 
-    void SetEmitsType(ParticleType emits_type) {m_EmitsType = emits_type;};
-    ParticleType GetEmitsType() const {return m_EmitsType;};
+        /**
+         * Sets the emitter type.
+         *
+         * @param emitter_type[in] The emitter type.
+         */
+        void SetEmitterType(const Ogre::String& emitter_type){
+            emitter_type_ = emitter_type;
+        };
 
-    void SetEmissionRate(int rate) {m_EmissionRate = rate;};
-    int GetEmissionRate() const {return m_EmissionRate;};
+        /**
+         * Retrieves the emitter type.
+         *
+         * @return The emitter type.
+         */
+        const Ogre::String& GetEmitterType() const{return emitter_type_;};
 
+        /**
+         * Sets the name of the emits.
+         *
+         * When changed, notifies the technique of the change.
+         *
+         * @param emits_name[in] Name for the emits.
+         * @todo What are the emits?
+         */
+        void SetEmitsName(const Ogre::String& emits_name);
 
+        /**
+         * Retrieves the name of the emits.
+         *
+         * @return Name of the emits
+         * @todo What are the emits?
+         */
+        const Ogre::String& GetEmitsName() const{return emits_name_;};
 
-    // EMIT PARTICLE SETTINGS
-    void SetEmitDirection(const Ogre::Vector3& dir) {m_EmitDirection1 = dir; m_EmitDirection2 = dir;};
-    void SetEmitDirectionRange(const Ogre::Vector3& dir1, const Ogre::Vector3& dir2) {m_EmitDirection1 = dir1; m_EmitDirection2 = dir2;};
-    void SetEmitTotalTimeToLive(float time) {m_EmitTotalTimeToLive = time;};
+        /**
+         * Sets the type of the emits.
+         *
+         * @param emits_type[in] Type for the emits.
+         * @todo What are the emits?
+         */
+        void SetEmitsType(ParticleType emits_type) {emits_type_ = emits_type;};
 
-protected:
-    ParticleTechnique*                                  m_ParentTechnique;
+        /**
+         * Retrieves the type of the emits.
+         *
+         * @return Type of the emits.
+         * @todo What are the emits?
+         */
+        ParticleType GetEmitsType() const {return emits_type_;};
 
-    Ogre::String                                        m_Name;
-    Ogre::String                                        m_EmitterType;
+        /**
+         * Set the emission rate for the emitter.
+         *
+         * @param rate[in] Emission rate.
+         */
+        void SetEmissionRate(int rate) {emission_rate_ = rate;};
 
-    Ogre::String                                        m_EmitsName;
-    ParticleType                                        m_EmitsType;
-    static ParticleEmitterDictionary::EmissionRate      m_EmissionRateDictionary;
-    int                                                 m_EmissionRate;
-    Ogre::Real                                          m_EmissionRemainder;
+        /**
+        * Retrieves the emission rate of the emitter.
+        *
+        * @return Emission rate.
+        */
+        int GetEmissionRate() const {return emission_rate_;};
 
-    static ParticleEmitterDictionary::Direction         m_DirectionDictionary;
-    Ogre::Vector3                                       m_EmitDirection1;
-    Ogre::Vector3                                       m_EmitDirection2;
-    static ParticleEmitterDictionary::TotalTimeToLive   m_TotalTimeToLiveDictionary;
-    float                                               m_EmitTotalTimeToLive;
-};
+        /**
+         * Sets the particle direction for the emitter.
+         *
+         * It sets a fixed direction. For a variable, ranged direction, use
+         * {@see setEmitDirectionRange}.
+         *
+         * @param dir[in] Particle direction.
+         */
+        void SetEmitDirection(const Ogre::Vector3& dir){
+            emit_direction_1_ = dir;
+            emit_direction_2_ = dir;
+        };
+
+        /**
+         * Sets the particle direction for the emitter.
+         *
+         * It sets a ranged direction. For each paticle, a random direction
+         * between DIR_1 and DIR_2 will be assigned. For a fixed direction, use
+         * {@see setEmitDirection}.
+         *
+         * @param dir_1[in] One of the limits for the range of directions.
+         * @param dir_2[in] One of the limits for the range of directions.
+         */
+        void SetEmitDirectionRange(
+          const Ogre::Vector3& dir_1, const Ogre::Vector3& dir_2
+        ){
+            emit_direction_1_ = dir_1;
+            emit_direction_2_ = dir_2;
+        };
+
+        /**
+         * Sets the time the particles must be displayed between being emitted
+         * and disappearing.
+         *
+         * @param time[in] Duration of the particles.
+         * @todo Time is in secons? milliseconds? frames?
+         */
+        void SetEmitTotalTimeToLive(float time){
+            emit_total_time_to_live_ = time;
+        };
+
+    protected:
+
+        /**
+         * The particle technique.
+         */
+        ParticleTechnique* parent_technique_;
+
+        /**
+         * The emitter name.
+         */
+        Ogre::String name_;
 
+        /**
+         * The emitter type.
+         */
+        Ogre::String emitter_type_;
 
+        /**
+         * The emits name.
+         */
+        Ogre::String emits_name_;
 
-#endif // PARTICLE_EMITTER_H
+        /**
+         * The emits type.
+         */
+        ParticleType emits_type_;
+
+        /**
+         * Dictionary for emission rates.
+         */
+        static ParticleEmitterDictionary::EmissionRate
+          emission_rate_dictionary_;
+
+        /**
+         * The emission rate.
+         */
+        int emission_rate_;
+
+        /**
+         * The remaining particles to be emitted.
+         */
+        Ogre::Real emission_remainder_;
+
+        /**
+         * Dictionary for particle directions.
+         */
+        static ParticleEmitterDictionary::Direction direction_dictionary_;
+
+        /**
+         * One of the limits for the range of directions.
+         */
+        Ogre::Vector3 emit_direction_1_;
+
+        /**
+         * One of the limits for the range of directions.
+         */
+        Ogre::Vector3 emit_direction_2_;
+
+        /**
+         * Disctionary for particle durations.
+         */
+        static ParticleEmitterDictionary::TotalTimeToLive
+          total_time_to_live_dictionary_;
+
+        /**
+         * Particle duration.
+         */
+        float emit_total_time_to_live_;
+};

+ 76 - 22
QGearsMain/include/core/particles/ParticleEmitterDictionary.h

@@ -1,34 +1,88 @@
-#ifndef PARTICLE_EMITTER_DICTIONARY_H
-#define PARTICLE_EMITTER_DICTIONARY_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreStringInterface.h>
 
+namespace ParticleEmitterDictionary{
 
+    /**
+     * The emission rate of a particle emitter.
+     */
+    class EmissionRate : public Ogre::ParamCommand{
 
-namespace ParticleEmitterDictionary
-{
-    class EmissionRate : public Ogre::ParamCommand
-    {
-    public:
-        Ogre::String doGet(const void* target) const {return "";};
-        void doSet(void* target, const Ogre::String& val);
-    };
+        public:
+
+            /**
+             * Retrieves the emission rate.
+             *
+             * @return Emission rate.
+             */
+            Ogre::String doGet(const void* target) const{return "";};
 
-    class TotalTimeToLive : public Ogre::ParamCommand
-    {
-    public:
-        Ogre::String doGet(const void* target) const {return "";};
-        void doSet(void* target, const Ogre::String& val);
+            /**
+             * Sets the emission rate
+             *
+             * @param val[in] The emission rate.
+             */
+            void doSet(void* target, const Ogre::String& val);
     };
 
-    class Direction : public Ogre::ParamCommand
-    {
-    public:
-        Ogre::String doGet(const void* target) const {return "";};
-        void doSet(void* target, const Ogre::String& val);
+    /**
+     * The total time to live for particles emitted by an emitter.
+     */
+    class TotalTimeToLive : public Ogre::ParamCommand{
+
+        public:
+
+            /**
+             * Retrieves the total time to live.
+             *
+             * @return Total time to live.
+             */
+            Ogre::String doGet(const void* target) const{return "";};
+
+            /**
+             * Sets the total time to live.
+             *
+             * @param val[in] Total time to live.
+             */
+            void doSet(void* target, const Ogre::String& val);
     };
-}
 
+    /**
+     * The direction at which an emitter emits particles.
+     */
+    class Direction : public Ogre::ParamCommand{
+
+        public:
+
+            /**
+             * Retrieves the direction.
+             *
+             * @return The direction.
+             */
+            Ogre::String doGet(const void* target) const {return "";};
 
+            /**
+             * Sets the direction.
+             *
+             * @param val[in] The direction.
+             */
+            void doSet(void* target, const Ogre::String& val);
+    };
+}
 
-#endif // PARTICLE_EMITTER_DICTIONARY_H

+ 1 - 1
QGearsMain/include/core/particles/ParticleEmitterFactory.h

@@ -25,7 +25,7 @@ public:
 
 protected:
     template <class T>
-    ParticleEmitter* _createEmitter()
+    ParticleEmitter* CreateEmitter_()
     {
         ParticleEmitter* particle_emitter = new T();
         particle_emitter->SetEmitterType(GetEmitterType());

+ 30 - 9
QGearsMain/include/core/particles/ParticleEmitterTranslator.h

@@ -1,17 +1,38 @@
-#ifndef PARTICLE_EMITTER_TRANSLATOR_H
-#define PARTICLE_EMITTER_TRANSLATOR_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreScriptTranslator.h>
 #include <OgreSingleton.h>
 
+/**
+ * A particle emitter translator for the Ogre system.
+ */
+class ParticleEmitterTranslator : public Ogre::ScriptTranslator{
 
+    public:
 
-class ParticleEmitterTranslator : public Ogre::ScriptTranslator
-{
-public:
-    void translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node);
+        /**
+         * Translates the emitter script to Ogre format.
+         *
+         * @param compiler[in] The compiler.
+         * @param node[in] The node to translate.
+         */
+        void translate(
+          Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node
+        );
 };
 
-
-
-#endif // PARTICLE_EMITTER_TRANSLATOR_H

+ 218 - 134
QGearsMain/include/core/particles/ParticlePool.h

@@ -1,140 +1,224 @@
-#ifndef PARTICLE_POOL_H
-#define PARTICLE_POOL_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <list>
 
-
-
+/**
+ * A particle pool
+ *
+ * There are actually two pools, one for locked particles and one for released
+ * ones. Locked particles can't be used until they are released.
+ *
+ * @tparam T The type of particle.
+ */
 template <typename T>
-class ParticlePool
-{
-public:
-    typedef std::list<T*> PoolList;
-    typedef typename PoolList::iterator PoolIterator; // The 'typename' MUST be added, since T is not a fixed type
-
-    ParticlePool() {};
-    virtual ~ParticlePool() {};
-
-    bool
-    IsEmpty()
-    {
-        return m_Released.empty();
-    };
-
-    size_t
-    GetSize()
-    {
-        return m_Released.size();
-    };
-
-    void
-    ResetIterator()
-    {
-        m_PoolIterator = m_Released.begin();
-    };
-
-    T*
-    GetFirst()
-    {
-        ResetIterator();
-        if (End())
-        {
-            return NULL;
-        }
-
-        T* t = *m_PoolIterator;
-        return t;
-    };
-
-    T*
-    GetNext()
-    {
-        if (End())
-        {
-            return NULL;
-        }
-
-        ++m_PoolIterator;
-        if (End())
-        {
-            return NULL;
-        }
-
-        T* t = *m_PoolIterator;
-        return t;
-    };
-
-    bool
-    End()
-    {
-        return m_PoolIterator == m_Released.end();
-    };
-
-    void
-    Clear()
-    {
-        m_Locked.clear();
-        m_Released.clear();
-    };
-
-    void
-    AddElement(T* element)
-    {
-        m_Locked.push_back(element);
-    };
-
-    T*
-    ReleaseElement()
-    {
-        // Return with 0 if no elements left
-        if (m_Locked.empty())
-        {
-            return 0;
-        }
-
-        // Move element from locked elements to released elements and return it
-        T* t = m_Locked.front();
-        m_Released.splice(m_Released.end(), m_Locked, m_Locked.begin());
-        return t;
-    };
-
-    void
-    ReleaseAllElements()
-    {
-        // Move all elements from locked elements to released elements
-        m_Released.splice(m_Released.end(), m_Locked);
-        ResetIterator();
-    };
-
-    void
-    LockLatestElement()
-    {
-        if (End() == false)
-        {
-            m_Locked.push_back(*m_PoolIterator);
-            m_PoolIterator = m_Released.erase(m_PoolIterator);
-        }
-    };
-
-    void LockAllElements()
-    {
-        // Move all elements from released elements to locked elements
-        m_Locked.splice(m_Locked.end(), m_Released);
-        ResetIterator();
-    };
-
-    std::list<T*>&
-    GetActiveElementsList()
-    {
-        return m_Released;
-    };
-
-protected:
-    PoolList        m_Released; // List with precreated 'released' elements
-    PoolList        m_Locked; // List with precreated 'locked' elements
-    PoolIterator    m_PoolIterator;
+class ParticlePool{
+
+    public:
+
+        typedef std::list<T*> PoolList;
+
+        // The 'typename' MUST be added, since T is not a fixed type
+        typedef typename PoolList::iterator PoolIterator;
+
+        /**
+         * Constructor.
+         */
+        ParticlePool(){};
+
+        /**
+         * Destructor.
+         */
+        virtual ~ParticlePool(){};
+
+        /**
+         * Checks if the pool is empty.
+         *
+         * It doesn't consider locked particles, only the released ones.
+         *
+         * @return True if the pool is empty, false if there is at least one
+         * particle in the pool.
+         */
+        bool IsEmpty(){return released_.empty();};
+
+        /**
+         * Retrieves the pool size.
+         *
+         * It doesn't consider locked particles, only the released ones.
+         *
+         * @return The number of particles in the pool.
+         */
+        size_t GetSize(){return released_.size();};
+
+        /**
+         * Resets the pool iterator.
+         */
+        void ResetIterator(){pool_iterator_ = released_.begin();};
+
+        /**
+         * Retrieves the first particle.
+         *
+         * Before doing so, it resets the pool iterator. It doesn't consider
+         * locked particles, only the released ones.
+         *
+         * @return A reference to the first particle in the pool. NULL if the
+         * pool is empty.
+         */
+        T* GetFirst() {
+            ResetIterator();
+            if (End()) return NULL;
+            T* t = *pool_iterator_;
+            return t;
+        };
+
+        /**
+         * Retrieves the next particle in the pool.
+         *
+         * Before doing so, it advances the pool iterator. It doesn't consider
+         * locked particles, only the released ones.
+         *
+         * @return A reference to the next particle in the pool. NULL if the
+         * pool is empty or the iterator is at the end of it.
+         */
+        T* GetNext(){
+            if (End()) return NULL;
+            ++ pool_iterator_;
+            if (End()) return NULL;
+            T* t = *pool_iterator_;
+            return t;
+        };
+
+        /**
+         * Checks if the iterator is at the end of the pool.
+         *
+         * If it's at the end, {@see GetNext} will return null when called. It
+         * doesn't consider locked particles, only the released ones.
+         *
+         * @return True if the iterator is at the end of the pool.
+         */
+        bool End(){
+            return pool_iterator_ == released_.end();
+        };
+
+        /**
+         * Removes all particles.
+         *
+         * Removes both locked and released particles.
+         */
+        void Clear(){
+            locked_.clear();
+            released_.clear();
+        };
+
+        /**
+         * Adds a particle to the pool.
+         *
+         * A particle is added in locked state.
+         *
+         * @param element[in] Particle to add to the pool.
+         */
+        void AddElement(T* element) {
+            locked_.push_back(element);
+        };
+
+        /**
+         * Releases a locked particle.
+         *
+         * The first locked particle will be the one unlocked.
+         *
+         * @return A pointer to the previously locked and now released
+         * particle, or 0 if there were no more locked particles.
+         */
+        T* ReleaseElement() {
+            // Return with 0 if no elements left
+            if (locked_.empty()) return 0;
+
+            // Move element from locked elements to released elements and return it
+            T* t = locked_.front();
+            released_.splice(released_.end(), locked_, locked_.begin());
+            return t;
+        };
+
+        /**
+         * Releases all locked particles.
+         *
+         * It also resets the pool operator.
+         */
+        void ReleaseAllElements(){
+            // Move all elements from locked elements to released elements
+            released_.splice(released_.end(), locked_);
+            ResetIterator();
+        };
+
+        /**
+         * Locks the released particle pointed by the iterator.
+         *
+         * The particle gets added to the end of the locked particle list.
+         */
+        void LockLatestElement(){
+            if (End() == false){
+                locked_.push_back(*pool_iterator_);
+                pool_iterator_ = released_.erase(pool_iterator_);
+            }
+        };
+
+        /**
+         * Locks all particles.
+         *
+         * The particles get added at the end of the locked list in the same
+         * order they were in the released list. The pool iterator is reseted.
+         */
+        void LockAllElements(){
+            // Move all elements from released elements to locked elements
+            locked_.splice(locked_.end(), released_);
+            ResetIterator();
+        };
+
+        /**
+         * Retrieves the list of released particles.
+         *
+         * @return List of released particles.
+         */
+        std::list<T*>& GetActiveElementsList(){
+            return released_;
+        };
+
+    protected:
+
+        /**
+         * List with released particles.
+         *
+         * They can be operated upon.
+         */
+        PoolList released_;
+
+        /**
+         * List with locked particles.
+         *
+         * They can't be operated upon until released.
+         */
+        PoolList locked_;
+
+        /**
+         * The pool iterator.
+         *
+         * Determines the current particle to be acted upon. Only works for
+         * released particles.
+         */
+        PoolIterator pool_iterator_;
 };
 
-
-
-#endif // PARTICLE_POOL_H

+ 222 - 145
QGearsMain/include/core/particles/ParticlePoolMap.h

@@ -1,150 +1,227 @@
-#ifndef PARTICLE_POOL_MAP_H
-#define PARTICLE_POOL_MAP_H
-
-
-
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+/**
+ * A particle pool map.
+ *
+ * @tparam T The type of particle.
+ */
 template <typename T>
-class ParticlePoolMap
-{
-public:
-    typedef std::multimap<Ogre::String, T*> PoolMapMap;
-    typedef typename PoolMapMap::iterator PoolMapIterator; // The 'typename' MUST be added, since T is not a fixed type
-
-    ParticlePoolMap () {};
-    virtual ~ParticlePoolMap() {};
-
-    bool
-    IsEmpty()
-    {
-        return m_Released.empty();
-    };
-
-    size_t
-    GetSize()
-    {
-        return m_Released.size();
-    };
-
-    void
-    ResetIterator()
-    {
-        m_PoolMapIterator = m_Released.begin();
-    };
-
-    T*
-    GetFirst()
-    {
-        ResetIterator();
-        if (End())
-        {
-            return NULL;
-        }
-
-        T* t = m_PoolMapIterator->second;
-        return t;
-    };
-
-    T*
-    GetNext()
-    {
-        if (End())
-        {
-            return NULL;
-        }
-
-        ++m_PoolMapIterator;
-        if (End())
-        {
-            return NULL;
-        }
-
-        T* t = m_PoolMapIterator->second;
-        return t;
-    };
-
-    bool
-    End()
-    {
-        return m_PoolMapIterator == m_Released.end();
-    };
-
-    void
-    Clear()
-    {
-        m_Locked.clear();
-        m_Released.clear();
-    };
-
-    void
-    AddElement(const Ogre::String& key, T* element)
-    {
-        m_Locked.insert(make_pair(key, element));
-    };
-
-    T*
-    ReleaseElement(const Ogre::String& key)
-    {
-        // Return with 0 if no elements left
-        if (m_Locked.empty())
-        {
-            return NULL;
-        }
-
-        // Return the first element that is encountered
-        T* t = 0;
-        PoolMapIterator it;
-        it = m_Locked.find(key);
-        if (it != m_Locked.end())
-        {
-            // Get the element and move it to the released elements list
-            t = it->second;
-            m_Released.insert(make_pair(key, t));
-            m_Locked.erase(it);
-        }
-
-        return t;
-    };
-
-    void
-    ReleaseAllElements()
-    {
-        // Move all elements from locked elements to released elements
-        PoolMapIterator it;
-        for (it = m_Locked.begin(); it != m_Locked.end(); ++it)
-        {
-            m_Released.insert(make_pair(it->first, it->second));
-        }
-        m_Locked.clear();
-        ResetIterator();
-    };
-
-    void
-    LockLatestElement()
-    {
-        // Move element pointed by iterator from released elements to locked elements
-        m_Locked.insert(make_pair(m_PoolMapIterator->first, m_PoolMapIterator->second));
-        m_Released.erase(m_PoolMapIterator++); // Watch the ++ at the end to set mPoolMapIterator to the next element
-    };
-
-    void
-    LockAllElements()
-    {
-        // Move all elements from release elements to locked elements
-        PoolMapIterator it;
-        for (it = m_Released.begin(); it != m_Released.end(); ++it)
-        {
-            m_Locked.insert(make_pair(it->first, it->second));
-        }
-        m_Released.clear();
-        ResetIterator();
-    };
-
-protected:
-    PoolMapMap m_Released;
-    PoolMapMap m_Locked;
-    PoolMapIterator m_PoolMapIterator;
+class ParticlePoolMap{
+
+    public:
+
+        typedef std::multimap<Ogre::String, T*> PoolMapMap;
+
+        // The 'typename' MUST be added, since T is not a fixed type.
+        typedef typename PoolMapMap::iterator PoolMapIterator;
+
+        /**
+         * Constructor.
+         */
+        ParticlePoolMap(){};
+
+        /**
+         * Destructor.
+         */
+        virtual ~ParticlePoolMap(){};
+
+        /**
+         * Checks if the pool map is empty.
+         *
+         * It doesn't consider locked particles, only the released ones.
+         *
+         * @return True if the pool is empty, false if there is at least one
+         * particle in the pool.
+         */
+        bool IsEmpty(){return released_.empty();};
+
+        /**
+         * Retrieves the pool map size.
+         *
+         * It doesn't consider locked particles, only the released ones.
+         *
+         * @return The number of particles in the pool.
+         */
+        size_t GetSize(){return released_.size();};
+
+        /**
+         * Resets the pool iterator.
+         */
+        void ResetIterator(){pool_map_iterator_ = released_.begin();};
+
+        /**
+         * Retrieves the first particle.
+         *
+         * Before doing so, it resets the pool map iterator. It doesn't
+         * consider locked particles, only the released ones.
+         *
+         * @return A reference to the first particle in the pool map. NULL if
+         * the pool map is empty.
+         */
+        T* GetFirst(){
+            ResetIterator();
+            if (End()) return NULL;
+            T* t = pool_map_iterator_->second;
+            return t;
+        };
+
+        /**
+         * Retrieves the next particle in the pool map.
+         *
+         * Before doing so, it advances the pool map iterator. It doesn't
+         * consider locked particles, only the released ones.
+         *
+         * @return A reference to the next particle in the pool map. NULL if
+         * the pool map is empty or the iterator is at the end of it.
+         */
+        T* GetNext(){
+            if (End()) return NULL;
+            ++ pool_map_iterator_;
+            if (End()) return NULL;
+            T* t = pool_map_iterator_->second;
+            return t;
+        };
+
+        /**
+         * Checks if the iterator is at the end of the pool map.
+         *
+         * If it's at the end, {@see GetNext} will return null when called. It
+         * doesn't consider locked particles, only the released ones.
+         *
+         * @return True if the iterator is at the end of the pool map.
+         */
+        bool End(){return pool_map_iterator_ == released_.end();};
+
+        /**
+         * Removes all particles.
+         *
+         * Removes both locked and released particles.
+         */
+        void Clear(){
+            locked_.clear();
+            released_.clear();
+        };
+
+        /**
+         * Adds a particle to the pool map.
+         *
+         * A particle is added in locked state.
+         *
+         * @param key[in] PArticle key in the map.
+         * @param element[in] Particle to add to the pool.
+         */
+        void AddElement(const Ogre::String& key, T* element){
+            locked_.insert(make_pair(key, element));
+        };
+
+        /**
+         * Releases a locked particle.
+         *
+         * @param key[in] The key of the particle to unlock.
+         * @return A pointer to the previously locked and now released
+         * particle, or 0 if there were no more locked particles.
+         */
+        T* ReleaseElement(const Ogre::String& key){
+            // Return with 0 if no elements left
+            if (locked_.empty()) return NULL;
+
+            // Return the first element that is encountered
+            T* t = 0;
+            PoolMapIterator it;
+            it = locked_.find(key);
+            if (it != locked_.end()){
+                // Get the element and move it to the released elements list
+                t = it->second;
+                released_.insert(make_pair(key, t));
+                locked_.erase(it);
+            }
+            return t;
+        };
+
+        /**
+         * Releases all locked particles.
+         *
+         * It also resets the pool map operator.
+         */
+        void ReleaseAllElements(){
+            // Move all elements from locked elements to released elements
+            PoolMapIterator it;
+            for (it = locked_.begin(); it != locked_.end(); ++ it)
+                released_.insert(make_pair(it->first, it->second));
+            locked_.clear();
+            ResetIterator();
+        };
+
+        /**
+         * Locks the released particle pointed by the iterator.
+         *
+         * The particle gets added to the end of the locked particle list.
+         */
+        void LockLatestElement(){
+            // Move element pointed by iterator from released elements to
+            // locked elements
+            locked_.insert(
+              make_pair(pool_map_iterator_->first, pool_map_iterator_->second)
+            );
+            // Watch the ++ at the end to set mPoolMapIterator to the next
+            // element
+            released_.erase(pool_map_iterator_ ++);
+        };
+
+        /**
+         * Locks all particles.
+         *
+         * The particles get added at the end of the locked list in the same
+         * order they were in the released list. The pool iterator is reseted.
+         */
+        void LockAllElements() {
+            // Move all elements from release elements to locked elements
+            PoolMapIterator it;
+            for (it = released_.begin(); it != released_.end(); ++ it)
+                locked_.insert(make_pair(it->first, it->second));
+            released_.clear();
+            ResetIterator();
+        };
+
+    protected:
+        /**
+         * List with released particles.
+         *
+         * They can be operated upon.
+         */
+        PoolMapMap released_;
+
+        /**
+         * List with locked particles.
+         *
+         * They can't be operated upon until released.
+         */
+        PoolMapMap locked_;
+
+        /**
+         * The pool map iterator.
+         *
+         * Determines the current particle to be acted upon. Only works for
+         * released particles.
+         */
+         PoolMapIterator pool_map_iterator_;
 };
 
 
 
-#endif // PARTICLE_POOL_MAP_H
+

+ 113 - 24
QGearsMain/include/core/particles/ParticleRenderer.h

@@ -1,43 +1,132 @@
-#ifndef PARTICLE_RENDERER_H
-#define PARTICLE_RENDERER_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreString.h>
 #include <OgreStringInterface.h>
-
 #include "ParticlePool.h"
 
 class ParticleTechnique;
 class VisualParticle;
 
+/**
+ * A particle renderer.
+ */
+class ParticleRenderer : public Ogre::StringInterface{
 
+    public:
 
-class ParticleRenderer : public Ogre::StringInterface
-{
-public:
-    ParticleRenderer();
-    virtual ~ParticleRenderer();
+        /**
+         * Constructor.
+         */
+        ParticleRenderer();
 
-    virtual void CopyAttributesTo(ParticleRenderer* renderer);
+        /**
+         * Destructor.
+         */
+        virtual ~ParticleRenderer();
 
-    void SetRendererInitialised(bool renderer_initialised);
-    bool IsRendererInitialised() const;
+        /**
+         * Copies the renderer attributes to other renderer.
+         *
+         * @param renderer[out] The renderer to copy the attributes to.
+         */
+        virtual void CopyAttributesTo(ParticleRenderer* renderer);
 
-    void SetRendererType(Ogre::String renderer_type);
-    const Ogre::String& GetRendererType() const;
+        /**
+         * Toggles renderer initialization state.
+         *
+         * @param renderer_initialised[in] True to mark the renderer as
+         * initialized, false to mark it as not initialized.
+         */
+        void SetRendererInitialised(bool renderer_initialised);
 
-    void SetParentTechnique(ParticleTechnique* parent_technique);
-    const ParticleTechnique* GetParentTechnique() const;
+        /**
+         * Checks the renderer initialization status.
+         *
+         * @return True if the renderer is initialized, false if not.
+         */
+        bool IsRendererInitialised() const;
 
-    virtual void SetVisible(bool visible = true) = 0;
-    virtual void Initialize() = 0;
-    virtual void UpdateRenderQueue(Ogre::RenderQueue* queue, ParticlePool<VisualParticle>& pool) = 0;
+        /**
+         * Sets the renderer type.
+         *
+         * @param renderer_type[in] The renderer type.
+         */
+        void SetRendererType(Ogre::String renderer_type);
 
-protected:
-    bool                m_RendererInitialised;
-    Ogre::String        m_RendererType;
-    ParticleTechnique*  m_ParentTechnique;
-};
+        /**
+         * Retrieves the renderer type.
+         *
+         * @return The renderer type.
+         */
+        const Ogre::String& GetRendererType() const;
+
+        /**
+         * Sets the renderer parent technique.
+         *
+         * @param parent_technique[in] Parent technique for the renderer.
+         */
+        void SetParentTechnique(ParticleTechnique* parent_technique);
+
+        /**
+         * Sets the renderer particle technique.
+         *
+         * @return The renderer particle technique.
+         */
+        const ParticleTechnique* GetParentTechnique() const;
 
+        /**
+         * Toggles the visibility of the particle renderer.
+         *
+         * @param visible[in] True to make th renderer visibible, false to make
+         * it invisible.
+         */
+        virtual void SetVisible(bool visible = true) = 0;
 
+        /**
+         * Initializes the renderer.
+         */
+        virtual void Initialize() = 0;
 
-#endif // PARTICLE_RENDERER_H
+        /**
+         * Adds the particle to the scene render queue.
+         *
+         * @param queue[] Unused
+         * @param pool[in] The particle pool.
+         */
+        virtual void UpdateRenderQueue(
+          Ogre::RenderQueue* queue,
+          ParticlePool<VisualParticle>& pool
+        ) = 0;
+
+    protected:
+
+        /**
+         * Indicates if the renderer has been initialized.
+         */
+        bool                renderer_initialized_;
+
+        /**
+         * The type of renderer.
+         */
+        Ogre::String        renderer_type_;
+
+        /**
+         * The renderer particle tchnique.
+         */
+        ParticleTechnique*  parent_technique_;
+};

+ 63 - 27
QGearsMain/include/core/particles/ParticleRendererFactory.h

@@ -1,38 +1,74 @@
-#ifndef PARTICLE_RENDERER_FACTORY_H
-#define PARTICLE_RENDERER_FACTORY_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-#include "ParticleRenderer.h"
+#pragma once
 
+#include "ParticleRenderer.h"
 
+/**
+ * A particle renderer factory.
+ */
+class ParticleRendererFactory{
 
-class ParticleRendererFactory
-{
-public:
-    ParticleRendererFactory(){};
-    virtual ~ParticleRendererFactory(){};
+    public:
 
-    virtual Ogre::String GetRendererType() const = 0;
+        /**
+         * Constructor.
+         */
+        ParticleRendererFactory(){};
 
-    virtual ParticleRenderer* CreateRenderer() = 0;
+        /**
+         * Destructor.
+         */
+        virtual ~ParticleRendererFactory(){};
 
-    void DestroyRenderer (ParticleRenderer* renderer)
-    {
-        if (renderer != NULL)
-        {
-            delete renderer;
-        }
-    };
+        /**
+         * Retrieves the renderer type.
+         *
+         * @return Renderer type.
+         */
+        virtual Ogre::String GetRendererType() const = 0;
 
-protected:
-    template <class T>
-    ParticleRenderer* _createRenderer()
-    {
-        ParticleRenderer* particle_renderer = new T();
-        particle_renderer->SetRendererType(GetRendererType());
-        return particle_renderer;
-    };
-};
+        /**
+         * Creates a rendered.
+         *
+         * @return Pointer to the new renderer.
+         */
+        virtual ParticleRenderer* CreateRenderer() = 0;
 
+        /**
+         * Destroys a renderer.
+         *
+         * @param renderer[in|out] The renderer to destroy.
+         */
+        void DestroyRenderer (ParticleRenderer* renderer){
+            if (renderer != NULL) delete renderer;
+        };
 
+    protected:
 
-#endif // PARTICLE_RENDERER_FACTORY_H
+        /**
+         * Creates a particle renderer.
+         *
+         * @tparam T The particle renderer type.
+         * @return The new particle renderer.
+         */
+        template <class T>
+        ParticleRenderer* _createRenderer(){
+            ParticleRenderer* particle_renderer = new T();
+            particle_renderer->SetRendererType(GetRendererType());
+            return particle_renderer;
+        };
+};

+ 30 - 9
QGearsMain/include/core/particles/ParticleRendererTranslator.h

@@ -1,17 +1,38 @@
-#ifndef PARTICLE_RENDERER_TRANSLATOR_H
-#define PARTICLE_RENDERER_TRANSLATOR_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreScriptTranslator.h>
 #include <OgreSingleton.h>
 
+/**
+ * Particle renderer translator for the Ogre system.
+ */
+class ParticleRendererTranslator : public Ogre::ScriptTranslator{
 
+    public:
 
-class ParticleRendererTranslator : public Ogre::ScriptTranslator
-{
-public:
-    void translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node);
+        /**
+         * Translates the renderer script to Ogre format.
+         *
+         * @param compiler[in] The compiler.
+         * @param node[in] The node to translate.
+         */
+        void translate(
+          Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node
+        );
 };
 
-
-
-#endif // PARTICLE_RENDERER_TRANSLATOR_H

+ 114 - 24
QGearsMain/include/core/particles/ParticleSystem.h

@@ -1,37 +1,127 @@
-#ifndef PARTICLE_SYSTEM_H
-#define PARTICLE_SYSTEM_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-#include <OgreMovableObject.h>
+#pragma once
 
+#include <OgreMovableObject.h>
 #include "ParticleTechnique.h"
 
+/**
+ * A particle system.
+ *
+ * @todo What is this?
+ */
+class ParticleSystem : public Ogre::MovableObject{
 
+    public:
 
-class ParticleSystem : public Ogre::MovableObject
-{
-public:
-    ParticleSystem(const Ogre::String& name);
-    virtual ~ParticleSystem();
-    void CopyAttributesTo(ParticleSystem* ps);
+        /**
+         * Constructor.
+         */
+        ParticleSystem(const Ogre::String& name);
 
-    // realization of Ogre::MovableObject
-    const Ogre::String& getMovableType() const;
-    const Ogre::AxisAlignedBox& getBoundingBox() const;
-    Ogre::Real getBoundingRadius() const;
-    void _updateRenderQueue(Ogre::RenderQueue* queue);
-    void visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables = false) {};
+        /**
+         * Destructor.
+         */
+        virtual ~ParticleSystem();
 
-    void Update(Ogre::Real time_elapsed);
+        /**
+         * Copies the system attributes to another ParticleSystem.
+         *
+         * @param ps[out] The ParticleSystem to copy the attributes to.
+         */
+        void CopyAttributesTo(ParticleSystem* ps);
 
-    // technique
-    ParticleTechnique* CreateTechnique();
-    void AddTechnique(ParticleTechnique* technique);
-    void DestroyAllTechniques();
+        // realization of Ogre::MovableObject
 
-private:
-    std::vector<ParticleTechnique*> m_Techniques;
-};
+        /**
+         * Retrieves the movable type.
+         *
+         * @return The movable type.
+         * @todo Understand and document.
+         */
+        const Ogre::String& getMovableType() const;
+
+        /**
+         * Retrieves the object bounding box.
+         *
+         * @return The bounding box.
+         */
+        const Ogre::AxisAlignedBox& getBoundingBox() const;
+
+        /**
+         * Retrieves the bounding radius.
+         *
+         * @return The bounding radius.
+         */
+        Ogre::Real getBoundingRadius() const;
+
+        /**
+         * Adds the system to the scene render queue.
+         *
+         * @param queue[in|out] The queue to update.
+         */
+        void _updateRenderQueue(Ogre::RenderQueue* queue);
 
+        /**
+         * Visits renderables.
+         *
+         * @param visitor[in] The visitor.
+         * @param debug_renderables[in] True to debug the renderables, default
+         * is false
+         * @todo Understand and document.
+         */
+        void visitRenderables(
+          Ogre::Renderable::Visitor* visitor, bool debug_renderables = false
+        ){};
 
+        /**
+         * Updates the system.
+         *
+         * Updates the system status based on the elapsed time.
+         *
+         * @param time_elapsed[in] The elapsed time.
+         */
+        void Update(Ogre::Real time_elapsed);
+
+        /**
+         * Technique creator.
+         *
+         * Creates a new technique and adds it to the system.
+         *
+         * @return Pointer to the newly created technique.
+         */
+        ParticleTechnique* CreateTechnique();
+
+        /**
+         * Adds a technique to the system.
+         *
+         * @param techique[in] Technique to add to the system
+         */
+        void AddTechnique(ParticleTechnique* technique);
+
+        /**
+         * Removes al techniques from the system.
+         */
+        void DestroyAllTechniques();
+
+    private:
+
+        /**
+         * List of the system techniques.
+         */
+        std::vector<ParticleTechnique*> techniques_;
+};
 
-#endif // PARTICLE_SYSTEM_H

+ 56 - 14
QGearsMain/include/core/particles/ParticleSystemFactory.h

@@ -1,26 +1,68 @@
-#ifndef PARTICLE_SYSTEM_FACTORY_H
-#define PARTICLE_SYSTEM_FACTORY_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreMovableObject.h>
 
+/**
+ * A particle system factory.
+ */
+class ParticleSystemFactory : public Ogre::MovableObjectFactory{
 
+    public:
 
-class ParticleSystemFactory : public Ogre::MovableObjectFactory
-{
-public:
-    ParticleSystemFactory() {};
-    ~ParticleSystemFactory() {};
+        /**
+         * Constructor.
+         */
+        ParticleSystemFactory(){};
 
-    static Ogre::String FACTORY_TYPE_NAME;
+        /**
+         * Destructor.
+         */
+        ~ParticleSystemFactory(){};
 
-    const Ogre::String& getType() const;
+        /**
+         * Type of the particle systems
+         */
+        static Ogre::String FACTORY_TYPE_NAME;
 
-    void destroyInstance(Ogre::MovableObject* obj);
+        /**
+         * Retrieves the particle systems type.
+         *
+         * @return The particle systems type.
+         */
+        const Ogre::String& getType() const;
 
-private:
-    Ogre::MovableObject* createInstanceImpl(const Ogre::String& name, const Ogre::NameValuePairList* params);
-};
+        /**
+         * Destroys a particle system.
+         *
+         * @param obj[in|out] System to destroy.
+         */
+        void DestroyInstance(Ogre::MovableObject* obj);
 
+    private:
 
+        /**
+         * Creates an instance from a template.
+         *
+         * @param name[in] Name for the particle system
+         * @param params[in] List of parameters for the particle system.
+         */
+        Ogre::MovableObject* createInstanceImpl(
+          const Ogre::String& name, const Ogre::NameValuePairList* params
+        );
+};
 
-#endif // PARTICLE_SYSTEM_FACTORY_H

+ 193 - 60
QGearsMain/include/core/particles/ParticleSystemManager.h

@@ -1,8 +1,21 @@
-#ifndef PARTICLE_SYSTEM_MANAGER_H
-#define PARTICLE_SYSTEM_MANAGER_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreSingleton.h>
-
 #include "ParticleEmitter.h"
 #include "ParticleEmitterFactory.h"
 #include "ParticleRendererFactory.h"
@@ -11,62 +24,182 @@
 #include "ParticleTechnique.h"
 #include "ParticleSystemTranslatorManager.h"
 
-
-
-class ParticleSystemManager: public Ogre::Singleton<ParticleSystemManager>
-{
-public:
-    ParticleSystemManager();
-    ~ParticleSystemManager();
-
-    // ParticleSystemTemplate
-    ParticleSystem* CreateParticleSystemTemplate(const Ogre::String& name);
-    ParticleSystem* GetParticleSystemTemplate(const Ogre::String& templateName);
-    void ParticleSystemTemplateNames(std::vector<Ogre::String>& v);
-
-    // ParticleSystem
-    ParticleSystem* CreateParticleSystem(const Ogre::String& name, const Ogre::String& template_name);
-    void DestroyParticleSystem(ParticleSystem* particle_system);
-
-    // ParticleTechnique.
-    ParticleTechnique* CreateTechnique();
-    ParticleTechnique* CloneTechnique(ParticleTechnique* technique);
-    void DestroyTechnique(ParticleTechnique* technique);
-
-    // ParticleEmitter
-    ParticleEmitter* CreateEmitter(const Ogre::String& emitter_type);
-    ParticleEmitter* CloneEmitter(ParticleEmitter* emitter);
-    void DestroyEmitter(ParticleEmitter* emitter);
-
-    // ParticleRenderer
-    ParticleRenderer* CreateRenderer(const Ogre::String& renderer_type);
-    ParticleRenderer* CloneRenderer(ParticleRenderer* renderer);
-    void DestroyRenderer(ParticleRenderer* renderer);
-
-private:
-    // factories
-    void AddEmitterFactory(ParticleEmitterFactory* factory);
-    void AddRendererFactory(ParticleRendererFactory* factory);
-
-
-private:
-    ParticleSystemFactory*           m_ParticleSystemFactory;
-
-    ParticleSystemTranslatorManager* m_TranslatorManager;
-
-    // ParticleSystemTemplate
-    typedef std::map<Ogre::String, ParticleSystem*> ParticleSystemTemplateMap;
-    ParticleSystemTemplateMap m_ParticleSystemTemplates;
-
-    // Emitter Factories
-    typedef std::map<Ogre::String, ParticleEmitterFactory*> EmitterFactoryMap;
-    EmitterFactoryMap m_EmitterFactories;
-
-    // Renderer Factories
-    typedef std::map<Ogre::String, ParticleRendererFactory*> RendererFactoryMap;
-    RendererFactoryMap m_RendererFactories;
+/**
+ * The particle system manager.
+ */
+class ParticleSystemManager: public Ogre::Singleton<ParticleSystemManager>{
+
+    public:
+
+        /**
+         * Constructor.
+         */
+        ParticleSystemManager();
+
+        /**
+         * Constructor.
+         */
+        ~ParticleSystemManager();
+
+        /**
+         * Creates a particle system template.
+         *
+         * @param name[in] Name for the template.
+         * @return A new particle system template.
+         */
+        ParticleSystem* CreateParticleSystemTemplate(const Ogre::String& name);
+
+        /**
+         * Retrieves a particle system template.
+         *
+         * @param template_name[in] The name of the template to retrieve.
+         * @return The template. 0 if no template with that name was found.
+         */
+        ParticleSystem* GetParticleSystemTemplate(
+          const Ogre::String& template_name
+        );
+
+        /**
+         * Gets all template names.
+         *
+         * @param v[out] List where the names will be loaded.
+         */
+        void ParticleSystemTemplateNames(std::vector<Ogre::String>& v);
+
+        /**
+         * Creates a particle system.
+         *
+         * @param name[in] Name for the template system.
+         * @param template_name[in] Name for the system template.
+         */
+        ParticleSystem* CreateParticleSystem(
+          const Ogre::String& name, const Ogre::String& template_name
+        );
+
+        /**
+         * Destroys a particle system.
+         *
+         * @param particle_system[out] Particle system to destroy.
+         */
+        void DestroyParticleSystem(ParticleSystem* particle_system);
+
+        /**
+         * Creates a new technique.
+         *
+         * @return The new technique.
+         */
+        ParticleTechnique* CreateTechnique();
+
+        /**
+         * Duplicates a technique.
+         *
+         * @param technique[in] Technique to duplicate.
+         * @return The new, duplicated technique.
+         */
+        ParticleTechnique* CloneTechnique(ParticleTechnique* technique);
+
+        /**
+         * Destroys a technique.
+         *
+         * @param technique[out] Technique to destroy.
+         */
+        void DestroyTechnique(ParticleTechnique* technique);
+
+        /**
+         * Creates a new particle emitter.
+         *
+         * @param emitter_type[in] Type for the emitter.
+         */
+        ParticleEmitter* CreateEmitter(const Ogre::String& emitter_type);
+
+        /**
+         * Duplicates a particle emitter.
+         *
+         * @param emitter[in] Emitter to duplicate.
+         * @return The new, duplicated emitter.
+         */
+        ParticleEmitter* CloneEmitter(ParticleEmitter* emitter);
+
+        /**
+         * Destroys a particle emitter.
+         *
+         * @param emitter[out] Emitter to destroy.
+         */
+        void DestroyEmitter(ParticleEmitter* emitter);
+
+        /**
+         * Creates a new particle renderer.
+         *
+         * @param renderer_type[in] Type for the renderer.
+         * @return The newly created renderer.
+         */
+        ParticleRenderer* CreateRenderer(const Ogre::String& renderer_type);
+
+        /**
+         * Duplicates a renderer.
+         *
+         * @param renderer[in] renderer to duplicate.
+         * @return The new, duplicated renderer.
+         */
+        ParticleRenderer* CloneRenderer(ParticleRenderer* renderer);
+
+        /**
+         * Destroys a renderer.
+         *
+         * @param renderer[out] The renderer to destroy.
+         */
+        void DestroyRenderer(ParticleRenderer* renderer);
+
+    private:
+
+        /**
+         * Adds a new {@see ParticleEmitterFactory} to the manager.
+         *
+         * @param factory[in] The factory to add to the manager.
+         */
+        void AddEmitterFactory(ParticleEmitterFactory* factory);
+
+        /**
+         * Adds a new {@see ParticleRendererFactory} to the manager.
+         *
+         * @param factory[in] The factory to add to the manager.
+         */
+        void AddRendererFactory(ParticleRendererFactory* factory);
+
+    private:
+
+        /**
+         * The particle system factory.
+         */
+        ParticleSystemFactory* particle_system_factory_;
+
+        /**
+         * The translator manager.
+         */
+        ParticleSystemTranslatorManager* translator_manager_;
+
+        typedef std::map<Ogre::String, ParticleSystem*>
+          ParticleSystemTemplateMap;
+
+        /**
+         * The particle system template map.
+         */
+        ParticleSystemTemplateMap particle_system_templates_;
+
+        typedef std::map<Ogre::String, ParticleEmitterFactory*>
+          EmitterFactoryMap;
+
+        /**
+         * List of particle emitter factories.
+         */
+        EmitterFactoryMap emitter_factories_;
+
+        typedef std::map<Ogre::String, ParticleRendererFactory*>
+          RendererFactoryMap;
+
+        /**
+         * List of renderer factories.
+         */
+        RendererFactoryMap renderer_factories_;
 };
 
-
-
-#endif // PARTICLE_SYSTEM_MANAGER_H

+ 28 - 9
QGearsMain/include/core/particles/ParticleSystemTranslator.h

@@ -1,17 +1,36 @@
-#ifndef PARTICLE_SYSTEM_TRANSLATOR_H
-#define PARTICLE_SYSTEM_TRANSLATOR_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreScriptTranslator.h>
 #include <OgreSingleton.h>
 
+/**
+ * Particle system translator for the Ogre system.
+ */
+class ParticleSystemTranslator : public Ogre::ScriptTranslator{
 
+    public:
 
-class ParticleSystemTranslator : public Ogre::ScriptTranslator
-{
-public:
-    void translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node);
+        /**
+         * Translates the particle system script to Ogre format.
+         *
+         * @param compiler[in] The compiler.
+         * @param node[in] The node to translate.
+         */
+        void translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node);
 };
 
-
-
-#endif // PARTICLE_SYSTEM_TRANSLATOR_H

+ 57 - 15
QGearsMain/include/core/particles/ParticleSystemTranslatorManager.h

@@ -1,31 +1,73 @@
-#ifndef PARTICLE_SYSTEM_TRANSLATOR_MANAGER_H
-#define PARTICLE_SYSTEM_TRANSLATOR_MANAGER_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreScriptTranslator.h>
 #include <OgreSingleton.h>
-
 #include "ParticleEmitterTranslator.h"
 #include "ParticleRendererTranslator.h"
 #include "ParticleSystemTranslator.h"
 #include "ParticleTechniqueTranslator.h"
 
 
+/**
+ * The particle system translator manager.
+ */
+class ParticleSystemTranslatorManager : public Ogre::ScriptTranslatorManager{
 
-class ParticleSystemTranslatorManager : public Ogre::ScriptTranslatorManager
-{
-public:
-    size_t getNumTranslators() const;
+    public:
 
-    Ogre::ScriptTranslator *getTranslator(const Ogre::AbstractNodePtr &node);
+        /**
+         * Get the translator count.
+         *
+         * @return The translator count.
+         */
+        size_t getNumTranslators() const;
 
-private:
-    ParticleEmitterTranslator   m_EmitterTranslator;
-    ParticleRendererTranslator  m_RendererTranslator;
-    ParticleSystemTranslator    m_ParticleSystemTranslator;
-    ParticleTechniqueTranslator m_TechniqueTranslator;
-};
+        /**
+         * Retreieves the translator for a node.
+         *
+         * @param node[in] The node for whose type to get the translator.
+         * @return The translator for the type of NODE, of nullptr if there is
+         * no translator for it's type of node.
+         */
+        Ogre::ScriptTranslator *getTranslator(
+          const Ogre::AbstractNodePtr &node
+        );
 
+    private:
 
+        /**
+         * The particle emitter translator.
+         */
+        ParticleEmitterTranslator emitter_translator_;
 
+        /**
+         * The renderer translator.
+         */
+        ParticleRendererTranslator renderer_translator_;
+
+        /**
+         * The particle system translator.
+         */
+        ParticleSystemTranslator particle_system_translator_;
+
+        /**
+         * The technique translator.
+         */
+        ParticleTechniqueTranslator technique_translator_;
+};
 
-#endif // PARTICLE_SYSTEM_TRANSLATOR_MANAGER_H

+ 207 - 55
QGearsMain/include/core/particles/ParticleTechnique.h

@@ -1,65 +1,217 @@
-#ifndef PARTICLE_TECHNIQUE_H
-#define PARTICLE_TECHNIQUE_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include "ParticleEmitter.h"
 #include "ParticleRenderer.h"
 #include "ParticlePool.h"
 #include "ParticlePoolMap.h"
 
-
-
 class ParticleSystem;
 
-
-
-class ParticleTechnique
-{
-public:
-    ParticleTechnique();
-    virtual ~ParticleTechnique();
-
-    void CopyAttributesTo(ParticleTechnique* technique);
-
-    void SetParentSystem(ParticleSystem* parentSystem) {m_ParentSystem = parentSystem;};
-    ParticleSystem* GetParentSystem() const {return m_ParentSystem;};
-
-    // this fucntion called from ParticleSystem which implements _updateRenderQueue from movable objects
-    void UpdateRenderQueue(Ogre::RenderQueue* queue);
-
-    void Initialize();
-    void Update(Ogre::Real time_elapsed);
-
-    ParticleRenderer* CreateRenderer(const Ogre::String& renderer_type);
-    void SetRenderer(ParticleRenderer* renderer);
-    void DestroyRenderer();
-
-    ParticleEmitter* CreateEmitter(const Ogre::String& emitter_type);
-    void AddEmitter(ParticleEmitter* emitter);
-    void DestroyAllEmitters();
-    int GetNumEmittableEmitters() const;
-
-    void EmissionChange();
-
-    int GetVisualParticlesQuota() const {return m_VisualParticleQuota;};
-    void ExecuteEmitParticles(ParticleEmitter* emitter, int requested, Ogre::Real time_elapsed);
-    void ResetVisualParticles();
-
-private:
-    ParticleSystem*                     m_ParentSystem;
-
-    ParticleRenderer*                   m_Renderer;
-
-    int                                 m_VisualParticleQuota;
-    bool                                m_VisualParticlePoolIncreased;
-    ParticlePool<VisualParticle>        m_VisualParticlesPool;
-    std::vector<VisualParticle*>        m_VisualParticles;
-
-    int                                 m_EmittedEmitterQuota;
-    bool                                m_ParticleEmitterPoolIncreased;
-    ParticlePoolMap<ParticleEmitter>    m_ParticleEmitterPool;
-    std::vector<ParticleEmitter*>       m_Emitters;
+/**
+ * A particle technique.
+ */
+class ParticleTechnique{
+
+    public:
+
+        /**
+         * Constructor.
+         */
+        ParticleTechnique();
+
+        /**
+         * Destructor.
+         */
+        virtual ~ParticleTechnique();
+
+        /**
+         * Copy the technique attributes to another technique.
+         */
+        void CopyAttributesTo(ParticleTechnique* technique);
+
+        /**
+         * Sets the parent system for the technique.
+         *
+         * @param
+         */
+        void SetParentSystem(ParticleSystem* parent_system){
+            parent_system_ = parent_system;
+        };
+
+        /**
+         * Retrieves the parent system.
+         *
+         * @return The parent system.
+         */
+        ParticleSystem* GetParentSystem() const {return parent_system_;};
+
+        /**
+         * Adds the technique to the scene render queue.
+         *
+         * @param queue[in|out] The queue to update.
+         */
+        void UpdateRenderQueue(Ogre::RenderQueue* queue);
+
+        /**
+         * Initializes the tehnique.
+         */
+        void Initialize();
+
+        /**
+         * Updates the technique.
+         *
+         * Updates the technique status based on the elapsed time.
+         *
+         * @param time_elapsed[in] The elapsed time.
+         */
+        void Update(Ogre::Real time_elapsed);
+
+        /**
+         * Creates a renderer.
+         *
+         * The renderer gets assigned to the technique.
+         *
+         * @param renderer_type[in] The type for the renderer.
+         * @return The newly created renderer.
+         */
+        ParticleRenderer* CreateRenderer(const Ogre::String& renderer_type);
+
+        /**
+         * Sets the renderer for the technique.
+         *
+         * @paramater renderer[in] Renderer for the technique.
+         */
+        void SetRenderer(ParticleRenderer* renderer);
+
+        /**
+         * Destroys the technique renderer.
+         */
+        void DestroyRenderer();
+
+        /**
+         * Creates a particle emitter for the technique.
+         *
+         * The emitter gets added to the technique.
+         *
+         * @param emitter_type[in] The type for the emitter.
+         * @return The newly created emitter.
+         */
+        ParticleEmitter* CreateEmitter(const Ogre::String& emitter_type);
+
+        /**
+         * Adds a particle emitter to the technique
+         *
+         * @param emitter[in] The emitter to add to the technique.
+         */
+        void AddEmitter(ParticleEmitter* emitter);
+
+        /**
+         * Destroys all the technique's emitters.
+         */
+        void DestroyAllEmitters();
+
+        /**
+         * Counts the number of emitters assigned to the techniques.
+         *
+         * @return The number of emitters assigned to the techniques.
+         */
+        int GetNumEmittableEmitters() const;
+
+        /**
+         * Marks all emitters as emittables.
+         */
+        void EmissionChange();
+
+        /**
+         * Retrieves the visual particles quota
+         *
+         * @return The visual particles quota
+         * @todo What is the quta for? How is it set?
+         */
+        int GetVisualParticlesQuota() const {return visual_particle_quota_;};
+
+        /**
+         * Initializes the particles of an emitter for emission.
+         *
+         * @param eitter[in] The emited to mark.
+         * @param requested[in] The number of particles to emit.
+         * @param time_elapsed[in] Unused.
+         * @todo Understand and document properly.
+         */
+        void ExecuteEmitParticles(
+          ParticleEmitter* emitter, int requested, Ogre::Real time_elapsed
+        );
+
+        /**
+         * Locks all particles and removes all their additional data.
+         */
+        void ResetVisualParticles();
+
+    private:
+
+        /**
+         * The parent particle system.
+         */
+        ParticleSystem* parent_system_;
+
+        /**
+         * The technique renderer.
+         */
+        ParticleRenderer* renderer_;
+
+        /**
+         * The visual particle quota.
+         */
+        int visual_particle_quota_;
+
+        /**
+         * Indicates if the visual particle quota has been increased.
+         */
+        bool visual_particle_pool_increased_;
+
+        /**
+         * The visual particle pool.
+         */
+        ParticlePool<VisualParticle> visual_particles_pool_;
+
+        /**
+         * List of visual particles.
+         */
+        std::vector<VisualParticle*> visual_particles_;
+
+        /**
+         * The particle emitter quota.
+         */
+        int emitted_emitter_quota_;
+
+        /**
+         * Indicates if the particle emitte quota has been increased.
+         */
+        bool particle_emitter_pool_increased_;
+
+        /**
+         * Particle emitter pool.
+         */
+        ParticlePoolMap<ParticleEmitter> particle_emitter_pool_;
+
+        /**
+         * List of particle emitters.
+         */
+        std::vector<ParticleEmitter*> emitters_;
 };
 
-
-
-#endif // PARTICLE_TECHNIQUE_H

+ 30 - 9
QGearsMain/include/core/particles/ParticleTechniqueTranslator.h

@@ -1,17 +1,38 @@
-#ifndef PARTICLE_TECHNIQUE_TRANSLATOR_H
-#define PARTICLE_TECHNIQUE_TRANSLATOR_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include <OgreScriptTranslator.h>
 #include <OgreSingleton.h>
 
+/**
+ * Particle technique translator for the Ogre system.
+ */
+class ParticleTechniqueTranslator : public Ogre::ScriptTranslator{
 
+    public:
 
-class ParticleTechniqueTranslator : public Ogre::ScriptTranslator
-{
-public:
-    void translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node);
+        /**
+         * Translates the particle system script to Ogre format.
+         *
+         * @param compiler[in] The compiler.
+         * @param node[in] The node to translate.
+         */
+        void translate(
+          Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node
+        );
 };
 
-
-
-#endif // PARTICLE_TECHNIQUE_TRANSLATOR_H

+ 34 - 11
QGearsMain/include/core/particles/ParticleVisual.h

@@ -1,19 +1,42 @@
-#ifndef VISUAL_PARTICLE_H
-#define VISUAL_PARTICLE_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include "Particle.h"
 
+/**
+ * A visual particle
+ */
+class VisualParticle : public Particle{
 
+    public:
 
-class VisualParticle : public Particle
-{
-public:
-    VisualParticle();
-    virtual ~VisualParticle() {};
-
-    virtual void InitForExpiration();
-};
+        /**
+         * Constructor.
+         */
+        VisualParticle();
 
+        /**
+         * Destructor.
+         */
+        virtual ~VisualParticle() {};
 
+        /**
+         * Initializes the particle for expiration.
+         */
+        virtual void InitForExpiration();
+};
 
-#endif // VISUAL_PARTICLE_H

+ 33 - 12
QGearsMain/include/core/particles/emitters/ParticlePointEmitter.h

@@ -1,19 +1,40 @@
-#ifndef PARTICLE_POINT_EMITTER_H
-#define PARTICLE_POINT_EMITTER_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include "../ParticleEmitter.h"
 
+class PointEmitter : public ParticleEmitter{
 
+    public:
 
-class PointEmitter : public ParticleEmitter
-{
-public:
-    PointEmitter();
-    virtual ~PointEmitter() {};
-
-    virtual void CopyAttributesTo(ParticleEmitter* emitter);
-};
+        /**
+         * Constructor.
+         */
+        PointEmitter();
 
+        /**
+         * Destructor.
+         */
+        virtual ~PointEmitter(){};
 
-
-#endif // PARTICLE_POINT_EMITTER_H
+        /**
+         * Copies all atributes to a ParticleEmitter.
+         *
+         * @param emitter[out] Emmiter to copy attributes to.
+         */
+        virtual void CopyAttributesTo(ParticleEmitter* emitter);
+};

+ 51 - 24
QGearsMain/include/core/particles/emitters/ParticlePointEmitterFactory.h

@@ -1,28 +1,55 @@
-#ifndef PARTICLE_POINT_EMITTER_FACTORY_H
-#define PARTICLE_POINT_EMITTER_FACTORY_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
-#include "../ParticleEmitterFactory.h"
 #include "ParticlePointEmitter.h"
+#include "../ParticleEmitterFactory.h"
 
-
-
-class PointEmitterFactory : public ParticleEmitterFactory
-{
-public:
-    PointEmitterFactory(){};
-    virtual ~PointEmitterFactory(){};
-
-    Ogre::String GetEmitterType() const
-    {
-        return "Point";
-    }
-
-    ParticleEmitter* CreateEmitter()
-    {
-        return _createEmitter<PointEmitter>();
-    }
+/**
+ * A particle emitter factory.
+ */
+class PointEmitterFactory : public ParticleEmitterFactory{
+
+    public:
+
+        /**
+         * Constructor.
+         */
+        PointEmitterFactory(){};
+
+        /**
+         * Destructor.
+         */
+        virtual ~PointEmitterFactory(){};
+
+        /**
+         * Retrieves the emitter type.
+         *
+         * @return The emitter type (always "Point").
+         */
+        Ogre::String GetEmitterType() const{
+            return "Point";
+        }
+
+        /**
+         * Creates an emitter.
+         *
+         * @return A new {@see PointEmitter}.
+         */
+        ParticleEmitter* CreateEmitter(){
+            return CreateEmitter_<PointEmitter>();
+        }
 };
-
-
-
-#endif // PARTICLE_POINT_EMITTER_FACTORY_H

+ 41 - 22
QGearsMain/include/core/particles/renderer/ParticleEntityAdditionalData.h

@@ -1,29 +1,48 @@
-#ifndef PARTICLE_ENTITY_ADDITIONAL_DATA_H
-#define PARTICLE_ENTITY_ADDITIONAL_DATA_H
-
-
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include "../ParticleAdditionalData.h"
 
-
-
-struct ParticleEntityAdditionalData : public ParticleAdditionalData
-{
-    ParticleEntityAdditionalData(Ogre::SceneNode* scene_node):
-        node(scene_node)
-    {
-    };
-
-    void SetVisible(bool visible)
-    {
-        if (node != NULL)
-        {
-            node->setVisible(visible);
-        }
+/**
+ * Additional data for a particle entity.
+ */
+struct ParticleEntityAdditionalData : public ParticleAdditionalData{
+
+    /**
+     * Constructor.
+     *
+     * @param scene_node[in] The scene node.
+     */
+    ParticleEntityAdditionalData(Ogre::SceneNode* scene_node)
+    : node(scene_node)
+    {};
+
+    /**
+     * Toggles the particle entity visibility.
+     *
+     * @param visible[in] True to make the particle visible, false to make it
+     * invisible.
+     */
+    void SetVisible(bool visible){
+        if (node != NULL) node->setVisible(visible);
     }
 
+    /**
+     * The node that is the particle entity.
+     */
     Ogre::SceneNode* node;
 };
-
-
-#endif // PARTICLE_ENTITY_ADDITIONAL_DATA_H

+ 102 - 23
QGearsMain/include/core/particles/renderer/ParticleEntityRenderer.h

@@ -1,39 +1,118 @@
-#ifndef PARTICLE_ENTITY_RENDERER_H
-#define PARTICLE_ENTITY_RENDERER_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-#include <OgreSceneNode.h>
+#pragma once
 
+#include <OgreSceneNode.h>
 #include "ParticleEntityAdditionalData.h"
 #include "ParticleEntityRendererDictionary.h"
 #include "../ParticleRenderer.h"
 
+/**
+ * A particle entity renderer.
+ */
+class ParticleEntityRenderer : public ParticleRenderer{
 
+    public:
 
-class ParticleEntityRenderer : public ParticleRenderer
-{
-public:
-    ParticleEntityRenderer();
-    virtual ~ParticleEntityRenderer();
+        /**
+         * Constructor.
+         */
+        ParticleEntityRenderer();
 
-    virtual void CopyAttributesTo(ParticleRenderer* renderer);
+        /**
+         * Destructor.
+         */
+        virtual ~ParticleEntityRenderer();
 
-    const Ogre::String& GetMeshName() const;
-    void SetMeshName(const Ogre::String& mesh_name);
+        /**
+         * Copies the atributtes to other renderer.
+         *
+         * @param renderer[out] Renderer to copy the attributes to.
+         */
+        virtual void CopyAttributesTo(ParticleRenderer* renderer);
 
-    void Clear();
+        /**
+         * Retrieves the emitter's mesh name.
+         *
+         * @return The emitter mesh name.
+         */
+        const Ogre::String& GetMeshName() const;
 
-    virtual void SetVisible(bool visible);
-    virtual void Initialize();
-    virtual void UpdateRenderQueue(Ogre::RenderQueue* queue, ParticlePool<VisualParticle>& pool);
+        /**
+         * Sets the emitter's mesh name.
+         *
+         * @param mesh_name[in] The name for the emitter's mesh.
+         */
+        void SetMeshName(const Ogre::String& mesh_name);
 
-protected:
-    std::vector<ParticleEntityAdditionalData*>          m_AllAdditionalData;
-    std::vector<ParticleEntityAdditionalData*>          m_UnassignedAdditionalData;
-    std::vector<Ogre::Entity*>                          m_Entities;
-    static ParticleEntityRendererDictionary::MeshName   m_MeshNameDictionary;
-    Ogre::String                                        m_MeshName;
-};
+        /**
+         * Clears all data in the entity.
+         */
+        void Clear();
+
+        /**
+         * Toggles the particle entity visibility.
+         *
+         * @param visible[in] True to make the particle visible, false to make
+         * it invisible.
+         */
+        virtual void SetVisible(bool visible);
+
+        /**
+         * Initializes the particle.
+         */
+        virtual void Initialize();
+
+        /**
+         * Adds the particle to the scene render queue.
+         *
+         * @param queue[] Unused
+         * @param pool[in] The particle pool.
+         */
+        virtual void UpdateRenderQueue(
+          Ogre::RenderQueue* queue, ParticlePool<VisualParticle>& pool
+        );
 
+    protected:
 
+        /**
+         * Additional data for the rendered.
+         */
+        std::vector<ParticleEntityAdditionalData*> all_additional_data_;
+
+        /**
+         * Additional data for the rendered that is not yet assigned.
+         */
+        std::vector<ParticleEntityAdditionalData*> unassigned_additional_data_;
+
+        /**
+         * List of entities.
+         *
+         * @todo What are these entities?
+         */
+        std::vector<Ogre::Entity*> entities_;
+
+        /**
+         * A dictionary of mesh names.
+         */
+        static ParticleEntityRendererDictionary::MeshName mesh_name_dictionary_;
+
+        /**
+         * The mesh name for the particles.
+         */
+        Ogre::String mesh_name_;
+};
 
-#endif // PARTICLE_ENTITY_RENDERER_H

+ 48 - 23
QGearsMain/include/core/particles/renderer/ParticleEntityRendererFactory.h

@@ -1,28 +1,53 @@
-#ifndef PARTICLE_ENTITY_RENDERER_FACTORY_H
-#define PARTICLE_ENTITY_RENDERER_FACTORY_H
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
 
 #include "../ParticleRendererFactory.h"
 #include "ParticleEntityRenderer.h"
 
-
-
-class ParticleEntityRendererFactory : public ParticleRendererFactory
-{
-public:
-    ParticleEntityRendererFactory() {};
-    virtual ~ParticleEntityRendererFactory() {};
-
-    Ogre::String GetRendererType() const
-    {
-        return "Entity";
-    }
-
-    ParticleRenderer* CreateRenderer()
-    {
-        return _createRenderer<ParticleEntityRenderer>();
-    }
+/**
+ * A particle entity renderer factory.
+ */
+class ParticleEntityRendererFactory : public ParticleRendererFactory{
+
+    public:
+
+        /**
+         * Constructor.
+         */
+        ParticleEntityRendererFactory() {};
+
+        /**
+         * Destructor.
+         */
+        virtual ~ParticleEntityRendererFactory(){};
+
+        /**
+         * Retrieves the renderer type.
+         *
+         * @return The renderer type (always "Entity").
+         */
+        Ogre::String GetRendererType() const{return "Entity";}
+
+        /**
+         * Create a renderer.
+         *
+         * @return A new renderer.
+         */
+        ParticleRenderer* CreateRenderer(){
+            return _createRenderer<ParticleEntityRenderer>();
+        }
 };
-
-
-
-#endif // PARTICLE_ENTITY_RENDERER_FACTORY_H

+ 1 - 1
QGearsMain/include/data/QGearsCameraMatrixFile.h

@@ -70,7 +70,7 @@ namespace QGears
     private:
         Ogre::Matrix3   m_matrix;
         Ogre::Vector3   m_position;
-        Pixel           m_offset;
+        Pixel           moffset_;
         Ogre::Real      m_focal_length;
         size_t          m_count;
     };

+ 1 - 1
QGearsMain/include/data/QGearsFLevelFileSerializer.h

@@ -64,7 +64,7 @@ namespace QGears
     protected:
         void    readFileHeader( Ogre::DataStreamPtr &stream );
 
-        void    readSectionData(Ogre::DataStreamPtr &stream, Ogre::DataStreamPtr &out_buffer, size_t sectionSize);
+        void    readSectionData(Ogre::DataStreamPtr &stream, Ogre::DataStreamPtr &outbuffer_, size_t sectionSize);
         virtual void    readSection( Ogre::DataStreamPtr &stream, FLevelFile* pDest, const size_t section_index );
 
         template<typename ResourceManagerType>

+ 3 - 3
QGearsMain/include/data/QGearsLGPArchive.h

@@ -80,14 +80,14 @@ namespace QGears
             struct FileEntry
             {
                 String file_name;
-                uint32 file_offset;
+                uint32 fileoffset_;
                 uint8  unknown1;
                 uint16 unknown2;
 
-                String data_file_name;
+                String datafile_name_;
                 uint32 data_size;
 
-                uint32 data_offset;
+                uint32 dataoffset_;
             };
 
             typedef std::vector<FileEntry> FileList;

+ 1 - 1
QGearsMain/include/data/QGearsLGPArchiveFactory.h

@@ -50,7 +50,7 @@ namespace QGears
                 return OGRE_NEW LGPArchive( name, ARCHIVE_TYPE );
             }
 
-            /// @copydoc FactoryObj::destroyInstance
+            /// @copydoc FactoryObj::DestroyInstance
             void destroyInstance( Ogre::Archive* arch ) override final
             {
                 OGRE_DELETE arch;

+ 10 - 10
QGearsMain/include/data/QGearsLZSDataStream.h

@@ -41,21 +41,21 @@ namespace QGears
 			clear();
 		}
 
-		void write( const void *in_buffer )
+		void write( const void *inbuffer_ )
 		{
-		    m_buffer[m_pos] = *( static_cast<const uint8*>( in_buffer ) );
+		    mbuffer_[m_pos] = *( static_cast<const uint8*>( inbuffer_ ) );
 		    ++m_pos %= buffer_size;
 		    ++m_avail = std::min( m_avail, buffer_size );
 		}
 
-		size_t read( void *out_buffer, size_t count )
+		size_t read( void *outbuffer_, size_t count )
 		{
 		    assert( m_avail && "Can't read if no data is available" );
 		    size_t read( 0 );
-		    uint8 *buffer( static_cast<uint8*>(out_buffer) );
+		    uint8 *buffer( static_cast<uint8*>(outbuffer_) );
 		    while( read < count && m_avail )
             {
-		        *(buffer++) = m_buffer[(m_pos - m_avail) % buffer_size];
+		        *(buffer++) = mbuffer_[(m_pos - m_avail) % buffer_size];
 		        --m_avail;
 		        ++read;
             }
@@ -64,7 +64,7 @@ namespace QGears
 
 		uint8 get( const size_t offset )
 		{
-		    return m_buffer[offset % buffer_size];
+		    return mbuffer_[offset % buffer_size];
 		}
 
 		size_t avail( void ) const
@@ -76,11 +76,11 @@ namespace QGears
 		{
 			m_pos = 0;
 			m_avail = 0;
-			memset( m_buffer, 0, buffer_size );
+			memset( mbuffer_, 0, buffer_size );
 		}
 
 	protected:
-		uint8 m_buffer[buffer_size];
+		uint8 mbuffer_[buffer_size];
 		size_t m_pos, m_avail;
 
 	};
@@ -104,7 +104,7 @@ namespace QGears
         virtual void close(void) override;
 
         size_t availableCompressed( void ) const { return m_available_compressed; }
-        size_t availableUncompressed( void ) const { return m_buffer.avail(); }
+        size_t availableUncompressed( void ) const { return mbuffer_.avail(); }
 
         void flipEndian( uint32 &inout_data );
 
@@ -115,7 +115,7 @@ namespace QGears
         Ogre::DataStreamPtr m_compressed_stream;
         uint32              m_available_compressed;
         size_t              m_pos;
-        RingBuffer<4096>    m_buffer;
+        RingBuffer<4096>    mbuffer_;
     private:
     };
 

+ 2 - 2
QGearsMain/include/data/worldmap/MapFile.h

@@ -3,7 +3,7 @@
 
 #include "common/QGearsResource.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 class WorldMapFile : public Resource
 {
@@ -24,6 +24,6 @@ private:
 
 typedef Ogre::SharedPtr<WorldMapFile> MapFilePtr;
 
-END_QGEARS
+} // namespace QGears
 
 #endif // _MAP_FILE_H_

+ 2 - 2
QGearsMain/include/data/worldmap/MapFileManager.h

@@ -5,7 +5,7 @@
 #include "common/TypeDefine.h"
 #include "QGearsPrerequisites.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 class WorldMapFile;
 
@@ -30,6 +30,6 @@ private:
             const Ogre::NameValuePairList *createParams ) override final;
 };
 
-END_QGEARS
+} // namespace QGears
 
 #endif // _MAP_FILE_MANAGER_H_

+ 2 - 2
QGearsMain/include/data/worldmap/MapFileSerializer.h

@@ -4,7 +4,7 @@
 #include "common/TypeDefine.h"
 #include "data/QGearsSerializer.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 class WorldMapFile;
 
@@ -182,6 +182,6 @@ public:
     std::vector<SBlock> mBlocks;
 };
 
-END_QGEARS
+} // namespace QGears
 
 #endif // _MAP_FILE_SERIALIZER_H_

+ 2 - 2
QGearsMain/include/data/worldmap/TxzFile.h

@@ -3,7 +3,7 @@
 
 #include "common/QGearsResource.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 class TxzFile : public Resource
 {
@@ -23,6 +23,6 @@ private:
 
 typedef Ogre::SharedPtr<TxzFile> TxzFilePtr;
 
-END_QGEARS
+} // namespace QGears
 
 #endif // _TXZ_FILE_H_

+ 2 - 2
QGearsMain/include/data/worldmap/TxzFileManager.h

@@ -5,7 +5,7 @@
 #include "common/TypeDefine.h"
 #include "QGearsPrerequisites.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 class _QGearsExport TxzFileManager
         : public Ogre::ResourceManager,
@@ -28,6 +28,6 @@ private:
             const Ogre::NameValuePairList *createParams ) override final;
 };
 
-END_QGEARS
+} // namespace QGears
 
 #endif // _TXZ_FILE_MANAGER_H_

+ 2 - 2
QGearsMain/include/data/worldmap/TxzFileSerializer.h

@@ -5,7 +5,7 @@
 #include "data/QGearsSerializer.h"
 #include <array>
 
-BEGIN_QGEARS
+namespace QGears {
 
 class TxzFile;
 
@@ -113,6 +113,6 @@ private:
 static_assert(sizeof(TxzFileSerializer::wm_texture)==4, "wm_texture is not packed");
 static_assert(sizeof(TxzFileSerializer::psx_pixel)==2, "psx_pixel is not packed");
 
-END_QGEARS
+} // namespace QGears
 
 #endif // _TXZ_FILE_SERIALIZER_H_

+ 1 - 1
QGearsMain/include/map/QGearsBackground2DFile.h

@@ -77,7 +77,7 @@ namespace QGears
     private:
         String              m_texture_name;
         Ogre::Vector2       m_clip;
-        Ogre::Vector4       m_range;
+        Ogre::Vector4       range_;
         Ogre::Vector3       m_position;
         Ogre::Quaternion    m_orientation;
         Ogre::Radian        m_fov;

+ 2 - 2
QGearsMain/include/modules/worldmap/WorldMapModule.h

@@ -4,7 +4,7 @@
 #include <OgreSingleton.h>
 #include "common/TypeDefine.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 class WorldMapModule : public Ogre::Singleton< WorldMapModule >
 {
@@ -12,6 +12,6 @@ public:
     void Init();
 };
 
-END_QGEARS
+} // namespace QGears
 
 #endif // _WORLD_MAP_MODULE_H_

+ 22 - 0
QGearsMain/include/vgears_version.h

@@ -1,3 +1,25 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/**
+ * This file defines the application version.
+ */
+
 #pragma once
 
+/**
+ * Application version.
+ */
 #define QG_VERSION_NAME ""

+ 22 - 0
QGearsMain/include/vgears_version.h.in

@@ -1,3 +1,25 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/**
+ * This file defines the application version.
+ */
+
 #pragma once
 
+/**
+ * Application version.
+ */
 #define QG_VERSION_NAME "@QGEARS_VERSION@"

+ 67 - 68
QGearsMain/src/Main.cpp

@@ -1,8 +1,25 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
 #include <OgreRoot.h>
 #include <OgreConfigFile.h>
 #include <OgreArchiveManager.h>
 #include <OIS.h>
-
+#include <OgreFontManager.h>
+#include <OgreOverlayManager.h>
+#include <OgreOverlaySystem.h>
 #include "QGearsGameState.h"
 #ifdef VGears_SOUND
 #include "core/AudioManager.h"
@@ -26,70 +43,67 @@
 #include "core/DialogsManager.h"
 #include "data/QGearsLZSFLevelFileManager.h"
 #include "common/make_unique.h"
-#include <OgreFontManager.h>
-#include <OgreOverlayManager.h>
-#include <OgreOverlaySystem.h>
-
 #include "modules/worldmap/WorldMapModule.h"
 #include "data/worldmap/MapFileManager.h"
 #include "data/QGearsLGPArchiveFactory.h"
 
-int
-main(int argc, char *argv[])
-{
-    try
-    {
-        std::cout << "[MAIN] Init" << std::endl;
+/**
+ * Main application function
+ *
+ * @param argc Number of command line arguments.
+ * @param argv List of command line arguments.
+ * @return 0 on sucess, an error code on error.
+ */
+int main(int argc, char *argv[]){
+    try{
+        std::cout << "V-Gears Init" << std::endl;
         QGears::Application app(argc, argv);
         if (!app.initOgre()) return 0;
-
-        Ogre::Root         *root(app.getRoot());
+        Ogre::Root *root(app.getRoot());
         Ogre::RenderWindow *window(app.getRenderWindow());
         Ogre::SceneManager *scene_manager(nullptr);
 
         auto timer = std::make_unique<Timer>();
-        auto particle_system_manager = std::make_unique<ParticleSystemManager>();
-        std::cout << "[MAIN] Init 1" << std::endl;
+        auto particle_system_manager =
+          std::make_unique<ParticleSystemManager>();
 
-        // set scene camera and viewport for other moduls
-        // create this before initialize particle because some of them use scene to create themself
+        // Set scene camera and viewport for other modules.
+        // Create this before initialize particle because some of them use
+        // scene to create themselves.
         scene_manager = root->createSceneManager(Ogre::ST_GENERIC, "Scene");
+        // TODO: Why is this used twice?
         scene_manager->setAmbientLight(Ogre::ColourValue(1, 1, 1));
         scene_manager->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
-        std::cout << "[MAIN] Init 2" << std::endl;
-        Ogre::Light *directionalLight(scene_manager->createLight("directionalLight"));
+        Ogre::Light *directionalLight(
+          scene_manager->createLight("directionalLight")
+        );
         directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
         directionalLight->setDiffuseColour(Ogre::ColourValue(0.5, 0.5, 0.5));
         directionalLight->setSpecularColour(Ogre::ColourValue(0.0, 0.0, 0.0));
         directionalLight->setDirection(Ogre::Vector3(0, 1, 0));
-
         // auto fontManager = std::make_unique<Ogre::FontManager>();
-
         QGears::MapFileManager* worldManager = new QGears::MapFileManager();
 
-        std::cout << "[MAIN] Init 2" << std::endl;
-        //Ogre::Root::getSingleton().addResourceLocation(".", "FileSystem");
-        //Ogre::Root::getSingleton().addResourceLocation("./data/wm", "FileSystem", "TEST");
-        //Ogre::Root::getSingleton().addResourceLocation("./data/wm/world_us.lgp", QGears::LGPArchiveFactory::ARCHIVE_TYPE, "TEST");
-        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
-        std::cout << "[MAIN] Init 3" << std::endl;
-        Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./data/wm", "FileSystem", "TEST");
-        std::cout << "[MAIN] Init 4" << std::endl;
-        Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./data/wm/world_us.lgp", QGears::LGPArchiveFactory::ARCHIVE_TYPE, "TEST");
-        std::cout << "[MAIN] Init 5" << std::endl;
-
-
+        // Initialize resources.
+        // TODO: Use correct file location in the end, now is OK for testing
+        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
+          ".", "FileSystem"
+        );
+        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
+          "./data/wm", "FileSystem", "TEST"
+        );
+        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
+          "./data/wm/world_us.lgp",
+          QGears::LGPArchiveFactory::ARCHIVE_TYPE, "TEST"
+        );
         Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-        std::cout << "[MAIN] Init 6" << std::endl;
 
-        // init it before console because it may use it
+        // Initialize it before console because it may use it
         auto config_var_manager = std::make_unique<ConfigVarManager>();
         auto config_cmd_manager = std::make_unique<ConfigCmdManager>();
-
         auto debug_draw = std::make_unique<DebugDraw>();
 
-
-        // init before GameFrameListener, but after ConfigCmdManager
+        // Initialize before GameFrameListener, but after ConfigCmdManager
         auto input_manager = std::make_unique<InputManager>();
 
 
@@ -98,65 +112,50 @@ main(int argc, char *argv[])
         //audio_manager->MusicPlay( "loop1" );
 #endif
 
-        // create This earlier than DisplayFrameListener cause it can fire event there
+        // Create this earlier than DisplayFrameListener cause it can fire
+        // events there
         auto camera_manager = std::make_unique<CameraManager>();
         auto text_manager = std::make_unique<TextManager>();
-
         auto ui_manager = std::make_unique<UiManager>();
         auto dialogs_manager = std::make_unique<DialogsManager>();
         auto entity_manager = std::make_unique<EntityManager>();
-
         auto console = std::make_unique<Console>();
-
         auto worldMapModule = std::make_unique<QGears::WorldMapModule>();
 
-
-        // init after game managers because it attach them to script
+        // Initialize after game managers because it attaches them to script.
         auto script_manager = std::make_unique<ScriptManager>();
 
-        // set base listner for usual game moduls
+        // Set base listener for usual game modules.
         auto frame_listener = std::make_unique<GameFrameListener>(window);
         root->addFrameListener(frame_listener.get());
 
+        // Execute the configuration file to locad values.
+        ConfigFile config;
+        config.Execute("./data/config.cfg");
 
 
-
-        // execute config
-        {
-            ConfigFile config;
-            config.Execute("./data/config.cfg");
-        }
-
-        // init ui and run it scripts
+        // Initialize UID and run it's scripts.
         ui_manager->Initialise();
-    dialogs_manager->Initialise();
-
+        dialogs_manager->Initialise();
 
-        // run application cycle
+        // Run application loop
         QGears::g_ApplicationState = QGears::G_GAME;
         root->startRendering();
 
-
-
-        // system moduls
-        // we must remove this first cause this can fire event to console
+        // System modules
+        // Thes must be removed first cause this can fire events to console.
         root->removeFrameListener(frame_listener.get());
 
-
-        // Must destruct before the script manager
+        // Must be destroyed before the script manager.
         entity_manager.reset();
         ui_manager.reset();
-
         script_manager.reset();
     }
-    catch (const std::runtime_error& ex)
-    {
+    catch (const std::runtime_error& ex){
         std::cout << "std::runtime_error thrown: " << ex.what() << std::endl;
     }
-    catch (const Ogre::Exception& ex)
-    {
+    catch (const Ogre::Exception& ex){
         std::cout << "Ogre::Exception thrown: " << ex.what() << std::endl;
     }
-
     return 0;
 }

+ 14 - 25
QGearsMain/src/QGearsGameState.cpp

@@ -1,31 +1,20 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-Copyright (c) 2013-08-28 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "QGearsGameState.h"
 
-namespace QGears
-{
+namespace QGears{
     GAME_STATE  g_ApplicationState;
 }

+ 72 - 103
QGearsMain/src/common/File.cpp

@@ -1,144 +1,113 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
 #include <cassert>
 #include <string.h>
-
 #include "common/File.h"
 #include "common/FileSystem.h"
 #include "core/Logger.h"
 
-
-
-//-------------------------------------------------------------------------
 File::File(const Ogre::String& file):
-  m_FileName(file),
-  m_Buffer(nullptr),
-  m_BufferSize(0)
+  file_name_(file),
+  buffer_(nullptr),
+  buffer_size_(0)
 {
-    LOG_TRIVIAL("Loading file: " + m_FileName + "\n");
-    m_BufferSize = FileSystem::GetFileSize(m_FileName);
-
-    m_Buffer = (u8*)malloc(sizeof(u8) * m_BufferSize);
-
-    if (!FileSystem::ReadFile(m_FileName, m_Buffer, 0, m_BufferSize))
-    {
-        LOG_TRIVIAL("Warning: " + m_FileName + " not found!\n");
+    LOG_TRIVIAL("Loading file: " + file_name_ + "\n");
+    buffer_size_ = FileSystem::GetFileSize(file_name_);
+    buffer_ = (u8*) malloc(sizeof(u8) * buffer_size_);
+    if (!FileSystem::ReadFile(file_name_, buffer_, 0, buffer_size_)){
+        LOG_TRIVIAL("Warning: " + file_name_ + " not found!\n");
     }
 }
 
-//-------------------------------------------------------------------------
-File::File(const File* pFile, u32 offset, u32 length):
-  m_Buffer(nullptr),
-  m_BufferSize(length)
+File::File(const File* file, u32 offset, u32 length):
+  buffer_(nullptr),
+  buffer_size_(length)
 {
-    assert(pFile != nullptr);
+    assert(file != nullptr);
 
-    m_FileName = pFile->GetFileName();
+    file_name_ = file->GetFileName();
 
-    m_Buffer = (u8 *)malloc(sizeof(u8) * m_BufferSize);
-    pFile->GetFileBuffer(m_Buffer, offset, m_BufferSize);
+    buffer_ = (u8 *) malloc(sizeof(u8) * buffer_size_);
+    file->GetFileBuffer(buffer_, offset, buffer_size_);
 }
 
-//-------------------------------------------------------------------------
-File::File(const u8* pBuffer, u32 offset, u32 length):
-  m_FileName("BUFFER"),
-  m_Buffer(nullptr),
-  m_BufferSize(length)
+File::File(const u8* buffer, u32 offset, u32 length):
+  file_name_("BUFFER"),
+  buffer_(nullptr),
+  buffer_size_(length)
 {
-    assert(pBuffer != nullptr);
-
-    m_Buffer = (u8*)malloc(sizeof(u8) * m_BufferSize);
-    memcpy(m_Buffer, pBuffer + offset, m_BufferSize);
+    assert(buffer != nullptr);
+    buffer_ = (u8*) malloc(sizeof(u8) * buffer_size_);
+    memcpy(buffer_, buffer + offset, buffer_size_);
 }
 
-//-------------------------------------------------------------------------
-File::File(const File* pFile)
-{
-    assert(pFile != nullptr);
-
-    m_BufferSize = pFile->GetFileSize();
-    m_FileName   = pFile->GetFileName();
-
-    m_Buffer = (u8*)malloc(sizeof(u8) * m_BufferSize);
-    pFile->GetFileBuffer(m_Buffer, 0, m_BufferSize);
+File::File(const File* file){
+    assert(file != nullptr);
+    buffer_size_ = file->GetFileSize();
+    file_name_   = file->GetFileName();
+    buffer_ = (u8*) malloc(sizeof(u8) * buffer_size_);
+    file->GetFileBuffer(buffer_, 0, buffer_size_);
 }
 
-//-------------------------------------------------------------------------
-File::~File()
-{
-    free(m_Buffer);
+File::~File(){
+    free(buffer_);
 }
 
-//-------------------------------------------------------------------------
-void
-File::WriteFile(const Ogre::String& file) const
-{
-  FileSystem::WriteNewFile(file, m_Buffer, m_BufferSize);
+void File::WriteFile(const Ogre::String& file) const{
+  FileSystem::WriteNewFile(file, buffer_, buffer_size_);
 }
 
-//-------------------------------------------------------------------------
-const Ogre::String&
-File::GetFileName() const
-{
-    return m_FileName;
-}
+const Ogre::String& File::GetFileName() const{return file_name_;}
 
-//-------------------------------------------------------------------------
-u32
-File::GetFileSize() const
-{
-    return m_BufferSize;
-}
+u32 File::GetFileSize() const{return buffer_size_;}
 
-//-------------------------------------------------------------------------
-void
-File::GetFileBuffer(u8* pBuffer, const u32 &start, const u32 &length) const
-{
-    memcpy(pBuffer, m_Buffer + start, length);
+void File::GetFileBuffer(
+  u8* buffer, const u32 &start, const u32 &length
+) const{
+    memcpy(buffer, buffer_ + start, length);
 }
 
-//-------------------------------------------------------------------------
-u8
-File::GetU8(u32 offset) const
-{
-    return *(m_Buffer + offset);
-}
+u8 File::GetU8(u32 offset) const{return *(buffer_ + offset);}
 
-//-------------------------------------------------------------------------
-u16
-File::GetU16LE(u32 offset) const
-{
-    return (m_Buffer + offset)[0] | ((m_Buffer + offset)[1] << 8);
+u16 File::GetU16LE(u32 offset) const{
+    return (buffer_ + offset)[0] | ((buffer_ + offset)[1] << 8);
 }
 
-//-------------------------------------------------------------------------
-u32
-File::GetU32LE(u32 offset) const
-{
-    return (m_Buffer + offset)[0] | ((m_Buffer + offset)[1] << 8) | ((m_Buffer + offset)[2] << 16) | ((m_Buffer + offset)[3] << 24);
+u32 File::GetU32LE(u32 offset) const{
+    return
+      (buffer_ + offset)[0]
+      | ((buffer_ + offset)[1] << 8)
+      | ((buffer_ + offset)[2] << 16)
+      | ((buffer_ + offset)[3] << 24);
 }
 
-//-------------------------------------------------------------------------
-u8
-File::readU8()
-{
-    return GetU8( m_offset++ );
+u8 File::readU8(){
+    u8 data(GetU8(offset_));
+    offset_ += 1;
+    return data;
 }
 
-//-------------------------------------------------------------------------
-u16
-File::readU16LE()
-{
-    u16 data( GetU16LE(m_offset) );
-    m_offset += 2;
+u16 File::readU16LE(){
+    u16 data(GetU16LE(offset_));
+    offset_ += 2;
     return data;
 }
 
-//-------------------------------------------------------------------------
-u32
-File::readU32LE()
-{
-    u32 data( GetU32LE(m_offset) );
-    m_offset += 4;
+u32 File::readU32LE(){
+    u32 data(GetU32LE(offset_));
+    offset_ += 4;
     return data;
 }
-
-//-------------------------------------------------------------------------

+ 34 - 47
QGearsMain/src/common/FileSystem.cpp

@@ -1,84 +1,71 @@
-#include "common/FileSystem.h"
-#include "core/Logger.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <stdio.h>
+#include "common/FileSystem.h"
+#include "core/Logger.h"
 
-
-
-unsigned int
-FileSystem::GetFileSize(const Ogre::String &path)
-{
+unsigned int FileSystem::GetFileSize(const Ogre::String &path){
     FILE* file = fopen(path.c_str(), "rb");
-
-    if (file == nullptr)
-    {
+    if (file == nullptr){
         LOG_ERROR("Can't open file " + path + ".\n");
         return 0;
     }
-
-    // set cursor to end of file
+    // Set cursor to end of file
     fseek(file, 0, SEEK_END);
     unsigned int size = ftell(file);
     fclose(file);
     return size;
 }
 
-
-
-bool
-FileSystem::ReadFile(const Ogre::String &path, void* buffer, const unsigned int start, const unsigned int length)
-{
+bool FileSystem::ReadFile(
+  const Ogre::String &path, void* buffer,
+  const unsigned int start, const unsigned int length
+){
     FILE* file = fopen(path.c_str(), "rb");
-
-    if (file == nullptr)
-    {
+    if (file == nullptr){
         LOG_ERROR("Can't open file " + path + ".\n");
         return false;
     }
-
     fseek(file, start, SEEK_SET);
     const auto ret = fread(buffer, sizeof(char), length, file);
     fclose(file);
-    if (ret != sizeof(char) * length)
-    {
+    if (ret != sizeof(char) * length){
         LOG_ERROR("Failed to read all data\n");
         return false;
     }
-
     return true;
 }
 
-
-
-bool
-FileSystem::WriteFile(const Ogre::String &path, const void* buffer, const unsigned int length)
-{
+bool FileSystem::WriteFile(
+  const Ogre::String &path, const void* buffer, const unsigned int length
+){
     FILE* file = fopen(path.c_str(), "ab");
-
-    if (file == nullptr)
-    {
-        return false;
-    }
-
+    if (file == nullptr) return false;
     fwrite(buffer, sizeof(char), length, file);
     fclose(file);
-
     return true;
 }
 
-
-
-bool
-FileSystem::WriteNewFile(const Ogre::String &path, const void* buffer, unsigned int length)
-{
+bool FileSystem::WriteNewFile(
+  const Ogre::String &path, const void* buffer, unsigned int length
+){
     RemoveFile(path);
-    return !!(WriteFile(path, buffer, length));
+    return !! (WriteFile(path, buffer, length));
 }
 
-
-
-bool
-FileSystem::RemoveFile(const Ogre::String &path)
-{
+bool FileSystem::RemoveFile(const Ogre::String &path){
     return (remove(path.c_str()) == 0);
 }

+ 62 - 87
QGearsMain/src/common/LzsFile.cpp

@@ -1,132 +1,107 @@
-#include "common/LzsFile.h"
-//#include "common/Logger.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
+#include "common/LzsFile.h"
+#include "core/Logger.h"
 
-LzsFile::LzsFile(const Ogre::String& file):
-    File(file)
-{
+LzsFile::LzsFile(const Ogre::String& file): File(file){
     ExtractLzs();
 }
 
-
-
 LzsFile::LzsFile(File* pFile, u32 offset, u32 length):
-    File(pFile, offset, length)
+  File(pFile, offset, length)
 {
     ExtractLzs();
 }
 
-
-
 LzsFile::LzsFile(const u8* pBuffer, u32 offset, u32 length):
-    File(pBuffer, offset, length)
+  File(pBuffer, offset, length)
 {
     ExtractLzs();
 }
 
-
-
-LzsFile::LzsFile(File* pFile):
-    File(pFile)
-{
+LzsFile::LzsFile(File* pFile): File(pFile){
     ExtractLzs();
 }
 
+LzsFile::~LzsFile(){}
 
-
-LzsFile::~LzsFile()
-{
-}
-
-
-
-void
-LzsFile::ExtractLzs()
-{
+void LzsFile::ExtractLzs(){
     u32 input_length = GetU32LE(0) + 4;
-
-    if (input_length != m_BufferSize)
-    {
-        //LOGGER->Log("Warning: extract failed, this is not lzs!\n");
+    if (input_length != buffer_size_){
+        LOG_TRIVIAL("Warning: extract failed, this is not lzs!\n");
         return;
     }
-
-
-
-    u32 extract_size = (m_BufferSize + 255) & ~255;
-    u8* extract_buffer = (u8*)malloc(extract_size);
-
-
-
-    unsigned int input_offset = 4;
-    int output_offset = 0;
+    u32 extract_size = (buffer_size_ + 255) & ~255;
+    u8* extractbuffer_ = (u8*) malloc(extract_size);
+    unsigned int inputoffset_ = 4;
+    int outputoffset_ = 0;
     u8 control_byte = 0;
     u8 control_bit = 0;
-
-    while (input_offset < m_BufferSize)
-    {
-        if (control_bit == 0)
-        {
-            control_byte = ((u8*)m_Buffer)[input_offset++];
+    while (inputoffset_ < buffer_size_){
+        if (control_bit == 0){
+            control_byte = ((u8*) buffer_)[inputoffset_ ++];
             control_bit = 8;
         }
 
-        if (control_byte & 1)
-        {
-            ((u8*)extract_buffer)[output_offset++] = ((u8*)m_Buffer)[input_offset++];
-
-            if (output_offset == extract_size)
-            {
+        if (control_byte & 1){
+            ((u8*) extractbuffer_) [outputoffset_ ++] =
+              ((u8*) buffer_) [inputoffset_ ++];
+            if (outputoffset_ == extract_size){
                 extract_size += 256;
-                extract_buffer = (u8*)realloc(extract_buffer, extract_size);
+                extractbuffer_ = (u8*) realloc(extractbuffer_, extract_size);
             }
         }
-        else
-        {
-            u8 reference1 = ((u8*)m_Buffer)[input_offset++];
-            u8 reference2 = ((u8*)m_Buffer)[input_offset++];
-
-            u16 reference_offset = reference1 | ((reference2 & 0xF0) << 4);
-
+        else{
+            u8 reference1 = ((u8*) buffer_)[inputoffset_++];
+            u8 reference2 = ((u8*) buffer_)[inputoffset_++];
+            u16 referenceoffset_ = reference1 | ((reference2 & 0xF0) << 4);
             u8 reference_length = (reference2 & 0xF) + 3;
-
-            int real_offset = output_offset - ((output_offset - 18 - reference_offset) & 0xFFF);
-
-            for (int j = 0; j < reference_length; ++j)
-            {
-                if (real_offset < 0)
-                {
-                    ((u8*)extract_buffer)[output_offset++] = 0;
+            int realoffset_ =
+              outputoffset_
+              - ((outputoffset_ - 18 - referenceoffset_) & 0xFFF);
+            for (int j = 0; j < reference_length; ++ j){
+                if (realoffset_ < 0){
+                    ((u8*)extractbuffer_)[outputoffset_++] = 0;
                 }
-                else
-                {
-                    ((u8*)extract_buffer)[output_offset++] = ((u8*)extract_buffer)[real_offset];
+                else{
+                    ((u8*)extractbuffer_)[outputoffset_++] =
+                      ((u8*)extractbuffer_)[realoffset_];
                 }
-
-                if (output_offset == extract_size)
-                {
+                if (outputoffset_ == extract_size){
                     extract_size += 256;
-                    extract_buffer = (u8*)realloc(extract_buffer, extract_size);
+                    extractbuffer_ =
+                      (u8*) realloc(extractbuffer_, extract_size);
                 }
-
-                ++real_offset;
+                ++ realoffset_;
             }
         }
-
         control_byte >>= 1;
-        control_bit--;
+        control_bit --;
     }
-
-    free(m_Buffer);
+    free(buffer_);
     // the real buffer size and mBufferSize will be a bit different
-    m_Buffer = extract_buffer;
-    m_BufferSize = output_offset;
+    buffer_ = extractbuffer_;
+    buffer_size_ = outputoffset_;
 }
 
-/*static*/ std::vector<QGears::uint8> LzsBuffer::Decompress(const std::vector<QGears::uint8>& buffer)
-{
+std::vector<QGears::uint8> LzsBuffer::Decompress(
+  const std::vector<QGears::uint8>& buffer
+){
     LzsFile tmp(static_cast<const u8*>(buffer.data()), 0, buffer.size());
-    std::vector<QGears::uint8> ret(tmp.m_BufferSize);
-    ret.assign(tmp.m_Buffer, tmp.m_Buffer + tmp.m_BufferSize);
+    std::vector<QGears::uint8> ret(tmp.buffer_size_);
+    ret.assign(tmp.buffer_, tmp.buffer_ + tmp.buffer_size_);
     return ret;
 }

+ 160 - 191
QGearsMain/src/common/QGearsApplication.cpp

@@ -1,29 +1,26 @@
 /*
------------------------------------------------------------------------------
-Copyright (c) 19.10.2013 Tobias Peters <tobias.peters@kreativeffekt.at>
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-This file is part of Q-Gears
-
-Q-Gears is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.0 (GPLv2) of the License.
-
-Q-Gears is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
------------------------------------------------------------------------------
-*/
 #include <iostream>
-#include "common/QGearsApplication.h"
-
 #include <boost/filesystem.hpp>
 #include <boost/program_options.hpp>
 #include <OgreConfigFile.h>
 #include <OgreArchiveManager.h>
 #include <OgreLogManager.h>
 #include <OgreConfigDialog.h>
-
+#include "common/QGearsApplication.h"
 #include "QGearsGameState.h"
 #include "data/QGearsAFileManager.h"
 #include "data/QGearsBackgroundFileManager.h"
@@ -43,64 +40,56 @@ GNU General Public License for more details.
 #include "common/make_unique.h"
 #include "vgears_version.h"
 
-template<> QGears::Application *Ogre::Singleton<QGears::Application>::msSingleton = nullptr;
+template<> QGears::Application
+  *Ogre::Singleton<QGears::Application>::msSingleton = nullptr;
+
+namespace QGears{
 
-namespace QGears
-{
     namespace bfs = boost::filesystem;
     namespace bpo = boost::program_options;
     typedef Ogre::ConfigFile::SettingsMultiMap SettingsMultiMap;
 
-    const char*     Application::CLI_SECTION_GENERIC( "Generic options" );
-    const char*     Application::CLI_HELP( "help" );
-    const char*     Application::CLI_HELP_DESCRIPTION( "this help message" );
-    const char*     Application::CLI_CONFIG_FILE( "config-file" );
-    const char*     Application::CLI_CONFIG_FILE_DESCRIPTION( "path to Ogre config file containing selected rendersystem and resolution" );
-    const char*     Application::CLI_LOG_FILE( "log-file" );
-    const char*     Application::CLI_LOG_FILE_DESCRIPTION( "path to log file" );
-    const char*     Application::CLI_PLUGINS_FILE( "plugins-file" );
-    const char*     Application::CLI_PLUGINS_FILE_DESCRIPTION( "path to config file containing available plugins" );
-    const char*     Application::CLI_RESOURCES_FILE( "resources-file" );
-    const char*     Application::CLI_RESOURCES_FILE_DESCRIPTION( "path to config file containing available resources" );
-
-    //--------------------------------------------------------------------------
-    Application::Application( int argc, char *argv[] ) :
-        m_argc( argc )
-      , m_argv( argv )
-    {
-    }
-
-    //--------------------------------------------------------------------------
-    Application::~Application()
-    {
-        destroyComponents();
-    }
-
-    //--------------------------------------------------------------------------
-    bool
-    Application::initOgre(bool hideWindow)
-    {
-        if( m_initialized )
-        {
-            return false;
+    const char* Application::CLI_SECTION_GENERIC("Generic options");
+    const char* Application::CLI_HELP("help");
+    const char* Application::CLI_HELP_DESCRIPTION("This help message");
+    const char* Application::CLI_CONFIG_FILE("config-file");
+    const char* Application::CLI_CONFIG_FILE_DESCRIPTION(
+      "Path to Ogre config file containing selected rendersystem and resolution"
+    );
+    const char* Application::CLI_LOG_FILE("log-file");
+    const char* Application::CLI_LOG_FILE_DESCRIPTION("Path to log file");
+    const char* Application::CLI_PLUGINS_FILE("plugins-file");
+    const char* Application::CLI_PLUGINS_FILE_DESCRIPTION(
+      "Path to config file containing available plugins"
+    );
+    const char* Application::CLI_RESOURCES_FILE("resources-file");
+    const char* Application::CLI_RESOURCES_FILE_DESCRIPTION(
+      "path to config file containing available resources"
+    );
+
+    Application::Application(int argc, char *argv[]): _argc(argc), _argv(argv){}
+
+    Application::~Application(){destroyComponents();}
+
+    bool Application::initOgre(bool hideWindow){
+        if(_initialized) return false;
+
+        _initialized = true;
+
+        if (_argc && _argv){
+            if (!processCommandLine(_argc, _argv)) return false;
         }
 
-        m_initialized = true;
+        _root = std::make_unique<Ogre::Root>(
+          plugins_filename_, config_filename_, log_filename_
+        );
+        _overlay_system = std::make_unique<Ogre::OverlaySystem>();
 
-        if (m_argc && m_argv)
-        {
-            if (!processCommandLine(m_argc, m_argv))
-            {
-                return false;
-            }
-        }
-
-        m_root = std::make_unique<Ogre::Root>( m_plugins_filename, m_config_filename, m_log_filename );
-        m_overlay_system = std::make_unique<Ogre::OverlaySystem>();
-
-        Ogre::Log* default_log( Ogre::LogManager::getSingleton().getDefaultLog() );
-        assert( default_log );
-        default_log->setLogDetail( Ogre::LL_BOREME );
+        Ogre::Log* default_log(
+          Ogre::LogManager::getSingleton().getDefaultLog()
+        );
+        assert(default_log);
+        default_log->setLogDetail(Ogre::LL_BOREME);
 
         //-------------------------------------------------------------------------
         // configure
@@ -108,193 +97,173 @@ namespace QGears
         // You can skip this and use root.restoreConfig() to load configuration
         // settings if you were sure there are valid ones saved in ogre.cfg
         // IVV ERROR COMPILING
-        if(/* !m_root->restoreConfig() &&*/ !m_root->showConfigDialog(NULL) )
-        {
+        if(/* !_root->restoreConfig() &&*/ !_root->showConfigDialog(NULL)){
             return false;
         }
 
-        if (hideWindow)
-        {
+        if (hideWindow){
             Ogre::NameValuePairList list;
             list.emplace("hidden", "true");
-            m_root->initialise(false, getWindowTitle());
-            m_render_window = m_root->createRenderWindow(getWindowTitle(), 1, 1, false, &list);
+            _root->initialise(false, getWindowTitle());
+            _render_window = _root->createRenderWindow(getWindowTitle(), 1, 1, false, &list);
         }
-        else
-        {
-            m_render_window = m_root->initialise(true, getWindowTitle());
+        else{
+            _render_window = _root->initialise(true, getWindowTitle());
         }
-
         registerArchiveFactories();
         loadResourcesConfig();
         initComponents();
-
         return true;
     }
 
-    //--------------------------------------------------------------------------
-    void
-    Application::loadResourcesConfig()
-    {
-        // set up resources
+    void Application::loadResourcesConfig(){
+
         // Load resource paths from config file
         Ogre::ConfigFile config_file;
-        config_file.load( m_resources_filename );
+        config_file.load(resources_filename_);
 
         // Go through all sections & settings in the file
-        Ogre::ConfigFile::SectionIterator section( config_file.getSectionIterator() );
+        Ogre::ConfigFile::SectionIterator section(config_file.getSectionIterator());
 
         Ogre::String section_name, archive_type, archive_name;
-        mResMgr = (&Ogre::ResourceGroupManager::getSingleton());
-        while( section.hasMoreElements() )
-        {
+        res_mgr_ = (&Ogre::ResourceGroupManager::getSingleton());
+        while(section.hasMoreElements()){
             section_name = section.peekNextKey();
-            SettingsMultiMap *settings( section.getNext() );
-            SettingsMultiMap::const_iterator it ( settings->begin() );
-            SettingsMultiMap::const_iterator end( settings->end()   );
-            while( it != end )
-            {
+            SettingsMultiMap *settings(section.getNext());
+            SettingsMultiMap::const_iterator it(settings->begin());
+            SettingsMultiMap::const_iterator end(settings->end());
+            while(it != end){
                 archive_type = it->first;
                 archive_name = it->second;
-                mResMgr->addResourceLocation(archive_name, archive_type, section_name, true);
-                ++it;
+                res_mgr_->addResourceLocation(
+                  archive_name, archive_type, section_name, true
+                );
+                ++ it;
             }
         }
     }
 
-    //--------------------------------------------------------------------------
-    Ogre::Root*
-    Application::getRoot()
-    {
-        return m_root.get();
-    }
+    Ogre::Root* Application::getRoot(){return _root.get();}
 
-    //--------------------------------------------------------------------------
-    Ogre::RenderWindow*
-    Application::getRenderWindow()
-    {
-        return m_render_window;
-    }
+    Ogre::RenderWindow* Application::getRenderWindow(){return _render_window;}
 
-    //--------------------------------------------------------------------------
-    const String&
-    Application::getResourcesFilename()
-    {
-        return m_resources_filename;
+    const String& Application::getResourcesFilename(){
+        return resources_filename_;
     }
 
-    //--------------------------------------------------------------------------
-    String Application::getWindowTitle() const
-    {
-        return QG_VERSION_NAME;
-    }
+    String Application::getWindowTitle() const {return QG_VERSION_NAME;}
 
-    //--------------------------------------------------------------------------
-    bool
-    Application::processCommandLine(  int argc, char *argv[] )
-    {
-        bfs::path self( argv[0] );
-        const String self_stem( self.stem().string() );
-        const String config_filename    ( self_stem     + EXT_CONFIG );
-        const String log_filename       ( self_stem     + EXT_LOG );
+    bool Application::processCommandLine( int argc, char *argv[]){
+        bfs::path self(argv[0]);
+        const String self_stem(self.stem().string());
+        const String config_filename(self_stem + EXT_CONFIG);
+        const String log_filename(self_stem + EXT_LOG);
 
 #ifdef  NDEBUG
-        const String plugins_filename   ( "plugins"     + EXT_CONFIG );
-        const String resources_filename ( "resources"   + EXT_CONFIG );
+        const String plugins_filename("plugins" + EXT_CONFIG);
+        const String resources_filename("resources" + EXT_CONFIG);
 #else
-        const String plugins_filename   ( "plugins_d"   + EXT_CONFIG );
-        const String resources_filename ( "resources_d" + EXT_CONFIG );
+        const String plugins_filename("plugins_d" + EXT_CONFIG);
+        const String resources_filename("resources_d" + EXT_CONFIG);
 #endif
 
-        bpo::options_description generic( CLI_SECTION_GENERIC );
+        bpo::options_description generic(CLI_SECTION_GENERIC);
         generic.add_options()
-            ( CLI_HELP, CLI_HELP_DESCRIPTION )
-            (   CLI_CONFIG_FILE
-              , bpo::value< String >()->default_value( config_filename )
+            (CLI_HELP, CLI_HELP_DESCRIPTION)
+            (  CLI_CONFIG_FILE
+              , bpo::value< String >()->default_value(config_filename)
               , CLI_CONFIG_FILE_DESCRIPTION
-            )
-            (   CLI_LOG_FILE
-              , bpo::value< String >()->default_value( log_filename )
+           )
+            (  CLI_LOG_FILE
+              , bpo::value< String >()->default_value(log_filename)
               , CLI_LOG_FILE_DESCRIPTION
-            )
-            (   CLI_PLUGINS_FILE
-              , bpo::value< String >()->default_value( plugins_filename )
+           )
+            (  CLI_PLUGINS_FILE
+              , bpo::value< String >()->default_value(plugins_filename)
               , CLI_PLUGINS_FILE_DESCRIPTION
-            )
-            (   CLI_RESOURCES_FILE
-              , bpo::value< String >()->default_value( resources_filename )
+           )
+            (  CLI_RESOURCES_FILE
+              , bpo::value< String >()->default_value(resources_filename)
               , CLI_RESOURCES_FILE_DESCRIPTION
-            )
+           )
             ;
         bpo::variables_map vm;
-        bpo::store( bpo::command_line_parser( argc, argv ).options( generic ).run(), vm );
-        if ( vm.count( CLI_HELP ) )
-        {
-            std::cout << "Usage: " << self_stem << "\n"
-                      << generic << "\n";
+        bpo::store(bpo::command_line_parser(argc, argv).options(generic).run(), vm);
+        if (vm.count(CLI_HELP)){
+            std::cout << "Usage: " << self_stem << "\n" << generic << "\n";
             return false;
         }
 
-        bpo::notify( vm );
-        m_config_filename       = vm[CLI_CONFIG_FILE].as< String >();
-        m_log_filename          = vm[CLI_LOG_FILE].as< String >();
-        m_plugins_filename      = vm[CLI_PLUGINS_FILE].as< String >();
-        m_resources_filename    = vm[CLI_RESOURCES_FILE].as< String >();
+        bpo::notify(vm);
+        config_filename_ = vm[CLI_CONFIG_FILE].as<String>();
+        log_filename_ = vm[CLI_LOG_FILE].as<String>();
+        plugins_filename_ = vm[CLI_PLUGINS_FILE].as<String>();
+        resources_filename_ = vm[CLI_RESOURCES_FILE].as<String>();
 
         return true;
     }
 
-    //--------------------------------------------------------------------------
-    void
-    Application::registerArchiveFactories()
-    {
-        Ogre::ArchiveManager::getSingleton().addArchiveFactory( new LGPArchiveFactory() );
+    void Application::registerArchiveFactories(){
+        Ogre::ArchiveManager::getSingleton().addArchiveFactory(
+          new LGPArchiveFactory()
+        );
     }
 
-    //--------------------------------------------------------------------------
-    void
-    Application::initComponents()
-    {
+    void Application::initComponents(){
         QGears::TexCodec::install();
         QGears::TexCodec::initialise();
         createResourceManagers();
     }
 
-    //--------------------------------------------------------------------------
-    void
-    Application::destroyComponents()
-    {
+    void Application::destroyComponents(){
         destroyResourceManagers();
         QGears::TexCodec::shutdown();
         QGears::TexCodec::uninstall();
     }
 
-    //--------------------------------------------------------------------------
-    void
-    Application::createResourceManagers()
-    {
-        assert( m_resource_managers.empty() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::CameraMatrixFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::PaletteFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::WalkmeshFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::FF7::ModelListFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::HRCFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::RSDFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::AFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::PFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::LZSFLevelFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::BackgroundFileManager>() );
-        m_resource_managers.emplace_back( std::make_shared<QGears::Background2DFileManager>() );
-        m_resource_managers.emplace_back(std::make_shared<QGears::TriggersFileManager>());
-        m_resource_managers.emplace_back(std::make_shared<QGears::MapListFileManager>());
+    void Application::createResourceManagers(){
+        assert(_resource_managers.empty());
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::CameraMatrixFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::PaletteFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::WalkmeshFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::FF7::ModelListFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::HRCFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::RSDFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::AFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::PFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::LZSFLevelFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::BackgroundFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::Background2DFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::TriggersFileManager>()
+        );
+        _resource_managers.emplace_back(
+          std::make_shared<QGears::MapListFileManager>()
+        );
     }
 
-    //--------------------------------------------------------------------------
-    void
-    Application::destroyResourceManagers()
-    {
-        m_resource_managers.clear();
-    }
+    void Application::destroyResourceManagers(){_resource_managers.clear();}
 
-    //--------------------------------------------------------------------------
 }

+ 164 - 235
QGearsMain/src/common/QGearsManualObject.cpp

@@ -1,278 +1,207 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
-
-Copyright (c) 2013-08-17 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#include "common/QGearsManualObject.h"
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <cstring>
-
 #include <OgreException.h>
 #include <OgreHardwareBufferManager.h>
 #include <OgreRoot.h>
+#include "common/QGearsManualObject.h"
 
-namespace QGears
-{
-    //-------------------------------------------------------------------------
-    ManualObject::ManualObject( Ogre::Mesh *mesh ) :
-        m_mesh( mesh )
-       ,m_section( nullptr )
-       ,m_bbox( mesh->getBounds() )
-       ,m_radius( mesh->getBoundingSphereRadius() )
-       ,m_position( nullptr )
-       ,m_normal( nullptr )
-       ,m_colour( nullptr )
-       ,m_texture_coordinate( nullptr )
-       ,m_index( nullptr )
-       ,colour_type( Ogre::VertexElement::getBestColourVertexElementType() )
-    {
-    }
-
-    //-------------------------------------------------------------------------
-    ManualObject::~ManualObject()
-    {
-    }
+namespace QGears{
+    ManualObject::ManualObject(Ogre::Mesh *mesh) :
+      _mesh(mesh),
+      _section(nullptr),
+      _bbox(mesh->getBounds()),
+      _radius(mesh->getBoundingSphereRadius()),
+      _position(nullptr),
+      _normal(nullptr),
+      colour_(nullptr),
+      _texture_coordinate(nullptr),
+      _index(nullptr),
+      colour_type_(Ogre::VertexElement::getBestColourVertexElementType())
+    {}
+
+    ManualObject::~ManualObject(){}
 
-    //-------------------------------------------------------------------------
     template<typename BufferType>
-    BufferType*
-    ManualObject::createBuffer( const BufferBinding binding
-                               ,Ogre::VertexElementType type
-                               ,Ogre::VertexElementSemantic semantic )
-    {
-        Ogre::VertexDeclaration* decl = m_section->vertexData->vertexDeclaration;
-        Ogre::VertexBufferBinding* bind = m_section->vertexData->vertexBufferBinding;
-
-        decl->addElement( binding, 0, type, semantic );
-        size_t vertex_size( decl->getVertexSize( binding ) );
-
-        VertexBuffer buffer = Ogre::HardwareBufferManager::getSingleton()
-            .createVertexBuffer( vertex_size
-                                ,m_section->vertexData->vertexCount
-                                ,Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
-        bind->setBinding( binding, buffer );
-        m_vertex_buffers[binding] = buffer;
-        return static_cast<BufferType*>( buffer->lock( Ogre::HardwareBuffer::HBL_DISCARD ) );
-    }
-
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::createPositionBuffer()
-    {
-        m_position = createBuffer<Ogre::Vector3>( BB_POSITION, Ogre::VET_FLOAT3, Ogre::VES_POSITION );
-    }
-
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::createNormalBuffer()
-    {
-        m_normal = createBuffer<Ogre::Vector3>( BB_NORMAL, Ogre::VET_FLOAT3, Ogre::VES_NORMAL );
-    }
-
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::createColourBuffer()
-    {
-        m_colour = createBuffer<uint32>( BB_COLOUR, colour_type, Ogre::VES_DIFFUSE  );
-    }
-
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::createTextureCoordinateBuffer()
-    {
-        m_texture_coordinate = createBuffer<Ogre::Vector2>( BB_TEXTURE, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES );
+    BufferType* ManualObject::createBuffer(
+      const BufferBinding binding, Ogre::VertexElementType type,
+      Ogre::VertexElementSemantic semantic
+    ){
+        Ogre::VertexDeclaration* decl =
+          _section->vertexData->vertexDeclaration;
+        Ogre::VertexBufferBinding* bind =
+          _section->vertexData->vertexBufferBinding;
+        decl->addElement(binding, 0, type, semantic);
+        size_t vertex_size(decl->getVertexSize(binding));
+
+        VertexBuffer buffer =
+          Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(
+            vertex_size, _section->vertexData->vertexCount,
+            Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY
+          );
+        bind->setBinding(binding, buffer);
+        _vertex_buffers[binding] = buffer;
+        return static_cast<BufferType*>(
+          buffer->lock(Ogre::HardwareBuffer::HBL_DISCARD)
+        );
+    }
+
+    void ManualObject::createPositionBuffer(){
+        _position = createBuffer<Ogre::Vector3>(
+          BB_POSITION, Ogre::VET_FLOAT3, Ogre::VES_POSITION
+        );
+    }
+
+    void ManualObject::createNormalBuffer(){
+        _normal = createBuffer<Ogre::Vector3>(
+          BB_NORMAL, Ogre::VET_FLOAT3, Ogre::VES_NORMAL
+        );
+    }
+
+    void ManualObject::createColourBuffer(){
+        colour_ = createBuffer<uint32>(
+          BB_COLOUR, colour_type_, Ogre::VES_DIFFUSE
+        );
+    }
+
+    void ManualObject::createTextureCoordinateBuffer(){
+        _texture_coordinate = createBuffer<Ogre::Vector2>(
+          BB_TEXTURE, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES
+        );
+    }
+
+    void ManualObject::createIndexBuffer(){
+        _indexbuffer_ =
+          Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(
+            Ogre::HardwareIndexBuffer::IT_16BIT,
+            _section->indexData->indexCount,
+            Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY
+          );
+
+        void *data(_indexbuffer_->lock(Ogre::HardwareBuffer::HBL_DISCARD));
+        _index = static_cast< uint16* >(data);
+        _section->indexData->indexBuffer = _indexbuffer_;
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::createIndexBuffer()
-    {
-        m_index_buffer = Ogre::HardwareBufferManager::getSingleton()
-            .createIndexBuffer( Ogre::HardwareIndexBuffer::IT_16BIT
-                               ,m_section->indexData->indexCount
-                               ,Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY );
-
-        void *data( m_index_buffer->lock( Ogre::HardwareBuffer::HBL_DISCARD ) );
-        m_index = static_cast< uint16* >( data );
-        m_section->indexData->indexBuffer = m_index_buffer;
-    }
-
-    //-------------------------------------------------------------------------
     template<typename BufferSharedPtr>
-    void
-    ManualObject::resetBuffer( BufferSharedPtr &buffer ) const
-    {
-        if( buffer == nullptr ) return;
-
-        if( buffer->isLocked() )
-        {
-            buffer->unlock();
-        }
-
+    void ManualObject::resetBuffer(BufferSharedPtr &buffer) const{
+        if(buffer == nullptr) return;
+        if(buffer->isLocked()) buffer->unlock();
         buffer.reset();
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::resetBuffers()
-    {
-        for( int i(BINDING_COUNT); i--; )
-        {
-            resetBuffer( m_vertex_buffers[i] );
+    void ManualObject::resetBuffers(){
+        for(int i(BINDING_COUNT); i--;) resetBuffer(_vertex_buffers[i]);
+        resetBuffer(_indexbuffer_);
+        _position = nullptr;
+        _normal = nullptr;
+        colour_ = nullptr;
+        _texture_coordinate = nullptr;
+        _index = nullptr;
+    }
+
+    void ManualObject::begin(
+      const String &name, const String &material_name,
+      size_t vertex_count, size_t index_count
+    ){
+        if (_mesh == nullptr){
+            OGRE_EXCEPT(
+              Ogre::Exception::ERR_INVALIDPARAMS,
+                "A section can't be started without a mesh.",
+                "ManualObject::begin"
+              );
         }
 
-        resetBuffer( m_index_buffer );
-        m_position = nullptr;
-        m_normal = nullptr;
-        m_colour = nullptr;
-        m_texture_coordinate = nullptr;
-        m_index = nullptr;
-    }
-
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::begin( const String &name, const String &material_name
-                        ,size_t vertex_count, size_t index_count )
-    {
-        if( m_mesh == nullptr )
-        {
-			OGRE_EXCEPT( Ogre::Exception::ERR_INVALIDPARAMS,
-				"You cannot begin a section without a Mesh",
-				"ManualObject::begin");
+        if (_section != nullptr){
+            OGRE_EXCEPT(
+              Ogre::Exception::ERR_INVALIDPARAMS,
+              "A section can't be started while other one is not ended",
+              "ManualObject::begin"
+            );
         }
 
-        if( m_section != nullptr )
-        {
-			OGRE_EXCEPT( Ogre::Exception::ERR_INVALIDPARAMS,
-				"You cannot begin a section without ending the old one first",
-				"ManualObject::begin");
+        if (vertex_count == 0){
+            OGRE_EXCEPT(
+              Ogre::Exception::ERR_INVALIDPARAMS,
+              "You cannot begin with a vertex count of 0",
+              "ManualObject::begin"
+            );
         }
 
-        if( vertex_count == 0 )
-        {
-			OGRE_EXCEPT( Ogre::Exception::ERR_INVALIDPARAMS,
-				"You cannot begin with a vertex count of 0",
-				"ManualObject::begin");
-        }
-
-        m_section = m_mesh->createSubMesh( name );
-        m_section->setMaterialName( material_name );
-        m_section->useSharedVertices = false;
-        m_section->operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;
-        m_section->vertexData = new Ogre::VertexData();
-        m_section->vertexData->vertexStart = 0;
-        m_section->vertexData->vertexCount = vertex_count;
-        m_section->indexData = new Ogre::IndexData();
-        m_section->indexData->indexStart = 0;
-        m_section->indexData->indexCount = index_count;
+        _section = _mesh->createSubMesh(name);
+        _section->setMaterialName(material_name);
+        _section->useSharedVertices = false;
+        _section->operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;
+        _section->vertexData = new Ogre::VertexData();
+        _section->vertexData->vertexStart = 0;
+        _section->vertexData->vertexCount = vertex_count;
+        _section->indexData = new Ogre::IndexData();
+        _section->indexData->indexStart = 0;
+        _section->indexData->indexCount = index_count;
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::position( const Ogre::Vector3 &position )
-    {
-        if( m_position == nullptr )
-        {
-            createPositionBuffer();
-        }
-        *(m_position++) = position;
-
-		m_bbox.merge( position );
-		m_radius = std::max( m_radius, position.length() );
+    void ManualObject::position(const Ogre::Vector3 &position){
+        if (_position == nullptr) createPositionBuffer();
+        *(_position ++) = position;
+        _bbox.merge(position);
+        _radius = std::max(_radius, position.length());
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::normal( const Ogre::Vector3 &normal )
-    {
-        if( m_normal == nullptr )
-        {
-            createNormalBuffer();
-        }
-        *(m_normal++) = normal;
+    void ManualObject::normal(const Ogre::Vector3 &normal){
+        if (_normal == nullptr) createNormalBuffer();
+        *(_normal ++) = normal;
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::colour( const Ogre::ColourValue &colour )
-    {
-        if( m_colour == nullptr )
-        {
-            createColourBuffer();
-        }
-        *(m_colour++) = Ogre::VertexElement::convertColourValue( colour, colour_type );
+    void ManualObject::colour(const Ogre::ColourValue &colour) {
+        if(colour_ == nullptr) createColourBuffer();
+        *(colour_ ++) =
+           Ogre::VertexElement::convertColourValue(colour, colour_type_);
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::textureCoord( const Ogre::Vector2 &texture_coordinate )
-    {
-        if( m_texture_coordinate == nullptr )
-        {
-            createTextureCoordinateBuffer();
-        }
-        *(m_texture_coordinate++) = texture_coordinate;
+    void ManualObject::textureCoord(const Ogre::Vector2 &texture_coordinate){
+        if (_texture_coordinate == nullptr) createTextureCoordinateBuffer();
+        *(_texture_coordinate ++) = texture_coordinate;
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::index( const uint32 idx )
-    {
-        if( m_index == nullptr )
-        {
-            createIndexBuffer();
-        }
-        *(m_index++) = idx;
+    void ManualObject::index(const uint32 idx){
+        if (_index == nullptr) createIndexBuffer();
+        *(_index ++) = idx;
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::bone( const uint32 idx, const uint16 bone_handle
-                       ,const Ogre::Real weight )
-    {
+    void ManualObject::bone(
+      const uint32 idx, const uint16 bone_handle, const Ogre::Real weight
+    ){
         Ogre::VertexBoneAssignment vba;
         vba.vertexIndex = idx;
         vba.boneIndex = bone_handle;
         vba.weight = weight;
-        m_section->addBoneAssignment( vba );
+        _section->addBoneAssignment(vba);
     }
 
-    //-------------------------------------------------------------------------
-    void
-    ManualObject::end()
-    {
-        if( m_section == nullptr )
-        {
-			OGRE_EXCEPT( Ogre::Exception::ERR_INVALIDPARAMS,
-				"You cannot end a section without beginning one first",
-				"ManualObject::end");
+    void ManualObject::end(){
+        if (_section == nullptr){
+            OGRE_EXCEPT(
+              Ogre::Exception::ERR_INVALIDPARAMS,
+              "A section can't be ended without having been started.",
+              "ManualObject::end"
+            );
         }
-
-        m_mesh->_setBounds( m_bbox );
-        m_mesh->_setBoundingSphereRadius( m_radius );
-        m_section = nullptr;
+        _mesh->_setBounds(_bbox);
+        _mesh->_setBoundingSphereRadius(_radius);
+        _section = nullptr;
         resetBuffers();
     }
-
-    //-------------------------------------------------------------------------
 }

+ 14 - 27
QGearsMain/src/common/QGearsResource.cpp

@@ -1,31 +1,18 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-Copyright (c) 2013-08-26 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "common/QGearsResource.h"
 
-namespace QGears
-{
-
-}
+namespace QGears{}

+ 21 - 41
QGearsMain/src/common/QGearsStringUtil.cpp

@@ -1,55 +1,35 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-Copyright (c) 2013-08-17 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "common/QGearsStringUtil.h"
 
-namespace QGears
-{
-    //---------------------------------------------------------------------
-    void
-    StringUtil::splitPath(  const String &qualifiedName, String &outPath )
-    {
+namespace QGears{
+
+    void StringUtil::splitPath(const String &name, String &path){
         String base, ext;
-        splitFullFilename( qualifiedName, base, ext, outPath );
+        splitFullFilename(name, base, ext, path);
     }
 
-    //---------------------------------------------------------------------
-    void
-    StringUtil::splitBase(  const String &qualifiedName, String &outBasename )
-    {
+    void StringUtil::splitBase(const String &name, String &basename){
         String path, ext;
-        splitFullFilename( qualifiedName, outBasename, ext, path );
+        splitFullFilename(name, basename, ext, path);
     }
 
-    //---------------------------------------------------------------------
-    void
-    StringUtil::splitFull(  const String &qualifiedName, String &outBasename )
-    {
+    void StringUtil::splitFull(const String &name, String &basename){
         String ext;
-        splitBaseFilename( qualifiedName, outBasename, ext );
+        splitBaseFilename(name, basename, ext);
     }
 
-    //---------------------------------------------------------------------
 }

+ 30 - 43
QGearsMain/src/common/TypeDefine.cpp

@@ -1,48 +1,35 @@
 /*
------------------------------------------------------------------------------
-The MIT License (MIT)
+ * Copyright(C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0(GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
-Copyright (c) 2013-08-17 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "common/TypeDefine.h"
 
-namespace QGears
-{
-    const String    EXT_MATERIAL( ".material"   );
-    const String    EXT_MESH    ( ".mesh"       );
-    const String    EXT_SKELETON( ".skeleton"   );
-    const String    EXT_CONFIG  ( ".cfg"        );
-    const String    EXT_LOG     ( ".log"        );
-
-    const String    EXT_P       ( ".p"          );
-    const String    EXT_PLY     ( ".ply"        );
-    const String    EXT_RSD     ( ".rsd"        );
-    const String    EXT_TEX     ( ".tex"        );
-    const String    EXT_TIM     ( ".tim"        );
-
-    const String    EXT_TRIGGERS     (".triggers");
-    const String    EXT_BACKGROUND   ( ".background" );
-    const String    EXT_CAMERA_MATRIX( ".cam_matrix" );
-    const String    EXT_MODEL_LIST   ( ".model_list" );
-    const String    EXT_PALETTE      ( ".palette"    );
-    const String    EXT_WALKMESH     ( ".walkmesh"   );
+namespace QGears{
+    const String EXT_MATERIAL(".material");
+    const String EXT_MESH(".mesh");
+    const String EXT_SKELETON(".skeleton");
+    const String EXT_CONFIG(".cfg");
+    const String EXT_LOG(".log");
+    const String EXT_P(".p");
+    const String EXT_PLY(".ply");
+    const String EXT_RSD(".rsd");
+    const String EXT_TEX(".tex");
+    const String EXT_TIM(".tim");
+    const String EXT_TRIGGERS(".triggers");
+    const String EXT_BACKGROUND(".background");
+    const String EXT_CAMERA_MATRIX(".cam_matrix");
+    const String EXT_MODEL_LIST(".model_list");
+    const String EXT_PALETTE(".palette");
+    const String EXT_WALKMESH(".walkmesh");
 }

+ 27 - 28
QGearsMain/src/core/particles/Particle.cpp

@@ -1,46 +1,45 @@
-#include "core/particles/Particle.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
+#include "core/particles/Particle.h"
 
-//------------------------------------------------------------------------------
 Particle::Particle():
-    m_ParentEmitter(nullptr),
-    m_ParticleType(PT_VISUAL),
-    m_Enabled(true),
-    m_Emittable(false),
-
+    parent_emitter_(nullptr),
+    particle_type_(PT_VISUAL),
+    enabled_(true),
+    emittable_(false),
     additional_data(nullptr),
     position(Ogre::Vector3::ZERO),
     direction(Ogre::Vector3::ZERO),
     time_to_live(10),
     total_time_to_live(10)
-{
-}
+{}
 
-//------------------------------------------------------------------------------
-Particle::~Particle()
-{
-}
+Particle::~Particle(){}
 
-//------------------------------------------------------------------------------
-void
-Particle::Update(Ogre::Real time_elapsed)
-{
+void Particle::Update(Ogre::Real time_elapsed){
     position += direction * time_elapsed;
 }
 
-//------------------------------------------------------------------------------
-void
-Particle::CopyAttributesTo(Particle* particle)
-{
-    // do not copy m_ParentEmitter and m_ParticleType
-    // this can be emited from other emitter and have different type
-    particle->m_Enabled = m_Enabled;
-    particle->SetEmittable(m_Emittable);
-
+void Particle::CopyAttributesTo(Particle* particle){
+    // Don't copy parent_emitter_ and particle_type_
+    // This can be emited from other emitter and have different type
+    particle->enabled_ = enabled_;
+    particle->SetEmittable(emittable_);
     particle->position = position;
     particle->direction = direction;
     particle->time_to_live = time_to_live;
     particle->total_time_to_live = total_time_to_live;
 }
-
-//------------------------------------------------------------------------------

+ 84 - 87
QGearsMain/src/core/particles/ParticleEmitter.cpp

@@ -1,117 +1,114 @@
-#include "core/particles/ParticleEmitter.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
 #include <OgreString.h>
 #include <OgreStringConverter.h>
-
+#include "core/particles/ParticleEmitter.h"
 #include "core/particles/ParticleTechnique.h"
 
-//------------------------------------------------------------------------------
-ParticleEmitterDictionary::EmissionRate     ParticleEmitter::m_EmissionRateDictionary;
-ParticleEmitterDictionary::TotalTimeToLive  ParticleEmitter::m_TotalTimeToLiveDictionary;
-ParticleEmitterDictionary::Direction        ParticleEmitter::m_DirectionDictionary;
+ParticleEmitterDictionary::EmissionRate
+  ParticleEmitter::emission_rate_dictionary_;
+ParticleEmitterDictionary::TotalTimeToLive
+  ParticleEmitter::total_time_to_live_dictionary_;
+ParticleEmitterDictionary::Direction ParticleEmitter::direction_dictionary_;
 
-//------------------------------------------------------------------------------
 ParticleEmitter::ParticleEmitter(void) :
     Particle(),
-    m_ParentTechnique(nullptr),
-    m_Name(Ogre::BLANKSTRING),
-    m_EmitsName(Ogre::BLANKSTRING),
-    m_EmitsType(PT_VISUAL),
-    m_EmissionRate(1),
-    m_EmissionRemainder(0),
-
-    m_EmitDirection1(Ogre::Vector3::ZERO),
-    m_EmitDirection2(Ogre::Vector3::ZERO),
-    m_EmitTotalTimeToLive(10)
+    parent_technique_(nullptr),
+    name_(Ogre::BLANKSTRING),
+    emits_name_(Ogre::BLANKSTRING),
+    emits_type_(PT_VISUAL),
+    emission_rate_(1),
+    emission_remainder_(0),
+    emit_direction_1_(Ogre::Vector3::ZERO),
+    emit_direction_2_(Ogre::Vector3::ZERO),
+    emit_total_time_to_live_(10)
 {
-    m_ParticleType = PT_EMITTER;
-
-    if (createParamDictionary("ParticleEmitter"))
-    {
+    particle_type_ = PT_EMITTER;
+    if (createParamDictionary("ParticleEmitter")){
         Ogre::ParamDictionary* dict = getParamDictionary();
-
-        dict->addParameter(Ogre::ParameterDef("emission_rate", "", Ogre::PT_INT), &m_EmissionRateDictionary);
-        dict->addParameter(Ogre::ParameterDef("time_to_live", "", Ogre::PT_REAL), &m_TotalTimeToLiveDictionary);
-        dict->addParameter(Ogre::ParameterDef("direction", "", Ogre::PT_STRING), &m_DirectionDictionary);
+        dict->addParameter(
+          Ogre::ParameterDef("emission_rate", "", Ogre::PT_INT),
+          &emission_rate_dictionary_
+        );
+        dict->addParameter(
+          Ogre::ParameterDef("time_to_live", "", Ogre::PT_REAL),
+          &total_time_to_live_dictionary_
+        );
+        dict->addParameter(
+          Ogre::ParameterDef("direction", "", Ogre::PT_STRING),
+          &direction_dictionary_
+        );
     }
 }
 
-//------------------------------------------------------------------------------
-ParticleEmitter::~ParticleEmitter()
-{
-}
+ParticleEmitter::~ParticleEmitter(){}
 
-//------------------------------------------------------------------------------
-void
-ParticleEmitter::CopyAttributesTo(ParticleEmitter* emitter)
-{
+void ParticleEmitter::CopyAttributesTo(ParticleEmitter* emitter){
     Particle::CopyAttributesTo(emitter);
-
-    emitter->SetParentTechnique(m_ParentTechnique);
-    emitter->SetName(m_Name);
-    emitter->SetEmitterType(m_EmitterType);
-
-    emitter->SetEmitsName(m_EmitsName);
-    emitter->SetEmitsType(m_EmitsType);
-    emitter->SetEmissionRate(m_EmissionRate);
-
-    emitter->SetEmitDirectionRange(m_EmitDirection1, m_EmitDirection2);
-    emitter->SetEmitTotalTimeToLive(m_EmitTotalTimeToLive);
+    emitter->SetParentTechnique(parent_technique_);
+    emitter->SetName(name_);
+    emitter->SetEmitterType(emitter_type_);
+    emitter->SetEmitsName(emits_name_);
+    emitter->SetEmitsType(emits_type_);
+    emitter->SetEmissionRate(emission_rate_);
+    emitter->SetEmitDirectionRange(emit_direction_1_, emit_direction_2_);
+    emitter->SetEmitTotalTimeToLive(emit_total_time_to_live_);
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEmitter::InitForEmission()
-{
-    m_EmissionRemainder = 0;
-}
+void ParticleEmitter::InitForEmission(){emission_remainder_ = 0;}
 
-//------------------------------------------------------------------------------
-int
-ParticleEmitter::CalculateRequestedParticles(Ogre::Real time_elapsed)
-{
+int ParticleEmitter::CalculateRequestedParticles(Ogre::Real time_elapsed){
     int request = 0;
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleEmitter::CalculateRequestedParticles time:" +
-        Ogre::StringConverter::toString(time_elapsed) +
-        " emission rate:" +
-        Ogre::StringConverter::toString(m_EmissionRate) +
-        " reminder:" +
-        Ogre::StringConverter::toString(m_EmissionRemainder));
-    if (m_Enabled && m_EmissionRate > 0)
-    {
-        m_EmissionRemainder += m_EmissionRate * time_elapsed;
-        request = (int)m_EmissionRemainder;
-        m_EmissionRemainder -= request;
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleEmitter::CalculateRequestedParticles time:"
+      + Ogre::StringConverter::toString(time_elapsed)
+      + " emission rate:"
+      + Ogre::StringConverter::toString(emission_rate_)
+      + " reminder:"
+      + Ogre::StringConverter::toString(emission_remainder_)
+    );
+    if (enabled_ && emission_rate_ > 0){
+        emission_remainder_ += emission_rate_ * time_elapsed;
+        request = (int) emission_remainder_;
+        emission_remainder_ -= request;
     }
-
     return request;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEmitter::InitParticleForEmission(Particle* particle)
-{
+void ParticleEmitter::InitParticleForEmission(Particle* particle){
     particle->SetParentEmitter(this);
-
-    particle->position = position; // particle emits from emitter position
-    particle->direction.x = Ogre::Math::RangeRandom(m_EmitDirection1.x, m_EmitDirection2.x);
-    particle->direction.y = Ogre::Math::RangeRandom(m_EmitDirection1.y, m_EmitDirection2.y);
-    particle->direction.z = Ogre::Math::RangeRandom(m_EmitDirection1.z, m_EmitDirection2.z);
-    particle->time_to_live = m_EmitTotalTimeToLive;
-    particle->total_time_to_live = m_EmitTotalTimeToLive;
+    particle->position = position; // Particle emits from emitter position
+    particle->direction.x = Ogre::Math::RangeRandom(
+      emit_direction_1_.x, emit_direction_2_.x
+    );
+    particle->direction.y = Ogre::Math::RangeRandom(
+      emit_direction_1_.y, emit_direction_2_.y
+    );
+    particle->direction.z = Ogre::Math::RangeRandom(
+      emit_direction_1_.z, emit_direction_2_.z
+    );
+    particle->time_to_live = emit_total_time_to_live_;
+    particle->total_time_to_live = emit_total_time_to_live_;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEmitter::SetEmitsName(const Ogre::String& emits_name)
-{
-    m_EmitsName = emits_name;
-    if (m_ParentTechnique && m_EmitsName != Ogre::BLANKSTRING)
-    {
+void ParticleEmitter::SetEmitsName(const Ogre::String& emits_name){
+    emits_name_ = emits_name;
+    if (parent_technique_ && emits_name_ != Ogre::BLANKSTRING){
         // Notify the Technique that something changed
-        m_ParentTechnique->EmissionChange();
+        parent_technique_->EmissionChange();
     }
 }
-
-//------------------------------------------------------------------------------

+ 39 - 29
QGearsMain/src/core/particles/ParticleEmitterDictionary.cpp

@@ -1,45 +1,55 @@
-#include "core/particles/ParticleEmitterDictionary.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreStringConverter.h>
-
+#include "core/particles/ParticleEmitterDictionary.h"
 #include "core/particles/ParticleEmitter.h"
 #include "core/Logger.h"
 #include "core/Utilites.h"
 
-namespace ParticleEmitterDictionary
-{
-    //--------------------------------------------------------------------------
-    void
-    EmissionRate::doSet(void* target, const Ogre::String& val)
-    {
-        static_cast<ParticleEmitter*>(target)->SetEmissionRate(Ogre::StringConverter::parseInt(val));
+namespace ParticleEmitterDictionary{
+
+    void EmissionRate::doSet(void* target, const Ogre::String& val){
+        static_cast<ParticleEmitter*>(target)->SetEmissionRate(
+          Ogre::StringConverter::parseInt(val)
+        );
     }
 
-    //--------------------------------------------------------------------------
-    void
-    TotalTimeToLive::doSet(void* target, const Ogre::String& val)
-    {
-        static_cast<ParticleEmitter*>(target)->SetEmitTotalTimeToLive(Ogre::StringConverter::parseReal(val));
+    void TotalTimeToLive::doSet(void* target, const Ogre::String& val){
+        static_cast<ParticleEmitter*>(target)->SetEmitTotalTimeToLive(
+          Ogre::StringConverter::parseReal(val)
+        );
     }
 
-    //--------------------------------------------------------------------------
-    void
-    Direction::doSet(void* target, const Ogre::String& val)
-    {
+    void Direction::doSet(void* target, const Ogre::String& val){
         Ogre::StringVector strings = StringTokenise(val);
-        if (strings.size() == 1)
-        {
-            static_cast<ParticleEmitter*>(target)->SetEmitDirection(Ogre::StringConverter::parseVector3(strings[0]));
+        if (strings.size() == 1){
+            static_cast<ParticleEmitter*>(target)->SetEmitDirection(
+              Ogre::StringConverter::parseVector3(strings[0])
+            );
         }
-        else if (strings.size() > 1)
-        {
-            static_cast<ParticleEmitter*>(target)->SetEmitDirectionRange(Ogre::StringConverter::parseVector3(strings[0]), Ogre::StringConverter::parseVector3(strings[1]));
+        else if (strings.size() > 1){
+            static_cast<ParticleEmitter*>(target)->SetEmitDirectionRange(
+              Ogre::StringConverter::parseVector3(strings[0]),
+              Ogre::StringConverter::parseVector3(strings[1])
+            );
         }
-        else
-        {
-            LOG_WARNING("In particle emitter setting direction must be at least one value.");
+        else{
+            LOG_WARNING(
+              "The direction of a particle emitter must have at least a value."
+            );
         }
     }
-
-    //--------------------------------------------------------------------------
 }

+ 70 - 40
QGearsMain/src/core/particles/ParticleEmitterTranslator.cpp

@@ -1,67 +1,97 @@
-#include "core/particles/ParticleEmitterTranslator.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
-
+#include "core/particles/ParticleEmitterTranslator.h"
 #include "core/particles/ParticleSystemManager.h"
 
-//------------------------------------------------------------------------------
-void
-ParticleEmitterTranslator::translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node)
-{
-    Ogre::ObjectAbstractNode *obj = reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
+void ParticleEmitterTranslator::translate(
+  Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node
+){
+    Ogre::ObjectAbstractNode *obj =
+      reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
 
-    // name can't be empty because we get renderer type from it
-    if(obj->name.empty())
-    {
-        compiler->addError(Ogre::ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line);
+    // Name can't be empty because the renderer type is retrieved from it.
+    if (obj->name.empty()){
+        compiler->addError(
+          Ogre::ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line
+        );
         return;
     }
 
-    ParticleTechnique* tech = Ogre::any_cast<ParticleTechnique*>(obj->parent->context);
+    ParticleTechnique* tech = Ogre::any_cast<ParticleTechnique*>(
+      obj->parent->context
+    );
 
     ParticleEmitter* emitter = tech->CreateEmitter(obj->name);
-    if (emitter == nullptr)
-    {
-        compiler->addError(Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line);
+    if (emitter == nullptr){
+        compiler->addError(
+          Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line
+        );
         return;
     }
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleEmitterTranslator: create emitter.");
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleEmitterTranslator: create emitter " + obj->name
+    );
 
-    for (Ogre::AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
-    {
-        if ((*i)->type == Ogre::ANT_PROPERTY)
-        {
-            Ogre::PropertyAbstractNode *prop = reinterpret_cast<Ogre::PropertyAbstractNode*>((*i).get());
+    for (
+      Ogre::AbstractNodeList::iterator i = obj->children.begin();
+      i != obj->children.end();
+      ++i
+    ){
+        if ((*i)->type == Ogre::ANT_PROPERTY){
+            Ogre::PropertyAbstractNode *prop =
+              reinterpret_cast<Ogre::PropertyAbstractNode*>((*i).get());
             Ogre::String value = prop->getValue();
-/*
+            /*
             // Glob the values together
-            for (Ogre::AbstractNodeList::iterator i = prop->values.begin(); i != prop->values.end(); ++i)
-            {
-                if((*i)->type == Ogre::ANT_ATOM)
-                {
-                    if (value.empty())
-                    {
+            for (
+              Ogre::AbstractNodeList::iterator i = prop->values.begin();
+              i != prop->values.end();
+              ++ i
+            ){
+                if((*i)->type == Ogre::ANT_ATOM){
+                    if (value.empty()){
                         value = ((Ogre::AtomAbstractNode*)(*i).get())->value;
                     }
-                    else
-                    {
-                        value = value + " " + ((Ogre::AtomAbstractNode*)(*i).get())->value;
+                    else{
+                        value =
+                          value
+                          + " " + ((Ogre::AtomAbstractNode*)(*i).get())->value;
                     }
                 }
-                else
-                {
-                    compiler->addError(Ogre::ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
+                else{
+                    compiler->addError(
+                      Ogre::ScriptCompiler::CE_INVALIDPARAMETERS,
+                      prop->file, prop->line
+                    );
                     break;
                 }
             }
-*/
-            Ogre::LogManager::getSingletonPtr()->logMessage("ParticleEmitterTranslator: Set param '" + prop->name + "' to '" + value + "'.");
-            if (!emitter->setParameter(prop->name, value))
-            {
-                compiler->addError(Ogre::ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
+            */
+            Ogre::LogManager::getSingletonPtr()->logMessage(
+              "ParticleEmitterTranslator: Set param '"
+              + prop->name + "' to '" + value + "'."
+            );
+            if (!emitter->setParameter(prop->name, value)){
+                compiler->addError(
+                  Ogre::ScriptCompiler::CE_INVALIDPARAMETERS,
+                  prop->file, prop->line
+                );
             }
         }
     }
 }
 
-//------------------------------------------------------------------------------

+ 32 - 46
QGearsMain/src/core/particles/ParticleRenderer.cpp

@@ -1,63 +1,49 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
 #include "core/particles/ParticleRenderer.h"
 
-//------------------------------------------------------------------------------
 ParticleRenderer::ParticleRenderer():
-    m_ParentTechnique(nullptr),
-    m_RendererInitialised(false)
-{
-}
+    parent_technique_(nullptr),
+    renderer_initialized_(false)
+{}
 
-//------------------------------------------------------------------------------
-ParticleRenderer::~ParticleRenderer()
-{
-}
+ParticleRenderer::~ParticleRenderer(){}
 
-//------------------------------------------------------------------------------
-void
-ParticleRenderer::CopyAttributesTo(ParticleRenderer* renderer)
-{
-}
+void ParticleRenderer::CopyAttributesTo(ParticleRenderer* renderer){}
 
-//------------------------------------------------------------------------------
-void
-ParticleRenderer::SetRendererInitialised(bool renderer_initialised)
-{
-    m_RendererInitialised = renderer_initialised;
+void ParticleRenderer::SetRendererInitialised(bool renderer_initialised){
+    renderer_initialized_ = renderer_initialised;
 }
 
-//------------------------------------------------------------------------------
-bool
-ParticleRenderer::IsRendererInitialised() const
-{
-    return m_RendererInitialised;
+bool ParticleRenderer::IsRendererInitialised() const{
+    return renderer_initialized_;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleRenderer::SetRendererType(Ogre::String renderer_type)
-{
-    m_RendererType = renderer_type;
+void ParticleRenderer::SetRendererType(Ogre::String renderer_type){
+    renderer_type_ = renderer_type;
 }
 
-//------------------------------------------------------------------------------
-const Ogre::String&
-ParticleRenderer::GetRendererType() const
-{
-    return m_RendererType;
+const Ogre::String&ParticleRenderer::GetRendererType() const{
+    return renderer_type_;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleRenderer::SetParentTechnique(ParticleTechnique* parent_technique)
-{
-    m_ParentTechnique = parent_technique;
+void ParticleRenderer::SetParentTechnique(ParticleTechnique* parent_technique){
+    parent_technique_ = parent_technique;
 }
 
-//------------------------------------------------------------------------------
-const ParticleTechnique*
-ParticleRenderer::GetParentTechnique() const
-{
-    return m_ParentTechnique;
+const ParticleTechnique* ParticleRenderer::GetParentTechnique() const{
+    return parent_technique_;
 }
-
-//------------------------------------------------------------------------------

+ 67 - 39
QGearsMain/src/core/particles/ParticleRendererTranslator.cpp

@@ -1,67 +1,95 @@
-#include "core/particles/ParticleRendererTranslator.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
-
+#include "core/particles/ParticleRendererTranslator.h"
 #include "core/particles/ParticleSystemManager.h"
 
-//------------------------------------------------------------------------------
-void
-ParticleRendererTranslator::translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node)
-{
-    Ogre::ObjectAbstractNode *obj = reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
+void ParticleRendererTranslator::translate(
+  Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node
+){
+    Ogre::ObjectAbstractNode *obj =
+      reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
 
     // name can't be empty because we get renderer type from it
-    if(obj->name.empty())
-    {
-        compiler->addError(Ogre::ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line);
+    if(obj->name.empty()){
+        compiler->addError(
+          Ogre::ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line
+        );
         return;
     }
-
-    ParticleTechnique* tech = Ogre::any_cast<ParticleTechnique*>(obj->parent->context);
+    ParticleTechnique* tech = Ogre::any_cast<ParticleTechnique*>(
+      obj->parent->context
+    );
 
     ParticleRenderer* rend = tech->CreateRenderer(obj->name);
-    if (rend == nullptr)
-    {
-        compiler->addError(Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line);
+    if (rend == nullptr) {
+        compiler->addError(
+          Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line
+        );
         return;
     }
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleRendererTranslator: create renderer");
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleRendererTranslator: create renderer: " + obj->name
+    );
 
-    for (Ogre::AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
-    {
-        if ((*i)->type == Ogre::ANT_PROPERTY)
-        {
-            Ogre::PropertyAbstractNode *prop = reinterpret_cast<Ogre::PropertyAbstractNode*>((*i).get());
+    for (
+      Ogre::AbstractNodeList::iterator i = obj->children.begin();
+      i != obj->children.end();
+      ++ i
+    ){
+        if ((*i)->type == Ogre::ANT_PROPERTY){
+            Ogre::PropertyAbstractNode *prop =
+              reinterpret_cast<Ogre::PropertyAbstractNode*>((*i).get());
             Ogre::String value;
 
             // Glob the values together
-            for (Ogre::AbstractNodeList::iterator i = prop->values.begin(); i != prop->values.end(); ++i)
-            {
-                if((*i)->type == Ogre::ANT_ATOM)
-                {
-                    if (value.empty())
-                    {
+            for (
+              Ogre::AbstractNodeList::iterator i = prop->values.begin();
+              i != prop->values.end();
+              ++ i
+            ){
+                if((*i)->type == Ogre::ANT_ATOM){
+                    if (value.empty()){
                         value = ((Ogre::AtomAbstractNode*)(*i).get())->value;
                     }
-                    else
-                    {
-                        value = value + " " + ((Ogre::AtomAbstractNode*)(*i).get())->value;
+                    else{
+                        value =
+                          value + " "
+                          + ((Ogre::AtomAbstractNode*)(*i).get())->value;
                     }
                 }
-                else
-                {
-                    compiler->addError(Ogre::ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
+                else{
+                    compiler->addError(
+                      Ogre::ScriptCompiler::CE_INVALIDPARAMETERS,
+                      prop->file, prop->line
+                    );
                     break;
                 }
             }
 
-            Ogre::LogManager::getSingletonPtr()->logMessage("ParticleRendererTranslator: Set param '" + prop->name + "' to '" + value + "'.");
-            if (!rend->setParameter(prop->name, value))
-            {
-                compiler->addError(Ogre::ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
+            Ogre::LogManager::getSingletonPtr()->logMessage(
+              "ParticleRendererTranslator: Set param '"
+              + prop->name + "' to '" + value + "'."
+            );
+            if (!rend->setParameter(prop->name, value)){
+                compiler->addError(
+                  Ogre::ScriptCompiler::CE_INVALIDPARAMETERS,
+                  prop->file, prop->line
+                );
             }
         }
     }
 }
-
-//------------------------------------------------------------------------------

+ 54 - 70
QGearsMain/src/core/particles/ParticleSystem.cpp

@@ -1,114 +1,98 @@
-#include "core/particles/ParticleSystem.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
 #include <OgreSceneNode.h>
-
+#include "core/particles/ParticleSystem.h"
 #include "core/particles/ParticleSystemManager.h"
 
-//------------------------------------------------------------------------------
-ParticleSystem::ParticleSystem(const Ogre::String& name):
-    MovableObject(name)
-{
-}
+ParticleSystem::ParticleSystem(const Ogre::String& name): MovableObject(name){}
 
-//------------------------------------------------------------------------------
-ParticleSystem::~ParticleSystem()
-{
-    // Destroy nodes that are used for renderers and stuff.
+
+ParticleSystem::~ParticleSystem(){
+    // Destroy nodes that are used for renderers.
     if (getParentSceneNode())
-    {
         getParentSceneNode()->removeAndDestroyAllChildren();
-    }
-
     DestroyAllTechniques();
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystem::CopyAttributesTo( ParticleSystem* ps )
-{
+void ParticleSystem::CopyAttributesTo(ParticleSystem* ps){
     // Destroy all existing techniques.
     ps->DestroyAllTechniques();
-
     // Copy techniques
     ParticleTechnique* cloned_technique = nullptr;
-    for( unsigned int i = 0; i < m_Techniques.size(); ++i )
-    {
-        cloned_technique = ParticleSystemManager::getSingletonPtr()->CloneTechnique( m_Techniques[ i ] );
-        ps->AddTechnique( cloned_technique );
+    for (unsigned int i = 0; i < techniques_.size(); ++ i){
+        cloned_technique =
+          ParticleSystemManager::getSingletonPtr()->CloneTechnique(
+            techniques_[i]
+          );
+        ps->AddTechnique(cloned_technique);
     }
 }
 
-//------------------------------------------------------------------------------
-const Ogre::String&
-ParticleSystem::getMovableType() const
-{
+const Ogre::String& ParticleSystem::getMovableType() const{
     static Ogre::String type = "ParticleSystem";
     return type;
 }
 
-//------------------------------------------------------------------------------
-const Ogre::AxisAlignedBox&
-ParticleSystem::getBoundingBox() const
-{
+const Ogre::AxisAlignedBox& ParticleSystem::getBoundingBox() const{
     return Ogre::AxisAlignedBox::BOX_INFINITE;
 }
 
-//------------------------------------------------------------------------------
-Ogre::Real
-ParticleSystem::getBoundingRadius() const
-{
+Ogre::Real ParticleSystem::getBoundingRadius() const{
+    // TODO: Calculate.
     return 999;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystem::_updateRenderQueue( Ogre::RenderQueue* queue )
-{
-    Ogre::LogManager::getSingletonPtr()->logMessage( "ParticleSystem::_updateRenderQueue" );
-    for( unsigned int i = 0; i < m_Techniques.size(); ++i )
-    {
-        m_Techniques[i]->UpdateRenderQueue(queue);
+void ParticleSystem::_updateRenderQueue(Ogre::RenderQueue* queue){
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleSystem::UpdateRenderQueue"
+    );
+    for(unsigned int i = 0; i < techniques_.size(); ++ i){
+        techniques_[i]->UpdateRenderQueue(queue);
     }
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystem::Update( Ogre::Real time_elapsed )
-{
-    Ogre::LogManager::getSingletonPtr()->logMessage( "ParticleSystem::Update STARTED. Technique number: " + Ogre::StringConverter::toString( m_Techniques.size() ) );
-    for( unsigned int i = 0; i < m_Techniques.size(); ++i )
-    {
-         m_Techniques[i]->Update( time_elapsed );
+void ParticleSystem::Update(Ogre::Real time_elapsed){
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleSystem::Update STARTED. Technique number: "
+      + Ogre::StringConverter::toString(techniques_.size())
+    );
+    for (unsigned int i = 0; i < techniques_.size(); ++ i){
+         techniques_[i]->Update(time_elapsed);
     }
 }
 
-//------------------------------------------------------------------------------
-ParticleTechnique*
-ParticleSystem::CreateTechnique()
-{
-    ParticleTechnique* technique = ParticleSystemManager::getSingletonPtr()->CreateTechnique();
+ParticleTechnique*ParticleSystem::CreateTechnique(){
+    ParticleTechnique* technique =
+      ParticleSystemManager::getSingletonPtr()->CreateTechnique();
     AddTechnique(technique);
     return technique;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystem::AddTechnique(ParticleTechnique* technique)
-{
-    m_Techniques.push_back(technique);
+void ParticleSystem::AddTechnique(ParticleTechnique* technique){
+    techniques_.push_back(technique);
     technique->SetParentSystem(this);
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystem::DestroyAllTechniques()
-{
-    for( unsigned int i = 0; i < m_Techniques.size(); ++i )
-    {
-        ParticleSystemManager::getSingletonPtr()->DestroyTechnique( m_Techniques[ i ] );
+void ParticleSystem::DestroyAllTechniques(){
+    for (unsigned int i = 0; i < techniques_.size(); ++ i){
+        ParticleSystemManager::getSingletonPtr()->DestroyTechnique(
+          techniques_[i]
+        );
     }
-    m_Techniques.clear();
+    techniques_.clear();
 }
 
-//------------------------------------------------------------------------------

+ 37 - 25
QGearsMain/src/core/particles/ParticleSystemFactory.cpp

@@ -1,47 +1,59 @@
-#include "core/particles/ParticleSystemFactory.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
+#include "core/particles/ParticleSystemFactory.h"
 #include "core/particles/ParticleSystem.h"
 #include "core/particles/ParticleSystemManager.h"
 
-//------------------------------------------------------------------------------
 Ogre::String ParticleSystemFactory::FACTORY_TYPE_NAME = "QgearsParticleSystem";
 
-//------------------------------------------------------------------------------
-const Ogre::String&
-ParticleSystemFactory::getType() const
-{
+
+const Ogre::String& ParticleSystemFactory::getType() const{
     return FACTORY_TYPE_NAME;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemFactory::destroyInstance(Ogre::MovableObject* obj)
-{
+void ParticleSystemFactory::DestroyInstance(Ogre::MovableObject* obj){
     delete obj;
 }
 
-//------------------------------------------------------------------------------
-Ogre::MovableObject*
-ParticleSystemFactory::createInstanceImpl( const Ogre::String& name, const Ogre::NameValuePairList* params)
-{
-    if (params != 0)
-    {
-        Ogre::NameValuePairList::const_iterator ni = params->find("template_name");
-        if (ni != params->end())
-        {
+Ogre::MovableObject* ParticleSystemFactory::createInstanceImpl(
+  const Ogre::String& name, const Ogre::NameValuePairList* params
+){
+    if (params != 0){
+        Ogre::NameValuePairList::const_iterator ni =
+          params->find("template_name");
+        if (ni != params->end()){
             Ogre::String template_name = ni->second;
 
             // Look up template
-            ParticleSystem* pTemplate = ParticleSystemManager::getSingleton().GetParticleSystemTemplate(template_name);
-            if (!pTemplate)
-            {
-                OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Cannot find required template '" + template_name + "'", "ParticleSystemManager::CreateSystem");
+            ParticleSystem* p_template =
+              ParticleSystemManager::getSingleton().GetParticleSystemTemplate(
+                template_name
+              );
+            if (!p_template){
+                OGRE_EXCEPT(
+                  Ogre::Exception::ERR_INVALIDPARAMS,
+                  "Cannot find required template '" + template_name + "'",
+                  "ParticleSystemManager::CreateSystem"
+                );
             }
 
             ParticleSystem* sys = new ParticleSystem(name);
 
             // Copy template settings
-            pTemplate->CopyAttributesTo(sys);
+            p_template->CopyAttributesTo(sys);
             return sys;
         }
     }
@@ -50,4 +62,4 @@ ParticleSystemFactory::createInstanceImpl( const Ogre::String& name, const Ogre:
     return new ParticleSystem(name);
 }
 
-//------------------------------------------------------------------------------
+

+ 156 - 162
QGearsMain/src/core/particles/ParticleSystemManager.cpp

@@ -1,258 +1,252 @@
-#include "core/particles/ParticleSystemManager.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
 #include <OgreRoot.h>
-
+#include "core/particles/ParticleSystemManager.h"
 #include "core/particles/ParticleSystemFactory.h"
 #include "core/particles/emitters/ParticlePointEmitterFactory.h"
 #include "core/particles/renderer/ParticleEntityRendererFactory.h"
 
-//------------------------------------------------------------------------------
-template<> ParticleSystemManager* Ogre::Singleton<ParticleSystemManager>::msSingleton = nullptr;
+template<> ParticleSystemManager*
+  Ogre::Singleton<ParticleSystemManager>::msSingleton = nullptr;
 
-//------------------------------------------------------------------------------
-ParticleSystemManager::ParticleSystemManager()
-{
-    m_TranslatorManager = new ParticleSystemTranslatorManager();
-    Ogre::ScriptCompilerManager::getSingleton().addTranslatorManager(m_TranslatorManager);
 
+ParticleSystemManager::ParticleSystemManager(){
+    translator_manager_ = new ParticleSystemTranslatorManager();
+    Ogre::ScriptCompilerManager::getSingleton().addTranslatorManager(
+      translator_manager_
+    );
     Ogre::ScriptCompilerManager::getSingleton().addScriptPattern("*.effects");
-
-    m_ParticleSystemFactory = new ParticleSystemFactory();
-    Ogre::Root::getSingleton().addMovableObjectFactory(m_ParticleSystemFactory);
-
+    particle_system_factory_ = new ParticleSystemFactory();
+    Ogre::Root::getSingleton().addMovableObjectFactory(
+      particle_system_factory_
+    );
     AddEmitterFactory(new PointEmitterFactory());
-
     AddRendererFactory(new ParticleEntityRendererFactory());
 }
 
-//------------------------------------------------------------------------------
-ParticleSystemManager::~ParticleSystemManager()
-{
-    Ogre::ScriptCompilerManager::getSingleton().removeTranslatorManager(m_TranslatorManager);
-    delete m_TranslatorManager;
-
-    if (m_ParticleSystemFactory)
-    {
-        Ogre::Root::getSingleton().removeMovableObjectFactory(m_ParticleSystemFactory);
-        delete m_ParticleSystemFactory;
-        m_ParticleSystemFactory = 0;
+ParticleSystemManager::~ParticleSystemManager(){
+    Ogre::ScriptCompilerManager::getSingleton().removeTranslatorManager(
+      translator_manager_
+    );
+    delete translator_manager_;
+    if (particle_system_factory_){
+        Ogre::Root::getSingleton().removeMovableObjectFactory(
+          particle_system_factory_
+        );
+        delete particle_system_factory_;
+        particle_system_factory_ = 0;
     }
 
     // Delete all Particle System Templates
     ParticleSystemTemplateMap::iterator t;
-    for (t = m_ParticleSystemTemplates.begin(); t != m_ParticleSystemTemplates.end(); ++t)
-    {
+    for (
+      t = particle_system_templates_.begin();
+      t != particle_system_templates_.end();
+      ++ t
+    ){
         delete t->second;
     }
-    m_ParticleSystemTemplates.clear();
-
-
-
+    particle_system_templates_.clear();
     EmitterFactoryMap::iterator efi;
-    for (efi = m_EmitterFactories.begin(); efi != m_EmitterFactories.end(); ++efi)
-    {
+    for (
+      efi = emitter_factories_.begin();
+      efi != emitter_factories_.end();
+      ++ efi
+    ){
         delete efi->second;
     }
-
-
-
     RendererFactoryMap::iterator rfi;
-    for (rfi = m_RendererFactories.begin(); rfi != m_RendererFactories.end(); ++rfi)
-    {
+    for (
+      rfi = renderer_factories_.begin();
+      rfi != renderer_factories_.end();
+      ++ rfi
+    ){
         delete rfi->second;
     }
 }
 
-//------------------------------------------------------------------------------
-ParticleSystem*
-ParticleSystemManager::CreateParticleSystemTemplate(const Ogre::String& name)
-{
+ParticleSystem* ParticleSystemManager::CreateParticleSystemTemplate(
+  const Ogre::String& name
+){
     // Validate name
-    if (m_ParticleSystemTemplates.find(name) != m_ParticleSystemTemplates.end())
-    {
-        OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM, "ParticleSystem template with name '" + name + "' already exists.", "ParticleSystemManager::CreateParticleSystemTemplate");
+    if (
+      particle_system_templates_.find(name) != particle_system_templates_.end()
+    ){
+        OGRE_EXCEPT(
+          Ogre::Exception::ERR_DUPLICATE_ITEM,
+          "ParticleSystem template with name '" + name + "' already exists.",
+          "ParticleSystemManager::CreateParticleSystemTemplate"
+        );
     }
-
     ParticleSystem* particle_system_template = new ParticleSystem(name);
-    m_ParticleSystemTemplates[name] = particle_system_template;
+    particle_system_templates_[name] = particle_system_template;
     return particle_system_template;
 }
 
-//------------------------------------------------------------------------------
-ParticleSystem*
-ParticleSystemManager::GetParticleSystemTemplate(const Ogre::String& template_name)
-{
-    ParticleSystemTemplateMap::iterator i = m_ParticleSystemTemplates.find(template_name);
-    if (i != m_ParticleSystemTemplates.end())
-    {
-        return i->second;
-    }
-
+ParticleSystem* ParticleSystemManager::GetParticleSystemTemplate(
+  const Ogre::String& template_name
+){
+    ParticleSystemTemplateMap::iterator i =
+      particle_system_templates_.find(template_name);
+    if (i != particle_system_templates_.end()) return i->second;
     return 0;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemManager::ParticleSystemTemplateNames(std::vector<Ogre::String>& v)
-{
+void ParticleSystemManager::ParticleSystemTemplateNames(
+  std::vector<Ogre::String>& v
+){
     ParticleSystemTemplateMap::iterator it;
-    ParticleSystemTemplateMap::iterator it_end = m_ParticleSystemTemplates.end();
-    for (it = m_ParticleSystemTemplates.begin(); it != it_end; ++it)
-    {
+    ParticleSystemTemplateMap::iterator it_end =
+      particle_system_templates_.end();
+    for (it = particle_system_templates_.begin(); it != it_end; ++ it)
         v.push_back((*it).first);
-    }
 }
 
-//------------------------------------------------------------------------------
-ParticleSystem*
-ParticleSystemManager::CreateParticleSystem(const Ogre::String& name, const Ogre::String& template_name)
-{
+ParticleSystem* ParticleSystemManager::CreateParticleSystem(
+  const Ogre::String& name, const Ogre::String& template_name
+){
     Ogre::NameValuePairList params;
     params["template_name"] = template_name;
-
-    ParticleSystem* system = static_cast<ParticleSystem*>(Ogre::Root::getSingleton().getSceneManager("Scene")->createMovableObject(name, ParticleSystemFactory::FACTORY_TYPE_NAME, &params));
+    ParticleSystem* system = static_cast<ParticleSystem*>(
+      Ogre::Root::getSingleton().getSceneManager("Scene")->createMovableObject(
+        name, ParticleSystemFactory::FACTORY_TYPE_NAME, &params
+      )
+    );
     return system;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemManager::DestroyParticleSystem(ParticleSystem* particle_system)
-{
-    Ogre::Root::getSingleton().getSceneManager("Scene")->destroyMovableObject(particle_system);
+void ParticleSystemManager::DestroyParticleSystem(
+  ParticleSystem* particle_system
+){
+    Ogre::Root::getSingleton().getSceneManager("Scene")->destroyMovableObject(
+      particle_system
+    );
 }
 
-//------------------------------------------------------------------------------
-ParticleTechnique*
-ParticleSystemManager::CreateTechnique()
-{
+ParticleTechnique* ParticleSystemManager::CreateTechnique(){
     ParticleTechnique* technique = new ParticleTechnique();
     technique->CreateRenderer("Entity"); // Set default renderer
     return technique;
 }
 
-//------------------------------------------------------------------------------
-ParticleTechnique*
-ParticleSystemManager::CloneTechnique(ParticleTechnique* technique)
-{
-    if (technique == nullptr)
-    {
-        return nullptr;
-    }
-
+ParticleTechnique* ParticleSystemManager::CloneTechnique(
+  ParticleTechnique* technique
+){
+    if (technique == nullptr) return nullptr;
     ParticleTechnique* cloned_technique = CreateTechnique();
     technique->CopyAttributesTo(cloned_technique);
     return cloned_technique;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemManager::DestroyTechnique(ParticleTechnique* technique)
-{
+void ParticleSystemManager::DestroyTechnique(ParticleTechnique* technique){
     // Deletion must be done by the same object that also created it
     delete technique;
 }
 
-//------------------------------------------------------------------------------
-ParticleEmitter*
-ParticleSystemManager::CreateEmitter(const Ogre::String& emitter_type)
-{
+ParticleEmitter* ParticleSystemManager::CreateEmitter(
+  const Ogre::String& emitter_type
+){
     // Locate emitter type
-    EmitterFactoryMap::iterator it = m_EmitterFactories.find(emitter_type);
-    if (it == m_EmitterFactories.end())
-    {
-        OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Particle System: Cannot find requested emitter type.", "ParticleSystemManager::CreateEmitter");
+    EmitterFactoryMap::iterator it = emitter_factories_.find(emitter_type);
+    if (it == emitter_factories_.end()){
+        OGRE_EXCEPT(
+          Ogre::Exception::ERR_INVALIDPARAMS,
+          "Particle System: Cannot find requested emitter type.",
+          "ParticleSystemManager::CreateEmitter"
+        );
     }
     return it->second->CreateEmitter();
 }
 
-//------------------------------------------------------------------------------
-ParticleEmitter*
-ParticleSystemManager::CloneEmitter(ParticleEmitter* emitter)
-{
-    if (!emitter)
-    {
-        return nullptr;
-    }
-
+ParticleEmitter* ParticleSystemManager::CloneEmitter(ParticleEmitter* emitter){
+    if (!emitter) return nullptr;
     ParticleEmitter* cloned_emitter = CreateEmitter(emitter->GetEmitterType());
     emitter->CopyAttributesTo(cloned_emitter);
     return cloned_emitter;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemManager::DestroyEmitter(ParticleEmitter* emitter)
-{
+void ParticleSystemManager::DestroyEmitter(ParticleEmitter* emitter){
     // Locate emitter type
-    EmitterFactoryMap::iterator it = m_EmitterFactories.find(emitter->GetEmitterType());
-    if (it == m_EmitterFactories.end())
-    {
-        OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Particle System: Cannot find requested emitter type.", "ParticleSystemManager::DestroyEmitter");
+    EmitterFactoryMap::iterator it = emitter_factories_.find(
+      emitter->GetEmitterType()
+    );
+    if (it == emitter_factories_.end()){
+        OGRE_EXCEPT(
+          Ogre::Exception::ERR_INVALIDPARAMS,
+          "Particle System: Cannot find requested emitter type.",
+          "ParticleSystemManager::DestroyEmitter"
+        );
     }
     it->second->DestroyEmitter(emitter);
 }
 
-//------------------------------------------------------------------------------
-ParticleRenderer*
-ParticleSystemManager::CreateRenderer(const Ogre::String& renderer_type)
-{
+ParticleRenderer* ParticleSystemManager::CreateRenderer(
+  const Ogre::String& renderer_type
+){
     // Locate renderer type
-    RendererFactoryMap::iterator it = m_RendererFactories.find(renderer_type);
-
-    if (it == m_RendererFactories.end())
-    {
-        OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "PU: Cannot find requested renderer type.", "ParticleSystemManager::CreateRenderer");
+    RendererFactoryMap::iterator it = renderer_factories_.find(renderer_type);
+    if (it == renderer_factories_.end()){
+        OGRE_EXCEPT(
+          Ogre::Exception::ERR_INVALIDPARAMS,
+          "Renderer: Cannot find requested renderer type.",
+          "ParticleSystemManager::CreateRenderer"
+        );
     }
-
     return it->second->CreateRenderer();
 }
 
-//------------------------------------------------------------------------------
-ParticleRenderer*
-ParticleSystemManager::CloneRenderer(ParticleRenderer* renderer)
-{
-    if (renderer == nullptr)
-    {
-        return nullptr;
-    }
-
-    ParticleRenderer* cloned_renderer = CreateRenderer(renderer->GetRendererType());
+ParticleRenderer* ParticleSystemManager::CloneRenderer(
+  ParticleRenderer* renderer
+){
+    if (renderer == nullptr) return nullptr;
+    ParticleRenderer* cloned_renderer =
+      CreateRenderer(renderer->GetRendererType());
     renderer->CopyAttributesTo(cloned_renderer);
     return cloned_renderer;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemManager::DestroyRenderer(ParticleRenderer* renderer)
-{
+void ParticleSystemManager::DestroyRenderer(ParticleRenderer* renderer){
     // Locate renderer type
-    RendererFactoryMap::iterator it = m_RendererFactories.find(renderer->GetRendererType());
-
-    if (it == m_RendererFactories.end())
-    {
-        OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "PU: Cannot find requested renderer type.", "ParticleSystemManager::DestroyRenderer");
+    RendererFactoryMap::iterator it =
+      renderer_factories_.find(renderer->GetRendererType());
+    if (it == renderer_factories_.end()){
+        OGRE_EXCEPT(
+          Ogre::Exception::ERR_INVALIDPARAMS,
+          "Renderer: Cannot find requested renderer type.",
+          "ParticleSystemManager::DestroyRenderer"
+        );
     }
-
     it->second->DestroyRenderer(renderer);
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemManager::AddEmitterFactory(ParticleEmitterFactory* factory)
-{
+void ParticleSystemManager::AddEmitterFactory(ParticleEmitterFactory* factory){
     Ogre::String type = factory->GetEmitterType();
-    m_EmitterFactories[type] = factory;
-    Ogre::LogManager::getSingleton().logMessage("ParticleUniverse: Particle Emitter Type '" + type + "' registered.");
+    emitter_factories_[type] = factory;
+    Ogre::LogManager::getSingleton().logMessage(
+      "Particle system: Particle Emitter Type '" + type + "' registered."
+    );
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemManager::AddRendererFactory(ParticleRendererFactory* factory)
-{
+void ParticleSystemManager::AddRendererFactory(
+  ParticleRendererFactory* factory
+){
     Ogre::String type = factory->GetRendererType();
-    m_RendererFactories[type] = factory;
-    Ogre::LogManager::getSingleton().logMessage("ParticleUniverse: Particle Renderer Type '" + type + "' registered");
+    renderer_factories_[type] = factory;
+    Ogre::LogManager::getSingleton().logMessage(
+      "Particle system: Particle Renderer Type '" + type + "' registered"
+    );
 }
-
-//------------------------------------------------------------------------------

+ 44 - 29
QGearsMain/src/core/particles/ParticleSystemTranslator.cpp

@@ -1,41 +1,56 @@
-#include "core/particles/ParticleSystemTranslator.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
-
+#include "core/particles/ParticleSystemTranslator.h"
 #include "core/particles/ParticleSystemManager.h"
 
-//------------------------------------------------------------------------------
-void
-ParticleSystemTranslator::translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node)
-{
-    Ogre::ObjectAbstractNode *obj = reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
-
-    // name can't be empty because we add particle system by it
-    if(obj->name.empty())
-    {
-        compiler->addError(Ogre::ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line);
+void ParticleSystemTranslator::translate(
+  Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node
+){
+    Ogre::ObjectAbstractNode *obj =
+      reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
+    // Name can't be empty because particle systems are added by it.
+    if(obj->name.empty()){
+        compiler->addError(
+          Ogre::ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line
+        );
         return;
     }
-
-    ParticleSystem* system = ParticleSystemManager::getSingleton().CreateParticleSystemTemplate(obj->name);
-
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleSystemTranslator: create template for particle system '" + obj->name + "'");
-
-    if (!system)
-    {
-        compiler->addError(Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line);
+    ParticleSystem* system =
+      ParticleSystemManager::getSingleton().CreateParticleSystemTemplate(
+        obj->name
+      );
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleSystemTranslator: create template for particle system '"
+      + obj->name + "'"
+    );
+    if (!system){
+        compiler->addError(
+          Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line
+        );
         return;
     }
-
     obj->context = Ogre::Any(system);
-
-    for (Ogre::AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
-    {
-        if ((*i)->type != Ogre::ANT_PROPERTY)
-        {
-            processNode(compiler, *i);
-        }
+    for (
+      Ogre::AbstractNodeList::iterator i = obj->children.begin();
+      i != obj->children.end();
+      ++ i
+    ){
+        if ((*i)->type != Ogre::ANT_PROPERTY) processNode(compiler, *i);
     }
 }
 
-//------------------------------------------------------------------------------
+

+ 43 - 29
QGearsMain/src/core/particles/ParticleSystemTranslatorManager.cpp

@@ -1,46 +1,60 @@
-#include "core/particles/ParticleSystemTranslatorManager.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
+#include "core/particles/ParticleSystemTranslatorManager.h"
 
-//------------------------------------------------------------------------------
-size_t
-ParticleSystemTranslatorManager::getNumTranslators() const
-{
+size_t ParticleSystemTranslatorManager::getNumTranslators() const{
+    // TODO: Calculate.
     return 1;
 }
 
-//------------------------------------------------------------------------------
-Ogre::ScriptTranslator*
-ParticleSystemTranslatorManager::getTranslator(const Ogre::AbstractNodePtr &node)
-{
+
+Ogre::ScriptTranslator* ParticleSystemTranslatorManager::getTranslator(
+  const Ogre::AbstractNodePtr &node
+){
     Ogre::ScriptTranslator* translator = nullptr;
-    if (node->type == Ogre::ANT_OBJECT)
-    {
+    if (node->type == Ogre::ANT_OBJECT){
         Ogre::ObjectAbstractNode* obj = reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
 
-        if (obj->cls == "effect")
-        {
-            Ogre::LogManager::getSingletonPtr()->logMessage("Found object 'effect'.");
-            translator = &m_ParticleSystemTranslator;
+        if (obj->cls == "effect"){
+            Ogre::LogManager::getSingletonPtr()->logMessage(
+              "Found object 'effect'."
+            );
+            translator = &particle_system_translator_;
         }
-        else if (obj->cls == "group")
-        {
-            Ogre::LogManager::getSingletonPtr()->logMessage("Found object 'technique'.");
-            translator = &m_TechniqueTranslator;
+        else if (obj->cls == "group"){
+            Ogre::LogManager::getSingletonPtr()->logMessage(
+              "Found object 'technique'."
+            );
+            translator = &technique_translator_;
         }
-        else if (obj->cls == "renderer")
-        {
-            Ogre::LogManager::getSingletonPtr()->logMessage("Found object 'renderer'.");
-            translator = &m_RendererTranslator;
+        else if (obj->cls == "renderer"){
+            Ogre::LogManager::getSingletonPtr()->logMessage(
+              "Found object 'renderer'."
+            );
+            translator = &renderer_translator_;
         }
-        else if (obj->cls == "emitter")
-        {
-            Ogre::LogManager::getSingletonPtr()->logMessage("Found object 'emitter'.");
-            translator = &m_EmitterTranslator;
+        else if (obj->cls == "emitter"){
+            Ogre::LogManager::getSingletonPtr()->logMessage(
+              "Found object 'emitter'."
+            );
+            translator = &emitter_translator_;
         }
     }
-
     return translator;
 }
 
-//------------------------------------------------------------------------------
+

+ 175 - 295
QGearsMain/src/core/particles/ParticleTechnique.cpp

@@ -1,414 +1,294 @@
-#include "core/particles/ParticleTechnique.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
 #include <OgreStringConverter.h>
-
+#include "core/particles/ParticleTechnique.h"
 #include "core/particles/ParticleSystemManager.h"
 #include "core/particles/ParticleVisual.h"
 
-//------------------------------------------------------------------------------
-ParticleTechnique::ParticleTechnique():
-    m_Renderer(nullptr),
-
-    m_VisualParticleQuota(10),
-    m_VisualParticlePoolIncreased(false),
-
-    m_EmittedEmitterQuota(10),
-    m_ParticleEmitterPoolIncreased(false)
-{
-}
 
-//------------------------------------------------------------------------------
-ParticleTechnique::~ParticleTechnique()
-{
+ParticleTechnique::ParticleTechnique():
+    renderer_(nullptr),
+    visual_particle_quota_(10),
+    visual_particle_pool_increased_(false),
+    emitted_emitter_quota_(10),
+    particle_emitter_pool_increased_(false)
+{}
+
+ParticleTechnique::~ParticleTechnique(){
     DestroyAllEmitters();
     DestroyRenderer();
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::CopyAttributesTo(ParticleTechnique* technique)
-{
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::CopyAttributesTo start");
+void ParticleTechnique::CopyAttributesTo(ParticleTechnique* technique){
     // Destroy the emitters, affectors, etc.
     technique->DestroyAllEmitters();
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::CopyAttributesTo 1");
     technique->DestroyRenderer();
-
-    technique->m_ParentSystem = m_ParentSystem;
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::CopyAttributesTo 2");
+    technique->parent_system_ = parent_system_;
     // Copy the renderer
-    ParticleRenderer* cloned_renderer = ParticleSystemManager::getSingletonPtr()->CloneRenderer(m_Renderer);
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::CopyAttributesTo 3");
+    ParticleRenderer* cloned_renderer =
+      ParticleSystemManager::getSingletonPtr()->CloneRenderer(renderer_);
     technique->SetRenderer(cloned_renderer);
-
-    technique->m_VisualParticleQuota = m_VisualParticleQuota;
-    technique->m_VisualParticlePoolIncreased = false;
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::CopyAttributesTo 4");
-    technique->m_EmittedEmitterQuota = m_EmittedEmitterQuota;
-    technique->m_ParticleEmitterPoolIncreased = false;
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::CopyAttributesTo 5");
+    technique->visual_particle_quota_ = visual_particle_quota_;
+    technique->visual_particle_pool_increased_ = false;
+    technique->emitted_emitter_quota_ = emitted_emitter_quota_;
+    technique->particle_emitter_pool_increased_ = false;
     // Copy all emitters
     ParticleEmitter* cloned_emitter;
-    for( unsigned int i = 0; i < m_Emitters.size(); ++i )
-    {
-        cloned_emitter = ParticleSystemManager::getSingletonPtr()->CloneEmitter( m_Emitters[ i ] );
+    for (unsigned int i = 0; i < emitters_.size(); ++ i){
+        cloned_emitter = ParticleSystemManager::getSingletonPtr()->CloneEmitter(
+          emitters_[i]
+        );
         technique->AddEmitter( cloned_emitter );
     }
-
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::CopyAttributesTo end");
-}
-
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::UpdateRenderQueue(Ogre::RenderQueue* queue)
-{
-    if (m_Renderer && m_Renderer->IsRendererInitialised())
-    {
-        m_Renderer->UpdateRenderQueue(queue, m_VisualParticlesPool);
-    }
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::Initialize()
-{
-    if (m_Renderer && m_Renderer->IsRendererInitialised() == false)
-    {
-        m_Renderer->Initialize();
-    }
-
+void ParticleTechnique::UpdateRenderQueue(Ogre::RenderQueue* queue){
+    if (renderer_ && renderer_->IsRendererInitialised())
+        renderer_->UpdateRenderQueue(queue, visual_particles_pool_);
 
+}
 
+void ParticleTechnique::Initialize(){
+    if (renderer_ && renderer_->IsRendererInitialised() == false)
+        renderer_->Initialize();
     // Create new visual particles if the quota has been increased
-    if (m_VisualParticlePoolIncreased == false)
-    {
-        int old_size = m_VisualParticlesPool.GetSize();
-        if (m_VisualParticleQuota > old_size)
-        {
+    if (visual_particle_pool_increased_ == false){
+        int old_size = visual_particles_pool_.GetSize();
+        if (visual_particle_quota_ > old_size){
             // Create new visual particles
             VisualParticle* particle = nullptr;
-            for (int i = old_size; i < m_VisualParticleQuota; ++i)
-            {
+            for (int i = old_size; i < visual_particle_quota_; ++ i){
                 particle = new VisualParticle();
-                m_VisualParticlesPool.AddElement(particle);
-                m_VisualParticles.push_back(particle);
+                visual_particles_pool_.AddElement(particle);
+                visual_particles_.push_back(particle);
             }
         }
-
-        m_VisualParticlePoolIncreased = true;
+        visual_particle_pool_increased_ = true;
     }
-
-
-
     // Create new emitter particles if the quota has been increased
-    if (m_ParticleEmitterPoolIncreased == false)
-    {
-        int old_size = m_ParticleEmitterPool.GetSize();
-        if (m_EmittedEmitterQuota > old_size)
-        {
-            // Create new emitters, based on the already created emitters in the technique and which are marked for emission.
-            int numberOfEmittedEmitters = GetNumEmittableEmitters();
-            if (numberOfEmittedEmitters == 0)
-            {
-                return;
-            }
-
+    if (particle_emitter_pool_increased_ == false){
+        int old_size = particle_emitter_pool_.GetSize();
+        if (emitted_emitter_quota_ > old_size){
+            // Create new emitters, based on the already created emitters
+            // in the technique and which are marked for emission.
+            int number_of_emitted_emitters = GetNumEmittableEmitters();
+            if (number_of_emitted_emitters == 0) return;
             ParticleEmitter* existing_emitter = 0;
             ParticleEmitter* cloned_emitter = 0;
-
             // Distribute size equally
-            int increment = m_EmittedEmitterQuota / numberOfEmittedEmitters;
-
+            int increment = emitted_emitter_quota_ / number_of_emitted_emitters;
             // Run through emitters of the technique
-            for( unsigned int i = 0; i < m_Emitters.size(); ++i )
-            {
-                if( m_Emitters[ i ]->IsEmittable() )
-                {
+            for( unsigned int i = 0; i < emitters_.size(); ++i ){
+                if( emitters_[ i ]->IsEmittable() ){
                     // Clone the emitter 'increment' times and add to the pool
-                    for (int j = 0; j < increment; ++j)
-                    {
-                        cloned_emitter = ParticleSystemManager::getSingletonPtr()->CloneEmitter(m_Emitters[i]);
+                    for (int j = 0; j < increment; ++ j){
+                        cloned_emitter =ParticleSystemManager::getSingletonPtr()
+                          ->CloneEmitter(emitters_[i]);
                         cloned_emitter->SetEmittable(true);
-                        m_ParticleEmitterPool.AddElement(cloned_emitter->GetName(), cloned_emitter);
+                        particle_emitter_pool_.AddElement(
+                          cloned_emitter->GetName(), cloned_emitter
+                        );
                     }
                 }
             }
         }
-
-        m_ParticleEmitterPoolIncreased = true;
+        particle_emitter_pool_increased_ = true;
     }
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::Update(Ogre::Real time_elapsed)
-{
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update START");
-    // Perform some initialisation type of activities (if needed). This must be done within the update-loop,
-    // because settings could be changed (i.e. changing quota), which must trigger a re-initialisation.
-
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update initialize start");
+void ParticleTechnique::Update(Ogre::Real time_elapsed){
+    // Perform some initialisation type of activities (if needed). This must be
+    // done within the update-loop, because settings could be changed (i.e.
+    // changing quota), which must trigger a re-initialisation.
     Initialize();
-
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update initialize end");
-
     // Process the emitters
-    for( unsigned int i = 0; i < m_Emitters.size(); ++i )
-    {
+    for (unsigned int i = 0; i < emitters_.size(); ++ i){
         // emitted particles handled in pool update
-        if( m_Emitters[ i ]->IsEmittable() == false )
-        {
-            Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update emit static emitters");
-            ExecuteEmitParticles(m_Emitters[i], m_Emitters[i]->CalculateRequestedParticles(time_elapsed), time_elapsed);
+        if (emitters_[ i ]->IsEmittable() == false){
+            ExecuteEmitParticles(
+              emitters_[i],
+              emitters_[i]->CalculateRequestedParticles(time_elapsed),
+              time_elapsed
+            );
         }
     }
 
-
-
-    if (m_VisualParticlesPool.IsEmpty() == false)
-    {
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update: visual particle started.");
-
-        VisualParticle* particle = m_VisualParticlesPool.GetFirst();
-        while (!m_VisualParticlesPool.End())
-        {
-            if (particle != nullptr)
-            {
-                Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update found particle with ttl " + Ogre::StringConverter::toString(particle->time_to_live));
-                if (particle->time_to_live > time_elapsed)
-                {
-                    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update update visual start");
+    if (visual_particles_pool_.IsEmpty() == false){
+        VisualParticle* particle = visual_particles_pool_.GetFirst();
+        while (!visual_particles_pool_.End()){
+            if (particle != nullptr){
+                if (particle->time_to_live > time_elapsed){
                     particle->Update(time_elapsed);
-                    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update update visual end");
                 }
-                else
-                {
-                    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update expire visual start");
+                else{
                     particle->InitForExpiration();
-                    m_VisualParticlesPool.LockLatestElement();
-                    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update expire visual end");
+                    visual_particles_pool_.LockLatestElement();
                 }
-
                 // Decrement time to live
                 particle->time_to_live -= time_elapsed;
             }
-
-            particle = m_VisualParticlesPool.GetNext();
+            particle = visual_particles_pool_.GetNext();
         }
-
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update: visual particle finished.");
     }
-
-
-
     // Process all particles
-    if (m_ParticleEmitterPool.IsEmpty() == false)
-    {
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update: emitter particle started.");
-
-        ParticleEmitter* particle = m_ParticleEmitterPool.GetFirst();
-        while (!m_ParticleEmitterPool.End())
-        {
-            if (particle)
-            {
-                if (particle->time_to_live > time_elapsed)
-                {
+    if (particle_emitter_pool_.IsEmpty() == false){
+        ParticleEmitter* particle = particle_emitter_pool_.GetFirst();
+        while (!particle_emitter_pool_.End()){
+            if (particle){
+                if (particle->time_to_live > time_elapsed){
                     particle->Update(time_elapsed);
-                    ExecuteEmitParticles(particle, particle->CalculateRequestedParticles(time_elapsed), time_elapsed);
+                    ExecuteEmitParticles(
+                      particle,
+                      particle->CalculateRequestedParticles(time_elapsed),
+                      time_elapsed
+                    );
                 }
-                else
-                {
+                else{
                     particle->InitForExpiration();
-                    m_ParticleEmitterPool.LockLatestElement();
+                    particle_emitter_pool_.LockLatestElement();
                 }
-
                 // Decrement time to live
                 particle->time_to_live -= time_elapsed;
             }
-
-            particle = m_ParticleEmitterPool.GetNext();
+            particle = particle_emitter_pool_.GetNext();
         }
-
-        Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update: emitter particle finished.");
     }
-
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::Update END");
 }
 
-//------------------------------------------------------------------------------
-ParticleRenderer*
-ParticleTechnique::CreateRenderer(const Ogre::String& renderer_type)
-{
-    if (m_Renderer)
-    {
-        DestroyRenderer();
-    }
-
-    if (renderer_type != Ogre::BLANKSTRING)
-    {
-        m_Renderer = ParticleSystemManager::getSingletonPtr()->CreateRenderer(renderer_type);
-        m_Renderer->SetParentTechnique(this);
-        m_Renderer->SetRendererInitialised(false);
+ParticleRenderer* ParticleTechnique::CreateRenderer(
+  const Ogre::String& renderer_type
+){
+    if (renderer_) DestroyRenderer();
+    if (renderer_type != Ogre::BLANKSTRING){
+        renderer_ = ParticleSystemManager::getSingletonPtr()->CreateRenderer(
+          renderer_type
+        );
+        renderer_->SetParentTechnique(this);
+        renderer_->SetRendererInitialised(false);
     }
-
-    return m_Renderer;
+    return renderer_;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::SetRenderer(ParticleRenderer* renderer)
-{
-    if (m_Renderer)
-    {
-        DestroyRenderer();
-    }
-
-    m_Renderer = renderer;
-    m_Renderer->SetParentTechnique(this);
-    m_Renderer->SetRendererInitialised(false);
+void ParticleTechnique::SetRenderer(ParticleRenderer* renderer){
+    if (renderer_) DestroyRenderer();
+    renderer_ = renderer;
+    renderer_->SetParentTechnique(this);
+    renderer_->SetRendererInitialised(false);
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::DestroyRenderer()
-{
-    if (m_Renderer)
-    {
-        ParticleSystemManager::getSingletonPtr()->DestroyRenderer(m_Renderer);
-        m_Renderer = nullptr;
+void ParticleTechnique::DestroyRenderer(){
+    if (renderer_){
+        ParticleSystemManager::getSingletonPtr()->DestroyRenderer(renderer_);
+        renderer_ = nullptr;
     }
 }
 
-//------------------------------------------------------------------------------
-ParticleEmitter*
-ParticleTechnique::CreateEmitter(const Ogre::String& emitter_type)
-{
+ParticleEmitter* ParticleTechnique::CreateEmitter(
+  const Ogre::String& emitter_type
+){
     ParticleEmitter* emitter = nullptr;
-
-    if (emitter_type != Ogre::BLANKSTRING)
-    {
-        emitter = ParticleSystemManager::getSingletonPtr()->CreateEmitter(emitter_type);
-        m_Emitters.push_back(emitter);
+    if (emitter_type != Ogre::BLANKSTRING){
+        emitter =
+          ParticleSystemManager::getSingletonPtr()->CreateEmitter(emitter_type);
+        emitters_.push_back(emitter);
         emitter->SetParentTechnique(this);
         EmissionChange();
     }
-
     return emitter;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::AddEmitter(ParticleEmitter* emitter)
-{
-    if (emitter != nullptr)
-    {
-        m_Emitters.push_back(emitter);
+void ParticleTechnique::AddEmitter(ParticleEmitter* emitter){
+    if (emitter != nullptr){
+        emitters_.push_back(emitter);
         emitter->SetParentTechnique(this);
         EmissionChange();
     }
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::DestroyAllEmitters()
-{
-    for( unsigned int i = 0; i < m_Emitters.size(); ++i )
-    {
-        ParticleSystemManager::getSingletonPtr()->DestroyEmitter(m_Emitters[i]);
-    }
-    m_Emitters.clear();
+void ParticleTechnique::DestroyAllEmitters(){
+    for (unsigned int i = 0; i < emitters_.size(); ++ i)
+        ParticleSystemManager::getSingletonPtr()->DestroyEmitter(emitters_[i]);
+    emitters_.clear();
 }
 
-//------------------------------------------------------------------------------
-int
-ParticleTechnique::GetNumEmittableEmitters() const
-{
+int ParticleTechnique::GetNumEmittableEmitters() const{
     int count = 0;
-    for( unsigned int i = 0; i < m_Emitters.size(); ++i )
-    {
-        if (m_Emitters[i]->IsEmittable())
-        {
-            count++;
-        }
+    for (unsigned int i = 0; i < emitters_.size(); ++ i){
+        if (emitters_[i]->IsEmittable()) count++;
     }
-
     return count;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::EmissionChange()
-{
+void ParticleTechnique::EmissionChange() {
     // Run through all emitters and set MarkedForEmission to false.
-    for( unsigned int i = 0; i < m_Emitters.size(); ++i )
-    {
-        m_Emitters[i]->SetEmittable(false);
-    }
-
+    for (unsigned int i = 0; i < emitters_.size(); ++ i)
+        emitters_[i]->SetEmittable(false);
     // Run through all emitters and determine which objects each one emits.
-    for( unsigned int i = 0; i < m_Emitters.size(); ++i )
-    {
-        Ogre::String name = m_Emitters[i]->GetEmitsName();
-        if (name != m_Emitters[i]->GetName())
-        {
+    for (unsigned int i = 0; i < emitters_.size(); ++ i){
+        Ogre::String name = emitters_[i]->GetEmitsName();
+        if (name != emitters_[i]->GetName()){
             // Search the emitter to be emitted
-            for( unsigned int j = 0; j < m_Emitters.size(); ++j )
-            {
-                if (m_Emitters[j]->GetName() == name)
-                {
-                    m_Emitters[j]->SetEmittable(true);
-                }
+            for (unsigned int j = 0; j < emitters_.size(); ++ j){
+                if (emitters_[j]->GetName() == name)
+                    emitters_[j]->SetEmittable(true);
             }
         }
     }
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::ExecuteEmitParticles(ParticleEmitter* emitter, int requested, Ogre::Real time_elapsed)
-{
+void ParticleTechnique::ExecuteEmitParticles(
+  ParticleEmitter* emitter, int requested, Ogre::Real time_elapsed
+){
     // Only proceed if the emitter and technique are enabled
-    if (emitter->IsEnabled() == false)
-    {
-        return;
-    }
-
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::ExecuteEmitParticles request " + Ogre::StringConverter::toString(requested) + " particles to emit.");
-
-    for (int j = 0; j < requested; ++j)
-    {
+    if (emitter->IsEnabled() == false) return;
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleTechnique::ExecuteEmitParticles request "
+      + Ogre::StringConverter::toString(requested) + " particles to emit."
+    );
+    for (int j = 0; j < requested; ++ j){
         // Create a new particle & init using emitter
         Particle* particle = nullptr;
-        switch (emitter->GetEmitsType())
-        {
-            case Particle::PT_VISUAL: particle = m_VisualParticlesPool.ReleaseElement(); break;
-            case Particle::PT_EMITTER: particle = m_ParticleEmitterPool.ReleaseElement(emitter->GetEmitsName()); break;
+        switch (emitter->GetEmitsType()){
+            case Particle::PT_VISUAL:
+                particle = visual_particles_pool_.ReleaseElement();
+                break;
+            case Particle::PT_EMITTER:
+                particle = particle_emitter_pool_.ReleaseElement(
+                  emitter->GetEmitsName()
+                );
+                break;
         }
-
-        // Return if there is no particle left anymore, or the name cannot be found
-        if (particle == nullptr)
-        {
-            Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechnique::ExecuteEmitParticles request there is no particles left.");
+        // Return if there is no particle left anymore, or the name cannot be
+        // found
+        if (particle == nullptr){
+            Ogre::LogManager::getSingletonPtr()->logMessage(
+              "ParticleTechnique::ExecuteEmitParticles request there are no "
+              "particles left."
+            );
             return;
         }
-
         particle->InitForEmission();
-
-        // Initialise the particle with data from the emitter.
+        // Initialize the particle with data from the emitter.
         emitter->InitParticleForEmission(particle);
     }
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleTechnique::ResetVisualParticles()
-{
-    for( unsigned int i = 0; i < m_VisualParticles.size(); ++i )
-    {
-        m_VisualParticles[i]->additional_data = nullptr;
-    }
-    m_VisualParticlesPool.LockAllElements();
+void ParticleTechnique::ResetVisualParticles(){
+    for (unsigned int i = 0; i < visual_particles_.size(); ++ i)
+        visual_particles_[i]->additional_data = nullptr;
+    visual_particles_pool_.LockAllElements();
 }
-
-//------------------------------------------------------------------------------

+ 36 - 23
QGearsMain/src/core/particles/ParticleTechniqueTranslator.cpp

@@ -1,34 +1,47 @@
-#include "core/particles/ParticleTechniqueTranslator.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreLogManager.h>
-
+#include "core/particles/ParticleTechniqueTranslator.h"
 #include "core/particles/ParticleSystemManager.h"
 
-//------------------------------------------------------------------------------
-void
-ParticleTechniqueTranslator::translate(Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node)
-{
-    Ogre::ObjectAbstractNode *obj = reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
-
+void ParticleTechniqueTranslator::translate(
+  Ogre::ScriptCompiler *compiler, const Ogre::AbstractNodePtr &node
+){
+    Ogre::ObjectAbstractNode *obj =
+      reinterpret_cast<Ogre::ObjectAbstractNode*>(node.get());
     // Create the technique from the material
-    ParticleSystem* system = Ogre::any_cast<ParticleSystem*>(obj->parent->context);
-
+    ParticleSystem* system = Ogre::any_cast<ParticleSystem*>(
+      obj->parent->context
+    );
     ParticleTechnique* tech = system->CreateTechnique();
-    if (!tech)
-    {
-        compiler->addError(Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line);
+    if (!tech){
+        compiler->addError(
+          Ogre::ScriptCompiler::CE_OBJECTALLOCATIONERROR, obj->file, obj->line
+        );
         return;
     }
     obj->context = Ogre::Any(tech);
-    Ogre::LogManager::getSingletonPtr()->logMessage("ParticleTechniqueTranslator: create tech");
-
-    for (Ogre::AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
-    {
-        if ((*i)->type == Ogre::ANT_OBJECT)
-        {
-            processNode(compiler, *i);
-        }
+    Ogre::LogManager::getSingletonPtr()->logMessage(
+      "ParticleTechniqueTranslator: create tech"
+    );
+    for (
+      Ogre::AbstractNodeList::iterator i = obj->children.begin();
+      i != obj->children.end();
+      ++i
+    ){
+        if ((*i)->type == Ogre::ANT_OBJECT) processNode(compiler, *i);
     }
 }
-
-//------------------------------------------------------------------------------

+ 21 - 16
QGearsMain/src/core/particles/ParticleVisual.cpp

@@ -1,23 +1,28 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
 #include "core/particles/ParticleVisual.h"
 
-//------------------------------------------------------------------------------
-VisualParticle::VisualParticle():
-    Particle()
-{
-    m_ParticleType = PT_VISUAL;
-    m_Emittable = true; // Default is false, but visual particles are always emitted.
+VisualParticle::VisualParticle(): Particle(){
+    particle_type_ = PT_VISUAL;
+    // Default is false, but visual particles are always emitted.
+    emittable_ = true;
 }
 
-//------------------------------------------------------------------------------
-void
-VisualParticle::InitForExpiration()
-{
+void VisualParticle::InitForExpiration(){
     Particle::InitForExpiration();
-
-    if (additional_data != nullptr)
-    {
-        additional_data->SetVisible(false);
-    }
+    if (additional_data != nullptr) additional_data->SetVisible(false);
 }
 
-//------------------------------------------------------------------------------

+ 18 - 12
QGearsMain/src/core/particles/emitters/ParticlePointEmitter.cpp

@@ -1,18 +1,24 @@
-#include "core/particles/emitters/ParticlePointEmitter.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
+#include "core/particles/emitters/ParticlePointEmitter.h"
 
-//------------------------------------------------------------------------------
-PointEmitter::PointEmitter():
-    ParticleEmitter()
-{
-    m_EmitterType ="Point";
+PointEmitter::PointEmitter():ParticleEmitter(){
+    emitter_type_ = "Point";
 }
 
-//------------------------------------------------------------------------------
-void
-PointEmitter::CopyAttributesTo(ParticleEmitter* emitter)
-{
+void PointEmitter::CopyAttributesTo(ParticleEmitter* emitter){
     ParticleEmitter::CopyAttributesTo(emitter);
 }
-
-//------------------------------------------------------------------------------

+ 116 - 127
QGearsMain/src/core/particles/renderer/ParticleEntityRenderer.cpp

@@ -1,185 +1,176 @@
-#include "core/particles/renderer/ParticleEntityRenderer.h"
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
 
 #include <OgreEntity.h>
 #include <OgreRoot.h>
-
+#include "core/particles/renderer/ParticleEntityRenderer.h"
 #include "core/particles/ParticleSystem.h"
 #include "core/particles/ParticleTechnique.h"
 #include "core/particles/ParticleVisual.h"
 
-//------------------------------------------------------------------------------
-ParticleEntityRendererDictionary::MeshName ParticleEntityRenderer::m_MeshNameDictionary;
+ParticleEntityRendererDictionary::MeshName
+  ParticleEntityRenderer::mesh_name_dictionary_;
 
-//------------------------------------------------------------------------------
 ParticleEntityRenderer::ParticleEntityRenderer():
-    ParticleRenderer(),
-    m_MeshName(Ogre::BLANKSTRING)
+    ParticleRenderer(), mesh_name_(Ogre::BLANKSTRING)
 {
-    m_RendererType = "Entity";
-
-    if (createParamDictionary("ParticleEntityRenderer"))
-    {
+    renderer_type_ = "Entity";
+    if (createParamDictionary("ParticleEntityRenderer")){
         Ogre::ParamDictionary* dict = getParamDictionary();
-
-        dict->addParameter(Ogre::ParameterDef("mesh_name", "", Ogre::PT_STRING), &m_MeshNameDictionary);
+        dict->addParameter(
+          Ogre::ParameterDef("mesh_name", "", Ogre::PT_STRING),
+          &mesh_name_dictionary_
+        );
     }
 }
 
-//------------------------------------------------------------------------------
-ParticleEntityRenderer::~ParticleEntityRenderer()
-{
-    if (m_ParentTechnique == nullptr)
-    {
-        return;
-    }
-
+ParticleEntityRenderer::~ParticleEntityRenderer(){
+    if (parent_technique_ == nullptr) return;
     Clear();
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEntityRenderer::CopyAttributesTo(ParticleRenderer* renderer)
-{
+void ParticleEntityRenderer::CopyAttributesTo(ParticleRenderer* renderer){
     // First copy parent attributes
     ParticleRenderer::CopyAttributesTo(renderer);
 
     // First cast to ParticleEntityRenderer
-    ParticleEntityRenderer* entity_renderer = static_cast<ParticleEntityRenderer*>(renderer);
+    ParticleEntityRenderer* entity_renderer =
+      static_cast<ParticleEntityRenderer*>(renderer);
 
-    // Copy attributes in case there is a entityRenderer (which should be available)
-    entity_renderer->m_MeshName = m_MeshName;
+    // Copy attributes in case there is a entityRenderer (which should be
+    // available)
+    entity_renderer->mesh_name_ = mesh_name_;
 }
 
-//------------------------------------------------------------------------------
-const Ogre::String&
-ParticleEntityRenderer::GetMeshName() const
-{
-    return m_MeshName;
+const Ogre::String& ParticleEntityRenderer::GetMeshName() const{
+    return mesh_name_;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEntityRenderer::SetMeshName(const Ogre::String& mesh_name)
-{
-    m_MeshName = mesh_name;
-    m_RendererInitialised = false; // Retriggers the _prepare function
-    Clear(); // Delete all nodes en entities, they will be rebuild
-}
 
-//------------------------------------------------------------------------------
-void
-ParticleEntityRenderer::Clear()
-{
-    if (m_ParentTechnique == nullptr)
-    {
-        return;
-    }
+void ParticleEntityRenderer::SetMeshName(const Ogre::String& mesh_name){
+    mesh_name_ = mesh_name;
+    renderer_initialized_ = false; // Re-triggers the _prepare function.
+    Clear(); // Delete all nodes in entities, they will be rebuilt.
+}
 
-    // Note: The created ChildSceneNodes are destroyed when the ParticleSystem is destroyed
+void ParticleEntityRenderer::Clear(){
+    if (parent_technique_ == nullptr) return;
 
+    // Note: The created ChildSceneNodes are destroyed when the ParticleSystem
+    // is destroyed
     std::vector<ParticleEntityAdditionalData*>::const_iterator it;
-    std::vector<ParticleEntityAdditionalData*>::const_iterator itEnd = m_AllAdditionalData.end();
-    for (it = m_AllAdditionalData.begin(); it != itEnd; ++it)
-    {
-        delete (*it);
-    }
-
-    m_AllAdditionalData.clear();
-    m_UnassignedAdditionalData.clear();
-
-    // Destroy the Entities. Do it like this, because it must be assured that the entity still exists
-    // and has not already been destroyed.
-    Ogre::SceneManager* scene_manager = Ogre::Root::getSingleton().getSceneManager("Scene");
-    for( unsigned int i = 0; i < m_Entities.size(); i++ )
-    {
-        scene_manager->destroyEntity( m_Entities[ i ] );
-    }
-    m_Entities.clear();
+    std::vector<ParticleEntityAdditionalData*>::const_iterator itEnd =
+      all_additional_data_.end();
+    for (it = all_additional_data_.begin(); it != itEnd; ++ it) delete (*it);
+    all_additional_data_.clear();
+    unassigned_additional_data_.clear();
+
+    // Destroy the Entities. Do it like this, because it must be assured that
+    // the entity still exists and has not already been destroyed.
+    Ogre::SceneManager* scene_manager =
+      Ogre::Root::getSingleton().getSceneManager("Scene");
+    for(unsigned int i = 0; i < entities_.size(); i ++)
+        scene_manager->destroyEntity( entities_[ i ] );
+    entities_.clear();
 
     // Reset the visual data in the pool
-    m_ParentTechnique->ResetVisualParticles();
+    parent_technique_->ResetVisualParticles();
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEntityRenderer::SetVisible(bool visible)
-{
+void ParticleEntityRenderer::SetVisible(bool visible){
     std::vector<ParticleEntityAdditionalData*>::const_iterator it;
-    std::vector<ParticleEntityAdditionalData*>::const_iterator itEnd = m_AllAdditionalData.end();
-    for (it = m_AllAdditionalData.begin(); it != itEnd; ++it)
-    {
+    std::vector<ParticleEntityAdditionalData*>::const_iterator itEnd =
+      all_additional_data_.end();
+    for (it = all_additional_data_.begin(); it != itEnd; ++ it)
         (*it)->node->setVisible(visible);
-    }
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEntityRenderer::Initialize()
-{
-    // Use the given technique, although it should be the same as mParentTechnique (must be set already)
-    if (!m_ParentTechnique || m_RendererInitialised)
-    {
-        return;
-    }
+void ParticleEntityRenderer::Initialize(){
+    // Use the given technique, although it should be the same as
+    // parent_technique_ (must be set already)
+    if (!parent_technique_ || renderer_initialized_) return;
 
     std::stringstream ss;
     ss << this;
-    Ogre::String entity_name = m_MeshName + ss.str();
-    int quota = m_ParentTechnique->GetVisualParticlesQuota();
-    Ogre::SceneNode* parent_node = m_ParentTechnique->GetParentSystem()->getParentSceneNode();
+    Ogre::String entity_name = mesh_name_ + ss.str();
+    int quota = parent_technique_->GetVisualParticlesQuota();
+    Ogre::SceneNode* parent_node =
+      parent_technique_->GetParentSystem()->getParentSceneNode();
 
-    if (parent_node)
-    {
+    if (parent_node){
         // Create number of visual_data objects including SceneNodes
-        for (int i = 0; i < quota; i++)
-        {
-            ParticleEntityAdditionalData* visual_data = new ParticleEntityAdditionalData(parent_node->createChildSceneNode());
-            m_AllAdditionalData.push_back(visual_data); // Used to assign to a particle
-            m_UnassignedAdditionalData.push_back(visual_data); // Managed by this renderer
+        for (int i = 0; i < quota; i++){
+            ParticleEntityAdditionalData* visual_data =
+              new ParticleEntityAdditionalData(
+                parent_node->createChildSceneNode()
+              );
+
+            // Used to assign to a particle
+            all_additional_data_.push_back(visual_data);
+
+            // Managed by this renderer
+            unassigned_additional_data_.push_back(visual_data);
         }
 
         // Create number of Entities
-        Ogre::Entity* entity = Ogre::Root::getSingleton().getSceneManager("Scene")->createEntity(entity_name, m_MeshName); // Base entity
-
-        for( unsigned int i = 0; i < m_AllAdditionalData.size(); ++i )
-        {
-            Ogre::Entity* cloned_entity = entity->clone( entity_name + Ogre::StringConverter::toString( i ) );
-            m_Entities.push_back( cloned_entity );
-            m_AllAdditionalData[ i ]->node->attachObject( cloned_entity );
+        Ogre::Entity* entity =
+          Ogre::Root::getSingleton().getSceneManager("Scene")->createEntity(
+            entity_name, mesh_name_
+          ); // Base entity
+
+        for (unsigned int i = 0; i < all_additional_data_.size(); ++ i){
+            Ogre::Entity* cloned_entity =
+              entity->clone(
+                entity_name + Ogre::StringConverter::toString(i)
+              );
+            entities_.push_back(cloned_entity);
+            all_additional_data_[i]->node->attachObject(cloned_entity);
         }
-        Ogre::Root::getSingleton().getSceneManager( "Scene" )->destroyEntity( entity_name );
+        Ogre::Root::getSingleton().getSceneManager("Scene")->destroyEntity(
+          entity_name
+        );
     }
 
     SetVisible(false);
-    m_RendererInitialised = true;
+    renderer_initialized_ = true;
 }
 
-//------------------------------------------------------------------------------
-void
-ParticleEntityRenderer::UpdateRenderQueue(Ogre::RenderQueue* queue, ParticlePool<VisualParticle>& pool)
-{
+void ParticleEntityRenderer::UpdateRenderQueue(
+  Ogre::RenderQueue* queue, ParticlePool<VisualParticle>& pool
+){
     // Fast check to determine whether there are visual particles
-    if (pool.IsEmpty())
-    {
-        return;
-    }
+    if (pool.IsEmpty()) return;
 
     VisualParticle* particle = pool.GetFirst();
-    while (!pool.End())
-    {
-        if (particle)
-        {
-            if (!particle->additional_data && !m_UnassignedAdditionalData.empty())
-            {
-                particle->additional_data = m_UnassignedAdditionalData.back();
-                m_UnassignedAdditionalData.pop_back();
+    while (!pool.End()){
+        if (particle){
+            if (
+              !particle->additional_data && !unassigned_additional_data_.empty()
+            ){
+                particle->additional_data = unassigned_additional_data_.back();
+                unassigned_additional_data_.pop_back();
             }
 
-            if (particle->additional_data)
-            {
-                Ogre::SceneNode* node = (static_cast<ParticleEntityAdditionalData*>(particle->additional_data))->node;
-                if (node)
-                {
+            if (particle->additional_data){
+                Ogre::SceneNode* node =
+                  (
+                     static_cast<ParticleEntityAdditionalData*>(
+                       particle->additional_data
+                     )
+                   )->node;
+                if (node){
                     node->setPosition(particle->position);
                     node->setVisible(true);
                 }
@@ -188,5 +179,3 @@ ParticleEntityRenderer::UpdateRenderQueue(Ogre::RenderQueue* queue, ParticlePool
         particle = pool.GetNext();
     }
 }
-
-//------------------------------------------------------------------------------

+ 18 - 9
QGearsMain/src/core/particles/renderer/ParticleEntityRendererDictionary.cpp

@@ -1,16 +1,25 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <OgreLogManager.h>
 #include "core/particles/renderer/ParticleEntityRendererDictionary.h"
 #include "core/particles/renderer/ParticleEntityRenderer.h"
 
-#include <OgreLogManager.h>
+namespace ParticleEntityRendererDictionary{
 
-namespace ParticleEntityRendererDictionary
-{
-    //--------------------------------------------------------------------------
-    void
-    MeshName::doSet(void* target, const Ogre::String& val)
-    {
+    void MeshName::doSet(void* target, const Ogre::String& val){
         static_cast<ParticleEntityRenderer*>(target)->SetMeshName(val);
     }
-
-    //--------------------------------------------------------------------------
 }

+ 4 - 4
QGearsMain/src/data/QGearsCameraMatrixFile.cpp

@@ -64,8 +64,8 @@ namespace QGears
     {
         m_matrix = Ogre::Matrix3::ZERO;
         m_position = Ogre::Vector3::ZERO;
-        m_offset.x = 0;
-        m_offset.y = 0;
+        moffset_.x = 0;
+        moffset_.y = 0;
         m_focal_length = 0;
         m_count = 0;
     }
@@ -115,14 +115,14 @@ namespace QGears
     const Pixel&
     CameraMatrixFile::getOffset() const
     {
-        return m_offset;
+        return moffset_;
     }
 
     //---------------------------------------------------------------------
     void
     CameraMatrixFile::setOffset( const Pixel& offset )
     {
-        m_offset = offset;
+        moffset_ = offset;
     }
 
     //---------------------------------------------------------------------

+ 5 - 5
QGearsMain/src/data/QGearsFLevelFileSerializer.cpp

@@ -98,9 +98,9 @@ namespace QGears
         Ogre::DataStreamPtr section;
         for (size_t i(0); i < m_header.section_count; ++i)
         {
-            const size_t current_offset(stream->tell() - start_position);
-            const size_t section_gap(section_offsetsVec[i] - current_offset);
-            if (current_offset > section_offsetsVec[i])
+            const size_t currentoffset_(stream->tell() - start_position);
+            const size_t section_gap(section_offsetsVec[i] - currentoffset_);
+            if (currentoffset_ > section_offsetsVec[i])
             {
                 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS
                     , "FLevel sections overlap"
@@ -150,7 +150,7 @@ namespace QGears
     //--------------------------------------------------------------------------
     void
     FLevelFileSerializer::readSectionData( Ogre::DataStreamPtr &stream
-                                          ,Ogre::DataStreamPtr &out_buffer,
+                                          ,Ogre::DataStreamPtr &outbuffer_,
                                           size_t sectionSize )
     {
         // This can be wrong, we read it so we're at the correct stream position
@@ -169,7 +169,7 @@ namespace QGears
 
         Ogre::MemoryDataStream *buffer(new Ogre::MemoryDataStream(sectionSize));
         stream->read(buffer->getPtr(), sectionSize);
-        out_buffer = Ogre::DataStreamPtr( buffer );
+        outbuffer_ = Ogre::DataStreamPtr( buffer );
     }
 
     //--------------------------------------------------------------------------

+ 7 - 7
QGearsMain/src/data/QGearsHRCFile.cpp

@@ -85,26 +85,26 @@ namespace QGears
         serializer.importHRCFile( stream, this );
 
 
-        const String skeleton_file_name( getSkeletonFileName() );
+        const String skeletonfile_name_( getSkeletonFileName() );
         Ogre::SkeletonManager &skeleton_manager( Ogre::SkeletonManager::getSingleton() );
-        m_skeleton = skeleton_manager.getByName( skeleton_file_name, mGroup );
+        m_skeleton = skeleton_manager.getByName( skeletonfile_name_, mGroup );
         if (m_skeleton == nullptr)
         {
             assert( m_skeleton_loader == nullptr );
             m_skeleton_loader = new HRCSkeletonLoader( *this );
-            m_skeleton = skeleton_manager.create( skeleton_file_name, mGroup, true, m_skeleton_loader );
+            m_skeleton = skeleton_manager.create( skeletonfile_name_, mGroup, true, m_skeleton_loader );
         }
 
-        const String mesh_file_name( getMeshFileName() );
+        const String meshfile_name_( getMeshFileName() );
         Ogre::LogManager::getSingleton().stream()
-                << "HRC::loadImpl(): mesh_file_name: " << mesh_file_name;
+                << "HRC::loadImpl(): meshfile_name_: " << meshfile_name_;
         Ogre::MeshManager &mesh_manager( Ogre::MeshManager::getSingleton() );
-        m_mesh = mesh_manager.getByName( mesh_file_name, mGroup );
+        m_mesh = mesh_manager.getByName( meshfile_name_, mGroup );
         if (m_mesh == nullptr)
         {
             assert( m_mesh_loader == nullptr );
             m_mesh_loader = new HRCMeshLoader( *this );
-            m_mesh = mesh_manager.create( mesh_file_name, mGroup, true, m_mesh_loader );
+            m_mesh = mesh_manager.create( meshfile_name_, mGroup, true, m_mesh_loader );
         }
     }
 

+ 7 - 7
QGearsMain/src/data/QGearsHRCMeshLoader.cpp

@@ -79,19 +79,19 @@ namespace QGears
         const String &bone_name( bone.name );
         RSDNameList::const_iterator it( bone.rsd_names.begin() );
         RSDNameList::const_iterator end( bone.rsd_names.end() );
-        String rsd_base, rsd_file_name, p_file_name;
+        String rsd_base, rsdfile_name_, pfile_name_;
         while( it != end )
         {
             rsd_base = path + *it;
             StringUtil::toLowerCase( rsd_base );
-            rsd_file_name = rsd_base + EXT_RSD;
-            RSDFilePtr rsd_file = RSDFileManager::getSingleton().load( rsd_file_name, m_hrc_file.getGroup() ).staticCast<RSDFile>();
+            rsdfile_name_ = rsd_base + EXT_RSD;
+            RSDFilePtr rsd_file = RSDFileManager::getSingleton().load( rsdfile_name_, m_hrc_file.getGroup() ).staticCast<RSDFile>();
             assert(rsd_file != nullptr);
 
-            p_file_name = path + rsd_file->getPolygonName();
-            StringUtil::toLowerCase( p_file_name );
-            p_file_name = StringUtil::replaceAll( p_file_name, EXT_PLY, EXT_P );
-            PFilePtr p_file =  PFileManager::getSingleton().load( p_file_name, m_hrc_file.getGroup() ).staticCast<PFile>();
+            pfile_name_ = path + rsd_file->getPolygonName();
+            StringUtil::toLowerCase( pfile_name_ );
+            pfile_name_ = StringUtil::replaceAll( pfile_name_, EXT_PLY, EXT_P );
+            PFilePtr p_file =  PFileManager::getSingleton().load( pfile_name_, m_hrc_file.getGroup() ).staticCast<PFile>();
             assert(p_file != nullptr);
 
             p_file->addGroups( mesh, bone_name, rsd_file );

+ 1 - 1
QGearsMain/src/data/QGearsLGPArchive.cpp

@@ -109,7 +109,7 @@ namespace QGears
             {
                 if( it->file_name == filename )
                 {
-                    m_lgp_file->seek( it->data_offset );
+                    m_lgp_file->seek( it->dataoffset_ );
                     size_t length( it->data_size );
                     buffer = new Ogre::MemoryDataStream( length );
                     m_lgp_file->read( buffer->getPtr(), length );

+ 5 - 5
QGearsMain/src/data/QGearsLGPArchiveSerializer.cpp

@@ -56,10 +56,10 @@ namespace QGears
         FileList::const_iterator it_end( files.end() );
         while( it != it_end )
         {
-            stream->seek( it->file_offset );
-            it->data_file_name = readString( stream, FILE_NAME_LENGTH );
+            stream->seek( it->fileoffset_ );
+            it->datafile_name_ = readString( stream, FILE_NAME_LENGTH );
             readUInt32( stream, it->data_size );
-            it->data_offset = stream->tell();
+            it->dataoffset_ = stream->tell();
             ++it;
         }
     }
@@ -78,7 +78,7 @@ namespace QGears
                                      ,FileEntry& file_entry )
     {
         file_entry.file_name = readString( stream, FILE_NAME_LENGTH );
-        readUInt32( stream, file_entry.file_offset );
+        readUInt32( stream, file_entry.fileoffset_ );
         stream->read( &file_entry.unknown1, sizeof( file_entry.unknown1 ) );
         readShort( stream, file_entry.unknown2 );
 
@@ -87,7 +87,7 @@ namespace QGears
         {
             Ogre::LogManager::getSingleton().stream()
                 << "file_name: " << file_entry.file_name
-                << " file_offset: " << file_entry.file_offset
+                << " fileoffset_: " << file_entry.fileoffset_
                 << " unknown1: " << (uint16)file_entry.unknown1
                 << " unknown2: " << file_entry.unknown2
                 ;

+ 8 - 8
QGearsMain/src/data/QGearsLZSDataStream.cpp

@@ -89,11 +89,11 @@ namespace QGears
         size_t  read_total( 0 );
         while( count && !eof() )
         {
-            if( !m_buffer.avail() )
+            if( !mbuffer_.avail() )
             {
                 decompressChunk();
             }
-            size_t read( m_buffer.read( static_cast<uint8*>( buf ) + read_total, count ) );
+            size_t read( mbuffer_.read( static_cast<uint8*>( buf ) + read_total, count ) );
             count -= read;
             read_total += read;
         }
@@ -115,7 +115,7 @@ namespace QGears
         }
 
         uint8   data, control_byte, ref[2];
-        uint16  ref_offset;
+        uint16  refoffset_;
         m_available_compressed -= m_compressed_stream->read( &control_byte, sizeof( control_byte ) );
 
         for( uint8 control_bit( 8 )
@@ -125,7 +125,7 @@ namespace QGears
             if( control_byte & 1 )
             {
                 m_available_compressed -= m_compressed_stream->read( &data, sizeof( data ) );
-                m_buffer.write( &data );
+                mbuffer_.write( &data );
             }
             else if( m_available_compressed < 2 )
             {
@@ -136,11 +136,11 @@ namespace QGears
             else
             {
                 m_available_compressed -= m_compressed_stream->read( &ref, sizeof( ref ) );
-                ref_offset = 18 + ( ((ref[1] & 0xF0) << 4) | ref[0] );
+                refoffset_ = 18 + ( ((ref[1] & 0xF0) << 4) | ref[0] );
                 for( uint8 ref_length( (ref[1] & 0xF ) + 3 ); ref_length--; )
                 {
-                    data = m_buffer.get( ref_offset++ );
-                    m_buffer.write( &data );
+                    data = mbuffer_.get( refoffset_++ );
+                    mbuffer_.write( &data );
                 }
             }
         }
@@ -169,7 +169,7 @@ namespace QGears
     LZSDataStream::eof( void ) const
     {
         return !m_available_compressed
-            && !m_buffer.avail();
+            && !mbuffer_.avail();
     }
 
     //---------------------------------------------------------------------

+ 2 - 2
QGearsMain/src/data/worldmap/MapFile.cpp

@@ -1,7 +1,7 @@
 #include "data/worldmap/MapFile.h"
 #include "data/worldmap/MapFileSerializer.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 /*static*/ const String WorldMapFile::RESOURCE_TYPE( "QGearsWorldMap7File" );
 
@@ -22,4 +22,4 @@ void WorldMapFile::unloadImpl()
 
 }
 
-END_QGEARS
+} // namespace QGears

+ 2 - 2
QGearsMain/src/data/worldmap/MapFileManager.cpp

@@ -3,7 +3,7 @@
 
 template<> QGears::MapFileManager* Ogre::Singleton<QGears::MapFileManager>::msSingleton = nullptr;
 
-BEGIN_QGEARS
+namespace QGears {
 
 MapFileManager *MapFileManager::getSingletonPtr()
 {
@@ -39,4 +39,4 @@ Ogre::Resource* MapFileManager::createImpl(
     return new WorldMapFile( this, name, handle, group, isManual, loader );
 }
 
-END_QGEARS
+} // namespace QGears

+ 2 - 2
QGearsMain/src/data/worldmap/MapFileSerializer.cpp

@@ -1,7 +1,7 @@
 #include "data/worldmap/MapFileSerializer.h"
 #include "common/LzsFile.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 const int kWorldMapBlockSize = 0xB800;
 
@@ -143,4 +143,4 @@ void MapFileSerializer::importMapFile( Ogre::DataStreamPtr& stream, WorldMapFile
     }
 }
 
-END_QGEARS
+} // namespace QGears

+ 2 - 2
QGearsMain/src/data/worldmap/TxzFile.cpp

@@ -1,7 +1,7 @@
 #include "data/worldmap/TxzFile.h"
 #include "data/worldmap/TxzFileSerializer.h"
 
-BEGIN_QGEARS
+namespace QGears {
 
 /*static*/ const String TxzFile::RESOURCE_TYPE( "QGearsWorldMapTxzFile" );
 
@@ -22,4 +22,4 @@ void TxzFile::unloadImpl()
 
 }
 
-END_QGEARS
+} // namespace QGears

+ 2 - 2
QGearsMain/src/data/worldmap/TxzFileManager.cpp

@@ -3,7 +3,7 @@
 
 template<> QGears::TxzFileManager* Ogre::Singleton<QGears::TxzFileManager>::msSingleton = nullptr;
 
-BEGIN_QGEARS
+namespace QGears {
 
 TxzFileManager* TxzFileManager::getSingletonPtr()
 {
@@ -39,4 +39,4 @@ Ogre::Resource* TxzFileManager::createImpl(
     return new TxzFile( this, name, handle, group, isManual, loader );
 }
 
-END_QGEARS
+} // namespace QGears

+ 2 - 2
QGearsMain/src/data/worldmap/TxzFileSerializer.cpp

@@ -4,7 +4,7 @@
 #include <sstream>
 #include <array>
 
-BEGIN_QGEARS
+namespace QGears {
 
 TxzFileSerializer::TxzFileSerializer()
 {
@@ -710,4 +710,4 @@ void TxzFileSerializer::extract_texture(const std::array<TxzFileSerializer::wm_t
 
 }
 
-END_QGEARS
+} // namespace QGears

+ 3 - 3
QGearsMain/src/map/QGearsBackground2DFile.cpp

@@ -64,7 +64,7 @@ namespace QGears
     Background2DFile::unloadImpl()
     {
         m_texture_name.clear();
-        //m_range = 0; // IVV
+        //range_ = 0; // IVV
         m_position = Ogre::Vector3::ZERO;
         m_orientation = Ogre::Quaternion::IDENTITY;
         m_fov = 0;
@@ -110,14 +110,14 @@ namespace QGears
     void
     Background2DFile::setRange( const Ogre::Vector4 &range )
     {
-        m_range = range;
+        range_ = range;
     }
 
     //---------------------------------------------------------------------
     Ogre::Vector4
     Background2DFile::getRange() const
     {
-        return m_range;
+        return range_;
     }
 
     //---------------------------------------------------------------------

+ 2 - 2
QGearsMain/src/modules/worldmap/WorldMapModule.cpp

@@ -18,7 +18,7 @@
 
 template<> QGears::WorldMapModule *Ogre::Singleton< QGears::WorldMapModule >::msSingleton = nullptr;
 
-BEGIN_QGEARS
+namespace QGears {
 
 using namespace Ogre;
 
@@ -582,4 +582,4 @@ void WorldMapModule::Init()
     CameraManager::getSingleton().EnableWireFrame(true);
 }
 
-END_QGEARS
+} // namespace QGears

+ 3 - 3
QGearsMain/src/viewer/ViewerModule.cpp

@@ -326,11 +326,11 @@ ViewerModule::SetWalkmeshToLoad( const Ogre::String& name )
     Ogre::String file_name = xml.GetMapFileNameByName( name );
 
     XmlMapFile xml_map( "./data/" + file_name );
-    Ogre::String walkmesh_file_name = xml_map.GetWalkmeshFileName();
+    Ogre::String walkmeshfile_name_ = xml_map.GetWalkmeshFileName();
 
-    if( walkmesh_file_name != "" )
+    if( walkmeshfile_name_ != "" )
     {
-        XmlWalkmeshFile walkmesh_file( "./data/" + walkmesh_file_name );
+        XmlWalkmeshFile walkmesh_file( "./data/" + walkmeshfile_name_ );
         m_Walkmesh = new Walkmesh();
         walkmesh_file.Load( m_Walkmesh );
         //m_SceneNode->attachObject( m_Walkmesh );

+ 1 - 1
Tests/QGearsMain/src/test_QGearsLGPArchive.cpp

@@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE( load )
     BOOST_CHECK_EQUAL( filename_1, entry.file_name );
     BOOST_CHECK_EQUAL( entry.file_name, lgp.list()->at( 0 ) );
     BOOST_CHECK_EQUAL( 0x00000050, entry.file_offset );
-    BOOST_CHECK_EQUAL( "FILENAME 1", entry.data_file_name );
+    BOOST_CHECK_EQUAL( "FILENAME 1", entry.datafile_name_ );
     BOOST_CHECK_EQUAL( 0x00000018, entry.data_size );
     BOOST_CHECK_EQUAL( 0x00000068, entry.data_offset );
 

+ 5 - 5
Tests/QGearsMain/src/test_QGearsLZSDataStream.cpp

@@ -59,10 +59,10 @@ const unsigned char hexData[] = {
 
 BOOST_AUTO_TEST_CASE( read_file )
 {
-    const char* in_file_name( "reference_lzs.compressed" );
-    const char* out_file_name( "test_lzs.decompressed" );
-    std::ifstream *ifs(  OGRE_NEW_T( std::ifstream, Ogre::MEMCATEGORY_GENERAL )( in_file_name, std::ifstream::binary ) );
-    std::ofstream ofs( out_file_name, std::ifstream::binary );
+    const char* infile_name_( "reference_lzs.compressed" );
+    const char* outfile_name_( "test_lzs.decompressed" );
+    std::ifstream *ifs(  OGRE_NEW_T( std::ifstream, Ogre::MEMCATEGORY_GENERAL )( infile_name_, std::ifstream::binary ) );
+    std::ofstream ofs( outfile_name_, std::ifstream::binary );
     BOOST_REQUIRE( ifs->is_open() );
     BOOST_REQUIRE( ofs.is_open() );
     Ogre::DataStreamPtr         file_stream( OGRE_NEW Ogre::FileStreamDataStream( ifs ) );
@@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE( read_file )
     file_stream.reset();
     ofs.close();
 
-    std::ifstream actual( out_file_name );
+    std::ifstream actual( outfile_name_ );
     std::ifstream expected( "reference_lzs.decompressed" );
 
     std::istream_iterator<char> it_actual  ( actual   ), end_actual;

+ 3 - 9
debian/changelog

@@ -1,11 +1,5 @@
-q-gears (0.22) trusty; urgency=low
+v-gears (0.0.1) bullseye; urgency=low
 
-  Second QGears Package
+  First VGears Package
 
- -- Chris Rizzitello <sithlord48@gmail.com>  Fri, 06 Feb 2015 21:08:00 -0400
-
-q-gears (0.21) saucy; urgency=low
-
-  First QGears Package
-
- -- Chris Rizzitello <sithlord48@gmail.com>  Mon, 07 Oct 2013 12:00:00 -0400
+ -- Iñigo Valentin <i@inigovalentin.com>  Tue, 26 Jul 2022 22:07:00 -0100

+ 5 - 6
debian/control

@@ -1,16 +1,15 @@
-Source: q-gears
+Source: v-gears
 Section: games
 Priority: extra
-Maintainer: Chris Rizzitello <sithlord48@gmail.com>
-Build-Depends: debhelper(>= 7.0.50~),libogre-1.9-dev, cmake, cdbs,libois-dev,libboost-program-options-dev,libboost-filesystem-dev,libvorbis-dev,libopenal-dev,libboost-test-dev,zlib1g-dev,libqt4-dev
+Maintainer: Iñigo Valentin <i@inigovalentin.com>
+Build-Depends: debhelper(>= 7.0.50~),libogre-1.12-dev, libtiyxml-dev, cmake, cdbs, libois-dev, libboost-program-options-dev, libboost-filesystem-dev, libvorbis-dev, libopenal-dev, libboost-test-dev, zlib1g-dev, libqt5core5a, libqt5widgets5
 Standards-Version: 3.9.5
-Homepage: https://sourceforge.net/projects/q-gears
+Homepage: https://v-gears.inigovalentin.com
 Vcs-Git: git://https://github.com/q-gears/q-gears.git
 #Vcs-Browser: http://git.debian.org/?p=collab-maint/qgears.git;a=summary
 
-Package: q-gears
+Package: v-gears
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Recommends: q-gears-test-data
 Description: A Free Final Fantasy VII Engine
  A Free Replacement for the Final Fantasy VII Engine.

+ 2 - 4
debian/copyright

@@ -1,9 +1,9 @@
 Format: http://dep.debian.net/deps/dep5
-Upstream-Name: qgears
+Upstream-Name: V-Gears
 Source: http://sourceforge.net/projects/q-gears
 
 Files: debian/*
-Copyright: <get years from akari> CORRECTCOPYRIGHTHOLDER <CCR EMAIL>
+Copyright: 2022 The V-Gears team <CCR EMAIL>
 License: GPL-2+
  This package is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
@@ -21,5 +21,3 @@ License: GPL-2+
  On Debian systems, the complete text of the GNU General
  Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
 
-# Please also look if there are files or directories which have a
-# different copyright/license attached and list them here.

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff