Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

debug log: (2/2)

        waterColor = mix(waterColor, skyColor, blocklight.a * (1-fresnel));
    
    
        vec3 lightTint = max(blocklight.rgb, blocklight.a * skyAmbientColor);
        float alpha = mix(texColor.a*2.0, texColor.a*0.5, fresnel);
        
        if(alpha == 0)
        {
            discard;
        }
    
        outColor = vec4(waterColor * lightTint, alpha);
        outColor.rgb = mix(outColor.rgb, skyColor, blocklight.a * (1-fresnel));
        outColor *= tintColor;
        outColor.rgb = max(outColor.rgb, texColor.rgb * worldAmbientColor);
    }
    #endif //chunk_water_frag_glsl
    
* SkyStarShader: sky-star.vert.glsl, sky-star.frag.glsl
    VERTEX: #version 150
    #ifndef sky_star_vert_glsl
    #define sky_star_vert_glsl
    
    in vec3 a_position;
    
    uniform mat4 u_projViewTrans;
    
    void main() 
    {
        gl_Position = u_projViewTrans * vec4(a_position, 1.0);
        
    }
    #endif //sky_star_vert_glsl
    
    FRAG: #version 150
    #ifndef sky_star_frag_glsl
    #define sky_star_frag_glsl
    #ifdef GL_ES 
    precision mediump float;
    #endif
    
    out vec4 outColor;
    
    void main() 
    {
        outColor = vec4(1);
    }
    #endif //sky_star_frag_glsl
    
* SkyShader: sky.vert.glsl, sky.frag.glsl
    VERTEX: #version 150
    #ifndef sky_vert_glsl
    #define sky_vert_glsl
    
    in vec3 a_position;
    in vec3 a_normal;
    
    uniform mat4 u_projViewTrans;
    uniform vec3 cameraPosition;
    
    out vec3 v_position;
    out vec3 v_position_adjusted;
    out vec3 v_normal;
    
    void main() 
    {
        v_normal = a_normal;
        vec3 p = a_position;// - vec3(0, min(cameraPosition.y, 20), 0);
        gl_Position = u_projViewTrans * vec4(p, 1.0);
        v_position = p;
        v_position_adjusted = p;// + vec3(0, cameraPosition.y - 32, 0);
    }
    #endif //sky_vert_glsl
    
    FRAG: #version 150
    #ifndef sky_frag_glsl
    #define sky_frag_glsl
    #ifdef GL_ES 
    precision mediump float;
    #endif
    
    in vec3 v_position;
    in vec3 v_position_adjusted;
    in vec3 v_normal;
    out vec4 outColor;
    uniform vec3 u_sunDirection;
    uniform vec3 cameraPosition;
    
    void main() 
    {
        vec3 pos_normal = normalize(v_position);
        vec3 pos_adj_normal = normalize(v_position);
        float sunRadius = 0.005;
        float sun_dot = dot(u_sunDirection, pos_normal);
        float noon_dot = dot(u_sunDirection, vec3(0, 1, 0));
        float sunFactor = (sun_dot - (1 - sunRadius)) / sunRadius;
        float horizonFactor = 1-abs(pos_adj_normal.y);
        
        vec3 upperColor = vec3(0.1, 0.4, 0.7);
        float upperHalfFactor = sqrt(max(0, dot(vec3(0,1,0), pos_adj_normal)));
        float upperColorFactor = upperHalfFactor * clamp(1 - (pow(1 - noon_dot, 3)), 0, 1);
        vec3 lowerColor = vec3(0.2, 0.4, 0.7) * 3;
        float lowerColorFactor = (1 - max(0, upperHalfFactor)) * max(0, (noon_dot +0.75)/1.75);
        vec3 skyColor = (upperColor * upperColorFactor) + (lowerColor * lowerColorFactor);
    
        float sunsetOrSunRiseFactor = pow(1-abs(noon_dot), 2);
        vec3 redHorizonColor = vec3(3, 0, 0) * pow(horizonFactor,4) * sunsetOrSunRiseFactor;
        skyColor = max(skyColor, redHorizonColor);
    
        vec3 crossDir = cross(u_sunDirection, vec3(0,1,0));
        float sunHorizonFlareFactor = pow(1 - pow(dot(cross(u_sunDirection, crossDir), pos_normal), 2), 8) * pow(1 - abs(noon_dot), 4) * sun_dot;// * max(0, (noon_dot+0.25)/1.25);
        vec3 sunFlareHorizonColor = vec3(1,1,0) * sunHorizonFlareFactor;
        skyColor = max(skyColor, sunFlareHorizonColor);
    
    
        vec3 sunColor = vec3(1, 0.9, 0.6) * sunFactor;
    
        skyColor = max(skyColor, sunColor);
    
        float alpha = max(0.1, max(min(length(skyColor), (sun_dot+2)/3), min(1, round(sunFactor*2)))) + max(0, noon_dot);
        alpha = max(0, min(alpha, 1));
       
        outColor = vec4(skyColor / alpha, alpha);
    }
    #endif //sky_frag_glsl
    
