Skip to content

Commit

Permalink
Added x64 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
OopsOverflow authored May 16, 2021
1 parent 150383e commit 11190c7
Show file tree
Hide file tree
Showing 82 changed files with 406 additions and 0 deletions.
Binary file added Moncraft 64bit/MonCraft.exe
Binary file not shown.
Binary file added Moncraft 64bit/SDL2.dll
Binary file not shown.
Binary file added Moncraft 64bit/SDL2.lib
Binary file not shown.
Binary file added Moncraft 64bit/SDL2_image.dll
Binary file not shown.
Binary file added Moncraft 64bit/SDL2_image.lib
Binary file not shown.
Binary file added Moncraft 64bit/SDL2main.lib
Binary file not shown.
Binary file added Moncraft 64bit/SDL2test.lib
Binary file not shown.
Binary file added Moncraft 64bit/data/img/Character.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/Character1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/CharacterDebug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/Texture_atlas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/Texture_atlas1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/Texture_atlas2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/Texture_atlas3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/Texture_atlas4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions Moncraft 64bit/data/img/genMipMap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python

# Hello World in GIMP Python

from gimpfu import *

def hello_world(img, drawable, tileCountX, tileCountY, level):

pdb.gimp_undo_push_group_start(img)
pdb.gimp_context_set_interpolation(INTERPOLATION_LINEAR)

tileCountX = int(tileCountX)
tileCountY = int(tileCountY)
level = int(level)
tileSize = img.width / tileCountX


factor = pow(2, level)

for i in range(tileCountX):
for j in range(tileCountX):

offX = i * tileSize
offY = j * tileSize

pdb.gimp_image_select_rectangle(img, CHANNEL_OP_REPLACE, offX, offY, tileSize, tileSize)
drawable = pdb.gimp_image_get_active_drawable(img)
sel = pdb.gimp_item_transform_scale(drawable, offX/factor, offY/factor, (offX+tileSize)/factor, (offY+tileSize)/factor)
pdb.gimp_floating_sel_anchor(sel)

img.resize(img.width/factor, img.height/factor, 0, 0)

pdb.gimp_undo_push_group_end(img)


register(
"python_fu_moncraft_mipmap",
"Gen MipMap for MonCraft",
"Generates mipmap levels for a texture atlas",
"Mathis Brossier",
"Mathis Brossier",
"2021",
"<Image>/File/MIPMAP",
"",
[
(PF_SPINNER, "tileCountX", "Tile count (X)", 8, (1, 100, 1)),
(PF_SPINNER, "tileCountY", "Tile count (Y)", 8, (1, 100, 1)),
(PF_SPINNER, "level", "Mipmap level", 1, (1, 10, 1)),
],
[],
hello_world)

