beta release: textures, 3D models, Cameras

This commit is contained in:
EvilMuffinHa 2020-05-30 15:27:07 -04:00
commit 53c8740e13
28 changed files with 201683 additions and 58 deletions

View File

@ -4,10 +4,11 @@
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lwjgl-release-3.2" level="project" /> <orderEntry type="library" name="lwjgl-release-3.2" level="project" />
<orderEntry type="library" name="joml-1.9.24" level="project" /> <orderEntry type="library" name="snakeyaml-1.9" level="project" />
</component> </component>
</module> </module>

View File

@ -0,0 +1,152 @@
<component name="ArtifactManager">
<artifact type="jar" name="Helium-Engine:jar">
<output-path>$PROJECT_DIR$/out/artifacts/Helium_Engine_jar</output-path>
<root id="archive" name="Helium-Engine.jar">
<element id="module-output" name="Helium-Engine" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/joml-1.9.24.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-egl.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lz4.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nfd.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-par.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-sse.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-stb.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vma.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-bgfx.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-cuda.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-glfw.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-jawt.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-llvm.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lmdb.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-meow.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-odbc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opus.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-yoga.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-zstd.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-assimp.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nanovg.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openal.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opencl.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengl.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openvr.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyfd.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tootle.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vulkan.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-xxhash.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nuklear.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-shaderc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyexr.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-jemalloc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengles.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-remotery.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-rpmalloc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-libdivide.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-egl-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-egl-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lz4-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lz4-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nfd-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nfd-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-par-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-par-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-sse-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-sse-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-stb-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-stb-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vma-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vma-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-bgfx-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-bgfx-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-cuda-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-cuda-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-glfw-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-glfw-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-jawt-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-jawt-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-llvm-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-llvm-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lmdb-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lmdb-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-meow-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-meow-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-odbc-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-odbc-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opus-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opus-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-yoga-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-yoga-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-zstd-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-zstd-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-assimp-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-assimp-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nanovg-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nanovg-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openal-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openal-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opencl-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opencl-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengl-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengl-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openvr-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openvr-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyfd-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyfd-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tootle-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tootle-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vulkan-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vulkan-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-xxhash-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-xxhash-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nuklear-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nuklear-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-shaderc-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-shaderc-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyexr-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyexr-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-jemalloc-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-jemalloc-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengles-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengles-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-remotery-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-remotery-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-rpmalloc-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-rpmalloc-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-libdivide-javadoc.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-libdivide-sources.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lz4-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nfd-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-par-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-sse-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-stb-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vma-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-bgfx-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-glfw-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-llvm-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-lmdb-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-meow-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opus-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-yoga-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-zstd-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-assimp-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nanovg-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openal-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengl-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-openvr-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyfd-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tootle-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-vulkan-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-xxhash-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-nuklear-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-shaderc-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-tinyexr-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-jemalloc-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-opengles-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-remotery-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-rpmalloc-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Downloads/lwjgl-release-3.2.3-custom/lwjgl-libdivide-natives-macos.jar" path-in-jar="/" />
</root>
</artifact>
</component>

View File

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="snakeyaml-1.9">
<CLASSES>
<root url="jar://$USER_HOME$/Downloads/snakeyaml-1.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

BIN
resources/models/bunny.stl Normal file

Binary file not shown.

200007
resources/models/dragon.obj Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
type: color
vertices:
-
vertex:
- -20
- -0.5000001
- 20
texture:
- 0
- 0
color:
- 0
- 0
- 1
-
vertex:
- -20
- -0.5000001
- -20
texture:
- 0
- 1
color:
- 0
- 0
- 1
-
vertex:
- 20
- -0.5000001
- -20
texture:
- 1
- 1
color:
- 1
- 0
- 1
-
vertex:
- 20
- -0.5000001
- 20
texture:
- 1
- 0
color:
- 1
- 0
- 1
cull:
- 0
- 1
- 3
- 3
- 1
- 2
texture: "resources/textures/thonk.png"

7
src/Game.java Normal file
View File

@ -0,0 +1,7 @@
public interface Game {
void setup() throws Exception;
void loop() throws Exception;
void close() throws Exception;
void run() throws Exception;
}

193
src/Test.java Normal file
View File