* EntityShader: entity.vert.glsl, entity.frag.glsl
    VERTEX: #version 150
    #ifndef entity_vert_glsl
    #define entity_vert_glsl
    
    in vec3 a_position;
    in vec2 a_texCoord0;
    
    out vec2 v_texCoord0;
    
    uniform mat4 u_projViewTrans;
    uniform mat4 u_modelMat;
    
    void main() 
    {
        v_texCoord0 = a_texCoord0;
        gl_Position = u_projViewTrans * u_modelMat * vec4(a_position, 1.0);    
    }
    #endif //entity_vert_glsl
    
    FRAG: #version 150
    #ifndef entity_frag_glsl
    #define entity_frag_glsl
    #ifdef GL_ES 
    precision mediump float;
    #endif
    
    in vec2 v_texCoord0;
    
    uniform sampler2D texDiffuse;
    uniform vec4 tintColor;
    
    out vec4 outColor;
    
    void main() 
    {
        vec4 texColor = texture(texDiffuse, v_texCoord0);
    
        if(texColor.a == 0)
        {
            discard;
        }
    
        outColor = texColor * tintColor;
    }
    #endif //entity_frag_glsl
    
* SpriteBatchShader: death-screen.vert.glsl, death-screen.frag.glsl
    VERTEX: #version 150
    #ifndef death_screen_vert_glsl
    #define death_screen_vert_glsl
    
    in vec4 a_position;
    in vec4 a_color;
    in vec2 a_texCoord0;
    
    uniform mat4 u_projTrans;
    
    out vec4 v_color;
    out vec2 v_texCoords;
    
    void main()
    {
       v_color = a_color;
       v_color.a = v_color.a * (255.0/254.0);
       v_texCoords = a_texCoord0;
       gl_Position =  u_projTrans * a_position;
    }
    #endif //death_screen_vert_glsl
    
    FRAG: #version 150
    #ifndef death_screen_frag_glsl
    #define death_screen_frag_glsl
    
    in vec4 v_color;
    in vec2 v_texCoords;
    
    uniform sampler2D u_texture;
    uniform float u_time;
    
    out vec4 outColor;
    
    void main()
    {
        float s1 = u_time + v_texCoords.y*100 + 3*cos(u_time/10 + v_texCoords.x);
        float s2 = dot(normalize(vec2(v_texCoords)-0.5), vec2(sin(u_time), cos(u_time)));
    
        outColor = v_color * texture2D(u_texture, v_texCoords) * vec4(vec3((0.9 + 0.1*sin(s1))), 1) * (6+s2)/7;
    }
    #endif //death_screen_frag_glsl
    
* ItemShader: assets/base/shaders/item_shader.vert.glsl, assets/base/shaders/item_shader.frag.glsl
    VERTEX: #version 150
    #ifndef assets_base_shaders_item_shader_vert_glsl
    #define assets_base_shaders_item_shader_vert_glsl
    
    // Contributors: Shfloop, Mr-Zombii
    
    in vec3 a_position;
    in vec2 a_texCoord0;
    in vec3 a_normal;
    out vec2 v_texCoord0;
    
    uniform mat4 u_projViewTrans;
    uniform mat4 u_modelMat;
    
    out vec3 v_normal;
    
    void main()
    {
    
        v_normal = normalize(a_normal); // Mult by u_modelMat for world space vectors
        v_texCoord0 = a_texCoord0;
        gl_Position = u_projViewTrans * u_modelMat * vec4(a_position, 1.0);
    }
    #endif //assets_base_shaders_item_shader_vert_glsl
    
    FRAG: #version 150
    #ifndef assets_base_shaders_item_shader_frag_glsl
    #define assets_base_shaders_item_shader_frag_glsl
    #ifdef GL_ES
    precision mediump float;
    #endif
    
    // Contributors: Shfloop, Mr-Zombii
    
    in vec2 v_texCoord0;
    in vec3 v_normal;
    
    uniform sampler2D texDiffuse;
    uniform vec4 tintColor;
    uniform int isInSlot;
    
    out vec4 outColor;
    
    void main()
    {
        // arbitrary numbers might want to mess around with
        float faceShade = abs(dot(vec3(0,0,1), v_normal) ) + 0.6;
        faceShade *= abs(dot(vec3(0,1,0), v_normal) + 0.8);
        faceShade *= 1.0;
        vec4 texColor = texture(texDiffuse, v_texCoord0);
    
        if(texColor.a == 0)
        {
            discard;
        }
    
        if (isInSlot == 1) {
            outColor = texColor;
            return;
        } else outColor = vec4(texColor.rgb * faceShade , texColor.a) * tintColor;
    }
    #endif //assets_base_shaders_item_shader_frag_glsl
    

    at finalforeach.cosmicreach.gamestates.OptionsMenu$10.onClick(OptionsMenu.java:292)
    at finalforeach.cosmicreach.ui.UIElement.drawBackground(UIElement.java:145)
    at finalforeach.cosmicreach.gamestates.GameState.drawUIElements(GameState.java:121)
    at finalforeach.cosmicreach.gamestates.OptionsMenu.render(OptionsMenu.java:335)
    at finalforeach.cosmicreach.BlockGame.render(BlockGame.java:132)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:387)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:167)
    at finalforeach.cosmicreach.lwjgl3.Lwjgl3Launcher.createApplication(Lwjgl3Launcher.java:104)
    at finalforeach.cosmicreach.lwjgl3.Lwjgl3Launcher.main(Lwjgl3Launcher.java:92)```