Compare commits
20 Commits
22.2.0.0-a
...
master
Author | SHA1 | Date |
---|---|---|
Natty | 0ece56a871 | |
Natty | 88c966974c | |
Natty | 29e9f42bde | |
Natty | 54ade78b1d | |
Natty | 6ba1dfa2cb | |
Natty | 27f4882fcc | |
Natty | d178a303bd | |
Natty | c1c248be87 | |
Natty | cbab0a8153 | |
Natty | 142c9fbed7 | |
Natty | a9719ede37 | |
Natty | 12c9e6f8e9 | |
Natty | 81064b6bdf | |
Natty | c580104d81 | |
Natty | 61ce682270 | |
Natty | 635df54849 | |
Natty | 085454d941 | |
Natty | 1aaee9b17a | |
Natty | 0a3026e3d9 | |
Natty | 3082e88be9 |
|
@ -0,0 +1,35 @@
|
|||
SOFTWARE LICENSING
|
||||
==================
|
||||
While PlutoEngine is licensed under the MIT license, see
|
||||
individual libraries and their license requirements.
|
||||
|
||||
MEDIA LICENSING
|
||||
===============
|
||||
This repository contains some first-party media files, such as audio,
|
||||
fonts and images. See "Third party media within this repository" for
|
||||
exceptions.
|
||||
|
||||
Unless specified otherwise:
|
||||
This content may be freely used under the https://creativecommons.org/publicdomain/zero/1.0/ license
|
||||
as long as it is used within an application based on PlutoEngine and does not misrepresent
|
||||
PlutoEngine or any of the PlutoEngine authors and does not remove this restriction.
|
||||
|
||||
OR
|
||||
|
||||
This content may be freely used under the https://creativecommons.org/licenses/by-nd/4.0/ license
|
||||
with no further restrictions.
|
||||
|
||||
OR
|
||||
|
||||
This content may be freely used under the https://creativecommons.org/licenses/by-sa/4.0/ license
|
||||
with no further restrictions.
|
||||
|
||||
|
||||
|
||||
Third party media within this repository
|
||||
========================================
|
||||
file "engine-demo/jsr-clone/mods/tefek.srclone/default/sound/game_st.ogg":
|
||||
"Safehouse" by Selulance
|
||||
https://www.youtube.com/watch?v=-kNx6sqReFk
|
||||
|
||||
Licensed under https://creativecommons.org/licenses/by/3.0/
|
|
@ -1,50 +0,0 @@
|
|||
## Features targeted for 22.3.0.0-alpha.0
|
||||
* `[PlutoRuntime,PlutoCore]` **Initial implementation of the layer system (formerly known as "stage")**
|
||||
* A "layer", in this context, is a set of assets bound together
|
||||
by programming logic.
|
||||
Layer switching and asset management are handled by the engine.
|
||||
* Layers can be stacked on top of each other and run sequentially
|
||||
from bottom to top
|
||||
* Upon layer switch
|
||||
1. Unload unused assets
|
||||
2. Load new assets
|
||||
* Provide multiple means of layer switching
|
||||
* Two modes with the initial release, asynchronous switching will come at a later date
|
||||
1. Instant switch
|
||||
* Assets will be loaded and unloaded synchronously
|
||||
* The layer switch will happen in one frame
|
||||
2. Deferred switch
|
||||
* The layer will continue running until all assets load
|
||||
* Assets will load synchronously, but at a slower pace
|
||||
to avoid frame stutter
|
||||
* Automated asset loading
|
||||
* All asset management will eventually be handled by `PlutoCore`
|
||||
* This includes audio clips, textures, sprites
|
||||
* Add a common interface for all assets
|
||||
* Let the stage system handle audio playback
|
||||
* This API should be as neutral as possible and avoid steering towards
|
||||
game-only use
|
||||
* The stage manager should be relatively low-overhead and allow multiple
|
||||
instances
|
||||
* Allow stages to be inherited from, creating a stack-like structure
|
||||
* `[PlutoAudio]` Integrate the Audio API with the Stage API
|
||||
|
||||
## Features targeted for an unspecified future release
|
||||
* `[PlutoSpritesheet]` Expanded capabilities
|
||||
* Support for 9-slice rendering
|
||||
* Support for animated sprite rendering
|
||||
* Support for multidirectional sprite rendering
|
||||
* A spritesheet skeleton editor
|
||||
|
||||
* `[PlutoRuntime]`
|
||||
* Asynchronous switch
|
||||
* Assets will be loaded in asynchronously, where applicable
|
||||
* Falls back to deferred switching for synchronous loading,
|
||||
such as OpenGL texture upload
|
||||
|
||||
* `[PlutoGUI]` A fully-fledged GUI engine
|
||||
* Improve font-rendering capabilities
|
||||
* Subpixel rendering support [?]
|
||||
* Reimplement support for bitmap fonts
|
||||
* Improve upon the support of thread-local Pluto instances
|
||||
* The long term goal is to allow an unlimited amount of Pluto applications at any given time
|
76
README.md
76
README.md
|
@ -19,13 +19,13 @@ repositories {
|
|||
|
||||
maven {
|
||||
name = "Vega"
|
||||
url = uri("https://vega.botdiril.com/")
|
||||
url = uri("https://vega.botdiril.com/releases")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation group: "org.plutoengine", name: "plutocore", version: "22.2.0.0-alpha.0"
|
||||
implementation group: "org.plutoengine", name: "plutocore", version: "22.3.0.0-alpha.0"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -36,15 +36,21 @@ repositories {
|
|||
|
||||
maven {
|
||||
name = "Vega"
|
||||
url = uri("https://vega.botdiril.com/")
|
||||
url = uri("https://vega.botdiril.com/releases")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.plutoengine", "plutocore", "22.2.0.0-alpha.0")
|
||||
implementation("org.plutoengine", "plutocore", "22.3.0.0-alpha.0")
|
||||
}
|
||||
```
|
||||
|
||||
### Licensing
|
||||
|
||||
The code of PlutoEngine is licensed under the MIT license.
|
||||
|
||||
See [LICENSING_INFO](https://github.com/493msi/plutoengine/blob/master/LICENSING_INFO.txt) for further information.
|
||||
|
||||
### Versioning
|
||||
|
||||
All submodules share a version number for simplicity reasons.
|
||||
|
@ -64,56 +70,26 @@ version numbers.*
|
|||
|
||||
## Usability status of submodules
|
||||
|
||||
Keep in mind PlutoEngine is in alpha and all features are tentative.
|
||||
The following list simply provides an overview of how likely breaking changes are to occur.
|
||||
|
||||
### Safe submodules
|
||||
* **PlutoCore** - Stable
|
||||
* **PlutoFramebuffer** - Stable
|
||||
* **PlutoMesher** - Stable
|
||||
* **PlutoShader** - Stable
|
||||
* **PlutoTexture** - Stable
|
||||
* **PlutoSpriteSheet** - Stable, some features are unfinished
|
||||
* **PlutoDisplay** - Stable, collision API nowhere near completion
|
||||
* **PlutoUSS2** - Stable
|
||||
* **PlutoLib** - Mostly stable
|
||||
* **PlutoCore** - Stable
|
||||
* **PlutoSpritesheet** - Stable, some features are unfinished
|
||||
* **PlutoDisplay** - Stable, collision API nowhere near completion
|
||||
* **PlutoLib** - Mostly stable
|
||||
* **PlutoRender** - Stable
|
||||
* **PlutoRuntime** - Mostly stable
|
||||
|
||||
### Unstable submodules
|
||||
* **PlutoGUI** - Recently rewritten, the API is highly unstable
|
||||
* **PlutoRuntime** - Somewhat tentative, the module API has been rewritten and might contain bugs
|
||||
* **PlutoAudio** - Somewhat usable, unfinished
|
||||
* **PlutoAudio** - Very tentative, work in progress
|
||||
* **PlutoGUI** - Recently rewritten, the API is highly unstable, work in progress
|
||||
|
||||
### Extensions
|
||||
* **PlutoUSS2** - Stable
|
||||
* **PlutoGameObject** - Stable
|
||||
|
||||
|
||||
## Current priorities
|
||||
|
||||
See `NEXT_RELEASE_DRAFT.md` for details.
|
||||
|
||||
### To be fixed
|
||||
[ *Features or bugs that should be fixed **ASAP*** ]
|
||||
* Implement gradient variation support for Libra fills
|
||||
* Improve code quality in PlutoGUI
|
||||
|
||||
### Very high priority
|
||||
[ *Implemented in the current release.* ]
|
||||
* Improve image loading capabilities, possibly rewrite PlutoLib#TPL
|
||||
|
||||
### High priority
|
||||
[ *Implemented in the next release.* ]
|
||||
* Finish PlutoAudio
|
||||
* Depends on the stage system
|
||||
* Expand upon the Color API
|
||||
* Color mixing and blending
|
||||
* Color transformation
|
||||
* High-performance serialization
|
||||
|
||||
### Normal priority
|
||||
[ *Planned for an upcoming release.* ]
|
||||
* The collision system for PlutoStatic
|
||||
|
||||
### Low priority
|
||||
[ *Items not required immediately, planned to be implemented eventually.* ]
|
||||
* Allow multiple running instances of Pluto
|
||||
* Alternatively, if this deems too difficult to implement,
|
||||
prohibit the creation of more than one instance per JVM to avoid issues
|
||||
* A networking API
|
||||
* Re-add support for external mod jars to the ModLoader
|
||||
* This feature requires a full rewrite and possibly a complete overhaul
|
||||
* Mods should have limited execution levels, for example restricted file access
|
||||
or disabled native library loading (this is probably not possible)
|
||||
See [issues](https://github.com/493msi/plutoengine/issues) for details.
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
## 22.3.0.0-alpha.1
|
||||
* `[PlutoComponent]` Removing components using a token should have the same semantics as removing individual components
|
||||
* `[PlutoComponent]` Made the addition and removal of components hookable before mount events are fired
|
||||
|
||||
## 22.3.0.0-alpha.0
|
||||
* `[SDK]` **Combined `PlutoFramebuffer`, `PlutoMesher`, `PlutoShader` and `PlutoTexture`
|
||||
into `PlutoRender`**
|
||||
* Unified the package structure
|
||||
* `[SDK]` **Added the license text to all source files to conform with the MIT license requirements**
|
||||
* `plutoengine-demos/jsr-clone` Added a proper license file for the music
|
||||
|
||||
## 22.2.0.0-alpha.2
|
||||
* `[SDK]` The libraries now always reference natives for all architectures
|
||||
* `[SDK]` Replaced `NEXT_RELEASE_DRAFT.md` with [an issue tracker](https://github.com/493msi/plutoengine/issues)
|
||||
* `[PlutoAudio]` **Partial rewrite and support for managed sound effects**
|
||||
* `plutoengine-demos/` **Added the `jsr-clone` demo**
|
||||
* `[PlutoSpritesheet]` Renamed `TemporalSprite#getSideCount` to `getFrameCount`
|
||||
|
||||
## 22.2.0.0-alpha.1
|
||||
* `[PlutoGUI]` **Added support for bitmap fonts**
|
||||
* `[PlutoGUI]` Generalized the font renderer API
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
package org.plutoengine
|
||||
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.gradle.api.JavaVersion
|
||||
|
||||
object Versions {
|
||||
const val lwjglVersion = "3.3.1"
|
||||
val lwjglNatives = when (OperatingSystem.current()) {
|
||||
OperatingSystem.LINUX -> "natives-linux"
|
||||
OperatingSystem.WINDOWS -> "natives-windows"
|
||||
else -> throw Error("Unsupported operating system!")
|
||||
}
|
||||
val lwjglNatives = listOf(
|
||||
"natives-linux-arm64",
|
||||
"natives-linux-arm32",
|
||||
"natives-linux",
|
||||
"natives-macos-arm64",
|
||||
"natives-macos",
|
||||
"natives-windows-arm64",
|
||||
"natives-windows",
|
||||
"natives-windows-x86"
|
||||
)
|
||||
|
||||
const val jomlVersion = "1.10.2"
|
||||
const val jomlPrimitivesVersion = "1.10.0"
|
||||
|
@ -17,7 +21,7 @@ object Versions {
|
|||
const val steamworks4jServerVersion = "1.8.0"
|
||||
|
||||
const val versionYear = 22
|
||||
const val versionMajor = 2
|
||||
const val versionMajor = 3
|
||||
const val versionMinor = 0
|
||||
const val versionPatch = 0
|
||||
|
||||
|
|
|
@ -26,3 +26,6 @@
|
|||
|
||||
/bin
|
||||
/*/bin
|
||||
|
||||
/out
|
||||
/*/out
|
|
@ -45,7 +45,7 @@ subprojects {
|
|||
repositories {
|
||||
maven {
|
||||
name = "Vega"
|
||||
url = uri("https://vega.botdiril.com/")
|
||||
url = uri("https://vega.botdiril.com/releases")
|
||||
credentials {
|
||||
val vegaUsername: String? by project
|
||||
val vegaPassword: String? by project
|
||||
|
|
|
@ -12,5 +12,7 @@ dependencies {
|
|||
|
||||
api("org.lwjgl:lwjgl-openal")
|
||||
|
||||
runtimeOnly("org.lwjgl", "lwjgl-openal", classifier = Versions.lwjglNatives)
|
||||
org.plutoengine.Versions.lwjglNatives.forEach {
|
||||
runtimeOnly("org.lwjgl", "lwjgl-openal", classifier = it)
|
||||
}
|
||||
}
|
|
@ -1,8 +1,29 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
import org.lwjgl.stb.STBVorbis;
|
||||
import org.lwjgl.stb.STBVorbisInfo;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.plutoengine.buffer.BufferHelper;
|
||||
import org.plutoengine.logger.Logger;
|
||||
|
@ -10,8 +31,6 @@ import org.plutoengine.logger.SmartSeverity;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
|
@ -23,7 +42,7 @@ public class AudioLoader
|
|||
* medium-sized audio files, however it is discouraged to use such a track
|
||||
* in multiple audio sources at once due to the cost of seeking.
|
||||
*/
|
||||
public static ISeekableAudioTrack loadMemoryDecoded(Path path)
|
||||
public static SeekableTrack loadMemoryDecoded(Path path)
|
||||
{
|
||||
|
||||
Logger.logf(SmartSeverity.AUDIO_PLUS, "Loading audio file: %s\n", path);
|
||||
|
@ -45,13 +64,13 @@ public class AudioLoader
|
|||
* for from-memory PCM streaming. Good for frequently used small audio
|
||||
* files.
|
||||
*/
|
||||
public static ISeekableAudioTrack loadMemoryPCM(Path path)
|
||||
public static RandomAccessClip loadMemoryPCM(Path path)
|
||||
{
|
||||
Logger.logf(SmartSeverity.AUDIO_PLUS, "Loading audio file: %s\n", path);
|
||||
|
||||
try
|
||||
{
|
||||
return new MemoryPCMTrack(path);
|
||||
return new MemoryPCMClip(path);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -61,7 +80,7 @@ public class AudioLoader
|
|||
}
|
||||
}
|
||||
|
||||
private static ByteBuffer loadIntoMemory(Path path) throws IOException
|
||||
static ByteBuffer loadIntoMemory(Path path) throws IOException
|
||||
{
|
||||
var size = Files.size(path);
|
||||
|
||||
|
@ -73,203 +92,4 @@ public class AudioLoader
|
|||
return BufferHelper.readToByteBuffer(path, readData);
|
||||
}
|
||||
|
||||
private abstract static class StreamableTrack implements IAudioStream
|
||||
{
|
||||
protected int channels;
|
||||
protected int sampleRate;
|
||||
|
||||
@Override
|
||||
public int getChannels()
|
||||
{
|
||||
return this.channels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSampleRate()
|
||||
{
|
||||
return this.sampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
private abstract static class SeekableTrack extends StreamableTrack implements ISeekableAudioTrack
|
||||
{
|
||||
protected int samplesLength;
|
||||
|
||||
@Override
|
||||
public int getLengthInSamples()
|
||||
{
|
||||
return this.samplesLength;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MemoryPCMTrack extends SeekableTrack
|
||||
{
|
||||
private final ShortBuffer pcmAudio;
|
||||
|
||||
private int sampleOffset = 0;
|
||||
|
||||
private MemoryPCMTrack(Path path) throws IOException
|
||||
{
|
||||
long handle = MemoryUtil.NULL;
|
||||
ByteBuffer audioBytes = null;
|
||||
|
||||
try (MemoryStack stack = MemoryStack.stackPush())
|
||||
{
|
||||
audioBytes = loadIntoMemory(path);
|
||||
|
||||
IntBuffer error = stack.mallocInt(1);
|
||||
handle = STBVorbis.stb_vorbis_open_memory(audioBytes, error, null);
|
||||
|
||||
if (handle == MemoryUtil.NULL)
|
||||
{
|
||||
this.close();
|
||||
throw new IOException(String.format("Failed to load '%s', error code %d.\n", path, error.get(0)));
|
||||
}
|
||||
|
||||
STBVorbisInfo info = STBVorbisInfo.malloc(stack);
|
||||
STBVorbis.stb_vorbis_get_info(handle, info);
|
||||
|
||||
this.channels = info.channels();
|
||||
this.sampleRate = info.sample_rate();
|
||||
|
||||
// Downmix to mono, SOUNDS HORRIBLE
|
||||
//
|
||||
// this.channels = 1;
|
||||
// this.samplesLength = STBVorbis.stb_vorbis_stream_length_in_samples(handle) * this.channels;
|
||||
// this.pcmAudio = MemoryUtil.memAllocShort(this.samplesLength);
|
||||
// var ptr = stack.pointers(this.pcmAudio);
|
||||
// STBVorbis.stb_vorbis_get_samples_short(handle, ptr, this.samplesLength);
|
||||
|
||||
this.samplesLength = STBVorbis.stb_vorbis_stream_length_in_samples(handle) * this.channels;
|
||||
this.pcmAudio = MemoryUtil.memAllocShort(this.samplesLength);
|
||||
STBVorbis.stb_vorbis_get_samples_short_interleaved(handle, this.channels, this.pcmAudio);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
this.close();
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MemoryUtil.memFree(audioBytes);
|
||||
|
||||
if (handle != MemoryUtil.NULL)
|
||||
{
|
||||
STBVorbis.stb_vorbis_close(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seek(int sampleIndex)
|
||||
{
|
||||
this.sampleOffset = sampleIndex * this.getChannels();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getSamples(ShortBuffer pcm)
|
||||
{
|
||||
this.pcmAudio.limit(Math.min(this.sampleOffset + pcm.remaining(), this.pcmAudio.capacity()));
|
||||
int read = this.pcmAudio.remaining();
|
||||
pcm.put(this.pcmAudio);
|
||||
this.sampleOffset += read;
|
||||
pcm.clear();
|
||||
|
||||
return read / this.getChannels();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSampleOffset()
|
||||
{
|
||||
return this.sampleOffset / this.getChannels();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
MemoryUtil.memFree(this.pcmAudio);
|
||||
}
|
||||
}
|
||||
|
||||
public static class MemoryDecodedVorbisTrack extends SeekableTrack
|
||||
{
|
||||
protected long handle;
|
||||
|
||||
private final ByteBuffer encodedAudio;
|
||||
|
||||
private MemoryDecodedVorbisTrack(Path path) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
this.encodedAudio = loadIntoMemory(path);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
this.close();
|
||||
throw e;
|
||||
}
|
||||
|
||||
try (MemoryStack stack = MemoryStack.stackPush())
|
||||
{
|
||||
IntBuffer error = stack.mallocInt(1);
|
||||
this.handle = STBVorbis.stb_vorbis_open_memory(this.encodedAudio, error, null);
|
||||
|
||||
if (this.handle == MemoryUtil.NULL)
|
||||
{
|
||||
this.close();
|
||||
throw new IOException(String.format("Failed to load '%s', error code %d.\n", path, error.get(0)));
|
||||
}
|
||||
|
||||
STBVorbisInfo info = STBVorbisInfo.malloc(stack);
|
||||
STBVorbis.stb_vorbis_get_info(this.handle, info);
|
||||
|
||||
this.channels = info.channels();
|
||||
this.sampleRate = info.sample_rate();
|
||||
|
||||
}
|
||||
|
||||
this.samplesLength = STBVorbis.stb_vorbis_stream_length_in_samples(this.handle);
|
||||
|
||||
Logger.logf(SmartSeverity.AUDIO, """
|
||||
\tSample rate:\t%d
|
||||
\t\tChannels:\t%d
|
||||
\t\tSamples:\t%d
|
||||
%n""", this.sampleRate, this.channels, this.samplesLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getSamples(ShortBuffer pcm)
|
||||
{
|
||||
if (this.handle == MemoryUtil.NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return STBVorbis.stb_vorbis_get_samples_short_interleaved(this.handle, this.getChannels(), pcm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
MemoryUtil.memFree(this.encodedAudio);
|
||||
|
||||
if (this.handle != MemoryUtil.NULL)
|
||||
{
|
||||
STBVorbis.stb_vorbis_close(this.handle);
|
||||
this.handle = MemoryUtil.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void seek(int sampleIndex)
|
||||
{
|
||||
STBVorbis.stb_vorbis_seek(this.handle, sampleIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSampleOffset()
|
||||
{
|
||||
return STBVorbis.stb_vorbis_get_sample_offset(this.handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
public abstract class ClipTrack extends SeekableTrack implements ISeekableClip
|
||||
{
|
||||
protected int samplesLength;
|
||||
|
||||
@Override
|
||||
public int getLengthInSamples()
|
||||
{
|
||||
return this.samplesLength;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
public interface IAudio extends AutoCloseable
|
||||
{
|
||||
int getSampleRate();
|
||||
|
||||
int getChannels();
|
||||
|
||||
void close();
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package org.plutoengine.audio;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public interface IAudioStream extends AutoCloseable
|
||||
{
|
||||
int getSamples(ShortBuffer pcm);
|
||||
|
||||
int getSampleRate();
|
||||
|
||||
int getChannels();
|
||||
|
||||
void close();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
public interface IClip extends IAudio
|
||||
{
|
||||
int getLengthInSamples();
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public interface IRandomAccessAudio extends IClip
|
||||
{
|
||||
int getSamples(ShortBuffer pcm, int offset, boolean loopRead);
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.plutoengine.audio;
|
||||
|
||||
public interface ISeekableAudioTrack extends IAudioStream
|
||||
{
|
||||
int getSampleOffset();
|
||||
|
||||
int getLengthInSamples();
|
||||
|
||||
default void skip(int sampleCount)
|
||||
{
|
||||
this.seek(Math.min(Math.max(0, this.getSampleOffset() + sampleCount), this.getLengthInSamples()));
|
||||
}
|
||||
|
||||
default void skipTo(float offset0to1)
|
||||
{
|
||||
this.seek(Math.round(this.getLengthInSamples() * offset0to1));
|
||||
}
|
||||
|
||||
default void rewind()
|
||||
{
|
||||
this.seek(0);
|
||||
}
|
||||
|
||||
void seek(int sampleIndex);
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
public interface ISeekableClip extends ISeekableTrack, IClip
|
||||
{
|
||||
default void skip(int sampleCount)
|
||||
{
|
||||
this.seek(Math.min(Math.max(0, this.getSampleOffset() + sampleCount), this.getLengthInSamples()));
|
||||
}
|
||||
|
||||
default void skipTo(float offset0to1)
|
||||
{
|
||||
this.seek(Math.round(this.getLengthInSamples() * offset0to1));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
public interface ISeekableTrack extends IStreamingAudio
|
||||
{
|
||||
void seek(int sampleIndex);
|
||||
|
||||
default void rewind()
|
||||
{
|
||||
this.seek(0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public interface IStreamingAudio extends IAudio
|
||||
{
|
||||
int getSamples(ShortBuffer pcm);
|
||||
|
||||
int getSampleOffset();
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
import org.lwjgl.stb.STBVorbis;
|
||||
import org.lwjgl.stb.STBVorbisInfo;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.plutoengine.logger.Logger;
|
||||
import org.plutoengine.logger.SmartSeverity;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class MemoryDecodedVorbisTrack extends ClipTrack
|
||||
{
|
||||
protected long handle;
|
||||
|
||||
private final ByteBuffer encodedAudio;
|
||||
|
||||
MemoryDecodedVorbisTrack(Path path) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
this.encodedAudio = AudioLoader.loadIntoMemory(path);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
this.close();
|
||||
throw e;
|
||||
}
|
||||
|
||||
try (MemoryStack stack = MemoryStack.stackPush())
|
||||
{
|
||||
IntBuffer error = stack.mallocInt(1);
|
||||
this.handle = STBVorbis.stb_vorbis_open_memory(this.encodedAudio, error, null);
|
||||
|
||||
if (this.handle == MemoryUtil.NULL)
|
||||
{
|
||||
this.close();
|
||||
throw new IOException(String.format("Failed to load '%s', error code %d.\n", path, error.get(0)));
|
||||
}
|
||||
|
||||
STBVorbisInfo info = STBVorbisInfo.malloc(stack);
|
||||
STBVorbis.stb_vorbis_get_info(this.handle, info);
|
||||
|
||||
this.channels = info.channels();
|
||||
this.sampleRate = info.sample_rate();
|
||||
}
|
||||
|
||||
this.samplesLength = STBVorbis.stb_vorbis_stream_length_in_samples(this.handle);
|
||||
|
||||
Logger.logf(SmartSeverity.AUDIO, """
|
||||
\tSample rate:\t%d
|
||||
\t\tChannels:\t%d
|
||||
\t\tSamples:\t%d
|
||||
%n""", this.sampleRate, this.channels, this.samplesLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getSamples(ShortBuffer pcm)
|
||||
{
|
||||
if (this.handle == MemoryUtil.NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return STBVorbis.stb_vorbis_get_samples_short_interleaved(this.handle, this.getChannels(), pcm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
MemoryUtil.memFree(this.encodedAudio);
|
||||
|
||||
if (this.handle != MemoryUtil.NULL)
|
||||
{
|
||||
STBVorbis.stb_vorbis_close(this.handle);
|
||||
this.handle = MemoryUtil.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void seek(int sampleIndex)
|
||||
{
|
||||
STBVorbis.stb_vorbis_seek(this.handle, sampleIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSampleOffset()
|
||||
{
|
||||
return STBVorbis.stb_vorbis_get_sample_offset(this.handle);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
import org.lwjgl.stb.STBVorbis;
|
||||
import org.lwjgl.stb.STBVorbisInfo;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class MemoryPCMClip extends RandomAccessClip
|
||||
{
|
||||
private final ShortBuffer pcmAudio;
|
||||
|
||||
MemoryPCMClip(Path path) throws IOException
|
||||
{
|
||||
long handle = MemoryUtil.NULL;
|
||||
ByteBuffer audioBytes = null;
|
||||
|
||||
try (MemoryStack stack = MemoryStack.stackPush())
|
||||
{
|
||||
audioBytes = AudioLoader.loadIntoMemory(path);
|
||||
|
||||
IntBuffer error = stack.mallocInt(1);
|
||||
handle = STBVorbis.stb_vorbis_open_memory(audioBytes, error, null);
|
||||
|
||||
if (handle == MemoryUtil.NULL)
|
||||
{
|
||||
this.close();
|
||||
throw new IOException(String.format("Failed to load '%s', error code %d.\n", path, error.get(0)));
|
||||
}
|
||||
|
||||
STBVorbisInfo info = STBVorbisInfo.malloc(stack);
|
||||
STBVorbis.stb_vorbis_get_info(handle, info);
|
||||
|
||||
this.channels = info.channels();
|
||||
this.sampleRate = info.sample_rate();
|
||||
|
||||
// Downmix to mono, SOUNDS HORRIBLE
|
||||
//
|
||||
// this.channels = 1;
|
||||
// this.samplesLength = STBVorbis.stb_vorbis_stream_length_in_samples(handle) * this.channels;
|
||||
// this.pcmAudio = MemoryUtil.memAllocShort(this.samplesLength);
|
||||
// var ptr = stack.pointers(this.pcmAudio);
|
||||
// STBVorbis.stb_vorbis_get_samples_short(handle, ptr, this.samplesLength);
|
||||
|
||||
this.samplesLength = STBVorbis.stb_vorbis_stream_length_in_samples(handle) * this.channels;
|
||||
this.pcmAudio = MemoryUtil.memAllocShort(this.samplesLength);
|
||||
STBVorbis.stb_vorbis_get_samples_short_interleaved(handle, this.channels, this.pcmAudio);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
this.close();
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MemoryUtil.memFree(audioBytes);
|
||||
|
||||
if (handle != MemoryUtil.NULL)
|
||||
{
|
||||
STBVorbis.stb_vorbis_close(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLengthInSamples()
|
||||
{
|
||||
return this.samplesLength / this.getChannels();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSamples(ShortBuffer pcm, int offset, boolean loopRead)
|
||||
{
|
||||
int readTotal = 0;
|
||||
int read;
|
||||
|
||||
do
|
||||
{
|
||||
int thisRemaining = this.pcmAudio.limit() - offset;
|
||||
read = Math.min(pcm.remaining() - readTotal, thisRemaining);
|
||||
pcm.put(pcm.position() + readTotal, this.pcmAudio, offset, read);
|
||||
readTotal += read;
|
||||
|
||||
offset = (offset + read) % (this.getLengthInSamples() * this.channels);
|
||||
}
|
||||
while (loopRead && pcm.limit() - readTotal > 0);
|
||||
|
||||
return readTotal / this.getChannels();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
MemoryUtil.memFree(this.pcmAudio);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
public abstract class RandomAccessClip extends Track implements IRandomAccessAudio, IClip
|
||||
{
|
||||
protected int samplesLength;
|
||||
|
||||
@Override
|
||||
public int getLengthInSamples()
|
||||
{
|
||||
return this.samplesLength;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
public abstract class SeekableTrack extends Track implements ISeekableTrack
|
||||
{
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio;
|
||||
|
||||
abstract class Track implements IAudio
|
||||
{
|
||||
protected int channels;
|
||||
protected int sampleRate;
|
||||
|
||||
@Override
|
||||
public int getChannels()
|
||||
{
|
||||
return this.channels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSampleRate()
|
||||
{
|
||||
return this.sampleRate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.lwjgl.openal.AL10;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
class AudioBuffer implements AutoCloseable
|
||||
{
|
||||
private final int id;
|
||||
private final int format;
|
||||
private final int sampleRate;
|
||||
|
||||
AudioBuffer(int id, int format, int sampleRate)
|
||||
{
|
||||
this.id = id;
|
||||
this.format = format;
|
||||
this.sampleRate = sampleRate;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void writeData(ShortBuffer data)
|
||||
{
|
||||
AL10.alBufferData(this.id, this.format, data, this.sampleRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
AL10.alDeleteBuffers(this.id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.plutoengine.audio.RandomAccessClip;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public class AudioClipSource extends AudioDoubleBufferedSource
|
||||
{
|
||||
private final RandomAccessClip clip;
|
||||
|
||||
private final boolean looping;
|
||||
|
||||
private int readHead = 0;
|
||||
|
||||
public AudioClipSource(RandomAccessClip clip, boolean looping)
|
||||
{
|
||||
super(clip);
|
||||
|
||||
this.clip = clip;
|
||||
this.looping = looping;
|
||||
}
|
||||
|
||||
public AudioClipSource(RandomAccessClip clip)
|
||||
{
|
||||
this(clip, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSamples(ShortBuffer pcmTransferBuf)
|
||||
{
|
||||
var read = this.clip.getSamples(pcmTransferBuf, this.readHead * this.channels, this.looping);
|
||||
this.readHead += read / this.channels;
|
||||
|
||||
if (this.looping)
|
||||
this.readHead %= this.clip.getLengthInSamples();
|
||||
|
||||
return read;
|
||||
}
|
||||
|
||||
public boolean isLooping()
|
||||
{
|
||||
return this.looping;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.joml.Matrix4x3f;
|
||||
import org.joml.Matrix4x3fc;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3fc;
|
||||
import org.lwjgl.openal.*;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.plutoengine.Pluto;
|
||||
import org.plutoengine.component.PlutoLocalComponent;
|
||||
import org.plutoengine.logger.Logger;
|
||||
import org.plutoengine.logger.SmartSeverity;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/**
|
||||
* @author 493msi
|
||||
*
|
||||
*/
|
||||
public class AudioContext extends PlutoLocalComponent
|
||||
{
|
||||
private long device = MemoryUtil.NULL;
|
||||
private long context = MemoryUtil.NULL;
|
||||
private ALCapabilities capabilities;
|
||||
|
||||
private Matrix4x3fc transformation;
|
||||
|
||||
AudioContext()
|
||||
{
|
||||
this.transformation = new Matrix4x3f();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMount(ComponentDependencyManager manager)
|
||||
{
|
||||
var devicePtr = ALC10.alcOpenDevice((ByteBuffer) null);
|
||||
if (devicePtr == MemoryUtil.NULL)
|
||||
{
|
||||
Logger.log(SmartSeverity.AUDIO_ERROR, "Failed to open the default audio device.");
|
||||
|
||||
// No audio device found, but the game should not crash just because we have no audio
|
||||
return;
|
||||
}
|
||||
|
||||
this.device = devicePtr;
|
||||
|
||||
var contextPtr = ALC10.alcCreateContext(devicePtr, (IntBuffer) null);
|
||||
if (contextPtr == MemoryUtil.NULL)
|
||||
{
|
||||
ALC10.alcCloseDevice(devicePtr);
|
||||
|
||||
Logger.log(SmartSeverity.AUDIO_ERROR, "Failed to create an OpenAL context.");
|
||||
|
||||
// The game should not crash just because we have no audio
|
||||
return;
|
||||
}
|
||||
|
||||
this.context = contextPtr;
|
||||
|
||||
EXTThreadLocalContext.alcSetThreadContext(contextPtr);
|
||||
|
||||
ALCCapabilities deviceCaps = ALC.createCapabilities(devicePtr);
|
||||
var alCapabilities = AL.createCapabilities(deviceCaps);
|
||||
|
||||
if (Pluto.DEBUG_MODE)
|
||||
{
|
||||
Logger.logf(SmartSeverity.AUDIO, "OpenAL10: %b\n", alCapabilities.OpenAL10);
|
||||
Logger.logf(SmartSeverity.AUDIO, "OpenAL11: %b\n", alCapabilities.OpenAL11);
|
||||
Logger.logf(SmartSeverity.AUDIO, "Distance model: %s\n", EnumDistanceModel.getByID(AL11.alGetInteger(AL11.AL_DISTANCE_MODEL)));
|
||||
}
|
||||
|
||||
this.capabilities = alCapabilities;
|
||||
|
||||
Logger.log(SmartSeverity.AUDIO_PLUS, "Audio engine started.");
|
||||
}
|
||||
|
||||
public void setTransformation(Matrix4x3fc transformation)
|
||||
{
|
||||
this.transformation = transformation;
|
||||
}
|
||||
|
||||
public Vector3fc transform(Vector3fc vector)
|
||||
{
|
||||
return this.transformation.transformPosition(vector, new Vector3f());
|
||||
}
|
||||
|
||||
public void setDistanceModel(EnumDistanceModel model)
|
||||
{
|
||||
AL10.alDistanceModel(model.getALID());
|
||||
}
|
||||
|
||||
public void setSpeedOfSound(float speedOfSound)
|
||||
{
|
||||
AL11.alSpeedOfSound(speedOfSound);
|
||||
}
|
||||
|
||||
public void setSpeed(Vector3fc speed)
|
||||
{
|
||||
var tSpeed = this.transformation.transformPosition(speed, new Vector3f());
|
||||
AL10.alListener3f(AL10.AL_VELOCITY, tSpeed.x(), tSpeed.y(), tSpeed.z());
|
||||
}
|
||||
|
||||
public void setPosition(Vector3f position)
|
||||
{
|
||||
var tPosition = this.transformation.transformPosition(position, new Vector3f());
|
||||
AL10.alListener3f(AL10.AL_POSITION, tPosition.x(), tPosition.y(), tPosition.z());
|
||||
}
|
||||
|
||||
public void setVolume(float volume)
|
||||
{
|
||||
AL10.alListenerf(AL10.AL_GAIN, volume);
|
||||
}
|
||||
|
||||
public void setOrientation(Vector3f at, Vector3f up)
|
||||
{
|
||||
float[] data = new float[6];
|
||||
data[0] = at.x;
|
||||
data[1] = at.y;
|
||||
data[2] = at.z;
|
||||
data[3] = up.x;
|
||||
data[4] = up.y;
|
||||
data[5] = up.z;
|
||||
AL10.alListenerfv(AL10.AL_ORIENTATION, data);
|
||||
}
|
||||
|
||||
public boolean isReady()
|
||||
{
|
||||
return this.capabilities != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onUnmount()
|
||||
{
|
||||
Logger.log(SmartSeverity.AUDIO_MINUS, "Shutting down the audio engine.");
|
||||
|
||||
EXTThreadLocalContext.alcSetThreadContext(MemoryUtil.NULL);
|
||||
|
||||
ALC10.alcDestroyContext(this.context);
|
||||
ALC10.alcCloseDevice(this.device);
|
||||
|
||||
this.context = MemoryUtil.NULL;
|
||||
this.device = MemoryUtil.NULL;
|
||||
this.capabilities = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnique()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.lwjgl.openal.AL10;
|
||||
import org.lwjgl.openal.SOFTDirectChannels;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.plutoengine.audio.IAudio;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
abstract class AudioDoubleBufferedSource extends AudioSource
|
||||
{
|
||||
private static final int BUFFER_SIZE_PER_CHANNEL = 8192;
|
||||
private static final int DOUBLE_BUFFER = 2;
|
||||
|
||||
protected final int format;
|
||||
|
||||
protected final int channels;
|
||||
|
||||
protected final int sampleRate;
|
||||
|
||||
private final IntBuffer bufferIDs;
|
||||
protected final Map<Integer, AudioBuffer> buffers;
|
||||
|
||||
protected final ShortBuffer pcmTransferBuf;
|
||||
|
||||
protected boolean audioBufferDepleted;
|
||||
|
||||
protected boolean closed;
|
||||
|
||||
protected AudioDoubleBufferedSource(IAudio audio)
|
||||
{
|
||||
this.format = switch (audio.getChannels()) {
|
||||
case 1 -> AL10.AL_FORMAT_MONO16;
|
||||
case 2 -> AL10.AL_FORMAT_STEREO16;
|
||||
default -> throw new UnsupportedOperationException("Unsupported number of channels: " + audio.getChannels());
|
||||
};
|
||||
|
||||
this.channels = audio.getChannels();
|
||||
this.sampleRate = audio.getSampleRate();
|
||||
|
||||
int bufferSize = audio.getChannels() * BUFFER_SIZE_PER_CHANNEL;
|
||||
|
||||
this.pcmTransferBuf = MemoryUtil.memAllocShort(bufferSize);
|
||||
|
||||
this.bufferIDs = MemoryUtil.memCallocInt(DOUBLE_BUFFER);
|
||||
AL10.alGenBuffers(this.bufferIDs);
|
||||
this.buffers = IntStream.range(0, this.bufferIDs.limit())
|
||||
.mapToObj(i -> new AudioBuffer(this.bufferIDs.get(i), this.format, this.sampleRate))
|
||||
.collect(Collectors.toMap(AudioBuffer::getID, Function.identity(), (l, r) -> l));
|
||||
|
||||
AL10.alSourcei(this.id, SOFTDirectChannels.AL_DIRECT_CHANNELS_SOFT, AL10.AL_TRUE);
|
||||
}
|
||||
|
||||
public boolean play()
|
||||
{
|
||||
if (this.closed)
|
||||
return false;
|
||||
|
||||
var state = this.getState();
|
||||
|
||||
return switch (state)
|
||||
{
|
||||
case AL10.AL_PLAYING -> true;
|
||||
case AL10.AL_PAUSED, AL10.AL_STOPPED -> super.play();
|
||||
case AL10.AL_INITIAL -> {
|
||||
this.buffers.values()
|
||||
.forEach(this::stream);
|
||||
|
||||
yield super.play();
|
||||
}
|
||||
default -> false; // Unexpected value, just say it didn't play
|
||||
};
|
||||
}
|
||||
|
||||
private void stream(AudioBuffer buffer)
|
||||
{
|
||||
if (this.audioBufferDepleted)
|
||||
return;
|
||||
|
||||
this.fillTransferBuffer();
|
||||
|
||||
if (this.audioBufferDepleted)
|
||||
return;
|
||||
|
||||
buffer.writeData(this.pcmTransferBuf);
|
||||
AL10.alSourceQueueBuffers(this.id, buffer.getID());
|
||||
}
|
||||
|
||||
private void fillTransferBuffer()
|
||||
{
|
||||
this.pcmTransferBuf.clear();
|
||||
int samplesPerChannel = this.getSamples(this.pcmTransferBuf);
|
||||
|
||||
if (samplesPerChannel < BUFFER_SIZE_PER_CHANNEL)
|
||||
{
|
||||
this.audioBufferDepleted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var samples = samplesPerChannel * this.channels;
|
||||
this.pcmTransferBuf.limit(samples);
|
||||
}
|
||||
|
||||
protected abstract int getSamples(ShortBuffer pcmTransferBuf);
|
||||
|
||||
protected List<AudioBuffer> unqueueBuffers()
|
||||
{
|
||||
int processed = AL10.alGetSourcei(this.id, AL10.AL_BUFFERS_PROCESSED);
|
||||
var unqueued = new ArrayList<AudioBuffer>(DOUBLE_BUFFER);
|
||||
|
||||
for (int i = 0; i < processed; i++)
|
||||
{
|
||||
int bufID = AL10.alSourceUnqueueBuffers(this.id);
|
||||
var buffer = this.buffers.get(bufID);
|
||||
unqueued.add(buffer);
|
||||
}
|
||||
|
||||
return unqueued;
|
||||
}
|
||||
|
||||
private int getState()
|
||||
{
|
||||
return AL10.alGetSourcei(this.id, AL10.AL_SOURCE_STATE);
|
||||
}
|
||||
|
||||
public boolean update()
|
||||
{
|
||||
if (this.isClosed())
|
||||
return false;
|
||||
|
||||
var unqueued = this.unqueueBuffers();
|
||||
unqueued.forEach(this::stream);
|
||||
|
||||
var sourceState = this.getState();
|
||||
|
||||
if (sourceState == AL10.AL_STOPPED)
|
||||
{
|
||||
if (this.audioBufferDepleted)
|
||||
return false;
|
||||
|
||||
if (unqueued.size() == DOUBLE_BUFFER)
|
||||
return super.play();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean updateOrClose()
|
||||
{
|
||||
boolean shouldClose = !this.update();
|
||||
|
||||
if (shouldClose)
|
||||
this.close();
|
||||
|
||||
return shouldClose;
|
||||
}
|
||||
|
||||
public boolean isClosed()
|
||||
{
|
||||
return this.closed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
if (this.isClosed())
|
||||
return;
|
||||
|
||||
this.closed = true;
|
||||
|
||||
this.stop();
|
||||
|
||||
this.unqueueBuffers();
|
||||
|
||||
super.close();
|
||||
|
||||
this.buffers.values()
|
||||
.forEach(AudioBuffer::close);
|
||||
|
||||
MemoryUtil.memFree(this.pcmTransferBuf);
|
||||
}
|
||||
}
|
|
@ -1,122 +1,102 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.openal.*;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.plutoengine.Pluto;
|
||||
import org.plutoengine.component.AbstractComponent;
|
||||
import org.plutoengine.component.ComponentToken;
|
||||
import org.plutoengine.component.PlutoLocalComponent;
|
||||
import org.plutoengine.logger.Logger;
|
||||
import org.plutoengine.logger.SmartSeverity;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 493msi
|
||||
*
|
||||
*/
|
||||
public class AudioEngine extends PlutoLocalComponent
|
||||
{
|
||||
private long device = MemoryUtil.NULL;
|
||||
private long context = MemoryUtil.NULL;
|
||||
private ALCapabilities capabilities;
|
||||
|
||||
public static final ComponentToken<AudioEngine> TOKEN = ComponentToken.create(AudioEngine::new);
|
||||
|
||||
private AudioContext context;
|
||||
|
||||
private final List<Pair<AudioClipSource, AudioSourceInfo>> sfx;
|
||||
|
||||
|
||||
private AudioEngine()
|
||||
{
|
||||
|
||||
this.sfx = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMount(ComponentDependencyManager manager)
|
||||
protected void onMount(AbstractComponent<PlutoLocalComponent>.ComponentDependencyManager manager)
|
||||
{
|
||||
var devicePtr = ALC10.alcOpenDevice((ByteBuffer) null);
|
||||
if (devicePtr == MemoryUtil.NULL)
|
||||
this.context = manager.declareDependency(ComponentToken.create(AudioContext::new));
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
for (var iterator = this.sfx.listIterator(); iterator.hasNext(); )
|
||||
{
|
||||
Logger.log(SmartSeverity.AUDIO_ERROR, "Failed to open the default audio device.");
|
||||
var data = iterator.next();
|
||||
var source = data.getKey();
|
||||
var info = data.getValue();
|
||||
|
||||
// No audio device found, but the game should not crash just because we have no audio
|
||||
return;
|
||||
var kaFunc = info.keepAliveFunction();
|
||||
if (kaFunc != null && !kaFunc.getAsBoolean())
|
||||
source.close();
|
||||
|
||||
var moveFunc = info.moveFunction();
|
||||
if (!source.isClosed() && moveFunc != null)
|
||||
{
|
||||
var prevPos = source.getPosition();
|
||||
var newPos = moveFunc.apply(prevPos);
|
||||
var velocity = newPos.sub(prevPos, new Vector3f());
|
||||
|
||||
source.position(this.context, newPos);
|
||||
source.velocity(this.context, velocity);
|
||||
}
|
||||
|
||||
if (source.updateOrClose())
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
this.device = devicePtr;
|
||||
|
||||
var contextPtr = ALC10.alcCreateContext(devicePtr, (IntBuffer) null);
|
||||
if (contextPtr == MemoryUtil.NULL)
|
||||
{
|
||||
ALC10.alcCloseDevice(devicePtr);
|
||||
|
||||
Logger.log(SmartSeverity.AUDIO_ERROR, "Failed to create an OpenAL context.");
|
||||
|
||||
// The game should not crash just because we have no audio
|
||||
return;
|
||||
}
|
||||
|
||||
this.context = contextPtr;
|
||||
|
||||
EXTThreadLocalContext.alcSetThreadContext(contextPtr);
|
||||
|
||||
ALCCapabilities deviceCaps = ALC.createCapabilities(devicePtr);
|
||||
var alCapabilities = AL.createCapabilities(deviceCaps);
|
||||
|
||||
if (Pluto.DEBUG_MODE)
|
||||
{
|
||||
Logger.logf(SmartSeverity.AUDIO, "OpenAL10: %b\n", alCapabilities.OpenAL10);
|
||||
Logger.logf(SmartSeverity.AUDIO, "OpenAL11: %b\n", alCapabilities.OpenAL11);
|
||||
}
|
||||
|
||||
this.capabilities = alCapabilities;
|
||||
|
||||
Logger.log(SmartSeverity.AUDIO_PLUS, "Audio engine started.");
|
||||
}
|
||||
|
||||
public void setSpeed(Vector3f speed)
|
||||
public void playSound(SoundEffect sfx)
|
||||
{
|
||||
AL10.alListener3f(AL10.AL_VELOCITY, speed.x, speed.y, speed.z);
|
||||
}
|
||||
|
||||
public void setPosition(Vector3f position)
|
||||
{
|
||||
AL10.alListener3f(AL10.AL_POSITION, position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
public void setVolume(float volume)
|
||||
{
|
||||
AL10.alListenerf(AL10.AL_GAIN, volume);
|
||||
}
|
||||
|
||||
public void setOrientation(Vector3f at, Vector3f up)
|
||||
{
|
||||
float[] data = new float[6];
|
||||
data[0] = at.x;
|
||||
data[1] = at.y;
|
||||
data[2] = at.z;
|
||||
data[3] = up.x;
|
||||
data[4] = up.y;
|
||||
data[5] = up.z;
|
||||
AL10.alListenerfv(AL10.AL_ORIENTATION, data);
|
||||
}
|
||||
|
||||
public boolean isReady()
|
||||
{
|
||||
return this.capabilities != null;
|
||||
var soundEffect = new AudioClipSource(sfx.getClip());
|
||||
soundEffect.volume(sfx.getVolume());
|
||||
soundEffect.pitch(sfx.getPitch());
|
||||
soundEffect.position(this.context, sfx.getPosition());
|
||||
soundEffect.play();
|
||||
var info = new AudioSourceInfo(sfx.getMovementMapper(), sfx.getKeepAliveFunction());
|
||||
var data = Pair.of(soundEffect, info);
|
||||
this.sfx.add(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onUnmount()
|
||||
{
|
||||
Logger.log(SmartSeverity.AUDIO_MINUS, "Shutting down the audio engine.");
|
||||
|
||||
EXTThreadLocalContext.alcSetThreadContext(MemoryUtil.NULL);
|
||||
|
||||
ALC10.alcDestroyContext(this.context);
|
||||
ALC10.alcCloseDevice(this.device);
|
||||
|
||||
this.context = MemoryUtil.NULL;
|
||||
this.device = MemoryUtil.NULL;
|
||||
this.capabilities = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,4 +104,9 @@ public class AudioEngine extends PlutoLocalComponent
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public AudioContext getContext()
|
||||
{
|
||||
return this.context;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,45 +1,97 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||
import org.joml.Vector3fc;
|
||||
import org.lwjgl.openal.AL10;
|
||||
|
||||
public abstract class AudioSource implements AutoCloseable
|
||||
{
|
||||
protected final int source;
|
||||
protected final int id;
|
||||
protected Vector3fc position;
|
||||
|
||||
protected AudioSource()
|
||||
{
|
||||
this.source = AL10.alGenSources();
|
||||
this.id = AL10.alGenSources();
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
public boolean play()
|
||||
{
|
||||
AL10.alSourcePlay(this.id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
public void pause()
|
||||
{
|
||||
AL10.alSourcePause(this.id);
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
public void stop()
|
||||
{
|
||||
AL10.alSourceStop(this.source);
|
||||
AL10.alSourceStop(this.id);
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
public void close()
|
||||
{
|
||||
this.stop();
|
||||
AL10.alDeleteSources(this.source);
|
||||
AL10.alDeleteSources(this.id);
|
||||
}
|
||||
|
||||
public void position(Vector3fc pos)
|
||||
@MustBeInvokedByOverriders
|
||||
public void position(AudioContext context, Vector3fc pos)
|
||||
{
|
||||
AL10.alSource3f(this.source, AL10.AL_POSITION, pos.x(), pos.y(), pos.z());
|
||||
this.position = pos;
|
||||
var tPos = context.transform(pos);
|
||||
AL10.alSource3f(this.id, AL10.AL_POSITION, tPos.x(), tPos.y(), tPos.z());
|
||||
}
|
||||
|
||||
public void velocity(Vector3fc velocity)
|
||||
public Vector3fc getPosition()
|
||||
{
|
||||
AL10.alSource3f(this.source, AL10.AL_VELOCITY, velocity.x(), velocity.y(), velocity.z());
|
||||
return this.position;
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
public void velocity(AudioContext context, Vector3fc velocity)
|
||||
{
|
||||
var tVelocity = context.transform(velocity);
|
||||
AL10.alSource3f(this.id, AL10.AL_VELOCITY, tVelocity.x(), tVelocity.y(), tVelocity.z());
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
public void pitch(float f)
|
||||
{
|
||||
AL10.alSourcef(this.source, AL10.AL_PITCH, f);
|
||||
AL10.alSourcef(this.id, AL10.AL_PITCH, f);
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
public void volume(float f)
|
||||
{
|
||||
AL10.alSourcef(this.source, AL10.AL_GAIN, f);
|
||||
AL10.alSourcef(this.id, AL10.AL_GAIN, f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.joml.Vector3fc;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
public record AudioSourceInfo(
|
||||
UnaryOperator<Vector3fc> moveFunction,
|
||||
BooleanSupplier keepAliveFunction
|
||||
)
|
||||
{
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.lwjgl.openal.AL10;
|
||||
import org.lwjgl.openal.SOFTDirectChannels;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.plutoengine.audio.IAudioStream;
|
||||
import org.plutoengine.audio.ISeekableAudioTrack;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public class AudioTrack extends AudioSource
|
||||
{
|
||||
private static final int BUFFER_SIZE_PER_CHANNEL = 16384;
|
||||
|
||||
private final IAudioStream track;
|
||||
|
||||
private final int format;
|
||||
|
||||
private static final int DOUBLE_BUFFER = 2;
|
||||
|
||||
private final int[] buffers;
|
||||
|
||||
private boolean closeOnFinish;
|
||||
|
||||
private final ShortBuffer pcm;
|
||||
|
||||
public AudioTrack(IAudioStream track)
|
||||
{
|
||||
this.track = track;
|
||||
|
||||
this.format = switch (track.getChannels()) {
|
||||
case 1 -> AL10.AL_FORMAT_MONO16;
|
||||
case 2 -> AL10.AL_FORMAT_STEREO16;
|
||||
default -> throw new UnsupportedOperationException("Unsupported number of channels: " + track.getChannels());
|
||||
};
|
||||
|
||||
int bufferSize = track.getChannels() * BUFFER_SIZE_PER_CHANNEL;
|
||||
|
||||
this.pcm = MemoryUtil.memAllocShort(bufferSize);
|
||||
|
||||
this.buffers = new int[DOUBLE_BUFFER];
|
||||
AL10.alGenBuffers(this.buffers);
|
||||
|
||||
AL10.alSourcei(this.source, SOFTDirectChannels.AL_DIRECT_CHANNELS_SOFT, AL10.AL_TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
AL10.alDeleteBuffers(this.buffers);
|
||||
AL10.alDeleteSources(this.source);
|
||||
|
||||
MemoryUtil.memFree(this.pcm);
|
||||
}
|
||||
|
||||
public boolean play()
|
||||
{
|
||||
if (this.track instanceof ISeekableAudioTrack seekableAudioTrack)
|
||||
seekableAudioTrack.rewind();
|
||||
|
||||
for (int buf : this.buffers)
|
||||
{
|
||||
this.stream(buf);
|
||||
}
|
||||
|
||||
AL10.alSourcePlay(this.source);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setCloseOnFinish()
|
||||
{
|
||||
this.closeOnFinish = true;
|
||||
}
|
||||
|
||||
private void stream(int buffer)
|
||||
{
|
||||
this.pcm.clear();
|
||||
int samplesPerChannel = this.track.getSamples(this.pcm);
|
||||
|
||||
if (samplesPerChannel == 0)
|
||||
return;
|
||||
|
||||
var samples = samplesPerChannel * this.track.getChannels();
|
||||
this.pcm.limit(samples);
|
||||
AL10.alBufferData(buffer, this.format, this.pcm, this.track.getSampleRate());
|
||||
AL10.alSourceQueueBuffers(this.source, buffer);
|
||||
}
|
||||
|
||||
public boolean update()
|
||||
{
|
||||
int processed = AL10.alGetSourcei(this.source, AL10.AL_BUFFERS_PROCESSED);
|
||||
|
||||
for (int i = 0; i < processed; i++)
|
||||
{
|
||||
int buffer = AL10.alSourceUnqueueBuffers(this.source);
|
||||
this.stream(buffer);
|
||||
}
|
||||
|
||||
if (AL10.alGetSourcei(this.source, AL10.AL_SOURCE_STATE) == AL10.AL_STOPPED)
|
||||
{
|
||||
if (this.closeOnFinish)
|
||||
{
|
||||
this.close();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.plutoengine.audio.ISeekableTrack;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public class AudioTrackSource extends AudioDoubleBufferedSource
|
||||
{
|
||||
private final ISeekableTrack track;
|
||||
|
||||
public AudioTrackSource(ISeekableTrack track)
|
||||
{
|
||||
super(track);
|
||||
|
||||
this.track = track;
|
||||
}
|
||||
|
||||
public boolean play()
|
||||
{
|
||||
this.track.rewind();
|
||||
|
||||
return super.play();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSamples(ShortBuffer pcmTransferBuf)
|
||||
{
|
||||
return this.track.getSamples(pcmTransferBuf);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.lwjgl.openal.AL11;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum EnumDistanceModel implements IOpenALEnum
|
||||
{
|
||||
NONE(AL11.AL_NONE),
|
||||
INVERSE_DISTANCE(AL11.AL_INVERSE_DISTANCE),
|
||||
INVERSE_DISTANCE_CLAMPED(AL11.AL_INVERSE_DISTANCE_CLAMPED),
|
||||
LINEAR_DISTANCE(AL11.AL_LINEAR_DISTANCE),
|
||||
LINEAR_DISTANCE_CLAMPED(AL11.AL_LINEAR_DISTANCE_CLAMPED),
|
||||
EXPONENT_DISTANCE(AL11.AL_EXPONENT_DISTANCE),
|
||||
EXPONENT_DISTANCE_CLAMPED(AL11.AL_EXPONENT_DISTANCE_CLAMPED);
|
||||
|
||||
private final int alID;
|
||||
|
||||
EnumDistanceModel(int alID)
|
||||
{
|
||||
this.alID = alID;
|
||||
}
|
||||
|
||||
public static EnumDistanceModel getByID(int id)
|
||||
{
|
||||
return Arrays.stream(EnumDistanceModel.values()).filter(model -> model.getALID() == id).findAny().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getALID()
|
||||
{
|
||||
return this.alID;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
public interface IOpenALEnum
|
||||
{
|
||||
int getALID();
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.al;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Vector3fc;
|
||||
import org.plutoengine.audio.RandomAccessClip;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
public class SoundEffect
|
||||
{
|
||||
private final @NotNull RandomAccessClip clip;
|
||||
private @NotNull Vector3fc position;
|
||||
private float volume;
|
||||
private float pitch;
|
||||
private UnaryOperator<Vector3fc> movementMapper;
|
||||
private BooleanSupplier keepAliveFunction;
|
||||
|
||||
public SoundEffect(@NotNull RandomAccessClip soundEffect, @NotNull Vector3fc position, float volume)
|
||||
{
|
||||
this.clip = soundEffect;
|
||||
this.position = position;
|
||||
this.volume = volume;
|
||||
this.pitch = 1.0f;
|
||||
}
|
||||
|
||||
public SoundEffect position(Vector3fc position)
|
||||
{
|
||||
this.position = position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEffect volume(float volume)
|
||||
{
|
||||
this.volume = volume;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEffect pitch(float pitch)
|
||||
{
|
||||
this.pitch = pitch;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEffect movementMapper(UnaryOperator<Vector3fc> movementMapper)
|
||||
{
|
||||
this.movementMapper = movementMapper;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEffect keepAliveFunction(BooleanSupplier keepAliveFunction)
|
||||
{
|
||||
this.keepAliveFunction = keepAliveFunction;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull RandomAccessClip getClip()
|
||||
{
|
||||
return this.clip;
|
||||
}
|
||||
|
||||
@NotNull Vector3fc getPosition()
|
||||
{
|
||||
return this.position;
|
||||
}
|
||||
|
||||
float getVolume()
|
||||
{
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
float getPitch()
|
||||
{
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
UnaryOperator<Vector3fc> getMovementMapper()
|
||||
{
|
||||
return this.movementMapper;
|
||||
}
|
||||
|
||||
BooleanSupplier getKeepAliveFunction()
|
||||
{
|
||||
return this.keepAliveFunction;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.audio.util;
|
||||
|
||||
import org.lwjgl.stb.STBVorbis;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.component;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
|
|
|
@ -1,9 +1,34 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.component;
|
||||
|
||||
import org.apache.commons.collections4.MultiValuedMap;
|
||||
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
|
||||
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -50,6 +75,14 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
this.components.put(token, component);
|
||||
this.tokens.put(component, token);
|
||||
|
||||
this.onComponentAdded(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
protected void onComponentAdded(R component)
|
||||
{
|
||||
try
|
||||
{
|
||||
component.initialize(this);
|
||||
|
@ -58,8 +91,6 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
{
|
||||
throw new RuntimeException("An exception has occured while mounting the component", e);
|
||||
}
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public Class<R> getComponentBase()
|
||||
|
@ -106,6 +137,12 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
|
||||
classes.forEach(clazz -> this.implementationProviders.removeMapping(clazz, component));
|
||||
|
||||
this.onComponentRemoved(component);
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
protected void onComponentRemoved(R component)
|
||||
{
|
||||
try
|
||||
{
|
||||
component.destroy(this);
|
||||
|
@ -127,14 +164,7 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
|
||||
classes.forEach(clazz -> this.implementationProviders.removeMapping(clazz, component));
|
||||
|
||||
try
|
||||
{
|
||||
component.onUnmount();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException("An exception has occured whiile unmounting the component", e);
|
||||
}
|
||||
this.onComponentRemoved(component);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
@ -281,6 +305,7 @@ public abstract class PlutoApplication
|
|||
|
||||
this.display.swapBuffers();
|
||||
|
||||
audioEngine.update();
|
||||
inputBus.resetStates();
|
||||
|
||||
this.display.pollEvents();
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input;
|
||||
|
||||
import org.plutoengine.component.ComponentToken;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input.callback;
|
||||
|
||||
import org.lwjgl.glfw.GLFWCursorPosCallback;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input.callback;
|
||||
|
||||
import org.lwjgl.glfw.GLFWCharCallback;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input.callback;
|
||||
|
||||
import org.lwjgl.glfw.GLFWKeyCallback;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input.callback;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.input.callback;
|
||||
|
||||
import org.lwjgl.glfw.GLFWScrollCallback;
|
||||
|
|
|
@ -14,10 +14,13 @@ dependencies {
|
|||
api("org.lwjgl", "lwjgl-glfw")
|
||||
api("org.lwjgl", "lwjgl-opengl")
|
||||
api("org.lwjgl", "lwjgl-stb")
|
||||
runtimeOnly("org.lwjgl", "lwjgl", classifier = Versions.lwjglNatives)
|
||||
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = Versions.lwjglNatives)
|
||||
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = Versions.lwjglNatives)
|
||||
runtimeOnly("org.lwjgl", "lwjgl-stb", classifier = Versions.lwjglNatives)
|
||||
|
||||
org.plutoengine.Versions.lwjglNatives.forEach {
|
||||
runtimeOnly("org.lwjgl", "lwjgl", classifier = it)
|
||||
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = it)
|
||||
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = it)
|
||||
runtimeOnly("org.lwjgl", "lwjgl-stb", classifier = it)
|
||||
}
|
||||
|
||||
api("com.code-disaster.steamworks4j", "steamworks4j", Versions.steamworks4jVersion)
|
||||
api("com.code-disaster.steamworks4j", "steamworks4j-server", Versions.steamworks4jServerVersion)
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine;
|
||||
|
||||
import org.lwjgl.Version;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.buffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.buffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utilities for better native buffer handling.
|
||||
*
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.display;
|
||||
|
||||
import org.lwjgl.glfw.*;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.display;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.display;
|
||||
|
||||
import java.util.Deque;
|
||||
|
@ -16,7 +40,7 @@ public class Framerate
|
|||
|
||||
private static double animationTimer = 0;
|
||||
|
||||
private static double FPS = Double.NaN;
|
||||
private static double fps = Double.NaN;
|
||||
|
||||
private static int interpolatedFPS;
|
||||
|
||||
|
@ -31,7 +55,7 @@ public class Framerate
|
|||
|
||||
public static double getFPS()
|
||||
{
|
||||
return FPS;
|
||||
return fps;
|
||||
}
|
||||
|
||||
public static int getInterpolatedFPS()
|
||||
|
@ -55,7 +79,7 @@ public class Framerate
|
|||
animationTimer += frameTimeNs / (double) TimeUnit.SECONDS.toNanos(1);
|
||||
// Maintain precision in case the engine runs for many hours
|
||||
animationTimer %= TimeUnit.DAYS.toMinutes(1);
|
||||
FPS = TimeUnit.SECONDS.toMillis(1) / frameTime;
|
||||
fps = TimeUnit.SECONDS.toMillis(1) / frameTime;
|
||||
}
|
||||
|
||||
var nowMs = System.currentTimeMillis();
|
||||
|
@ -77,7 +101,7 @@ public class Framerate
|
|||
}
|
||||
else
|
||||
{
|
||||
interpolatedFPS = (int) Math.round(FPS);
|
||||
interpolatedFPS = (int) Math.round(fps);
|
||||
}
|
||||
|
||||
lastDraw = now;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utilities for display handling.
|
||||
*
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.gl;
|
||||
|
||||
import org.lwjgl.opengl.ARBFramebufferObject;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package org.plutoengine.gl;
|
||||
|
||||
/**
|
||||
* Denotes the implementing class is a set of OpenGL enums.
|
||||
*
|
||||
*
|
||||
* @author 493msi
|
||||
*
|
||||
*/
|
||||
public interface IOpenGLEnum
|
||||
{
|
||||
int getGLID();
|
||||
}
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.math;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
|
@ -24,7 +48,7 @@ public class ProjectionMatrix
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a centered 2D orthogonal projection Matrix3x2f based on the width and
|
||||
* Create a centered 2D orthogonal projection Matrix4f based on the width and
|
||||
* height.
|
||||
*
|
||||
* @param width The ortho width
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.math;
|
||||
|
||||
import org.joml.Matrix3x2f;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.math;
|
||||
|
||||
import org.joml.Matrix3x2f;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Math utility classes.
|
||||
*
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
plugins {
|
||||
java
|
||||
`java-library`
|
||||
}
|
||||
|
||||
description = ""
|
||||
|
||||
dependencies {
|
||||
api(project(":plutoengine:plutotexture"))
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package org.plutoengine.graphics.gl.fbo;
|
||||
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import org.plutoengine.graphics.texture.MagFilter;
|
||||
import org.plutoengine.graphics.texture.MinFilter;
|
||||
import org.plutoengine.graphics.texture.WrapMode;
|
||||
|
||||
public class FramebufferDepthTexture extends FramebufferTexture
|
||||
{
|
||||
public FramebufferDepthTexture(int width, int height, MagFilter magFilter, MinFilter minFilter, WrapMode wrapU, WrapMode wrapV)
|
||||
{
|
||||
super(width, height, magFilter, minFilter, wrapU, wrapV);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(long address)
|
||||
{
|
||||
GL33.glTexImage2D(this.type, 0, GL33.GL_DEPTH24_STENCIL8, this.width, this.height, 0, GL33.GL_DEPTH_STENCIL, GL33.GL_UNSIGNED_INT_24_8, address);
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package org.plutoengine.graphics.gl.fbo;
|
||||
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import org.plutoengine.graphics.texture.MagFilter;
|
||||
import org.plutoengine.graphics.texture.MinFilter;
|
||||
import org.plutoengine.graphics.texture.WrapMode;
|
||||
import org.plutoengine.graphics.texture.texture2d.RectangleTexture;
|
||||
|
||||
public class FramebufferTexture extends RectangleTexture
|
||||
{
|
||||
public FramebufferTexture(int width, int height, MagFilter magFilter, MinFilter minFilter, WrapMode wrapU, WrapMode wrapV)
|
||||
{
|
||||
this.bind();
|
||||
this.setFilteringOptions(magFilter, minFilter);
|
||||
this.setWrapOptions(wrapU, wrapV);
|
||||
|
||||
this.resize(width, height);
|
||||
}
|
||||
|
||||
public FramebufferTexture(int width, int height)
|
||||
{
|
||||
this(width, height, MagFilter.LINEAR, MinFilter.LINEAR, WrapMode.CLAMP_TO_EDGE, WrapMode.CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
public void resize(int width, int height)
|
||||
{
|
||||
this.bind();
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.writeData(MemoryUtil.NULL);
|
||||
}
|
||||
}
|
|
@ -14,7 +14,9 @@ dependencies {
|
|||
implementation("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml", "2.12.3")
|
||||
|
||||
implementation("org.lwjgl", "lwjgl-yoga")
|
||||
runtimeOnly("org.lwjgl", "lwjgl-yoga", classifier = org.plutoengine.Versions.lwjglNatives)
|
||||
org.plutoengine.Versions.lwjglNatives.forEach {
|
||||
runtimeOnly("org.lwjgl", "lwjgl-yoga", classifier = it)
|
||||
}
|
||||
|
||||
implementation("org.commonmark", "commonmark", "0.18.1")
|
||||
}
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics;
|
||||
|
||||
import org.joml.Matrix3f;
|
||||
|
|
|
@ -1,6 +1,31 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics;
|
||||
|
||||
import org.plutoengine.Pluto;
|
||||
import org.plutoengine.graphics.gui.BitmapFontShader;
|
||||
import org.plutoengine.graphics.gui.FontShader;
|
||||
import org.plutoengine.graphics.texture.MagFilter;
|
||||
import org.plutoengine.graphics.texture.MinFilter;
|
||||
|
@ -9,7 +34,7 @@ import org.plutoengine.graphics.texture.texture2d.RectangleTexture;
|
|||
import org.plutoengine.mod.IModEntryPoint;
|
||||
import org.plutoengine.mod.Mod;
|
||||
import org.plutoengine.mod.ModEntry;
|
||||
import org.plutoengine.shader.RenderShaderBuilder;
|
||||
import org.plutoengine.graphics.shader.RenderShaderBuilder;
|
||||
|
||||
/**
|
||||
* @author 493msi
|
||||
|
@ -28,7 +53,7 @@ public class PlutoGUIMod implements IModEntryPoint
|
|||
|
||||
public static FontShader fontShader;
|
||||
|
||||
public static FontShader bitmapFontShader;
|
||||
public static BitmapFontShader bitmapFontShader;
|
||||
|
||||
public void onLoad(Mod mod)
|
||||
{
|
||||
|
@ -36,7 +61,7 @@ public class PlutoGUIMod implements IModEntryPoint
|
|||
|
||||
fontShader = new RenderShaderBuilder(mod.getResource("shaders.VertexFontShader#glsl"), mod.getResource("shaders.FragmentFontShader#glsl")).build(FontShader.class, false);
|
||||
|
||||
bitmapFontShader = new RenderShaderBuilder(mod.getResource("shaders.VertexBitmapFontShader#glsl"), mod.getResource("shaders.FragmentBitmapFontShader#glsl")).build(FontShader.class, false);
|
||||
bitmapFontShader = new RenderShaderBuilder(mod.getResource("shaders.VertexBitmapFontShader#glsl"), mod.getResource("shaders.FragmentBitmapFontShader#glsl")).build(BitmapFontShader.class, false);
|
||||
|
||||
uiElementsAtlas = new RectangleTexture();
|
||||
uiElementsAtlas.load(mod.getResource("gui.elements#png"), MagFilter.NEAREST, MinFilter.NEAREST, WrapMode.CLAMP_TO_EDGE, WrapMode.CLAMP_TO_EDGE);
|
||||
|
|
|
@ -1,19 +1,43 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui;
|
||||
|
||||
import org.joml.Matrix3fc;
|
||||
import org.plutoengine.graphics.gl.vao.attrib.ReservedAttributes;
|
||||
import org.plutoengine.graphics.vao.attrib.ReservedAttributes;
|
||||
import org.plutoengine.graphics.shader.uniform.*;
|
||||
import org.plutoengine.libra.paint.LiColorPaint;
|
||||
import org.plutoengine.libra.paint.LiGradientPaint;
|
||||
import org.plutoengine.libra.paint.LiPaint;
|
||||
import org.plutoengine.shader.ShaderBase;
|
||||
import org.plutoengine.shader.ShaderProgram;
|
||||
import org.plutoengine.shader.VertexArrayAttribute;
|
||||
import org.plutoengine.shader.uniform.*;
|
||||
import org.plutoengine.shader.uniform.auto.AutoViewportProjection;
|
||||
import org.plutoengine.graphics.shader.ShaderBase;
|
||||
import org.plutoengine.graphics.shader.ShaderProgram;
|
||||
import org.plutoengine.graphics.shader.VertexArrayAttribute;
|
||||
import org.plutoengine.graphics.shader.uniform.auto.AutoViewportProjection;
|
||||
import org.plutoengine.util.color.IRGBA;
|
||||
|
||||
@ShaderProgram
|
||||
public final class BitmapTextShader extends ShaderBase implements IGUIShader
|
||||
public final class BitmapFontShader extends ShaderBase implements IGUIShader
|
||||
{
|
||||
@AutoViewportProjection
|
||||
@Uniform(name = "projection")
|
|
@ -1,15 +1,39 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui;
|
||||
|
||||
import org.joml.Matrix3fc;
|
||||
import org.plutoengine.graphics.gl.vao.attrib.ReservedAttributes;
|
||||
import org.plutoengine.graphics.vao.attrib.ReservedAttributes;
|
||||
import org.plutoengine.graphics.shader.uniform.*;
|
||||
import org.plutoengine.libra.paint.LiColorPaint;
|
||||
import org.plutoengine.libra.paint.LiGradientPaint;
|
||||
import org.plutoengine.libra.paint.LiPaint;
|
||||
import org.plutoengine.shader.ShaderBase;
|
||||
import org.plutoengine.shader.ShaderProgram;
|
||||
import org.plutoengine.shader.VertexArrayAttribute;
|
||||
import org.plutoengine.shader.uniform.*;
|
||||
import org.plutoengine.shader.uniform.auto.AutoViewportProjection;
|
||||
import org.plutoengine.graphics.shader.ShaderBase;
|
||||
import org.plutoengine.graphics.shader.ShaderProgram;
|
||||
import org.plutoengine.graphics.shader.VertexArrayAttribute;
|
||||
import org.plutoengine.graphics.shader.uniform.auto.AutoViewportProjection;
|
||||
import org.plutoengine.util.color.IRGBA;
|
||||
|
||||
@ShaderProgram
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui;
|
||||
|
||||
import org.joml.Matrix3fc;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui;
|
||||
|
||||
public interface ISDFTextShader extends IGUIShader
|
||||
|
|
|
@ -1,8 +1,32 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui;
|
||||
|
||||
import org.plutoengine.graphics.gl.DrawMode;
|
||||
import org.plutoengine.graphics.gl.vao.VertexArray;
|
||||
import org.plutoengine.graphics.gl.vao.VertexArrayBuilder;
|
||||
import org.plutoengine.graphics.vao.VertexArray;
|
||||
import org.plutoengine.graphics.vao.VertexArrayBuilder;
|
||||
import org.plutoengine.graphics.gui.command.PlutoCommandDrawMesh;
|
||||
import org.plutoengine.graphics.gui.command.PlutoCommandDrawMeshDirectBuffer;
|
||||
import org.plutoengine.graphics.gui.command.PlutoCommandSwitchShader;
|
||||
|
@ -13,7 +37,7 @@ import org.plutoengine.libra.command.LiCommandBuffer;
|
|||
import org.plutoengine.libra.command.impl.LiCommandSetPaint;
|
||||
import org.plutoengine.libra.command.impl.LiCommandSetTransform;
|
||||
import org.plutoengine.libra.command.impl.LiCommandSpecial;
|
||||
import org.plutoengine.shader.ShaderBase;
|
||||
import org.plutoengine.graphics.shader.ShaderBase;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
|
@ -1,6 +1,30 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.command;
|
||||
|
||||
import org.plutoengine.graphics.gl.vao.attrib.AttributeInfo;
|
||||
import org.plutoengine.graphics.vao.attrib.AttributeInfo;
|
||||
import org.plutoengine.libra.command.impl.LiCommand;
|
||||
import org.plutoengine.libra.command.impl.LiCommandDrawMesh;
|
||||
|
||||
|
|
|
@ -1,8 +1,32 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.command;
|
||||
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.plutoengine.graphics.gl.vao.attrib.AttributeInfo;
|
||||
import org.plutoengine.graphics.gl.vbo.EnumArrayBufferType;
|
||||
import org.plutoengine.graphics.vao.attrib.AttributeInfo;
|
||||
import org.plutoengine.graphics.vbo.EnumArrayBufferType;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
|
|
@ -1,7 +1,31 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.command;
|
||||
|
||||
import org.plutoengine.graphics.gl.vao.attrib.AttributeInfo;
|
||||
import org.plutoengine.graphics.gl.vbo.EnumArrayBufferType;
|
||||
import org.plutoengine.graphics.vao.attrib.AttributeInfo;
|
||||
import org.plutoengine.graphics.vbo.EnumArrayBufferType;
|
||||
import org.plutoengine.libra.command.impl.LiCommand;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.command;
|
||||
|
||||
import org.plutoengine.graphics.gui.IGUIShader;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.command;
|
||||
|
||||
import org.plutoengine.graphics.texture.Texture;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.font;
|
||||
|
||||
import org.plutoengine.graphics.texture.Texture;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.font.bitmap;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.font.bitmap;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.font.bitmap;
|
||||
|
||||
import org.joml.primitives.Rectanglef;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.font.stbttf;
|
||||
|
||||
import org.joml.primitives.Rectanglef;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.graphics.gui.font.stbttf;
|
||||
|
||||
import org.joml.primitives.Rectanglef;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.address;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.address;
|
||||
|
||||
public class VirtualAddressParseException extends RuntimeException
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.address;
|
||||
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.chrono;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utilities for time manipulation and conversion.
|
||||
*
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.event.lambda;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.io.property;
|
||||
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.math;
|
||||
|
||||
import org.joml.Math;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.math;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.math;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.math;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Math utility classes.
|
||||
*
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 493msi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.plutoengine.util.color;
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue