Skip to content

Instantly share code, notes, and snippets.

// Commented version of https://twitter.com/zozuar/status/1441384708441456651
// Google-translated (with some editing) from @gam0022's version
float i, // Ray marching loop counter
e, // Volume density (the smaller the value, the higher the density)
s, // FBM scale (and loop counter)
g, // Ray's distance (also used for tunnel twirl and camera prespective)
k = .01; // Handy constant
// Ray marching loop
@simonwittber
simonwittber / MonoBehaviourComponent.cs
Last active March 29, 2021 02:28
MonoBehaviour classes which allow for Batch Updating.
using System.Collections.Generic;
using UnityEngine;
public abstract class MonoBehaviourSystem<T> : MonoBehaviour where T : MonoBehaviourComponent<T>
{
protected abstract void UpdateBatch(Queue<T> components);
void Update()
{
UpdateBatch(ComponentBatch<T>.components);
// This doesn't seem to work properly
//#define USE_UNITY_PIN_FUNCTION
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Jobs;
using UnityEngine;
using UnityEngine.Assertions;
// This doesn't seem to work properly
//#define USE_UNITY_PIN_FUNCTION
using System;
using System.Runtime.InteropServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.Assertions;
// Trick for creating a temporary NativeArray which points to the contents of a managed array.
@takanakahiko
takanakahiko / プリパラの魅力.md
Last active December 10, 2018 02:24
ポエムです

この記事はプリッカソン Advent Calendar 20185日目の記事です

ひとこと

女児向けアーケードゲームを原作にしたアイドルアニメです!

こまかく

タカラトミーアーツが開発した新筐体、プリチケのローンチタイトル第1弾. 2010年から約4年間続いた『プリティーリズム』シリーズの後継作. アーケードゲーム、アニメを中心とした『プリパラ』としてリニューアルされました. 前作とは特につながりはなく,観ていなくても大丈夫です.

#extension GL_EXT_shader_texture_lod : enable
uniform samplerCube uRadianceMap;
uniform samplerCube uIrradianceMap;
#define saturate(x) clamp(x, 0.0, 1.0)
#define PI 3.1415926535897932384626433832795
const float A = 0.15;
@galek
galek / pbr.glsl
Created November 4, 2015 11:10
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
// ImGui - standalone example application for Glfw + OpenGL 3, using programmable pipeline
#include <imgui.h>
#include "imgui_impl_glfw_gl3.h"
#include <stdio.h>
#include <GL/gl3w.h>
#include <GLFW/glfw3.h>
#include <math.h>
#include <string.h>
#include <vector>
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active August 1, 2026 00:33
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@cloudwu
cloudwu / ffr.c
Last active January 30, 2023 04:29
fast IEEE 754 float random
#include <stdint.h>
#include <stdlib.h>
// assert(RAND_MAX >= 0x7fff)
float
random_0_to_1() {
union {
uint32_t d;
float f;
} u;