Commit e9bdebef7aa99a09f8166576bbed328e032370bd

Authored by Olav Kjartan Larseng
1 parent 7a50e490

multiple model imports done, enemy and spaceship model applied.

Showing 72 changed files with 3853 additions and 4530 deletions   Show diff stats
SpaceShooterV4/SpaceShooterV4.vcxproj
... ... @@ -155,6 +155,8 @@
155 155 <ClInclude Include="include\FpsCounter.hpp" />
156 156 <ClInclude Include="include\GameManager.hpp" />
157 157 <ClInclude Include="include\Input.hpp" />
  158 + <ClInclude Include="include\ModelDataGlmExporter.h" />
  159 + <ClInclude Include="include\ModelDataStruct.h" />
158 160 <ClInclude Include="include\SceneObject.hpp" />
159 161 <ClInclude Include="include\Shader.hpp" />
160 162 <ClInclude Include="include\Skybox.hpp" />
... ... @@ -162,11 +164,9 @@
162 164 <ClInclude Include="include\Spotlight.h" />
163 165 <ClInclude Include="include\Text.h" />
164 166 <ClInclude Include="include\Water.hpp" />
165   - <ClInclude Include="SpaceshipModelTest.h" />
166 167 </ItemGroup>
167 168 <ItemGroup>
168 169 <ClCompile Include="app\main.cpp" />
169   - <ClCompile Include="SpaceshipModelTest.cpp" />
170 170 <ClCompile Include="src\BattleField.cpp" />
171 171 <ClCompile Include="src\Bullet.cpp" />
172 172 <ClCompile Include="src\Camera.cpp" />
... ... @@ -184,6 +184,8 @@
184 184 <ItemGroup>
185 185 <None Include="assets\shaders\chess.frag" />
186 186 <None Include="assets\shaders\chess.vert" />
  187 + <None Include="assets\shaders\enemyspaceship.frag" />
  188 + <None Include="assets\shaders\enemyspaceship.vert" />
187 189 <None Include="assets\shaders\phong.frag" />
188 190 <None Include="assets\shaders\phong.vert" />
189 191 <None Include="assets\shaders\red.frag" />
... ...
SpaceShooterV4/SpaceShooterV4.vcxproj.filters
... ... @@ -68,7 +68,10 @@
68 68 <ClInclude Include="include\Water.hpp">
69 69 <Filter>Header Files</Filter>
70 70 </ClInclude>
71   - <ClInclude Include="SpaceshipModelTest.h">
  71 + <ClInclude Include="include\ModelDataGlmExporter.h">
  72 + <Filter>Header Files</Filter>
  73 + </ClInclude>
  74 + <ClInclude Include="include\ModelDataStruct.h">
72 75 <Filter>Header Files</Filter>
73 76 </ClInclude>
74 77 </ItemGroup>
... ... @@ -115,9 +118,6 @@
115 118 <ClCompile Include="src\Water.cpp">
116 119 <Filter>Source Files</Filter>
117 120 </ClCompile>
118   - <ClCompile Include="SpaceshipModelTest.cpp">
119   - <Filter>Source Files</Filter>
120   - </ClCompile>
121 121 </ItemGroup>
122 122 <ItemGroup>
123 123 <None Include="assets\shaders\chess.frag">
... ... @@ -162,5 +162,11 @@
162 162 <None Include="assets\shaders\spaceship.vert">
163 163 <Filter>Shaders</Filter>
164 164 </None>
  165 + <None Include="assets\shaders\enemyspaceship.frag">
  166 + <Filter>Shaders</Filter>
  167 + </None>
  168 + <None Include="assets\shaders\enemyspaceship.vert">
  169 + <Filter>Shaders</Filter>
  170 + </None>
