Skip to content

Instantly share code, notes, and snippets.

View reduz's full-sized avatar

Juan Linietsky reduz

View GitHub Profile
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
"global_constants": [
@reduz
reduz / api.json
Created June 19, 2021 23:05
New Godot API dump text format for native extensions
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
"global_constants": [
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
"builtin_class_sizes": [
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
"builtin_class_sizes": [
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
"builtin_class_sizes": [
@reduz
reduz / gist:6bd1a4922f68cf4e4bd14c19612343f2
Created July 19, 2023 11:49
Godot Struct Low Level Proposal
// Implementation in Array
// ArrayPrivate needs to be changed:
class ArrayPrivate {
public:
SafeRefCount refcount;
Vector<Variant> array;
Variant *read_only = nullptr; // If enabled, a pointer is used to a temporary value that is used to return read-only values.
ContainerTypeValidate typed;
@reduz
reduz / structs.cpp
Created July 19, 2023 11:49
Godot Struct Low Level Proposal
// Implementation in Array
// ArrayPrivate needs to be changed:
class ArrayPrivate {
public:
SafeRefCount refcount;
Vector<Variant> array;
Variant *read_only = nullptr; // If enabled, a pointer is used to a temporary value that is used to return read-only values.
ContainerTypeValidate typed;
@reduz
reduz / structs.cpp
Created July 19, 2023 12:29
Godot Struct Low Level Proposal
// The idea of this proposal is that we can solve these following problems:
//* Add struct support to GDScript (this has some user demand, given classes are quite heavy resource wise)
//* Add limited struct support to the Godot API, so we avoid exposing things as dictionaries in the API, which are unfriendly (no code completion, no doc)
//* As a plus, have a way to have optimized, flat memory arrays of these structs. this allows much higher performance in GDScript when dealing with thousands of elements (as in, bullet hell). We know we can use multimesh to accelerate drawing (or the new APIs in Godot 3 for drawing which are more optimized), but storing logical data for processing all these is still inefficient cache wise.
//In GDScript, structs should look very simple:
struct MyStruct:
var a : String

Mock up of how compositor material would work:

shader_type compositor;
// The custom buffers from the Compositor proposal are all available for reading and writing

// Available render modes
render_mode post_opaque, post_alpha, post_tonemap; // default is post_alpha

//uniform sampler2D buffer_texture0 : hint_custom_buffer0_texture, repeat_disable, filter_nearest;
@reduz
reduz / godot_over_time1.md
Last active February 6, 2024 23:55
Godot source code in 2002

This is a walkthrough to the Godot codebase over time. I can't publish full repositories, but I will put here the interfaces of some APIs including the year they were created and how they looked like at the time.

2002, Larvotor

This was the first version of the engine as such. It was later on used to create Regnum Oline. This is source code where I am sure I can still put legally here. Here are some class interfaces.

Mesh class: