Skip to content

Instantly share code, notes, and snippets.

View tnlogy's full-sized avatar

Tobias Teleman tnlogy

View GitHub Profile
--# Main
-- Infinite Grid
function setup()
displayMode(FULLSCREEN)
g = Grid()
end
--# Main
-- Terrain
function setup()
displayMode(FULLSCREEN)
forward, right, up = vec3(0,0,1), vec3(-1,0,0), vec3(0,1,0)
pos = vec3(0,100,0)
t = Terrain()
A = 0
--# Main
-- Terrain
function setup()
displayMode(FULLSCREEN)
forward, right, up = vec3(0,0,1), vec3(-1,0,0), vec3(0,1,0)
t = Terrain()
A = 0
end
@tnlogy
tnlogy / 3D touch.lua
Created January 6, 2014 02:28
Example of implementing 3D touch. In progress.
--# Main
function setup()
displayMode(FULLSCREEN)
sky = Skybox()
forward, right, up = vec3(0,0,-1), vec3(1,0,0), vec3(0,1,0)
rays = {}
-- creating some random triangles to hit
tris = {}
@tnlogy
tnlogy / GoingSouth.lua
Created December 25, 2013 16:47
Going Souh - Codea Cook Off code
--# Clouds
Clouds = class()
function Clouds:init(x)
local s = shader([[
uniform mat4 modelViewProjection;
attribute vec4 position;
attribute vec4 color;
attribute vec2 texCoord;
@tnlogy
tnlogy / ImageTools.h
Last active May 23, 2018 19:24
A Codea addon for saving images to the photo album, share photos to facebook and detect faces in an image. Just add [self.viewController registerAddon:[ImageTools sharedInstance]]; to AppDelegate.mm
//
// ImageTools.h
// FaceDetection
//
// Created by Tobias Teleman on fredag 12 april 2013
// Copyright (c) Tobias Teleman. All rights reserved.
//
#import <Foundation/Foundation.h>
@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
@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 / 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 / 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)