main()
Binary file added Moncraft 64bit/data/img/icon.ico
Binary file not shown.
Binary file added Moncraft 64bit/data/img/skybox/nx(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/nx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/ny(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/ny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/nz(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/nz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/px(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/py(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/py.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/pz(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Moncraft 64bit/data/img/skybox/pz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added Moncraft 64bit/data/music/ES_Mays-VanSandano.ogg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Moncraft 64bit/data/music/dev.ogg
Binary file not shown.
Binary file added Moncraft 64bit/libjpeg-9.dll
Binary file not shown.
Binary file added Moncraft 64bit/libpng16-16.dll
Binary file not shown.
Binary file added Moncraft 64bit/libtiff-5.dll
Binary file not shown.
Binary file added Moncraft 64bit/libwebp-7.dll
Binary file not shown.
Binary file added Moncraft 64bit/openal32.dll
Binary file not shown.
Binary file added Moncraft 64bit/sfml-audio-2.dll
Binary file not shown.
Binary file added Moncraft 64bit/sfml-audio-d-2.dll
Binary file not shown.
Binary file added Moncraft 64bit/sfml-system-2.dll
Binary file not shown.
Binary file added Moncraft 64bit/sfml-system-d-2.dll
Binary file not shown.
12 changes: 12 additions & 0 deletions Moncraft 64bit/src/shader/2dtex.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#version 330 core

precision mediump float;

out vec4 outputColor;
uniform sampler2D uTexture;

smooth in vec2 vertexPosition;

void main() {
outputColor = texture(uTexture, vertexPosition);
}
10 changes: 10 additions & 0 deletions Moncraft 64bit/src/shader/2dtex.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330 core

in vec2 vPosition;
uniform mat2 uMvp;
smooth out vec2 vertexPosition;

void main() {
vertexPosition = (vPosition + vec2(1.0)) / 2.0;
gl_Position = vec4(uMvp * vPosition, -1.0, 1.0);
}
6 changes: 6 additions & 0 deletions Moncraft 64bit/src/shader/shadow.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#version 330 core

void main()
{
gl_FragDepth = gl_FragCoord.z;
}
19 changes: 19 additions & 0 deletions Moncraft 64bit/src/shader/shadow.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 430 core
layout (location = 0) in vec3 v_position;
layout (location = 0) uniform mat4 m_model;
layout (location = 4) uniform mat4 m_shadows;

vec3 nsigmoid1(vec3 x, float k) {
return 1 / (1 + exp(-x * k)) * 2 - 1;
}

vec3 nsigmoid2(vec3 x, float k) {
vec3 val = (-pow(x, vec3(3)) + 3 * x) / 2;
return clamp(val, -1, 1);
}

void main()
{
gl_Position = m_shadows * m_model * vec4(v_position, 1.0);
// gl_Position = vec4(nsigmoid1(gl_Position.xyz, 5), gl_Position.w); // lod for shadows
}
197 changes: 197 additions & 0 deletions Moncraft 64bit/src/shader/simple.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
#version 430 core

precision mediump float;

smooth in vec3 vertexPosition;
smooth in vec3 vertexNormal;
smooth in float vertexOcclusion;
smooth in vec2 txrCoords;
smooth in vec2 normalCoords;
smooth in vec3 shadowCoords[3];
smooth in mat3 TBN;
smooth in vec3 fogColor;


uniform vec3 lightDirection;
uniform float lightIntensity;

uniform sampler2D textureSampler;
uniform sampler2D normalMap;
uniform sampler2D shadowSampler[3];
uniform float clipCascadeEndZ[3];
uniform int underWater; //glUniform1b :(
uniform int fog;
uniform float sunTime;

out vec4 outputColor;

float computeShadow(int i) {
vec3 normal = normalize(vertexNormal);
float dotNormal = dot(normalize(lightDirection), normal);

// float bias = 0.0;
float bmin = 0.00001;
float bmax = 0.00005;
float bias = max(bmax * (1.0 - dotNormal), bmin);
float currentDepth = shadowCoords[i].z * 0.5 + 0.5;
vec2 texelSize = 1.0 / textureSize(shadowSampler[i], 0) / 2;

// no pcf
// float pcfDepth = texture(shadowSampler[i], shadowCoords[i].xy * 0.5 + 0.5).r;
// return currentDepth - bias > pcfDepth ? 1.0 : 0.0;

// pcf
float shadow = 0.0;
for(float x = -1.5; x <= 1.5; ++x) {
for(float y = -1.5; y <= 1.5; ++y) {
float pcfDepth = texture(shadowSampler[i], shadowCoords[i].xy * 0.5 + 0.5 + vec2(x, y) * texelSize).r;
shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;
}
}
shadow /= 16.0;
return shadow;
}

float linearizeDepth(float depth) { // https://learnopengl.com/Advanced-OpenGL/Depth-testing
float near = 0.1;
float far = 200.0;
float z = depth * 2.0 - 1.0; // back to NDC
return (2.0 * near * far) / (far + near - z * (far - near)) / far;
}

float random (in vec2 _st) {
return fract(sin(dot(_st.xy,
vec2(12.9898,78.233)))*
43758.5453123);
}

// Based on Morgan McGuire @morgan3d
// https://www.shadertoy.com/view/4dS3Wd
float noise (in vec2 _st) {
vec2 i = floor(_st);
vec2 f = fract(_st);

// Four corners in 2D of a tile
float a = random(i);
float b = random(i + vec2(1.0, 0.0));
float c = random(i + vec2(0.0, 1.0));
float d = random(i + vec2(1.0, 1.0));

vec2 u = f * f * (3.0 - 2.0 * f);

return mix(a, b, u.x) +
(c - a)* u.y * (1.0 - u.x) +
(d - b) * u.x * u.y;
}

#define NUM_OCTAVES 5

float fbm ( in vec2 _st) {
float v = 0.0;
float a = 0.5;
vec2 shift = vec2(100.0);
// Rotate to reduce axial bias
mat2 rot = mat2(cos(0.5), sin(0.5),
-sin(0.5), cos(0.50));
for (int i = 0; i < NUM_OCTAVES; ++i) {
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
}
return v;
}

void main() {

// Noise Sampling Bovine Excrement
vec2 st = gl_FragCoord.xy/100.840f;
// st += st * abs(sin(sunTime*0.1)*3.0);
vec3 fcolor = vec3(0.0);

vec2 q = vec2(0.);
q.x = fbm( st + 0.00*sunTime);
q.y = fbm( st + vec2(1.0));

vec2 r = vec2(0.);
r.x = fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*sunTime );
r.y = fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*sunTime);

float f = fbm(st+r);

fcolor = mix(fogColor,
vec3(0.711,0.707,0.730),
clamp((f*f)*4.408,0.0,1.0));

fcolor = mix(fcolor,
vec3(0,0,0.164706),
clamp(length(q),0.0,-0.984));

fcolor = mix(fcolor,
vec3(0.799,1.000,0.981),
clamp(length(r.x),0.0,1.0));

vec4 fbmColor = vec4((f*f*f+.6*f*f+.5*f)*fcolor,0.);

// Fog Calc
float b = 0.0004f; // fallof of the fog density
float c = 0.5f; // integration constant, varies distance of fallof
float distance = (vertexPosition.y);
float fogAmounty = c * exp(vertexPosition.z*b) * (1.0f-exp( vertexPosition.z*lightDirection.y*b ))/lightDirection.y;
c =1.0f;
b = 0.0009f;
float fogAmountz = c * exp(-vertexPosition.z*b) * (1.0-exp( -vertexPosition.z*lightDirection.z*b ))/lightDirection.y;

vec3 normalizedLightDirection = normalize(lightDirection);

vec3 normal = normalize(TBN * (texture(normalMap ,normalCoords).rgb *2.0 -1.0));
float dotNormal = dot(normalizedLightDirection, normal);
float lambertian = max(-dotNormal, 0.0);

vec3 viewDir = normalize(-vertexPosition);
// this is blinn phong

vec3 halfDir = normalize(-normalizedLightDirection + viewDir);
float specAngle = max(dot(halfDir, normal), 0.0);
float specular = pow(specAngle, 200);

// Textures
outputColor = texture(textureSampler, txrCoords);

// Fog
if(fog!=0) outputColor = mix( outputColor, fbmColor, fogAmountz + fogAmounty);

// shadow

float shadow = 0.0;

for (int i = 0 ; i < 3; i++) {
if (texture(shadowSampler[i], shadowCoords[i].xy * 0.5 + 0.5).r != 1.0) {
shadow = 1 - computeShadow(i);
break;
}
}

vec4 color = outputColor;
outputColor.xyz = color.xyz * .5;
outputColor.xyz += color.xyz * lightIntensity * lambertian * shadow *.5 ;
outputColor.xyz +=vec3(1.0f) * specular * shadow * texture(normalMap ,normalCoords).a* 1.0;


float occl = .7;
outputColor.xyz *= 1.0 - (vertexOcclusion * vertexOcclusion / 9.0) * occl;

if(underWater == 1){
outputColor.rgb *=vec3(127.0f/255, 148.0f/255, 1.0f) ;
}
// show in which shadow cascade we are
// for (int i = 0 ; i < 3; i++) {
// if (texture(shadowSampler[i], shadowCoords[i].xy * 0.5 + 0.5).r != 1.0) {
// outputColor[i] += 0.2;
// break;
// }
// }

if(outputColor.a < 0.1) {
discard;
}
}
79 changes: 79 additions & 0 deletions Moncraft 64bit/src/shader/simple.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#version 430 core

layout (location = 0) in vec3 v_position;
layout (location = 1) in vec3 v_normal;
layout (location = 2) in vec2 v_texture;
layout (location = 3) in float v_occlusion;
layout (location = 4) in vec2 v_normalMap;

layout (location = 0) uniform mat4 m_model;
layout (location = 1) uniform mat4 m_view;
layout (location = 2) uniform mat4 m_projection;
layout (location = 3) uniform mat4 m_normal;
layout (location = 4) uniform mat4 m_shadows[3];

layout(location = 10) uniform vec3 lightDirection;

smooth out vec3 vertexPosition;
smooth out vec4 vertexColor;
smooth out vec3 vertexNormal;
smooth out vec2 txrCoords;
smooth out vec2 normalCoords;
smooth out vec3 shadowCoords[3];
smooth out mat3 TBN;
smooth out float vertexOcclusion;
smooth out float clipEndZ;
smooth out vec3 fogColor;

vec3 nsigmoid2(vec3 x, float k) {
vec3 val = (-pow(x, vec3(3)) + x * 3.0) / 2.0;
return clamp(val, -1, 1);
}

vec3 nsigmoid1(vec3 x, float k) {
return 1 / (1 + exp(-x * k)) * 2 - 1;
}

void main() {
// Pos
vec4 vertPos4 = m_view * m_model * vec4(v_position, 1.0);
gl_Position = m_projection * vertPos4;

// ----
// gl_Position = vec4(nsigmoid1(gl_Position.xyz, 0.1), gl_Position.w);
// ----

vertexPosition = vec3(vertPos4) / vertPos4.w;
// Normals
vertexNormal = vec3(m_normal * vec4(v_normal, 0.0));
// Textures
txrCoords = v_texture;
// Occlusion
vertexOcclusion = v_occlusion;
// NormalCoords
normalCoords = v_normalMap;


//normalMatrix
vec3 T= vec3(m_normal * vec4(v_normal.zxy, 1.0));
vec3 B= vec3(m_normal * vec4(v_normal.yzx, 1.0));
vec3 N= vec3(m_normal * vec4(v_normal, 1.0));
TBN = mat3(T, B, N);

// shadows
clipEndZ = gl_Position.z;
vec4 shadowCoords4;
shadowCoords4 = m_shadows[0] * m_model * vec4(v_position, 1.0);
shadowCoords[0] = vec3(shadowCoords4) / shadowCoords4.w;
shadowCoords4 = m_shadows[1] * m_model * vec4(v_position, 1.0);
shadowCoords[1] = vec3(shadowCoords4) / shadowCoords4.w;
shadowCoords4 = m_shadows[2] * m_model * vec4(v_position, 1.0);
shadowCoords[2] = vec3(shadowCoords4) / shadowCoords4.w;

// fog
float sunAmount = max( dot(vec3(m_view), lightDirection), 0.0 );
vec3 fogColor = mix( vec3(0.5,0.6,0.7), // bluish
vec3(1.0,0.9,0.7), // yellowish
pow(sunAmount,8.0) );

}
15 changes: 15 additions & 0 deletions Moncraft 64bit/src/shader/skyBox.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 330 core
out vec4 outputColor;

in vec3 txrCoords;

uniform samplerCube skybox;
uniform int underWater; //glUniform1b :(

void main()
{
outputColor = texture(skybox, txrCoords);
if(underWater == 1){
outputColor.rgb *=vec3(127.0f/255, 148.0f/255, 1.0f) ;
}
}
Loading

0 comments on commit 11190c7

Please sign in to comment.