Skip to content

Instantly share code, notes, and snippets.

View AndreaCatania's full-sized avatar
🍇
Hey!

Andrea Catania AndreaCatania

🍇
Hey!
View GitHub Profile
@AndreaCatania
AndreaCatania / amethyst_useful_information.md
Last active July 7, 2019 11:31
Useful information of amethyst game engine

Coords

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

Components

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.

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")
extends Node3D
var player_query: DynamicQuery
var animation_tree: AnimationTree
var root_state_machine: AnimationNodeStateMachinePlayback
func _ready():
# Build the player query used to fetch the player status.
player_query = DynamicQuery.new()
@AndreaCatania
AndreaCatania / importer.gd
Last active July 12, 2021 14:48
Godot 4 automated 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
AndreaCatania / godot_fluid_shader
Created May 2, 2019 20:37
Godot fluid shader using flex engine
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
AndreaCatania / read_memory_test.cpp
Last active December 11, 2021 02:25
C++ memory access performance test
/**
* 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
*
@AndreaCatania
AndreaCatania / FlyCam.gd
Last active January 7, 2022 10:55
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
AndreaCatania / FBX_edges.md
Last active March 28, 2023 21:52
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
@AndreaCatania
AndreaCatania / godot_expose_utils.h
Last active June 2, 2023 15:53
Header that defines some utility macro that allows to expose C++ class parameters to Godot editor.
/// 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);
{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\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": "kbdfans/niu_mini",
"keymap": "catania_layout_10",
"layout": "LAYOUT_planck_mit",
"layers": [
[
"KC_ESC",