Skip to content

Instantly share code, notes, and snippets.

View thomasvanta's full-sized avatar

VanTa thomasvanta

View GitHub Profile
@thomasvanta
thomasvanta / Easing.hlsl
Created January 16, 2020 15:07 — forked from mattatz/Easing.hlsl
Easing functions for HLSL.
#ifndef _EASING_INCLUDED_
#define _EASING_INCLUDED_
float ease_linear(float x) {
return x;
}
float ease_in_quad(float x) {
float t = x; float b = 0; float c = 1; float d = 1;
return c*(t/=d)*t + b;
@thomasvanta
thomasvanta / Quaternion.hlsl
Created January 16, 2020 15:07 — forked from mattatz/Quaternion.hlsl
Quaternion structure for HLSL
#ifndef __QUATERNION_INCLUDED__
#define __QUATERNION_INCLUDED__
#define QUATERNION_IDENTITY float4(0, 0, 0, 1)
#ifndef PI
#define PI 3.14159265359f
#endif
// Quaternion multiplication
@thomasvanta
thomasvanta / Matrix.hlsl
Created January 16, 2020 15:06 — forked from mattatz/Matrix.hlsl
Matrix operations for HLSL
#ifndef __MATRIX_INCLUDED__
#define __MATRIX_INCLUDED__
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
float4x4 inverse(float4x4 m) {
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0];
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1];
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2];
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3];
@thomasvanta
thomasvanta / StandardDoubleSide.shader
Created November 25, 2019 16:25 — forked from naojitaniguchi/StandardDoubleSide.shader
Standerd Double sided shader for Unity
Shader "StandardDoubleSide"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
@thomasvanta
thomasvanta / GLSL-Noise.md
Created September 29, 2015 10:17 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

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);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@thomasvanta
thomasvanta / com.tvt.keep-twitter-alive.plist
Last active September 6, 2015 18:40 — forked from admsyn/README.txt
Keep an installation alive with launchd & launchctl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</exit>
<true/>
</dict>
<key>Label</key>
#include "testApp.h"
const string SHADER_VS = " \
uniform mat4 projection_matrix; \
uniform mat4 view_matrix; \
attribute vec4 pos; \
attribute vec2 tex; \
varying vec2 vtex; \
\
void main() { \