Skip to content

Instantly share code, notes, and snippets.

@deakcor
deakcor / Godot_v4.0-betaX_win64.cmd
Created November 23, 2022 18:45
Execute Godot executable with the same filename (for switchable graphic issue)
@echo off
setlocal
set DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
start %~n0.exe
pause > nul
endlocal
@deakcor
deakcor / firebase_firestore_parser.gd
Last active November 21, 2021 19:54
Firebase cloud firestore parser for gdscript (Godot Engine)
### Use example
const PROJECT_ID := "<your project ID>"
const FIRESTORE_URL := "https://firestore.googleapis.com/v1/projects/%s/databases/(default)/documents/" % PROJECT_ID
func get_document(path: String) -> void:
var url := FIRESTORE_URL + path
http.request(url)
func _on_http_request_completed(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray) -> void:
@deakcor
deakcor / fix_transparent_viewport.shader
Last active November 21, 2021 19:55
Fix transparent viewport for Godot Engine
/**
* Fix Godot transparent viewport.
* License: CC0
* https://creativecommons.org/publicdomain/zero/1.0/
*/
shader_type canvas_item;
void fragment(){
vec4 color = texture(TEXTURE,UV);
if (color.a!=0.0){
@deakcor
deakcor / hq2x4x.shader
Last active August 25, 2021 06:12
hq2x and hq4x filter with transparency for Godot Engine
/**
* hq2x and hq4x filter.
* https://www.shadertoy.com/view/MslGRS
* https://github.com/libretro/common-shaders/blob/master/scalehq/shaders/4xScaleHQ.cg
* https://github.com/libretro/common-shaders/blob/master/scalehq/shaders/2xScaleHQ.cg
*/
shader_type canvas_item;
uniform int type = 0; // 0:none, 1:hq2x, 2:hq4x
@deakcor
deakcor / hq4x.shader
Created February 14, 2021 14:15
hq4x filter for Godot Engine
/**
* hq4x filter.
* https://www.shadertoy.com/view/MslGRS
* https://github.com/libretro/common-shaders/blob/master/scalehq/shaders/4xScaleHQ.cg
*/
shader_type canvas_item;
uniform bool enabled = true;
void fragment(){
@deakcor
deakcor / shadow2d.shader
Last active January 18, 2024 19:17
Shadow 2D for Godot Engine
/**
* Shadow 2D.
* License: CC0
* https://creativecommons.org/publicdomain/zero/1.0/
*/
shader_type canvas_item;
render_mode blend_mix;
uniform vec2 deform = vec2(2.0, 2.0);
uniform vec2 offset = vec2(0.0, 0.0);
@deakcor
deakcor / cropping_texture.shader
Created January 8, 2021 12:55
Cropping shader for Godot Engine
/**
* Crop a texture.
* License: CC0
* https://creativecommons.org/publicdomain/zero/1.0/
*/
shader_type canvas_item;
uniform float crop_left:hint_range(0.0,1.0,0.01) = 0.0;
uniform float crop_right:hint_range(0.0,1.0,0.01) = 0.5;
uniform float crop_top:hint_range(0.0,1.0,0.01) = 0.0;
@deakcor
deakcor / color_replacement.shader
Created January 8, 2021 12:45
Color replacement shader for Godot Engine
/**
* Replace a color by another one.
* License: CC0
* https://creativecommons.org/publicdomain/zero/1.0/
*/
shader_type canvas_item;
uniform vec4 remove_color: hint_color;