Skip to content

Instantly share code, notes, and snippets.

AndreaCatania /
Last active Apr 18, 2021
Godot 4 automatica material assigner
## License MIT
## This Post Import script automatically assign the
## material to the Mesh if it's found inside the
## `res://materials` directory.
## # How to use
## To you use it, you need to set this script as Post Import script
## on the file.fbx or file.glb.
AndreaCatania / godot_expose_utils.h
Last active Mar 12, 2021
Header that defines some utility macro that allows to expose C++ class parameters to Godot editor.
View godot_expose_utils.h
/// This file is an utility to avoid write the same code over and over to expose
/// the variables in Godot.
/// To use it you can include this into your header, and use `SETGET` to define
/// the variable you want to expose:
/// ```
/// #include "scene/3d/node_3d.h"
/// #include "godot_expose_utils.h"
/// class TestNode : public Node {
/// GDCLASS(TestNode, Node);
AndreaCatania /
Last active Apr 15, 2021
Godot Fly camera utility - Single file
extends Camera3D
class_name FlyCamera
## Simple Fly Camera for Godot Engine 3.x / 4.x.
## This Fly camera can be moved using the mouse and keyboard "WASD".
## You can toggle this camera activation by pressing the TAB key.
## The idea is to put this camera as autoload.
## It's possible to customize it by changing: The mouse `sensibility` and camera `speed`.
## If you want to contribute, please leave a comment, I'll update the code.
AndreaCatania /
Last active Jan 14, 2021
Explanation on how the edges are stored into the FBX.

FBX format - Unique Edges

How the edges are stored into FBX?

How to parse the edges from FBX?

Let's consider this geometry:

Objects:  {
	Geometry: 140696156120336, "Geometry::", "Mesh" {
		Vertices: *18 {
			a: -1,-1,0,1,-1,0,-1,1,0,1,1,0,-1.00631749629974,2.97582387924194,-0.0179548189043999,0.993682563304901,2.97582387924194,-0.0179548189043999
View catania_layout_9.json
{"version":1,"notes":"","documentation":"\"This file is a QMK Configurator export. You can import this at <>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n","keyboard":"niu_mini","keymap":"catania_layout_9.json","layout":"LAYOUT_planck_mit","layers":[["KC_ESC","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_BSPC","KC_TAB","KC_A","KC_S","KC_D","KC_F","KC_G","KC_H","KC_J","KC_K","KC_L","KC_SLSH","KC_ENT","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_N","KC_M","KC_COMM","KC_DOT","KC_SCLN","KC_QUOT","KC_LCTL","KC_LGUI","KC_LALT","KC_DLR","MO(1)","KC_SPC","MO(2)","KC_AMPR","MO(3)","MO(4)","KC_RALT"],["KC_NO","KC_1","KC_2","KC_3","KC_NO","KC_NO","KC_NO","KC_LPRN","KC_RPRN","KC_NO","KC_NO","KC_DEL","KC_CAPS","KC_4"
View gist:f8d307d5fd694b548e465eae3b2ff088
extends MeshInstance3D
var velocity: Vector3 = Vector3(2, 0, 0)
var interval: float = 0.0
func _ready():
SceneRewinder.register_variable(self, "translation")
SceneRewinder.register_variable(self, "velocity")
SceneRewinder.register_variable(self, "interval")
AndreaCatania /
Created Nov 11, 2019
FFmpeg example to extract a frame from a video in Rust Lang
/// This
unsafe {
// This portion of code was written by taking as resource:
// This article is outdated, and some APIs got deprecated, here I used the non deprecated version.
// The idea of FFmpeg is to
// 1. open the file
AndreaCatania /
Last active Jul 7, 2019
Useful information of amethyst game engine


The coordinate system is +Y up, and the camera looks toward -Z


A component must be registered before used. It is registerd automatically in the setup function by the System trait. If, for any reason, the component is not yet used by any system, you can register it using the below code, and thus avoid panics.

AndreaCatania / godot_fluid_shader
Created May 2, 2019
Godot fluid shader using flex engine
View godot_fluid_shader
shader_type spatial;
render_mode blend_mix, unshaded;
uniform float water_transparency = 0.1;
uniform vec4 water_color: hint_color;
uniform float water_distortion = 20;
uniform vec2 water_distortion_direction = vec2(0, 1);
vec4 blur(sampler2D tex, vec2 current_uv, vec2 pixel_size, int passes ){
AndreaCatania / read_memory_test.cpp
Last active Sep 18, 2020
C++ memory access performance test
View read_memory_test.cpp
* C++ memory reading performance test.
* This snippet is used to test the performance differences between a forward,
* backward and random array accessing.
* The random access memory is a biased test but was interesting test to do anyway.
* The execution of this code may time a while depending on your CPU