diff --git a/MshViewer/Header/Object.h b/MshViewer/Header/Object.h index 8d0dabd..36b8c8b 100644 --- a/MshViewer/Header/Object.h +++ b/MshViewer/Header/Object.h @@ -3,7 +3,6 @@ #include #include #include -#include #include enum Mtyp { @@ -22,16 +21,16 @@ struct ChunkHeader { }; struct Modl { - std::string name; - std::string parent; - Mtyp type; - std::uint32_t renderFlags; - glm::mat4 m4x4Translation; - std::string texture; - float* vertex; - float* uv; - std::uint32_t* mesh; - std::uint32_t meshSize; + std::string name = ""; + std::string parent = ""; + Mtyp type = null; + std::int32_t renderFlags = -1; + glm::mat4 m4x4Translation = glm::mat4(1.0f); + std::string texture = ""; + float* vertex = nullptr; + float* uv = nullptr; + std::uint32_t* mesh = nullptr; + std::uint32_t meshSize = 0; }; @@ -49,7 +48,6 @@ private: private: - void setModlDefault(Modl* model); void loadChunks(std::list &destination, std::streampos start, const std::uint32_t end); void analyseMsh2Chunks(std::list &chunkList); void analyseMatdChunks(std::list &chunkList); diff --git a/MshViewer/Header/OpenGLController.h b/MshViewer/Header/OpenGLController.h index 1132361..25121fd 100644 --- a/MshViewer/Header/OpenGLController.h +++ b/MshViewer/Header/OpenGLController.h @@ -1,11 +1,9 @@ #pragma once -#include #include #include -#include -#include #include "Object.h" -#include "Texture.h" +#include + #define VERTEX_INDEX_XYZ 0 #define VERTEX_INDEX_UV 1 diff --git a/MshViewer/Source/Object.cpp b/MshViewer/Source/Object.cpp index 315eb56..ed468bb 100644 --- a/MshViewer/Source/Object.cpp +++ b/MshViewer/Source/Object.cpp @@ -1,5 +1,7 @@ #include "Object.h" #include + + #define PI (4.0*atan(1.0)) @@ -72,20 +74,6 @@ Object::~Object() ///////////////////////////////////////////////////////////////////////// // private functions -void Object::setModlDefault(Modl * model) -{ - model->name = ""; - model->parent = ""; - model->type = null; - model->renderFlags = -1; - model->m4x4Translation = glm::mat4(1.0f); - model->texture = ""; - model->vertex = NULL; - model->uv = NULL; - model->mesh = NULL; - model->meshSize = 0; -} - void Object::loadChunks(std::list& destination, std::streampos start, const std::uint32_t end) { // jump to first chunk @@ -170,7 +158,6 @@ void Object::analyseMsh2Chunks(std::list& chunkList) if (!strcmp("MODL", (*it)->name)) { Modl* tempModl = new Modl; - setModlDefault(tempModl); // get all subchunks std::list tempChunks; diff --git a/MshViewer/Source/OpenGlController.cpp b/MshViewer/Source/OpenGlController.cpp index d2c4831..4c57218 100644 --- a/MshViewer/Source/OpenGlController.cpp +++ b/MshViewer/Source/OpenGlController.cpp @@ -1,17 +1,14 @@ -#include -#include -#include #include "OpenGLController.h" #include "callback.h" - -#include #include "shader.hpp" #include "Texture.h" -#include +#include +#include +#include + #define VERTEX_SHADER "Shader/TextureShader.vert" #define FRAGMENT_SHADER "Shader/TextureShader.frag" -#define MAX_MODEL_COUNT 1000 ///////////////////////////////////////////////////////////////////////// // public constructor/destructor @@ -282,7 +279,7 @@ void OpenGLController::updateScene() int instanceOffset(0); - for (int modelIndex = 0; modelIndex < vModels.size(); modelIndex++) + for (unsigned int modelIndex = 0; modelIndex < vModels.size(); modelIndex++) { // give texture to the shader glTexImage2D(GL_TEXTURE_2D, diff --git a/MshViewer/Source/Texture.cpp b/MshViewer/Source/Texture.cpp index fae2aeb..02c5ce2 100644 --- a/MshViewer/Source/Texture.cpp +++ b/MshViewer/Source/Texture.cpp @@ -1,7 +1,5 @@ #include "Texture.h" -#include #include -#include TextureTGA::TextureTGA(const char * filePath) { diff --git a/MshViewer/Source/callback.cpp b/MshViewer/Source/callback.cpp index 8b36647..e93e599 100644 --- a/MshViewer/Source/callback.cpp +++ b/MshViewer/Source/callback.cpp @@ -1,6 +1,3 @@ -//#include "callback.h" -#include -#include #include "OpenGLController.h" diff --git a/MshViewer/main.cpp b/MshViewer/main.cpp index 531e087..c23d154 100644 --- a/MshViewer/main.cpp +++ b/MshViewer/main.cpp @@ -3,9 +3,6 @@ #endif // DEBUG #include "OpenGLController.h" -#include "Object.h" -#include -#include int main(int argc, char** argv) {