Skip to content

Instantly share code, notes, and snippets.

View thomasvanta's full-sized avatar

VanTa thomasvanta

View GitHub Profile
echo -ne "\xf0\x7d\x17\x00\x00\x02\x00\x00\xf7" > test.syx
@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
vec3 getNormal(vec3 p){
//sampling around the point
vec2 e = vec2(0.01, 0.0);
float d = map(p);
vec3 n = d - vec3(
map(p-e.xyy),
map(p-e.yxy),
map(p-e.yyx));
return normalize(n);
}
@thomasvanta
thomasvanta / RaspiQEMU.md
Last active January 1, 2019 16:06
Raspi emulation for osx with QEMU

Install QEMU OSX port with ARM support

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
&& brew update 
&& brew install qemu 
export QEMU=$(which qemu-system-arm) 
brew install wget

Using Sublime for C++ and openFrameworks

//originally from https://github.com/jmwohl/sfpc/blob/master/C%2B%2B/Using%20Sublime%20for%20C%2B%2B%20and%20openFrameworks.md

Setting up SublimeText for C/C++ development

Two things I knew were going to be important to me: smart code hinting and completion, and auto formatting. Thankfully other folks had already solved these problems for me via a couple handy packages:

1) SublimeAStyleFormatter - for auto formatting
2) Easy​Clang​Complete - for code completion
  1. SublimeLinter and SublimeLinter-contrib-clang - for error checks
//from simon geilfus: https://github.com/simongeilfus/FlyingTokyo19
//Pass an argument by value when it is a built-in type or a small object (Passing by value makes a copy of the object) :
void firstFunction( int number, bool boolean );
//Pass an argument by reference when you want the argument to be read-write:
void secondFunction( Rectf &rectangle );
//Pass an argument by const reference when you want the argument to be read-only (Read-only also ensure that your data won't be unecessarely copied when calling the function):
void thirdFunction( const vector<gl::Texture> &textures );
//created by jvcleave
//edited by Thomas Van Ta
//openFrameworks 0.8-0.9 main.cpp
#include "ofMain.h"
#include "ofApp.h"
#if (OF_VERSION_MINOR != 9) && defined(TARGET_OPENGLES)
#include "ofGLProgrammableRenderer.h"
#endif