This commit is contained in:
Bixilon 2022-01-03 18:51:59 +01:00
parent 427c3283cb
commit fba9c24c8b
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
6 changed files with 31 additions and 10 deletions

View File

@ -52,7 +52,7 @@ In the root folder of your jar file (the mod) must be a file called `mod.json`.
- `version_name`, `authors` and `name` is the classic implementation of metadata. Can be anything, will be displayed in the mod list. **Required**
- `modding_api_version` Modding API version of minosoft. Currently `1` **Required**
- `resource_namespace` is the prefix of items (for Minecraft it is `minecraft`). Aka the thing before the `:`. **Required**
- `main_class` the Main class of your mod (self explaining). The main class needs to extent the abstract class `MinosoftMod`. **Required**
- `main_class` the Main class of your mod (self explaining). The main class needs to extend the abstract class `MinosoftMod`. **Required**
- `loading` Loading attributes. **Optional**
- `priority` should the mod be loaded at the beginning or at the end. Possible values are `LOWEST`, `LOW`, `NORMAL`, `HIGH`, `HIGHEST` **Optional**
- `dependencies` Used if you need another mod to work **Optional**

View File

@ -34,7 +34,7 @@ enum class KeyAction {
// custom ones
/**
* Key must be hold in addition to a other action
* Key must be hold in addition to another action
*/
MODIFIER,

View File

@ -75,7 +75,7 @@ class MatrixHandler(
}
private fun calculateProjectionMatrix(screenDimensions: Vec2 = renderWindow.window.sizef) {
projectionMatrix = glm.perspective(fov.rad.toFloat(), screenDimensions.x / screenDimensions.y, 0.01f, 10000.0f)
projectionMatrix = glm.perspective(fov.rad.toFloat(), screenDimensions.x / screenDimensions.y, 0.01f, 1000.0f)
}
fun init() {

View File

@ -13,9 +13,12 @@ class OpenGLFramebufferDepthTexture(
id = glGenTextures()
glBindTexture(GL_TEXTURE_2D, id)
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, size.x, size.y, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null as ByteBuffer?)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
}

View File

@ -20,16 +20,34 @@ out vec4 foutColor;
uniform sampler2D uColor;
uniform sampler2D uDepth;
uniform float uFogStart = 60.0f;
uniform float uFogEnd = 75.0f;
#define NEAR_PLANE 0.01f
#define FAR_PLANE 1000.0f
float linearize_depth(float depth) {
return (2.0f * NEAR_PLANE * FAR_PLANE) / (FAR_PLANE + NEAR_PLANE - (depth * 2.0f - 1.0f) * (FAR_PLANE - NEAR_PLANE));
}
float calulate_fog_alpha(float depth) {
if (depth < uFogStart){
return 1.0f;
}
if (depth > uFogEnd){
discard;
}
return pow(1.0f - (depth - uFogStart) / (uFogEnd - uFogStart), 2);
}
void main() {
vec4 color = texture(uColor, finUV);
if (color.a == 0.0f) {
discard;
}
float depth = texture(uDepth, finUV).r;
foutColor = vec4(color.xyz, depth);
float depth = linearize_depth(texture(uDepth, finUV).x);
float alpha = calulate_fog_alpha(depth);
if (foutColor.a == 0.0f) {
discard;
}
foutColor = vec4(color.xyz, alpha);
}

View File

@ -14,7 +14,7 @@
uniform sampler2DArray uTextures[7];
vec4 getTexture(uint textureId, vec3 uv) { // ToDo: This method is just stupid and workarounds a opengl crash with mesa drivers
vec4 getTexture(uint textureId, vec3 uv) { // ToDo: This method is just stupid and workarounds an opengl crash with mesa drivers
#if defined __NVIDIA || defined __AMD
return texture(uTextures[textureId], uv);
#else
@ -30,7 +30,7 @@ vec4 getTexture(uint textureId, vec3 uv) { // ToDo: This method is just stupid a
#endif
}
vec4 getTexture(uint textureId, vec3 uv, float mipmapLevel) { // ToDo: This method is just stupid and workarounds a opengl crash with mesa drivers
vec4 getTexture(uint textureId, vec3 uv, float mipmapLevel) { // ToDo: This method is just stupid and workarounds an opengl crash with mesa drivers
#if defined __NVIDIA || defined __AMD
return textureLod(uTextures[textureId], uv, mipmapLevel);
#else