Skip to content

Instantly share code, notes, and snippets.

@jayschwa
jayschwa / gist:5239689
Created March 25, 2013 19:02
Small Julia vectors to correspond with GLSL types
import Base:cross,getindex,reshape,size
immutable GLSLVector2{T} <: AbstractVector{T}
v1::T
v2::T
GLSLVector3(v1, v2) = new(convert(T, v1), convert(T, v2))
end
GLSLVector2{T}(v1::T, v2::T) = GLSLVector3{T}(v1, v2)
function getindex(x::GLSLVector2,i::Integer)