Skip to content

Instantly share code, notes, and snippets.

--This code can be improved a lot.
--Feel free to improve, use or modify in any way although credit would be appreciated.
--Global table
if BSHADOWS == nil then
BSHADOWS = {}
--The original drawing layer
BSHADOWS.RenderTarget = GetRenderTarget("bshadows_original", ScrW(), ScrH())
--This code can be improved a lot.
--Feel free to improve, use or modify in any way although credit would be appreciated.
if BMASKS == nil then
BMASKS = {} --Global table, access the functions here
BMASKS.Materials = {} --Cache materials so they dont need to be reloaded
BMASKS.Masks = {} --A table of all active mask objects, you should destroy a mask object when done with it
--The material used to draw the render targets
@haakov
haakov / FpsController.cs
Created April 1, 2017 13:36
Unity3D FPS Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FpsController : MonoBehaviour {
public float mouseSensitivityX = 1.0f;
public float mouseSensitivityY = 1.0f;
public float walkSpeed = 10.0f;
@vankasteelj
vankasteelj / sec2time.js
Last active February 2, 2024 11:08
Javascript - Seconds to Time (hh:mm:ss,ms) -> sec2time(593.685038) becomes 00:09:53,685
function sec2time(timeInSeconds) {
var pad = function(num, size) { return ('000' + num).slice(size * -1); },
time = parseFloat(timeInSeconds).toFixed(3),
hours = Math.floor(time / 60 / 60),
minutes = Math.floor(time / 60) % 60,
seconds = Math.floor(time - minutes * 60),
milliseconds = time.slice(-3);
return pad(hours, 2) + ':' + pad(minutes, 2) + ':' + pad(seconds, 2) + ',' + pad(milliseconds, 3);
}
@insin
insin / README.md
Last active February 13, 2024 21:59
Extract Minecraft music

Extract Minecraft music

As of 1.8, assets are stored by hash, which makes it fiddly to listen to Minecraft's amazing ambient soundtrack outside the game.

This script can be used to copy music files to appopriately-named and organised .ogg files for easier listening.

1. Install Node.js or io.js

2. Save extract-music.js to your Minecraft assets directory:

@rezoner
rezoner / easings.js
Created March 2, 2015 17:27
One argument easing equations
/*
A full list of simple easing equations inspired by GIST from greweb - https://gist.github.com/gre/1650294
Equations source - http://gsgd.co.uk/sandbox/jquery/easing/
*/
{
linear: function(t) {
return t
},
inQuad: function(t) {
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 16, 2024 21:20
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@ftvs
ftvs / CameraShake.cs
Last active May 17, 2024 12:21
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
@gre
gre / easing.js
Last active May 17, 2024 03:33
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {