Commit 9deb4aaafdad2041bf935dc042d85498bb57680c

Authored by Olav Kjartan Larseng
1 parent 03d9e394

water added

Showing 44 changed files with 265 additions and 125 deletions   Show diff stats
SpaceShooterV4/SpaceShooterV4.vcxproj
... ... @@ -161,6 +161,7 @@
161 161 <ClInclude Include="include\SpaceShip.hpp" />
162 162 <ClInclude Include="include\Spotlight.h" />
163 163 <ClInclude Include="include\Text.h" />
  164 + <ClInclude Include="include\Water.hpp" />
164 165 </ItemGroup>
165 166 <ItemGroup>
166 167 <ClCompile Include="app\main.cpp" />
... ... @@ -176,6 +177,7 @@
176 177 <ClCompile Include="src\SpaceShip.cpp" />
177 178 <ClCompile Include="src\Spotlight.cpp" />
178 179 <ClCompile Include="src\Text.cpp" />
  180 + <ClCompile Include="src\Water.cpp" />
179 181 </ItemGroup>
180 182 <ItemGroup>
181 183 <None Include="assets\shaders\chess.frag" />
... ... @@ -188,6 +190,8 @@
188 190 <None Include="assets\shaders\skybox.vert" />
189 191 <None Include="assets\shaders\terrain.frag" />
190 192 <None Include="assets\shaders\terrain.vert" />
  193 + <None Include="assets\shaders\water.frag" />
  194 + <None Include="assets\shaders\water.vert" />
191 195 </ItemGroup>
192 196 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
193 197 <ImportGroup Label="ExtensionTargets">
... ...
SpaceShooterV4/SpaceShooterV4.vcxproj.filters
... ... @@ -65,6 +65,9 @@
65 65 <ClInclude Include="include\Skybox.hpp">
66 66 <Filter>Header Files</Filter>
67 67 </ClInclude>
  68 + <ClInclude Include="include\Water.hpp">
  69 + <Filter>Header Files</Filter>
  70 + </ClInclude>
68 71 </ItemGroup>
69 72 <ItemGroup>
70 73 <ClCompile Include="app\main.cpp">
... ... @@ -106,6 +109,9 @@
106 109 <ClCompile Include="src\Skybox.cpp">
107 110 <Filter>Source Files</Filter>
108 111 </ClCompile>
  112 + <ClCompile Include="src\Water.cpp">
  113 + <Filter>Source Files</Filter>
  114 + </ClCompile>
109 115 </ItemGroup>
110 116 <ItemGroup>
111 117 <None Include="assets\shaders\chess.frag">
... ... @@ -138,5 +144,11 @@
138 144 <None Include="assets\shaders\skybox.vert">
139 145 <Filter>Shaders</Filter>
140 146 </None>
  147 + <None Include="assets\shaders\water.frag">
  148 + <Filter>Shaders</Filter>
  149 + </None>
  150 + <None Include="assets\shaders\water.vert">
  151 + <Filter>Shaders</Filter>
  152 + </None>
141 153 </ItemGroup>
142 154 </Project>
143 155 \ No newline at end of file
... ...
SpaceShooterV4/app/main.cpp
... ... @@ -96,6 +96,25 @@ void display()
96 96 gm->getSkybox()->moveDown(offset);
97 97 }
98 98  
  99 + if (keyPressed[KEY_ID_H])
  100 + {
  101 + gm->getCam()->rotateLeft();
  102 + }
  103 +
  104 + if (keyPressed[KEY_ID_J])
  105 + {
  106 + gm->getCam()->rotateRight();
  107 + }
  108 +
  109 + if (keyPressed[KEY_ID_U])
  110 + {
  111 + gm->getCam()->rotateUp();
  112 + }
  113 +
  114 + if (keyPressed[KEY_ID_N])
  115 + {
  116 + gm->getCam()->rotateDown();
  117 + }
99 118  
100 119 /* TEXT */
101 120 glPushMatrix();
... ... @@ -165,7 +184,16 @@ void keyDown(unsigned char key, int x, int y)
165 184 keyPressed[KEY_ID_LEFTARROW] = true;
166 185 break;
167 186 case 'h':
168   - keyPressed[KEY_ID_RIGHTARROW] = true;
  187 + keyPressed[KEY_ID_H] = true;
  188 + break;
  189 + case 'j':
  190 + keyPressed[KEY_ID_J] = true;
  191 + break;
  192 + case 'u':
  193 + keyPressed[KEY_ID_U] = true;
  194 + break;
  195 + case 'n':
  196 + keyPressed[KEY_ID_N] = true;