@ -0,0 +1,193 @@
import org.hl.engine.graphics.*;
import org.hl.engine.io.Display;
import org.hl.engine.io.Input;
import org.hl.engine.math.lalg.Vector3f;
import org.hl.engine.math.lalg.Vector2f;
import org.hl.engine.objects.FirstPersonCamera;
import org.hl.engine.objects.GameObject;
import org.hl.engine.objects.ThirdPersonCamera;
import org.hl.engine.utils.FileUtils;
import org.lwjgl.glfw.GLFW;
import java.io.IOException;
public class Test implements Game {
// Defining original parts of the game
public final static int WIDTH = 1280, HEIGHT = 760;
public final String windowName = "Game!";
public Display display;
public Input i;
public Renderer renderer;
public Shader shader;
public boolean lockToggle = false;
public GameObject cubeObject = new GameObject(new Mesh(new Vertex[] {
//Back face
new Vertex(new Vector3f(-0.5f, 0.5f, -0.5f), new Vector2f(0.0f, 0.0f)),
new Vertex(new Vector3f(-0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, -0.5f, -0.5f), new Vector2f(1.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, 0.5f, -0.5f), new Vector2f(1.0f, 0.0f)),
//Front face
new Vertex(new Vector3f(-0.5f, 0.5f, 0.5f), new Vector2f(0.0f, 0.0f)),
new Vertex(new Vector3f(-0.5f, -0.5f, 0.5f), new Vector2f(0.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, -0.5f, 0.5f), new Vector2f(1.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, 0.5f, 0.5f), new Vector2f(1.0f, 0.0f)),
//Right face
new Vertex(new Vector3f( 0.5f, 0.5f, -0.5f), new Vector2f(0.0f, 0.0f)),
new Vertex(new Vector3f( 0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, -0.5f, 0.5f), new Vector2f(1.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, 0.5f, 0.5f), new Vector2f(1.0f, 0.0f)),
//Left face
new Vertex(new Vector3f(-0.5f, 0.5f, -0.5f), new Vector2f(0.0f, 0.0f)),
new Vertex(new Vector3f(-0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 1.0f)),
new Vertex(new Vector3f(-0.5f, -0.5f, 0.5f), new Vector2f(1.0f, 1.0f)),
new Vertex(new Vector3f(-0.5f, 0.5f, 0.5f), new Vector2f(1.0f, 0.0f)),
//Top face
new Vertex(new Vector3f(-0.5f, 0.5f, 0.5f), new Vector2f(0.0f, 0.0f)),
new Vertex(new Vector3f(-0.5f, 0.5f, -0.5f), new Vector2f(0.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, 0.5f, -0.5f), new Vector2f(1.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, 0.5f, 0.5f), new Vector2f(1.0f, 0.0f)),
//Bottom face
new Vertex(new Vector3f(-0.5f, -0.5f, 0.5f), new Vector2f(0.0f, 0.0f)),
new Vertex(new Vector3f(-0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, -0.5f, -0.5f), new Vector2f(1.0f, 1.0f)),
new Vertex(new Vector3f( 0.5f, -0.5f, 0.5f), new Vector2f(1.0f, 0.0f)),
}, new int[] {
//Back face
0, 1, 3,
3, 1, 2,
//Front face
4, 5, 7,
7, 5, 6,
//Right face
8, 9, 11,
11, 9, 10,
//Left face
12, 13, 15,
15, 13, 14,
//Top face
16, 17, 19,
19, 17, 18,
//Bottom face
20, 21, 23,
23, 21, 22
}, new Material(new Texture("resources/textures/b.png")), "texture"), new Vector3f(0, 0, 0 ), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1));
public GameObject planeObject = new GameObject("resources/objects/plane.mesh", new Vector3f(0, 0, 0 ), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1));
public GameObject dragonObject = new GameObject("resources/models/dragon.obj", "resources/textures/b.png", new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1));
public ThirdPersonCamera camera = new ThirdPersonCamera(new Vector3f(0, 0, 5), new Vector3f(0, 0, 0), cubeObject, 0.5f, 5, 0.1f, 12f, true, true, true);
// public FirstPersonCamera camera = new FirstPersonCamera(new Vector3f(0, 0, 5), new Vector3f(0, 0, 0), 0.1f, 0.15f);
public Test() throws Exception {
}
public void run() throws Exception {
setup();
while (!(display.shouldClose())) {
loop();
}
close();
}
public void loop() throws Exception {
//First updating
int frames = display.update();
display.setWindowName(display.getWindowName().substring(0, 4) + " (Frames : " + frames + ")");
if (display.isLocked()) {
camera.standardKeybindUpdate();
}
if (i.buttonPress(GLFW.GLFW_MOUSE_BUTTON_LEFT)) {
if (!lockToggle) {
lockToggle = true;
display.mouseState(true);
}
} else if (i.isKeyDown(GLFW.GLFW_KEY_ESCAPE)) {
lockToggle = false;
display.mouseState(lockToggle);
}
i.reset();
// Now Render!
// rendering the cube and plane
renderer.renderMesh(cubeObject, camera);
renderer.renderMesh(planeObject, camera);
renderer.renderMesh(dragonObject, camera);
//swap buffers so the new one will appear
display.reset();
}
public void setup() throws Exception {
//First, set up the display
display = new Display(WIDTH, HEIGHT, windowName, 70, 0.1f, 1000f);
display.create();
// Open the shaders
shader = new Shader(Shader.VERTEXSHADER, Shader.FRAGSHADER);
// Set up the renderer
renderer = new Renderer(display, shader);
// Changing the background color
display.setBackgroundColor(0.53f, .81f, 0.92f);
// Creating / displaying the cube and plane
planeObject.create();
cubeObject.create();
dragonObject.create();
// Creating the shader
shader.create();
// Creating the input
i = new Input(display);
// Creating the camera
camera.create(i);
}
public void close() {
// Removing everything
display.destroy();
shader.destroy();
cubeObject.destroy();
planeObject.destroy();
dragonObject.destroy();
}
public static void main(String[] args) throws Exception {
//Running
new Test().run();
}
}

View File

@ -12,12 +12,21 @@ import java.nio.IntBuffer;
public class Mesh { public class Mesh {
private Vertex[] vertices; private Vertex[] vertices;
private int[] indices; private int[] indices;
private int vertexArrayObject, positionBufferObject, indicesBufferObject, colorBufferObject; private int vertexArrayObject, positionBufferObject, indicesBufferObject, colorBufferObject, textureBufferObject;
private Material material;
private boolean type;
// A group of vertices combined based on the indexes // A group of vertices combined based on the indexes
public Mesh(Vertex[] vertices, int[] indices) { public Mesh(Vertex[] vertices, int[] indices, Material material, String type) throws Exception {
this.vertices = vertices; this.vertices = vertices;
this.indices = indices; this.indices = indices;
this.material = material;
if (!type.equals("texture") && !type.equals("color")) {
throw new Exception("Type must be either texture or color. ");
}
this.type = type.equals("texture");
} }
// Destroy the mesh // Destroy the mesh
@ -108,4 +117,12 @@ public class Mesh {
return bufferID; return bufferID;
} }
public boolean isType() {
return type;
}
public void setMaterial(Material material) {
this.material = material;
}
} }

View File

@ -0,0 +1,61 @@
package org.hl.engine.graphics;
import org.hl.engine.math.lalg.Vector2f;
import org.hl.engine.math.lalg.Vector3f;
import org.lwjgl.assimp.*;
public class ModelLoader {
public static Mesh loadModel(String path, String texture) throws Exception {
AIScene scene = Assimp.aiImportFile(path, Assimp.aiProcess_JoinIdenticalVertices | Assimp.aiProcess_Triangulate);
if (scene == null) {
throw new Exception("Couldn't load model at " + path);
}
AIMesh mesh = AIMesh.create(scene.mMeshes().get(0));
int vertexCount = mesh.mNumVertices();
AIVector3D.Buffer vertices = mesh.mVertices();
AIVector3D.Buffer normals = mesh.mNormals();
Vertex[] vertexList = new Vertex[vertexCount];
for (int i = 0; i < vertexCount; i ++) {
AIVector3D vertex = vertices.get(i);
Vector3f engineVertex = new Vector3f(vertex.x(), vertex.y(), vertex.z());
AIVector3D normal = normals.get(i);
Vector3f engineNormal = new Vector3f(normal.x(), normal.y(), normal.z());
Vector2f meshTextureCoord = new Vector2f(0, 0);
if (mesh.mNumUVComponents().get(0) != 0) {
AIVector3D tex = mesh.mTextureCoords(0).get(i);
meshTextureCoord.setX(tex.x());
meshTextureCoord.setY(tex.y());
}
vertexList[i] = new Vertex(engineVertex, meshTextureCoord, engineNormal);
}
int faceCount = mesh.mNumFaces();
AIFace.Buffer indices = mesh.mFaces();
int[] indicesList = new int[faceCount*3];
for (int i = 0; i < faceCount; i ++) {
AIFace face = indices.get(i);
indicesList[i * 3 + 0] = face.mIndices().get(0);
indicesList[i * 3 + 1] = face.mIndices().get(1);
indicesList[i * 3 + 2] = face.mIndices().get(2);
}
return new Mesh(vertexList, indicesList, new Material(new Texture(texture)), "texture");
}
}

