Skip to content

Instantly share code, notes, and snippets.

View tnlogy's full-sized avatar

Tobias Teleman tnlogy

View GitHub Profile
@tnlogy
tnlogy / UI.codea
Created January 26, 2013 20:33
QML implementation attempt for Codea
--# UI
UI = {}
function UI.C(code)
return loadstring("return " .. code)
end
UI.Item = class()
UI.Item.defaults = {
@tnlogy
tnlogy / Light Shader in Codea
Created February 1, 2013 09:40
Light Shader in Codea
--# Main
-- 2 Face
function parseObjFormat(data)
local avs, ans, auvs = {},{},{}
local f = "%s(\-?%d*[\.]%d+)"
for x,y,z in string.gmatch(data, "v" .. f .. f .. f) do
table.insert(avs,
@tnlogy
tnlogy / Notes in Codea
Created February 4, 2013 16:24
Notes in Codea
-- 4 play
-- Use this function to perform your initial setup
function setup()
displayMode(FULLSCREEN)
createPitchTable()
parameter.integer("X", 1,10,1,play)
song = {
@tnlogy
tnlogy / Formation
Created February 17, 2013 12:26
Swarming behaviour in Codea
--# Main
-- Formation
function setup()
displayMode(FULLSCREEN)
physics.gravity(0,0)
touches = {}
items = {}
ships = {}
@tnlogy
tnlogy / UI
Created February 23, 2013 21:21
--# Main
-- 0 UI
-- Use this function to perform your initial setup
function setup()
displayMode(FULLSCREEN)
scene = Item({0,0},
Button{100,300,180,60,text="Hello"},
Button{400,300,100,40,text="Ping"},
@tnlogy
tnlogy / Scene and Noise
Created February 24, 2013 17:53
Scene and Noise and Pinch Zoom
--# Main
-- 0 UI
-- Use this function to perform your initial setup
function setup()
displayMode(FULLSCREEN)
local p1 = UI.Pad({0,100,200,200})
local p2 = UI.Pad({550,100,200,200})
local shipPos = UI.Item({500,500,scale=0.1},
@tnlogy
tnlogy / gist:5132866
Last active December 14, 2015 18:59
CSG for Codea
-- CSG - Constructive Solid Geometry
function table.map(t, f)
local res = {};
for i,v in ipairs(t) do res[i] = f(v); end
return res;
end
function table.append(t1, t2)
local res = table.copy(t1)
@tnlogy
tnlogy / IsoSphere
Created March 12, 2013 19:46
IsoSphere with texture mapping
--# Main
-- IsoSphere
-- Use this function to perform your initial setup
function setup()
parameter.integer("Divisions", 0,5,1, createSphere)
parameter.number("H",-10,10,0)
R = 0
end
@tnlogy
tnlogy / Grass Simulation.lua
Created March 19, 2013 14:22
Grass Simulation in Codea
--# Main
-- Grass
function setup()
displayMode(FULLSCREEN)
R,H = 40,1
base = mesh()
base.vertices = {
vec3(-1,0,-1), vec3(1,0,-1),
@tnlogy
tnlogy / Simple Volume Renderer in Codea.lua
Created March 22, 2013 05:22
Simple Volume Renderer in Codea
--# Main
-- Slices
function setup()
displayMode(FULLSCREEN)
parameter.number("Limit",0,1,.1)
parameter.integer("LowSlice",-80,80,-80)
parameter.integer("HighSlice",-80,80,80)
R = 0