Skip to content

Instantly share code, notes, and snippets.

@Lightnet
Lightnet / README.md
Last active October 20, 2025 22:15
Sample refine Raylib, Flecs, and raygui for transform 3D hierarchy.

I kept it simple but with the raygui it easy to debug to control transform to update real time.

// Transform3D component
typedef struct {
    Vector3 position;         // Local position
    Quaternion rotation;      // Local rotation
    Vector3 scale;            // Local scale
    Matrix localMatrix;       // Local transform matrix
    Matrix worldMatrix;       // World transform matrix
 bool isDirty; // Flag to indicate if transform needs updating
@Lightnet
Lightnet / raylib_flecs_ode_controller.c
Created October 18, 2025 06:01
Sample player controller move test for raylib, ode and flecs.
// flecs 4.1.1
// raylb 5.5
// ode 0.16.6
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "raylib.h"
#include "raymath.h"
#include "ode/ode.h"
#include "flecs.h"
@Lightnet
Lightnet / Flecs 4 Documentation for Hierarchical 3D Transformation Systems.md
Last active March 22, 2026 19:55
Flecs 4.x Documentation for Hierarchical 3D Transformation Systems

Flecs 4.x Documentation for Hierarchical 3D Transformation Systems

This guide outlines how to set up a hierarchical 3D transformation system using Flecs 4.x, focusing on correct entity-component-system (ECS) configuration, transformation order, and parent-child relationships. It is tailored for AI agents and developers building 3D applications (e.g., with OpenGL or other rendering APIs) where entities have position, rotation, and scale, and transformations are propagated through a parent-child hierarchy.Key Concepts1. Flecs Basics

  • Entities: Unique identifiers representing objects (e.g., a cube in a 3D scene).
  • Components: Data structures attached to entities (e.g., Transform3D for position, rotation, scale).
  • Systems: Functions that operate on entities with specific components, executed in a defined order (e.g., EcsPreUpdate, EcsOnUpdate).
  • Pairs: Relationships between entities, used for hierarchies (e.g., (EcsChildOf, ParentEntity) to denote a child-parent relationship).
  1. Hierarchical Transformat
@Lightnet
Lightnet / README.md
Created October 1, 2025 04:47
Sample SDL 3.2 Flecs 4.1 cimgui 1.92 cube test render.

Flecs: 4.1 Glad: 2.0.8 opengl: 330 sdl: 3.2 just sample test. cimgui: 1.92

This is just cube render set up test.

Sample test for getting the font working as cimgui conflict with font type from imgui.

rlgl_font.c main point.

raylib 5.5 cimgui

@Lightnet
Lightnet / raylib_picking.c
Last active September 26, 2025 22:51
Sample raylib 5.5 flecs 4.1 raygui picking single cube test.
// raylib 5.5
// flecs v4.1
// https://github.com/SanderMertens/flecs/blob/master/examples/c/systems/custom_pipeline/src/main.c
// right mouse toggle camera capture
// W,A,S,D = move camera when capture mouse
// escape to close app
// left mouse button to select cube
#include <stdio.h>
#include <flecs.h>
@Lightnet
Lightnet / main_transform_select_list.c
Created September 26, 2025 07:23
Sample raylib 5.5 flecs 4.1 raygui select node transform edit test.
// raylib 5.5
// flecs v4.1.1
// strange rotation for gui
// y -85 to 85 is cap else it will have strange rotate.
// note that child does not update the changes.
#include <stdio.h>
#include "raylib.h"
#include "raymath.h"
#include "flecs.h"
#define RAYGUI_IMPLEMENTATION
@Lightnet
Lightnet / raylib3d_flecs_transform_hierarchy_gui09.c
Last active September 26, 2025 06:18
sample test raylib 5.5 flecs 4.1 raygui transform test.
// flecs v4.1.1
// strange rotation for gui
// y -85 to 85 is cap else it will have strange rotate.
#include <stdio.h>
#include "raylib.h"
#include "raymath.h"
#include "flecs.h"
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
@Lightnet
Lightnet / rl_flecs_camera3d.c
Created September 26, 2025 00:43
sample raylib 5.5 flecs 4.1 raygui move position silder test
// raylib 5.5
// flecs v4.1
// https://github.com/SanderMertens/flecs/blob/master/examples/c/systems/custom_pipeline/src/main.c
//
#include <stdio.h>
#include <flecs.h>
#include "raylib.h"
#include <math.h>
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
@Lightnet
Lightnet / rl_flecs_camera3d_cube_wireframe.c
Created September 25, 2025 21:03
raylib 5.5 flecs 4.1 test params
// raylib
// https://github.com/SanderMertens/flecs/blob/master/examples/c/systems/custom_pipeline/src/main.c
#include <stdio.h>
#include <flecs.h>
#include "raylib.h"
//#define RAYGUI_IMPLEMENTATION
//#include "raygui.h"
// component