Skip to content

Instantly share code, notes, and snippets.

@Lightnet
Lightnet / transform.js
Created April 6, 2026 02:21
sample transform 3d hierarchy matrix4.
// transform 3d hierarchy matrix4
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
// import { TransformControls } from 'three/addons/controls/TransformControls.js';
import { ViewportGizmo } from "three-viewport-gizmo";
import van from "vanjs-core";
import { Pane } from 'https://cdn.jsdelivr.net/npm/tweakpane@4.0.5/dist/tweakpane.min.js';
import { label } from 'three/tsl';
@Lightnet
Lightnet / three_transform.js
Created April 5, 2026 21:39
sample editor test transform matrix.
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
// import { TransformControls } from 'three/addons/controls/TransformControls.js';
import { ViewportGizmo } from "three-viewport-gizmo";
import van from "vanjs-core";
import { Pane } from 'https://cdn.jsdelivr.net/npm/tweakpane@4.0.5/dist/tweakpane.min.js';
import { label } from 'three/tsl';
function degreeToRadians(degrees) {
@Lightnet
Lightnet / threesql.js
Created March 25, 2026 19:35
simple collision box and sphere 3d with sql javascript test
// sqlite wasm
// <script type="importmap">
// {
// "imports":{
// "three":"https://cdn.jsdelivr.net/npm/three@0.183.2/+esm"
// }
// }
// </script>
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.183.2/+esm';
@Lightnet
Lightnet / three_sql.js
Created March 23, 2026 19:04
three sqlite wasm test collision 3d
// sqlite wasm
// <script type="importmap">
// {
// "imports":{
// "three":"https://cdn.jsdelivr.net/npm/three@0.183.2/+esm"
// }
// }
// </script>
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.183.2/+esm';
@Lightnet
Lightnet / becsy_test.js
Created December 4, 2025 19:44
becsy Singleton System test.
import {System, Type, World} from 'https://esm.run/@lastolivegames/becsy';
// import * as THREE from 'https://esm.run/three';
import van from "vanjs-core";
class ConfigComponent {
static schema = {
gameSpeed: {type:Type.float32, default: 60},
isPaused: {type:Type.boolean, default: false},
};
@Lightnet
Lightnet / tiny_llm02.js
Created December 3, 2025 22:54
sample tiny LLM from grok test.
// ===============================================
// TINY GPT FROM SCRATCH IN PURE JAVASCRIPT
// ~250 lines | No dependencies | Runs in Node.js & Browser
// Educational version with deep comments
// ===============================================
class TinyLLM {
constructor(config = {}) {
// Hyperparameters — feel free to tweak
this.vocabSize = config.vocabSize || 65; // How many tokens exist
@Lightnet
Lightnet / raylib_hex01.c
Last active November 8, 2025 02:09
Sample raylib 5.5 hex bar.
/*********************************************************************
* raylib 5.5 + raygui – Hex-Bar Progress Bar (100% fill)
* gcc raylib_hex01.c -o hexbar -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
*********************************************************************/
#define RAYGUI_IMPLEMENTATION
#include "raylib.h"
#include "raymath.h"
#include "raygui.h"
#include <stdio.h>
@Lightnet
Lightnet / raylib_jolt_character.cpp
Created October 30, 2025 20:16
sample raylib jolt physics character controller test move and jump.
#define RAYLIB_IMPLEMENTATION // <-- tells raylib to include its source once
#include <raylib.h>
#include <Jolt/Jolt.h>
#include <Jolt/RegisterTypes.h>
#include <Jolt/Core/Factory.h>
#include "Jolt/Physics/PhysicsSettings.h"
#include <Jolt/Core/JobSystemThreadPool.h>
#include <Jolt/Physics/PhysicsSystem.h>
@Lightnet
Lightnet / raylib_ode_capsule_controller.c
Created October 27, 2025 22:16
raylib ODE capsule controller test.
#include "raylib.h"
#include <ode/ode.h>
#include <stdio.h>
#include <math.h> // Ensure math.h is included for PI
// Global ODE variables
dWorldID world;
dSpaceID space;
dJointGroupID contactgroup;
dGeomID floorGeom, cube1Geom, cube2Geom;
@Lightnet
Lightnet / README.md
Last active October 22, 2025 02:13
Sample raylib, flecs ODE cube controller test.

Note for cmake ODE must build first then raylib due to config in ODE conflicts.

raylib 5.5 ode 0.16.6 flecs v4.1.1

KEY_C = enable/disable mouse orbiting mouse motion to rotate camera Q and E keys to rotate the camera’s yaw left and right