165 171 </ItemGroup>
166 172 </Project>
167 173 \ No newline at end of file
... ...
SpaceShooterV4/SpaceshipModelTest.cpp deleted
1   -#include "SpaceshipModelTest.h"
2   -#include "include/OBJ_Loader.h"
3   -
4   -SpaceshipModelTest::SpaceshipModelTest()
5   -{
6   -
7   -
8   -}
9   -
10   -SpaceshipModelTest::~SpaceshipModelTest()
11   -{
12   -}
13   -
14   -void SpaceshipModelTest::privateInit()
15   -{
16   - spaceshipShader.initShaders("assets/shaders/spaceship");
17   -
18   - _texture = SOIL_load_OGL_texture
19   - (
20   - "assets/models/Spaceship/Textures/shipA.bmp",
21   - SOIL_LOAD_AUTO,
22   - SOIL_CREATE_NEW_ID,
23   - SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
24   - );
25   -
26   - if (0 == _texture)
27   - {
28   - printf("SOIL loading error: '%s'\n", SOIL_last_result());
29   - }
30   -
31   -
32   - objl::Loader Loader;
33   - bool loadout = Loader.LoadFile("assets/models/Spaceship/shipA_OBJ/shipA_OBJ.obj");
34   -
35   - if (loadout)
36   - {
37   - for (int i = 0; i < Loader.LoadedMeshes.size(); i++)
38   - {
39   - objl::Mesh curMesh = Loader.LoadedMeshes[i];
40   - for (int j = 0; j < curMesh.Vertices.size(); j++)
41   - {
42   - _VERT.push_back(glm::vec3(curMesh.Vertices[j].Position.X, curMesh.Vertices[j].Position.Y, curMesh.Vertices[j].Position.Z));
43   - _NORM.push_back(glm::vec3(curMesh.Vertices[j].Normal.X, curMesh.Vertices[j].Normal.Y, curMesh.Vertices[j].Normal.Z));
44   - _TEXC.push_back(glm::vec2(curMesh.Vertices[j].TextureCoordinate.X, curMesh.Vertices[j].TextureCoordinate.Y));
45   - }
46   -
47   - for (int j = 0; j < curMesh.Indices.size(); j += 3)
48   - {
49   - _INDI.push_back(curMesh.Indices[j]);
50   - _INDI.push_back(curMesh.Indices[j+1]);
51   - _INDI.push_back(curMesh.Indices[j+2]);
52   - }
53   -
54   - }
55   - } else {
56   - std::cout << "Could not load file!" << std::endl;
57   - }
58   -
59   - spaceshipShader.enable();
60   - _texColormapSampler = glGetUniformLocation(spaceshipShader.getProg(), "tex_colormap");
61   - glUniform1i(_texColormapSampler, 0);
62   - spaceshipShader.disable();
63   -
64   -}
65   -
66   -void SpaceshipModelTest::privateRender()
67   -{
68   - spaceshipShader.enable();
69   -
70   - glDisable(GL_COLOR_MATERIAL);
71   -
72   - glClearColor(0.0, 0.0, 0.0, 0.0);
73   -
74   - glActiveTexture(GL_TEXTURE0);
75   - glEnable(GL_TEXTURE_2D);
76   - glBindTexture(GL_TEXTURE_2D, _texture);
77   -
78   - glEnableClientState(GL_VERTEX_ARRAY);
79   - glEnableClientState(GL_TEXTURE_COORD_ARRAY);
80   -
81   - glEnable(GL_PRIMITIVE_RESTART);
82   -
83   - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
84   - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
85   - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
86   - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
87   - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
88   - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
89   -
90   - glVertexPointer(3, GL_FLOAT, 0, &_VERT[0]);
91   - glTexCoordPointer(2, GL_FLOAT, 0, &_TEXC[0]);
92   -
93   -
94   - glDrawElements(GL_TRIANGLES,
95   - _INDI.size(),
96   - GL_UNSIGNED_INT,
97   - &_INDI[0]);
98   -
99   - glDisable(GL_PRIMITIVE_RESTART);
100   -
101   - glClearColor(0.0, 0.0, 0.0, 0.0);
102   -
103   - glActiveTexture(GL_TEXTURE0);
104   - glDisable(GL_TEXTURE_2D);
105   - glDisableClientState(GL_TEXTURE_COORD_ARRAY);
106   - glDisableClientState(GL_VERTEX_ARRAY);
107   - spaceshipShader.disable();
108   -}
109   -
110   -void SpaceshipModelTest::privateUpdate()
111   -{
112   -}
113   -
114   -bool SpaceshipModelTest::markedForDeletion()
115   -{
116   - return _markDelete;
117   -}
SpaceShooterV4/SpaceshipModelTest.h deleted
1   -#pragma once
2   -
3   -#include <GL/glew.h>
4   -#include <windows.h>
5   -#include <GL/gl.h>
6   -#include <GL/glu.h>
7   -#include "include/SceneObject.hpp"
8   -#include "include/Shader.hpp"
9   -#include "include\soil\SOIL.h"
10   -#include "include/glm/gtc/matrix_transform.hpp"
11   -
12   -
13   -class SpaceshipModelTest : public SceneObject
14   -{
15   -public:
16   -
17   - SpaceshipModelTest();
18   - ~SpaceshipModelTest();
19   -
20   - bool markedForDeletion();
21   -
22   -
23   -private:
24   - void privateInit();
25   - void privateRender();
26   - void privateUpdate();
27   -
28   - bool _markDelete = false;
29   -
30   - GLuint _texture;
31   - GLint _texColormapSampler;
32   -
33   - /*
34   - std::vector<glm::vec3> vertices;
35   - std::vector<glm::vec3> normal;
36   - std::vector<glm::vec2> texCoords;
37   - std::vector<glm::uint> indices;
38   - */
39   - std::vector<glm::vec3> _VERT;
40   - std::vector<glm::vec3> _NORM;
41   - std::vector<glm::vec2> _TEXC;
42   - std::vector<glm::uint> _INDI;
43   -
44   - Shader spaceshipShader;
45   -
46   -};
47   -
SpaceShooterV4/assets/models/Enemy/DiffuseTexture.png 0 → 100644