add basic shaders and Tile class
This commit is contained in:
parent
569f2dfb00
commit
9124915237
7 changed files with 324 additions and 124 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,4 +12,4 @@
|
|||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
.idea/*
|
||||
.idea/
|
|
@ -2,11 +2,13 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="00f293cb-c755-478c-9b6f-422f827454e0" name="Default" comment="">
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/libraries/lwjgl.xml" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/src/com/company/Main.java" afterPath="" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/res/shaders/main.frag" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/res/shaders/main.vert" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/globalgamejam/render/Tile.java" />
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/src/globalgamejam/audio/Sound3D.java" afterPath="" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
|
@ -25,8 +27,8 @@
|
|||
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-740">
|
||||
<caret line="19" column="3" lean-forward="false" selection-start-line="19" selection-start-column="3" selection-end-line="19" selection-end-column="3" />
|
||||
<state relative-caret-position="790">
|
||||
<caret line="105" column="24" lean-forward="false" selection-start-line="105" selection-start-column="24" selection-end-line="105" selection-end-column="24" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
@ -34,51 +36,66 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="main.vert" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.vert">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="119">
|
||||
<caret line="7" column="21" lean-forward="false" selection-start-line="7" selection-start-column="21" selection-end-line="7" selection-end-column="21" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="main.frag" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="13" column="59" lean-forward="false" selection-start-line="13" selection-start-column="59" selection-end-line="13" selection-end-column="59" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Tile.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Tile.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-825">
|
||||
<caret line="3" column="35" lean-forward="false" selection-start-line="3" selection-start-column="35" selection-end-line="3" selection-end-column="35" />
|
||||
<folding>
|
||||
<element signature="e#2418#2419#0" expanded="true" />
|
||||
<element signature="e#2448#2449#0" expanded="true" />
|
||||
<element signature="e#2495#2496#0" expanded="true" />
|
||||
<element signature="e#2533#2534#0" expanded="true" />
|
||||
<element signature="e#2566#2567#0" expanded="true" />
|
||||
<element signature="e#2594#2595#0" expanded="true" />
|
||||
<element signature="e#2639#2640#0" expanded="true" />
|
||||
<element signature="e#2675#2676#0" expanded="true" />
|
||||
<element signature="e#2702#2703#0" expanded="true" />
|
||||
<element signature="e#2728#2729#0" expanded="true" />
|
||||
<element signature="e#2766#2767#0" expanded="true" />
|
||||
<element signature="e#2798#2799#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Audio.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/audio/Audio.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="21" column="59" lean-forward="false" selection-start-line="21" selection-start-column="59" selection-end-line="21" selection-end-column="59" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="7" lean-forward="true" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Quaternion.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Quaternion.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="68">
|
||||
<caret line="4" column="3" lean-forward="false" selection-start-line="4" selection-start-column="3" selection-end-line="4" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Vector2f.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Vector2f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="119">
|
||||
<caret line="7" column="3" lean-forward="false" selection-start-line="7" selection-start-column="3" selection-end-line="7" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Vector3f.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Vector3f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="119">
|
||||
<caret line="7" column="3" lean-forward="false" selection-start-line="7" selection-start-column="3" selection-end-line="7" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Vector4f.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Vector4f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="68">
|
||||
<caret line="4" column="3" lean-forward="false" selection-start-line="4" selection-start-column="3" selection-end-line="4" selection-end-column="3" />
|
||||
<caret line="14" column="6" lean-forward="false" selection-start-line="14" selection-start-column="6" selection-end-line="14" selection-end-column="6" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -96,23 +113,11 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="DisplayManager.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="3" lean-forward="false" selection-start-line="9" selection-start-column="3" selection-end-line="9" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Shaders.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Shaders.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="3" lean-forward="false" selection-start-line="9" selection-start-column="3" selection-end-line="9" selection-end-column="3" />
|
||||
<caret line="18" column="88" lean-forward="false" selection-start-line="18" selection-start-column="88" selection-end-line="18" selection-end-column="88" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
@ -132,6 +137,13 @@
|
|||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>fr.technicalgames</find>
|
||||
|
@ -166,10 +178,13 @@
|
|||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Vector4f.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Camera.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Texture.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/Main.java" />
|
||||
<option value="$PROJECT_DIR$/.gitignore" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
|
||||
<option value="$PROJECT_DIR$/res/shaders/main.frag" />
|
||||
<option value="$PROJECT_DIR$/res/shaders/main.vert" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Tile.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -335,6 +350,24 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="GGL-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="GGL-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="res" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="shaders" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
|
@ -644,24 +677,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/audio/Audio.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="323">
|
||||
<caret line="21" column="59" lean-forward="false" selection-start-line="21" selection-start-column="59" selection-end-line="21" selection-end-column="59" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/audio/Sound3D.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="68">
|
||||
<caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="6" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/Game.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="136">
|
||||
|
@ -692,14 +707,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/input/IO.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="85">
|
||||
<caret line="5" column="3" lean-forward="false" selection-start-line="5" selection-start-column="3" selection-end-line="5" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Color4f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="119">
|
||||
|
@ -758,13 +765,19 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Camera.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Texture.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="12" column="3" lean-forward="false" selection-start-line="12" selection-start-column="3" selection-end-line="12" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="85">
|
||||
<caret line="14" column="3" lean-forward="false" selection-start-line="14" selection-start-column="3" selection-end-line="14" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="6" lean-forward="false" selection-start-line="14" selection-start-column="6" selection-end-line="14" selection-end-column="6" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -778,42 +791,99 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Shaders.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Camera.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="3" lean-forward="false" selection-start-line="9" selection-start-column="3" selection-end-line="9" selection-end-column="3" />
|
||||
<state relative-caret-position="204">
|
||||
<caret line="12" column="3" lean-forward="false" selection-start-line="12" selection-start-column="3" selection-end-line="12" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Texture.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="85">
|
||||
<caret line="14" column="3" lean-forward="false" selection-start-line="14" selection-start-column="3" selection-end-line="14" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-740">
|
||||
<caret line="19" column="3" lean-forward="false" selection-start-line="19" selection-start-column="3" selection-end-line="19" selection-end-column="3" />
|
||||
<state relative-caret-position="790">
|
||||
<caret line="105" column="24" lean-forward="false" selection-start-line="105" selection-start-column="24" selection-end-line="105" selection-end-column="24" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/audio/Sound3D.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="7" lean-forward="true" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
|
||||
<state relative-caret-position="68">
|
||||
<caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="6" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/audio/Audio.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="21" column="59" lean-forward="false" selection-start-line="21" selection-start-column="59" selection-end-line="21" selection-end-column="59" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/input/IO.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="85">
|
||||
<caret line="5" column="3" lean-forward="false" selection-start-line="5" selection-start-column="3" selection-end-line="5" selection-end-column="3" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Shaders.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="18" column="88" lean-forward="false" selection-start-line="18" selection-start-column="88" selection-end-line="18" selection-end-column="88" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="13" column="59" lean-forward="false" selection-start-line="13" selection-start-column="59" selection-end-line="13" selection-end-column="59" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.vert">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="119">
|
||||
<caret line="7" column="21" lean-forward="false" selection-start-line="7" selection-start-column="21" selection-end-line="7" selection-end-column="21" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Tile.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-825">
|
||||
<caret line="3" column="35" lean-forward="false" selection-start-line="3" selection-start-column="35" selection-end-line="3" selection-end-column="35" />
|
||||
<folding>
|
||||
<element signature="e#2418#2419#0" expanded="true" />
|
||||
<element signature="e#2448#2449#0" expanded="true" />
|
||||
<element signature="e#2495#2496#0" expanded="true" />
|
||||
<element signature="e#2533#2534#0" expanded="true" />
|
||||
<element signature="e#2566#2567#0" expanded="true" />
|
||||
<element signature="e#2594#2595#0" expanded="true" />
|
||||
<element signature="e#2639#2640#0" expanded="true" />
|
||||
<element signature="e#2675#2676#0" expanded="true" />
|
||||
<element signature="e#2702#2703#0" expanded="true" />
|
||||
<element signature="e#2728#2729#0" expanded="true" />
|
||||
<element signature="e#2766#2767#0" expanded="true" />
|
||||
<element signature="e#2798#2799#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
|
|
15
res/shaders/main.frag
Normal file
15
res/shaders/main.frag
Normal file
|
@ -0,0 +1,15 @@
|
|||
#version 150
|
||||
|
||||
uniform sampler2D materialTex;
|
||||
uniform vec4 color;
|
||||
|
||||
|
||||
in vec2 fragTexCoord;
|
||||
in vec3 fragVert;
|
||||
|
||||
out vec4 finalColor;
|
||||
|
||||
void main() {
|
||||
|
||||
finalColor = texture(materialTex, fragTexCoord) * color;
|
||||
}
|
21
res/shaders/main.vert
Normal file
21
res/shaders/main.vert
Normal file
|
@ -0,0 +1,21 @@
|
|||
#version 150
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 camera;
|
||||
uniform mat4 transform;
|
||||
|
||||
in vec3 vert;
|
||||
in vec2 vertTexCoord;
|
||||
|
||||
out vec3 fragVert;
|
||||
out vec2 fragTexCoord;
|
||||
|
||||
void main() {
|
||||
// Pass some variables to the fragment shader
|
||||
fragTexCoord = vertTexCoord;
|
||||
fragVert = vert;
|
||||
fragColor = vertColor;
|
||||
|
||||
// Apply all matrix transformations to vert
|
||||
gl_Position = projection * camera * transform * vec4(vert, 1);
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package globalgamejam.audio;
|
||||
|
||||
import globalgamejam.math.*;
|
||||
|
||||
/**
|
||||
* Class created by MrDev023 (Florian RICHER) on 14/01/2017
|
||||
*/
|
||||
public class Sound3D extends Audio{
|
||||
|
||||
public Sound3D(String fileName,Vector3f position) throws Exception {
|
||||
super(fileName);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,16 @@ public class Shaders {
|
|||
|
||||
public int program;
|
||||
|
||||
public static Shaders MAIN_SHADERS;
|
||||
|
||||
static{
|
||||
try{
|
||||
MAIN_SHADERS = new Shaders("res/shaders/main.vert","res/shaders/main.frag");
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Shaders(String vertexFile,String fragmentFile) throws Exception{
|
||||
String fragmentShader = IO.loadFile(fragmentFile);
|
||||
String vertexShader = IO.loadFile(vertexFile);
|
||||
|
|
98
src/globalgamejam/render/Tile.java
Normal file
98
src/globalgamejam/render/Tile.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
package globalgamejam.render;
|
||||
|
||||
import globalgamejam.math.Color4f;
|
||||
import globalgamejam.math.Matrix4f;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
/**
|
||||
* Created by MrDev023 (Florian RICHER) on 14/01/2017.
|
||||
*/
|
||||
public abstract class Tile {
|
||||
|
||||
private int vbo;
|
||||
private Texture texture;
|
||||
private Color4f color;
|
||||
private Matrix4f transform;
|
||||
private int size;
|
||||
|
||||
public Tile(){
|
||||
this.texture = new Texture(0,0,0);
|
||||
this.transform = new Matrix4f();
|
||||
this.color = Color4f.WHITE;
|
||||
this.vbo = GL15.glGenBuffers();
|
||||
load();
|
||||
}
|
||||
|
||||
private void load(){
|
||||
float[] a = new float[]{
|
||||
-1.0f,-1.0f, 0.0f,0.0f,
|
||||
1.0f,-1.0f, 1.0f,0.0f,
|
||||
1.0f,1.0f, 1.0f,1.0f,
|
||||
1.0f,-1.0f, 0.0f,1.0f,
|
||||
};
|
||||
FloatBuffer buffer = BufferUtils.createFloatBuffer(a.length);
|
||||
buffer.put(a).flip();
|
||||
size = a.length/(2+2);
|
||||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
|
||||
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vert"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vert"), 2, GL11.GL_FLOAT, false, (2+2)*4, 0);
|
||||
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"), 2, GL11.GL_FLOAT, true, (2+2)*4, 2*4);
|
||||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void render(){
|
||||
Shaders.MAIN_SHADERS.bind();
|
||||
Shaders.MAIN_SHADERS.uniform("camera", Camera.matrix);
|
||||
Shaders.MAIN_SHADERS.uniform("transform", transform);
|
||||
Shaders.MAIN_SHADERS.uniform("projection", DisplayManager.projection);
|
||||
Shaders.MAIN_SHADERS.uniform("color", this.color);
|
||||
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
texture.bind();
|
||||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
GL11.glDrawArrays(GL11.GL_QUADS, 0, size);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
texture.unbind();
|
||||
Shaders.MAIN_SHADERS.unbind();
|
||||
}
|
||||
|
||||
public void destroy(){
|
||||
GL15.glDeleteBuffers(vbo);
|
||||
texture.destroy();
|
||||
transform = null;
|
||||
}
|
||||
|
||||
public Texture getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setTexture(Texture texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public Color4f getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color4f color4f) {
|
||||
this.color = color4f;
|
||||
}
|
||||
|
||||
public int getVbo() {
|
||||
return vbo;
|
||||
}
|
||||
|
||||
public Matrix4f getTransform() {
|
||||
return transform;
|
||||
}
|
||||
}
|
Reference in a new issue