Skip to content

Instantly share code, notes, and snippets.

@sp4cemonkey
sp4cemonkey / Physics Sandbox
Last active December 11, 2015 18:49
Physics Sandbox
--# Main
-- Physics Sandbox
-- Use this function to perform your initial setup
function setup()
displayMode(FULLSCREEN)
lineCapMode(PROJECT)
debugDraw = PhysicsDebugDraw()
--1 is max bouncyness, 0 is no bounce
--# Main
-- Use this function to perform your initial setup
function setup()
displayMode(STANDARD)
availableTests = { Test2(), Test1() }
currentTest = availableTests[1]
@sp4cemonkey
sp4cemonkey / 3d Sin in a shader
Last active December 13, 2015 21:28
3d Sin in a shader
-- 3d sin
-- todo project touch to y=0 plane...
-- Use this function to perform your initial setup
function setup()
gridSize = 30
--displayMode(FULLSCREEN)
parameter.number("speed", 0, 1,0.2)
--# Main
-- Cube
function setup()
parameter.number("ambient", 0, 1, 0.1)
parameter.number("diffuse", 0, 1, 1.0)
parameter.number("specular", 0, 1, 1)
parameter.color("lightColor", color(255,255,255,255))
parameter.color("surfaceColor", color(191,41,85,255))
allTextures = {
--# Main
--# Main
-- Use this function to perform your initial setup
displayMode(FULLSCREEN)
function setup()
stick = Stick()
--# Main
-- Cube
function setup()
parameter.number("ambient", 0, 1, 0.1)
parameter.number("diffuse", 0, 1, 1.0)
parameter.number("specular", 0, 1, 1)
parameter.color("lightColor", color(255,255,255,255))
parameter.color("surfaceColor", color(191,41,85,255))
allTextures = {
@sp4cemonkey
sp4cemonkey / Vintage 3d Tile Based
Last active December 14, 2015 11:19
Vintage 3d Tile Based w lighting and bump mapping
--# Main
--# Main
-- Use this function to perform your initial setup
displayMode(FULLSCREEN)
function setup()
stick = Stick()
pylon = Wall("Cargo Bot:Crate Red 2")
@sp4cemonkey
sp4cemonkey / Shadow Map
Last active January 8, 2019 16:33
Example 2 pass shadow mapping in Codea and OpenGL SL
--# Main
-- Light Map
-- Use this function to perform your initial setup
function setup()
displayMode(FULLSCREEN)
--initialise the world
world = World()
@sp4cemonkey
sp4cemonkey / LitMesh Class
Last active December 14, 2015 15:59
This is a codea class with an ADS lighting with options for colored, textured and bumpmapped
LitMesh = class()
--[[
LitMesh provides a bumpmappable ADS (ambient/diffuse/specular) lighting enhanced class
for meshes.
usage:
setup()
myObject = LitMesh(isTextured, isBumpMapped)
myObject.litMesh.vertices = some table of vertices
@sp4cemonkey
sp4cemonkey / Grass
Last active December 15, 2015 05:19
-- Grass
-- Use this function to perform your initial setup
function setup()
field = mesh()
--field.shader = shader("Documents:Grass")
field.shader = shader(GrassShader.vertexShader, GrassShader.fragmentShader)
bladeWidth = 0.15
bladeHeight = 1.5
midWeight = 0.4