Skip to content

Instantly share code, notes, and snippets.

View tnlogy's full-sized avatar

Tobias Teleman tnlogy

View GitHub Profile
--# Main
function setup()
parameter.boolean("FILL")
parameter.integer("RANGE", 1,20,3)
parameter.boolean("LINE")
parameter.boolean("FOV")
parameter.boolean("MOVE")
hs = Hexagons():createMesh():set(0,0,color(207, 67, 67))
u = Unit(hs:pos(0,0))
--# Main
-- March
function setup()
local function sp(p)
return p:len() * p:dist(vec3(5,3,0))
end
local st = os.clock()
local vs = volume(sp, 9, .5, 6)
print(os.clock() - st)
--# Main
-- Voronoi
function draw()
background(40, 40, 50)
startVoronoi()
end
@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 / 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