169 197 break;
170 198  
171 199 default:
... ... @@ -212,8 +240,18 @@ void keyUp(unsigned char key, int x, int y)
212 240 keyPressed[KEY_ID_LEFTARROW] = false;
213 241 break;
214 242 case 'h':
215   - keyPressed[KEY_ID_RIGHTARROW] = false;
  243 + keyPressed[KEY_ID_H] = false;
216 244 break;
  245 + case 'j':
  246 + keyPressed[KEY_ID_J] = false;
  247 + break;
  248 + case 'u':
  249 + keyPressed[KEY_ID_U] = false;
  250 + break;
  251 + case 'n':
  252 + keyPressed[KEY_ID_N] = false;
  253 + break;
  254 +
217 255  
218 256 }
219 257 }
... ...
SpaceShooterV4/assets/shaders/skybox.vert
... ... @@ -3,5 +3,5 @@ varying vec4 texCoord;
3 3 void main()
4 4 {
5 5 texCoord = gl_Vertex;
6   - gl_Position = gl_ModelViewProjectionMatrix * (gl_Vertex * vec4(1200.0, 1200.0, 1200.0, 1.0));
  6 + gl_Position = gl_ModelViewProjectionMatrix * (gl_Vertex);
7 7 }
8 8 \ No newline at end of file
... ...
SpaceShooterV4/assets/shaders/terrain.vert
... ... @@ -9,8 +9,8 @@ void main()
9 9 vec4 pos = gl_Vertex;
10 10 texCoord = gl_MultiTexCoord0;
11 11 vec4 texHeight = texture2D(tex_heightmap, texCoord.xy);
12   - pos.y = ((texHeight.y * 100.0) - 150.0);
13   - //pos.x = pos.x * 3.0;
  12 + pos.y = ((texHeight.y * 700.0) - 350.0);
  13 + pos.x = pos.x * 3.0;
14 14  
15 15 gl_Position = gl_ModelViewProjectionMatrix * pos;
16 16 }
17 17 \ No newline at end of file
... ...
SpaceShooterV4/assets/shaders/water.frag 0 → 100644
  1 +uniform sampler2D tex_colormap;
  2 +varying vec4 texCoord;
  3 +
  4 +void main()
  5 +{
  6 +
  7 + gl_FragColor = texture2D(tex_colormap, texCoord.xy);
  8 + gl_FragColor.a = 0.4;
  9 +}
... ...
SpaceShooterV4/assets/shaders/water.vert 0 → 100644
  1 +uniform float water_data;
  2 +varying vec4 texCoord;
  3 +
  4 +void main()
  5 +{
  6 + vec4 pos = gl_Vertex;
  7 + texCoord = gl_MultiTexCoord0;
  8 + float xpos = pos.x * 12.0;
  9 + pos.x = xpos;
  10 + pos.z = pos.z * 35.0;
  11 + pos.y = -160.0 + (sin(gl_MultiTexCoord0.x * 10.0 * water_data));
  12 + texCoord.x = texCoord.x + (water_data * 0.05);
  13 +
  14 + gl_Position = gl_ModelViewProjectionMatrix * pos;
  15 +}
0 16 \ No newline at end of file
... ...
SpaceShooterV4/assets/textures/heightMap2012v2.bmp 0 → 100644
No preview for this file type
SpaceShooterV4/assets/textures/heightMap2012v3.bmp 0 → 100644
No preview for this file type
SpaceShooterV4/assets/textures/skybox/skybox_xn.bmp
No preview for this file type
SpaceShooterV4/assets/textures/skybox/skybox_xp.bmp
No preview for this file type
SpaceShooterV4/assets/textures/skybox/skybox_yp.bmp
No preview for this file type
SpaceShooterV4/assets/textures/skybox/skybox_zn.bmp
No preview for this file type
SpaceShooterV4/assets/textures/skybox/skybox_zp.bmp
No preview for this file type
SpaceShooterV4/assets/textures/water.jpg 0 → 100644