View File

@ -1,5 +1,9 @@
package org.hl.engine.graphics; package org.hl.engine.graphics;
import org.hl.engine.io.Display;
import org.hl.engine.math.lalg.Matrix4f;
import org.hl.engine.objects.Camera;
import org.hl.engine.objects.GameObject;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15; import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL30; import org.lwjgl.opengl.GL30;
@ -12,8 +16,7 @@ public class Renderer {
this.shader = shader; this.shader = shader;
} }
public void renderMesh(GameObject object, Camera camera) {
public void renderMesh(Mesh mesh) {
// Renders the mesh by drawing it using triangles (least complicated) // Renders the mesh by drawing it using triangles (least complicated)
GL30.glBindVertexArray(mesh.getVertexArrayObject()); GL30.glBindVertexArray(mesh.getVertexArrayObject());
@ -23,7 +26,12 @@ public class Renderer {
shader.bind(); shader.bind();
GL11.glDrawElements(GL11.GL_TRIANGLES, mesh.getIndices().length, GL11.GL_UNSIGNED_INT, 0); shader.setUniform("type", object.getMesh().isType());
shader.setUniform("projection", display.getProjectionMatrix());
shader.setUniform("view", Matrix4f.view(camera.getPosition(), camera.getRotation()));
shader.setUniform("model", Matrix4f.transform(object.getPosition(), object.getRotation(), object.getScale()));
GL11.glDrawElements(GL11.GL_TRIANGLES, object.getMesh().getIndices().length, GL11.GL_UNSIGNED_INT, 0);
shader.unbind(); shader.unbind();
GL30.glDisableVertexAttribArray(0); GL30.glDisableVertexAttribArray(0);

View File

@ -6,12 +6,33 @@ public class Vertex {
// Just a vertex // Just a vertex
private Vector3f position; private Vector3f position, normal;
private Vector3f color; private Vector3f color;
private Vector2f textureCoords;
private boolean type;
public Vertex(Vector3f position, Vector2f textureCoords) {
this.position = position;
this.textureCoords = textureCoords;
this.color = new Vector3f(1, 1, 1);
}
public Vertex(Vector3f position, Vector2f textureCoords, Vector3f normal) {
this.position = position;
this.textureCoords = textureCoords;
this.normal = normal;
this.color = new Vector3f(1, 1, 1);
}
public Vertex(Vector3f position, Vector3f color) { public Vertex(Vector3f position, Vector3f color) {
this.position = position; this.position = position;
this.color = color; this.color = color;
this.textureCoords = new Vector2f(0, 0);
}
public Vertex(Vector3f position, Vector3f color, Vector2f textureCoords) {
this.position = position;
this.color = color;
} }
public Vector3f getPosition() { public Vector3f getPosition() {
@ -21,4 +42,16 @@ public class Vertex {
public Vector3f getColor() { public Vector3f getColor() {
return color; return color;
} }
public Vector2f getTextureCoords() {
return textureCoords;
}
public boolean isType() {
return type;
}
public Vector3f getNormal() {
return normal;
}
} }

View File

@ -26,7 +26,12 @@ public class Display {
private int savedPosY; private int savedPosY;
private int savedWidth; private int savedWidth;
private int savedHeight; private int savedHeight;
private Matrix4f projection;
private boolean isLocked;
private double[] cursorX = new double[1];
private double[] cursorY = new double[1];
private double[] enabledCursorX = new double[1];
private double[] enabledCursorY = new double[1];
@ -86,6 +91,26 @@ public class Display {
} }
} }
public void mouseState(boolean lock) {
if (lock != isLocked) {
if (lock) {
glfwGetCursorPos(window, enabledCursorX, enabledCursorY);
glfwSetCursorPos(window, cursorX[0], cursorY[0]);
isLocked = lock;
glfwSetInputMode(window, GLFW_CURSOR, lock ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL);
} else {
glfwGetCursorPos(window, cursorX, cursorY);
isLocked = lock;
glfwSetInputMode(window, GLFW_CURSOR, lock ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL);
glfwSetCursorPos(window, enabledCursorX[0], enabledCursorY[0]);
}
}
}
public boolean isLocked() {
return isLocked;
}
// resized getter // resized getter
public boolean isResized() { public boolean isResized() {
@ -101,9 +126,13 @@ public class Display {
System.err.println("Failed to initialize GLFW! "); System.err.println("Failed to initialize GLFW! ");
System.exit(1); System.exit(1);
} }
if(System.getProperty("os.name").contains("Mac")) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
} else {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
}
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL11.GL_TRUE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL11.GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
@ -122,6 +151,8 @@ public class Display {
windowYPos[0] = (videoMode.height() - this.height ) / 2; windowYPos[0] = (videoMode.height() - this.height ) / 2;
glfwSetWindowPos(window, windowXPos[0], windowYPos[0]); glfwSetWindowPos(window, windowXPos[0], windowYPos[0]);
glfwSetCursorPos(window, 0, 0);
// Graphics // Graphics
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
@ -209,4 +240,8 @@ public class Display {
public void setBackgroundColor(float r, float g, float b) { public void setBackgroundColor(float r, float g, float b) {
background.setVector(r, g, b); background.setVector(r, g, b);
} }
public void reset() {
swapBuffers();
}
} }

View File

@ -1,44 +0,0 @@
package org.hl.engine.math;
public class Vector3f {
private float x;
private float y;
private float z;
// Just a vector if you know what I mean
public Vector3f (float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public void setVector(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public float getZ() {
return z;
}
public void setZ(float z) {
this.z = z;
}
}

View File

@ -0,0 +1,196 @@
package org.hl.engine.math.lalg;
public class Matrix4f {
public static final int SIZE = 4;
private float[][] elements = new float[SIZE][SIZE];
public Matrix4f() {
}
public Matrix4f(float[][] values) {
this.elements = values;
}
public static Matrix4f identity() {
float[][] identityArray = {
{1 , 0 , 0 , 0},
{0 , 1 , 0 , 0},
{0 , 0 , 1 , 0},
{0 , 0 , 0 , 1}
};
return new Matrix4f(identityArray);
}
public static Matrix4f zeroes() {
float[][] zeroMatrix = {
{0 , 0 , 0 , 0},
{0 , 0 , 0 , 0},
{0 , 0 , 0 , 0},
{0 , 0 , 0 , 0}
};
return new Matrix4f(zeroMatrix);
}
public static Matrix4f translate(Vector3f translate) {
Matrix4f result = Matrix4f.identity();
result.set(3, 0, translate.getX());
result.set(3, 1, translate.getY());
result.set(3, 2, translate.getZ());
return result;
}
public static Matrix4f flip(Matrix4f matrix) {
Matrix4f flippedMatrix = matrix;
for (int i = 0; i < SIZE; i ++) {
for (int j = 0; j < SIZE; j ++ ) {
flippedMatrix.set(i, j, matrix.get(j, i));
}
}
return flippedMatrix;
}
// This one doesn't work
/* public static Matrix4f rotate(float angle, Vector3f axis) {
float cos = (float)Math.cos(Math.toDegrees(angle));
float sin = (float)Math.sin(Math.toDegrees(angle));
float C = 1 - cos;
float x = axis.getX();
float y = axis.getY();
float z = axis.getZ();
float[][] rotArray = {
{cos + x*x*C , x*y*C - z*sin , x*z*C + y*sin , 0},
{y*z*C + z*sin , cos + y*y*C , y*z*C - x*sin , 0},
{z*x*C-y*sin , z*y*C + x*sin , cos + z*z*C , 0},
{0 , 0 , 0 , 1}
};
return new Matrix4f(rotArray);
} */
public static Matrix4f rotate(float angle, Vector3f axis) {
Matrix4f result = Matrix4f.identity();
float cos = (float) Math.cos(Math.toRadians(angle));
float sin = (float) Math.sin(Math.toRadians(angle));
float C = 1 - cos;
result.set(0, 0, cos + axis.getX() * axis.getX() * C);
result.set(0, 1, axis.getX() * axis.getY() * C - axis.getZ() * sin);
result.set(0, 2, axis.getX() * axis.getZ() * C + axis.getY() * sin);
result.set(1, 0, axis.getY() * axis.getX() * C + axis.getZ() * sin);
result.set(1, 1, cos + axis.getY() * axis.getY() * C);
result.set(1, 2, axis.getY() * axis.getZ() * C - axis.getX() * sin);
result.set(2, 0, axis.getZ() * axis.getX() * C - axis.getY() * sin);
result.set(2, 1, axis.getZ() * axis.getY() * C + axis.getX() * sin);
result.set(2, 2, cos + axis.getZ() * axis.getZ() * C);
return result;
}
public static Matrix4f scale(Vector3f scaleVec) {
Matrix4f result = Matrix4f.identity();
result.set(0, 0, scaleVec.getX());
result.set(1, 1, scaleVec.getY());
result.set(2, 2, scaleVec.getZ());
return result;
}
public static Matrix4f projection( float fov, float aspectRatio, float near, float far) {
Matrix4f result = Matrix4f.identity();
float tan = (float)Math.tan(Math.toRadians(fov / 2));
float range = far - near;
result.set(0, 0, 1.0f / (aspectRatio * tan));
result.set(1, 1, 1.0f / tan);
result.set(2, 2, -((far + near) / range));
result.set(3, 2, -1.0f);
result.set(2, 3, -(2.0f*far*near/range));
result.set(3, 3, 0f);
return result;
}
public static Matrix4f view(Vector3f position, Vector3f rotation) {
Vector3f negative = new Vector3f(-position.getX(), -position.getY(), -position.getZ());
Matrix4f translationMatrix = Matrix4f.translate(negative);
Matrix4f rotationXMatrix = Matrix4f.rotate(-rotation.getX(), new Vector3f(1, 0, 0));
Matrix4f rotationYMatrix = Matrix4f.rotate(-rotation.getY(), new Vector3f(0, 1, 0));
Matrix4f rotationZMatrix = Matrix4f.rotate(-rotation.getZ(), new Vector3f(0, 0, 1));
Matrix4f rotMat = Matrix4f.multiply(rotationZMatrix, Matrix4f.multiply(rotationXMatrix, rotationYMatrix));
return Matrix4f.multiply(rotMat, translationMatrix);
}
public static Matrix4f multiply(Matrix4f first, Matrix4f second) {
Matrix4f result = Matrix4f.zeroes();
for (int i = 0; i < SIZE; i ++ ) {
for (int j = 0; j < SIZE; j ++) {
result.set(i, j,
first.get(0, i) * second.get(j, 0) +
first.get(1, i) * second.get(j, 1) +
first.get(2, i) * second.get(j, 2) +
first.get(3, i) * second.get(j, 3)
);
}
}
return result;
}
public float get(int x, int y) {
return elements[x][y];
}
public void set(int x, int y, float value) {
elements[x][y] = value;
}
public float[][] getAll() {
return elements;
}
public static Matrix4f transform(Vector3f position, Vector3f rotation, Vector3f scale) {
Matrix4f translationMatrix = Matrix4f.translate(position);
Matrix4f rotationXMatrix = Matrix4f.rotate(rotation.getX(), new Vector3f(1, 0, 0));
Matrix4f rotationYMatrix = Matrix4f.rotate(rotation.getY(), new Vector3f(0, 1, 0));
Matrix4f rotationZMatrix = Matrix4f.rotate(rotation.getZ(), new Vector3f(0, 0, 1));
Matrix4f scaleMatrix = Matrix4f.scale(scale);
Matrix4f rotMat = Matrix4f.multiply(rotationXMatrix, Matrix4f.multiply(rotationYMatrix, rotationZMatrix));
return Matrix4f.multiply(translationMatrix, Matrix4f.multiply(rotMat, scaleMatrix));
}
public float[] convertTo1D() {
float[] returnedArray = new float[SIZE*SIZE];
int sizeOfRow = elements[0].length;
for (int i = 0; i < elements.length; i ++) {
for (int j = 0; j < sizeOfRow; j ++) {
returnedArray[i*SIZE + j] = elements[i][j];
}
}
return returnedArray;
}
}

View File

@ -0,0 +1,95 @@
package org.hl.engine.math.lalg;
import java.util.Objects;
public class Vector2f {
private float x;
private float y;
// Just a vector if you know what I mean
public Vector2f (float x, float y) {
this.x = x;
this.y = y;
}
public void setVector(float x, float y) {
this.x = x;
this.y = y;
}
public static Vector2f add(Vector2f first, Vector2f second) {
return new Vector2f(first.getX() + second.getX(), first.getY() + second.getY());
}
public static Vector2f sub(Vector2f first, Vector2f second) {
return new Vector2f(first.getX() - second.getX(), first.getY() - second.getY());
}
public static Vector2f mul(Vector2f first, Vector2f second) {
return new Vector2f(first.getX() * second.getX(), first.getY() * second.getY());
}
public static Vector2f div(Vector2f first, Vector2f second) {
return new Vector2f(first.getX() / second.getX(), first.getY() / second.getY());
}
public static float dot(Vector2f first, Vector2f second) {
return first.getX()*second.getX() + first.getY()*second.getY();
}
public static float magnitude(Vector2f vector) {
return (float)Math.sqrt(vector.getX()*vector.getX() + vector.getY()*vector.getY());
}
public static Vector2f normalize(Vector2f vector) {
float len = Vector2f.magnitude(vector);
return Vector2f.div(vector, new Vector2f(len, len));
}
public static Vector2f scale(Vector2f vector, float scalar) {
return new Vector2f(vector.getX()*scalar, vector.getY()*scalar);
}
public static Vector2f projection(Vector2f projecting, Vector2f projectedOnto) {
return Vector2f.scale(projectedOnto, ( Vector2f.dot(projecting, projectedOnto) / Vector2f.dot(projectedOnto, projectedOnto) ));
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vector2f vector2f = (Vector2f) o;
return Float.compare(vector2f.getX(), getX()) == 0 &&
Float.compare(vector2f.getY(), getY()) == 0;
}
@Override
public int hashCode() {
return Objects.hash(getX(), getY());
}
@Override
public String toString() {
return "Vector2f{" +
"x=" + x +
", y=" + y +
'}';
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
}

View File

@ -0,0 +1,107 @@
package org.hl.engine.math;
import java.util.Objects;
public class Vector3f {
private float x;
private float y;
private float z;
// Just a vector if you know what I mean
public Vector3f (float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public void setVector(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public static Vector3f add(Vector3f first, Vector3f second) {
return new Vector3f(first.getX() + second.getX(), first.getY() + second.getY(), first.getZ() + second.getZ());
}
public static Vector3f sub(Vector3f first, Vector3f second) {
return new Vector3f(first.getX() - second.getX(), first.getY() - second.getY(), first.getZ() - second.getZ());
}
public static Vector3f mul(Vector3f first, Vector3f second) {
return new Vector3f(first.getX() * second.getX(), first.getY() * second.getY(), first.getZ() * second.getZ());
}
public static Vector3f div(Vector3f first, Vector3f second) {
return new Vector3f(first.getX() / second.getX(), first.getY() / second.getY(), first.getZ() / second.getZ());
}
public static float dot(Vector3f first, Vector3f second) {
return first.getX()*second.getX() + first.getY()*second.getY() + first.getZ()*second.getZ();
}
public static float magnitude(Vector3f vector) {
return (float)Math.sqrt(vector.getX()*vector.getX() + vector.getY()*vector.getY() + vector.getZ()*vector.getZ());
}
public static Vector3f normalize(Vector3f vector) {
float len = Vector3f.magnitude(vector);
return Vector3f.div(vector, new Vector3f(len, len, len));
}
public static Vector3f scale(Vector3f vector, float scalar) {
return new Vector3f(vector.getX()*scalar, vector.getY()*scalar, vector.getZ()*scalar);
}
public static Vector3f projection(Vector3f projecting, Vector3f projectedOnto) {
return Vector3f.scale(projectedOnto, ( Vector3f.dot(projecting, projectedOnto) / Vector3f.dot(projectedOnto, projectedOnto) ));
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vector3f vector3f = (Vector3f) o;
return Float.compare(vector3f.getX(), getX()) == 0 &&
Float.compare(vector3f.getY(), getY()) == 0 &&
Float.compare(vector3f.getZ(), getZ()) == 0;
}
@Override
public int hashCode() {
return Objects.hash(getX(), getY(), getZ());
}
@Override
public String toString() {
return "Vector3f{" +
"x=" + x +
", y=" + y +
", z=" + z +
'}';
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public float getZ() {
return z;
}
public void setZ(float z) {
this.z = z;
}
}

View File

@ -0,0 +1,126 @@
package org.hl.engine.math.lalg;
import java.util.Objects;
public class Vector4f {
private float x;
private float y;
private float z;
private float a;
// Just a vector if you know what I mean
public Vector4f (float x, float y, float z, float a) {
this.x = x;
this.y = y;
this.z = z;
this.a = a;
}
public void setVector(float x, float y, float z, float a) {
this.x = x;
this.y = y;
this.z = z;
this.a = a;
}
public void add(float x, float y, float z, float a) {
this.x += x;
this.y += y;
this.z += z;
this.a += a;
}
public static Vector4f add(Vector4f first, Vector4f second) {
return new Vector4f(first.getX() + second.getX(), first.getY() + second.getY(), first.getZ() + second.getZ(), first.getA() + second.getA());
}
public static Vector4f sub(Vector4f first, Vector4f second) {
return new Vector4f(first.getX() - second.getX(), first.getY() - second.getY(), first.getZ() - second.getZ(), first.getA() - second.getA());
}
public static Vector4f mul(Vector4f first, Vector4f second) {
return new Vector4f(first.getX() * second.getX(), first.getY() * second.getY(), first.getZ() * second.getZ(), first.getA() * second.getA());
}
public static Vector4f div(Vector4f first, Vector4f second) {
return new Vector4f(first.getX() / second.getX(), first.getY() / second.getY(), first.getZ() / second.getZ(), first.getA() / second.getA());
}
public static float dot(Vector4f first, Vector4f second) {
return first.getX()*second.getX() + first.getY()*second.getY() + first.getZ()*second.getZ() + first.getA()*second.getA();
}
public static float magnitude(Vector4f vector) {
return (float)Math.sqrt(vector.getX()*vector.getX() + vector.getY()*vector.getY() + vector.getZ()*vector.getZ() + vector.getA()*vector.getA());
}
public static Vector4f normalize(Vector4f vector) {
float len = Vector4f.magnitude(vector);
return Vector4f.div(vector, new Vector4f(len, len, len, len));
}
public static Vector4f scale(Vector4f vector, float scalar) {
return new Vector4f(vector.getX()*scalar, vector.getY()*scalar, vector.getZ()*scalar, vector.getA()*scalar);
}
public static Vector4f projection(Vector4f projecting, Vector4f projectedOnto) {
return Vector4f.scale(projectedOnto, ( Vector4f.dot(projecting, projectedOnto) / Vector4f.dot(projectedOnto, projectedOnto) ));
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vector4f vector4f = (Vector4f) o;
return Float.compare(vector4f.getX(), getX()) == 0 &&
Float.compare(vector4f.getY(), getY()) == 0 &&
Float.compare(vector4f.getZ(), getZ()) == 0 &&
Float.compare(vector4f.getA(), getA()) == 0;
}
@Override
public int hashCode() {
return Objects.hash(getX(), getY(), getZ(), getA());
}
@Override
public String toString() {
return "Vector4f{" +
"x=" + x +
", y=" + y +
", z=" + z +
", a=" + a +
'}';
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public float getZ() {
return z;
}
public void setZ(float z) {
this.z = z;
}
public float getA() {
return a;
}
public void setA(float a) {
this.a = a;
}
}

View File

@ -0,0 +1,43 @@
package org.hl.engine.objects;
import org.hl.engine.math.lalg.Vector3f;
public class Camera {
private Vector3f position;
private Vector3f rotation;
public Camera(Vector3f position, Vector3f rotation) {
this.position = position;
this.rotation = rotation;
}
public Vector3f getPosition() {
return position;
}
public void setPosition(Vector3f position) throws Exception {
this.position = position;
}
public Vector3f getRotation() {
return rotation;
}
public void setRotation(Vector3f rotation) throws Exception {
this.rotation = rotation;
}
public void movePosition(float offsetX, float offsetY, float offsetZ) {
if(offsetZ != 0) {
position.setZ(position.getZ() + (float) Math.cos(Math.toRadians(rotation.getY())) * offsetZ);
position.setX(position.getX() + (float) Math.sin(Math.toRadians(rotation.getY())) * -offsetZ);
}
if(offsetX != 0) {
position.setX(position.getX() + (float) Math.cos(Math.toRadians(rotation.getY())) * offsetX) ;
position.setZ(position.getZ() + (float) Math.sin(Math.toRadians(rotation.getY())) * offsetX);
}
position.setY(position.getY() + offsetY);
}
}

View File

@ -0,0 +1,96 @@
package org.hl.engine.objects;
import org.hl.engine.io.Display;
import org.hl.engine.io.Input;
import org.hl.engine.math.lalg.Vector3f;
import org.lwjgl.glfw.GLFW;
import java.util.Vector;
public class FirstPersonCamera extends Camera {
private Input i;
private float moveSpeed;
private float sensitivity;
private double oldMouseX, oldMouseY = 0;
private double newMouseX, newMouseY;
public FirstPersonCamera(Vector3f position, Vector3f rotation, float moveSpeed, float sensitivity) {
super(position, rotation);
this.moveSpeed = moveSpeed;
this.sensitivity = sensitivity;
}
public void create(Input i) {
this.i = i;
}
public void standardKeybindUpdate () throws Exception {
newMouseX = i.getMouseX();
newMouseY = i.getMouseY();
Vector3f cameraPos = getPosition();
Vector3f cameraRot = getRotation();
float dx = (float) ((float)newMouseX - oldMouseX);
float dy = (float) ((float)newMouseY - oldMouseY);
oldMouseX = newMouseX;
oldMouseY = newMouseY;
cameraRot = Vector3f.add(cameraRot, new Vector3f(dy*sensitivity, dx*sensitivity, 0));
if (i.isKeyDown(GLFW.GLFW_KEY_A)) movePosition(-moveSpeed, 0, 0);
if (i.isKeyDown(GLFW.GLFW_KEY_D)) movePosition(moveSpeed, 0, 0);
if (i.isKeyDown(GLFW.GLFW_KEY_W)) movePosition(0, 0, -moveSpeed);
if (i.isKeyDown(GLFW.GLFW_KEY_S)) movePosition(0, 0, moveSpeed);
if (i.isKeyDown(GLFW.GLFW_KEY_SPACE)) movePosition(0, moveSpeed, 0);
if (i.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) movePosition(0, -moveSpeed, 0);
if (i.keyPress(GLFW.GLFW_KEY_R)) moveSpeed = 3*moveSpeed;
if (i.keyReleased(GLFW.GLFW_KEY_R)) moveSpeed = moveSpeed / 3;
setRotation(cameraRot);
setPosition(cameraPos);
i.reset();
}
public void moveForward() {
movePosition(0, 0, -moveSpeed);
}
public void moveBackward() {
movePosition(0, 0, moveSpeed);
}
public void moveLeft() {
movePosition(-moveSpeed, 0, 0);
}
public void moveRight() {
movePosition(moveSpeed, 0, 0);
}
public void moveUp() {
movePosition(0, moveSpeed, 0);
}
public void moveDown() {
movePosition(0, -moveSpeed, 0);
}
public float getMoveSpeed() {
return moveSpeed;
}
public void setMoveSpeed(float moveSpeed) {
this.moveSpeed = moveSpeed;
}
public void rotateCamera(float dx, float dy) throws Exception {
Vector3f cameraRot = getRotation();
cameraRot = Vector3f.add(cameraRot, new Vector3f(dy*sensitivity, dx*sensitivity, 0));
setRotation(cameraRot);
}
}

View File

@ -0,0 +1,19 @@
package org.hl.engine.objects;
import org.hl.engine.math.lalg.Vector3f;
public class FixedCamera extends Camera {
public FixedCamera(Vector3f position, Vector3f rotation) {
super(position, rotation);
}
@Override
public void setRotation(Vector3f rotation) throws Exception {
throw new Exception("You cannot rotate a fixed camera! ");
}
@Override
public void setPosition(Vector3f rotation) throws Exception {
throw new Exception("You cannot move a fixed camera! ");
}
}

View File

@ -0,0 +1,128 @@
package org.hl.engine.objects;
import org.hl.engine.graphics.*;
import org.hl.engine.math.lalg.Vector2f;
import org.hl.engine.math.lalg.Vector3f;
import org.hl.engine.objects.yloaders.YMesh;
import org.hl.engine.objects.yloaders.YPoint;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Objects;
public class GameObject {
private Vector3f position, rotation, scale;
private Mesh mesh;
public GameObject(Mesh mesh, Vector3f position, Vector3f rotation, Vector3f scale) {
this.position = position;
this.rotation = rotation;
this.scale = scale;
this.mesh = mesh;
}
public GameObject(String meshFileName, Vector3f position, Vector3f rotation, Vector3f scale) throws Exception {
if (!meshFileName.endsWith(".mesh")) { throw new Exception("Wrong file type! "); }
Yaml yaml = new Yaml();
FileInputStream inputStream = new FileInputStream(meshFileName);
YMesh yMesh = yaml.loadAs(inputStream, YMesh.class);
Integer[] cull = yMesh.getCull().toArray(new Integer[0]);
String type = yMesh.getType();
String texture = yMesh.getTexture();
YPoint[] vertices = yMesh.getVertices().toArray(new YPoint[0]);
Vertex[] meshFormat = new Vertex[vertices.length];
for (YPoint vertex : vertices) {
if (vertex.getVertex().size() != 3) {
throw new Exception("Incorrect number of coordinates. ");
}
if (vertex.getColor().size() != 3) {
throw new Exception("Incorrect number of color values. ");
}
if (vertex.getTexture().size() != 2) {
throw new Exception("Incorrect number of texture coordinates. ");
}
}
if (!type.equals("texture") && !type.equals("color")) {
throw new Exception("Incorrect type. Type can only be texture or color. ");
}
for (int i = 0; i < vertices.length; i ++) {
Vertex value = new Vertex(
new Vector3f(vertices[i].getVertex().get(0), vertices[i].getVertex().get(1), vertices[i].getVertex().get(2)),
new Vector3f(vertices[i].getColor().get(0), vertices[i].getColor().get(1), vertices[i].getColor().get(2)),
new Vector2f(vertices[i].getTexture().get(0), vertices[i].getTexture().get(1)));
meshFormat[i] = value;
}
int[] indices = new int[cull.length];
for (int j = 0; j < cull.length; j ++) {
indices[j] = cull[j];
}
this.mesh = new Mesh(meshFormat, indices, new Material(new Texture(texture)), type);
this.position = position;
this.scale = scale;
this.rotation = rotation;
}
public GameObject(String meshFileName, String texturePath, Vector3f position, Vector3f rotation, Vector3f scale) throws Exception {
this.mesh = ModelLoader.loadModel(meshFileName, texturePath);
this.position = position;
this.scale = scale;
this.rotation = rotation;
}
public void create() {
mesh.create();
}
public void destroy() {
mesh.destroy();
}
public Vector3f getPosition() {
return position;
}
public Vector3f getRotation() {
return rotation;
}
public Vector3f getScale() {
return scale;
}
public Mesh getMesh() {
return mesh;
}
public void setPosition(Vector3f position) {
this.position = position;
}
public void setRotation(Vector3f rotation) {
this.rotation = rotation;
}
public void setScale(Vector3f scale) {
this.scale = scale;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GameObject that = (GameObject) o;
return Objects.equals(getPosition(), that.getPosition()) &&
Objects.equals(getRotation(), that.getRotation()) &&
Objects.equals(getScale(), that.getScale()) &&
Objects.equals(getMesh(), that.getMesh());
}
@Override
public int hashCode() {
return Objects.hash(getPosition(), getRotation(), getScale(), getMesh());
}
}

View File

@ -0,0 +1,173 @@
package org.hl.engine.objects;
import org.hl.engine.io.Input;
import org.hl.engine.math.lalg.Vector3f;
import org.lwjgl.glfw.GLFW;
public class ThirdPersonCamera extends Camera {
private GameObject object;
private Input i;
private float distance;
private float angle = 0;
private float horizAngle = 0;
private float vertAngle = 0;
private float moveSpeed;
private float sensitivity;
private float near;
private float far;
private boolean clickToMove;
private boolean clickToZoom;
private boolean zoomEnabled;
private double oldMouseX, oldMouseY = 0;
private double newMouseX, newMouseY;
public ThirdPersonCamera(Vector3f position, Vector3f rotation, GameObject object, float sensitivity, float distance, float near, float far, boolean clickToMove, boolean clickToZoom, boolean zoomEnabled) {
super(position, rotation);
this.object = object;
this.sensitivity = sensitivity;
this.clickToMove = clickToMove;
this.clickToZoom = clickToZoom;
this.zoomEnabled = zoomEnabled;
this.near = near;
this.far = far;
this.distance = distance;
}
public void create(Input i) throws Exception {
this.i = i;
setRotation(getRotation());
setPosition(getPosition());
}
public void standardKeybindUpdate() throws Exception {
newMouseX = i.getMouseX();
newMouseY = i.getMouseY();
float dx = (float) ((float)newMouseX - oldMouseX);
float dy = (float) ((float)newMouseY - oldMouseY);
if (clickToMove && clickToZoom) {
if (i.isButtonDown(GLFW.GLFW_MOUSE_BUTTON_LEFT)) {
vertAngle -= dy * sensitivity;
horizAngle += dx * sensitivity;
}
if (i.isButtonDown(GLFW.GLFW_MOUSE_BUTTON_RIGHT) && zoomEnabled) {
if (distance > 0) {
distance += dy * sensitivity;
}
else {
distance = near;
}
if (distance > far) {
distance = far;
}
}
} else if (clickToMove) {
if (i.isButtonDown(GLFW.GLFW_MOUSE_BUTTON_LEFT)) {
vertAngle -= dy * sensitivity;
horizAngle += dx * sensitivity;
}
if (zoomEnabled) {
if (distance > 0) {
distance += dy * sensitivity;
} else {
distance = near;
}
if (distance > far) {
distance = far;
}
}
} else if (clickToZoom) {
vertAngle -= dy * sensitivity;
horizAngle += dx * sensitivity;
if (i.isButtonDown(GLFW.GLFW_MOUSE_BUTTON_RIGHT) && zoomEnabled) {
if (distance > 0) {
distance += dy * sensitivity;
} else {
distance = near;
}
if (distance > far) {
distance = far;
}
}
} else {
vertAngle -= dy * sensitivity;
horizAngle += dx * sensitivity;
if (zoomEnabled) {
if (distance > 0) {
distance += dy * sensitivity;
} else {
distance = near;
}
if (distance > far) {
distance = far;
}
}
}
oldMouseX = newMouseX;
oldMouseY = newMouseY;
float horizDistance = (float) (distance * Math.cos(Math.toRadians(vertAngle)));
float vertDistance = (float) (distance * Math.sin(Math.toRadians(vertAngle)));
float xOffset = (float) (horizDistance * Math.sin(Math.toRadians(-horizAngle)));
float zOffset = (float) (horizDistance * Math.cos(Math.toRadians(-horizAngle)));
setPosition(new Vector3f(object.getPosition().getX() + xOffset, object.getPosition().getY() - vertDistance, object.getPosition().getZ() + zOffset));
setRotation(new Vector3f(-vertAngle, horizAngle,0));
i.reset();
}
public void movePosition (float dy, float dx) throws Exception {
vertAngle -= dy * sensitivity;
horizAngle += dx * sensitivity;
float horizDistance = (float) (distance * Math.cos(Math.toRadians(vertAngle)));
float vertDistance = (float) (distance * Math.sin(Math.toRadians(vertAngle)));
float xOffset = (float) (horizDistance * Math.sin(Math.toRadians(-horizAngle)));
float zOffset = (float) (horizDistance * Math.cos(Math.toRadians(-horizAngle)));
setPosition(new Vector3f(object.getPosition().getX() + xOffset, object.getPosition().getY() - vertDistance, object.getPosition().getZ() + zOffset));
setRotation(new Vector3f(-vertAngle, horizAngle,0));
}
public void zoom (float dy) throws Exception {
if (zoomEnabled) {
if (distance > 0) {
distance += dy * sensitivity;
} else {
distance = near;
}
if (distance > far) {
distance = far;
}
}
float horizDistance = (float) (distance * Math.cos(Math.toRadians(vertAngle)));
float vertDistance = (float) (distance * Math.sin(Math.toRadians(vertAngle)));
float xOffset = (float) (horizDistance * Math.sin(Math.toRadians(-horizAngle)));
float zOffset = (float) (horizDistance * Math.cos(Math.toRadians(-horizAngle)));
setPosition(new Vector3f(object.getPosition().getX() + xOffset, object.getPosition().getY() - vertDistance, object.getPosition().getZ() + zOffset));
setRotation(new Vector3f(-vertAngle, horizAngle,0));
}
}

View File

@ -0,0 +1,9 @@
package org.hl.engine.objects;
import org.hl.engine.math.lalg.Vector3f;
public class TopDownCamera extends FixedCamera {
public TopDownCamera(Vector3f position) {
super(position, new Vector3f(90, 0, 0));
}
}

View File

@ -0,0 +1,42 @@
package org.hl.engine.objects.yloaders ;
import java.util.ArrayList;
public class YMesh implements java.io.Serializable {
private String type;
private ArrayList<YPoint> vertices;
private ArrayList<Integer> cull;
private String texture;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public ArrayList<YPoint> getVertices() {
return vertices;
}
public void setVertices(ArrayList<YPoint> vertices) {
this.vertices = vertices;
}
public ArrayList<Integer> getCull() {
return cull;
}
public void setCull(ArrayList<Integer> cull) {
this.cull = cull;
}
public String getTexture() {
return texture;
}
public void setTexture(String texture) {
this.texture = texture;
}
}

View File

@ -0,0 +1,33 @@
package org.hl.engine.objects.yloaders;
import java.util.ArrayList;
public class YPoint implements java.io.Serializable {
private ArrayList<Float> vertex;
private ArrayList<Float> texture;
private ArrayList<Float> color;
public ArrayList<Float> getVertex() {
return vertex;
}
public void setVertex(ArrayList<Float> vertex) {
this.vertex = vertex;
}
public ArrayList<Float> getTexture() {
return texture;
}
public void setTexture(ArrayList<Float> texture) {
this.texture = texture;
}
public ArrayList<Float> getColor() {
return color;
}
public void setColor(ArrayList<Float> color) {
this.color = color;
}
}

View File

@ -1,9 +1,15 @@
#version 330 core #version 330 core
in vec3 passColor; in vec3 passColor;
in vec2 passTextureCoord;
uniform int type;
out vec4 outColor; out vec4 outColor;
void main() { void main() {
if (type == 1) {
outColor = texture(tex, passTextureCoord);
} else {
outColor = vec4(passColor, 1.0); outColor = vec4(passColor, 1.0);
} }
}

View File

@ -2,10 +2,24 @@
layout(location = 0) in vec3 position; layout(location = 0) in vec3 position;
layout(location = 1) in vec3 color; layout(location = 1) in vec3 color;
layout(location = 2) in vec2 textureCoord;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform int type;
layout(location = 0) out vec3 passColor;
layout(location = 1) out vec2 passTextureCoord;
layout(location = 2) out int passType;
out vec3 passColor; out vec3 passColor;
void main() { void main() {
gl_Position = vec4(position, 1.0); gl_Position = projection * view * model * vec4(position, 1.0);
passColor = color; passColor = color;
passType = type;
passTextureCoord = textureCoord;
} }