Skip to content

Instantly share code, notes, and snippets.

View sortofsleepy's full-sized avatar

Joe sortofsleepy

View GitHub Profile
@sortofsleepy
sortofsleepy / Unreal notes.md
Last active April 10, 2024 01:13
Web/OpenGL -> Unreal Engine

Some general observations about Unreal. Note that I am dumb and some mistakes / misinformation might be present.

Units

1 "unit" in unreal for setting something is approximately setting that object to 0.01 scale.

For example, for the default 100x100x100 cube, to make it 1x1x1, you set the scale of that to 0.01

I believe things are "technically" in cm, but don't quote me on that.

@sortofsleepy
sortofsleepy / .gitdepsignore
Last active March 19, 2024 16:14
Setup UE w/ some excluded dependencies
/Engine/Extras/VisualStudioDebugging/**
/Engine/Extras/VisualStudioSnippets/**
/Engine/Extras/Maya_AnimationRiggingTools/**
/Engine/Extras/MayaVelocityGridExporter/**
/Engine/Plugins/Online/**
@sortofsleepy
sortofsleepy / OdinWebAssemblyBasic.md
Last active February 28, 2024 13:49
Odin language simple WebAsembly setup

Have some free time on my hands so I thought I'd try out Odin, an interesting language I came across a few weeks ago. I haven't dived too far into it but so far from what I understand, it's another language in a similar vain of Rust and Zig(both also very good)

Since as far as I can tell, though Odin does support WebAssembly, how specifically to build for it is not well documented so I thought I should post a very basic setup for WebAssembly.

All the Odin app does is

  • export a function that called setup that calls an imported JS function getWindowWidth
  • In the JS, it calls setup and logs the result.

When building the Odin code, the command is roughly odin build -target="js_wasm32" -out=""

@sortofsleepy
sortofsleepy / +page.server.ts
Created July 2, 2023 14:31
SvelteKit File Upload Example
import {writeFileSync, existsSync, mkdirSync} from "fs"
// make sure tmp directory exists and create it if it doesn't
function checkTmp() {
if (!existsSync("static/tmp")) {
mkdirSync("static/tmp")
}
}
export const actions = {
// Example of how to find indices to values in a 2D array that are below a specified index.
/*
Take the following
[0,1,2,3
4,5,6,7
8,9,10,11]
This formula helps you figure out, for instance, what the index of 4 is if we're looking at index 0.
@sortofsleepy
sortofsleepy / CMakeLists.txt
Created June 8, 2023 23:07
Building Google Dawn w/ CMake
cmake_minimum_required(VERSION 3.25)
project(dawn_compile)
set(CMAKE_CXX_STANDARD 17)
add_executable(dawn_compile main.cpp)
include_directories(dawn_compile ${CMAKE_CURRENT_SOURCE_DIR}/libraries/dawn/include)
include_directories(dawn_compile ${CMAKE_CURRENT_SOURCE_DIR}/libraries/dawn/gen/include)
@sortofsleepy
sortofsleepy / ParticleSystem.ts
Last active May 27, 2023 16:13
BabylonJS MultiRenderTarget particle system example
import {
Constants,
Color4,
Mesh,
Scene,
RenderTargetTexture,
Engine,
Vector3,
UniversalCamera,
RawTexture,
@sortofsleepy
sortofsleepy / setup.jsx
Last active May 19, 2023 16:40
example of how to build an instanced sphere while adding additional attributes to the mesh
// Builds instanced data for the packing
const objdata = useMemo(() => {
let sphere = new SphereGeometry(1, widthSegments, heightSegments);
// build colors
let palette = colors({
numberOfValues: 20
})
const settings = {
@sortofsleepy
sortofsleepy / r3fInstancedBufferGeometry.js
Last active April 20, 2023 16:32
This is a basic example of using InstancedBufferGeometry in react-three-fiber as of 8.12.1. Uses the pack-spheres npm module to generate the shapes.
import React, {useMemo} from "react";
import pack from "pack-spheres"
import {SphereGeometry, GLSL3, InstancedBufferAttribute} from "three"
export default function (props) {
const {
numInstances = 1000,
dimensions = 3,
packAttempts = 500,
@sortofsleepy
sortofsleepy / build.zig
Created January 24, 2023 23:51
Zig build script - passing command line value example
const Builder = @import("std").build.Builder;
const std = @import("std");
pub const OptionsStep = @import("std").build.OptionsStep;
pub fn build(b: *Builder) void {
var option = b.option(bool,"Desktop", "Set to true to build desktop focused library");
if(option == true){
std.log.info("TODO",.{});