This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- Cube World | |
-- Use this function to perform your initial setup | |
function setup() | |
print(math.floor(3/4)) | |
--print(3\4) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- Terrain | |
--[[ | |
I started a project on terrains with the idea of small triangles near the camera, and then bigger triangles further away where less detail was required and driving the terrain from a heightfield. | |
It got very messy... | |
So I restarted heavily influenced by: | |
http://galfar.vevb.net/wp/2013/android-terrain-rendering-vertex-texture-fetch-part-1/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- Explosion | |
-- Use this function to perform your initial setup | |
function setup() | |
--first generate a spherical mesh radius 1 around the origin | |
--this uses an isosphere primitive code I made some time ago, but any sphere will do with sufficient vertices | |
--the parameter to Sphere is how much to subdivide the faces (more vertices, slower performance) | |
sphere = Primitive:Sphere(3) | |
--attach the explosion shader to the mesh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Explosion | |
-- Use this function to perform your initial setup | |
function setup() | |
sphere = Primitive:Sphere(4) | |
sphere.shader = shader(ExplosionShader.vertexShader,ExplosionShader.fragmentShader) | |
sphere.shader.texture = readImage("Dropbox:explosion") | |
shader() | |
size = 0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- Skeletal Animation | |
--helper function for matrix vector maths | |
function matrixByVector(m, v) | |
m=m:transpose() | |
vx = vec4(m[1], m[2], m[3], m[4]):dot(v) | |
vy = vec4(m[5], m[6], m[7], m[8]):dot(v) | |
vz = vec4(m[9], m[10], m[11], m[12]):dot(v) | |
vw = vec4(m[13], m[14], m[15], m[16]):dot(v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- RayTracer 3Balls | |
-- Use this function to perform your initial setup | |
function setup() | |
displayMode(FULLSCREEN) | |
myMesh = mesh() | |
--myMesh.shader = shader("Documents:ray") | |
myMesh.shader = shader(rayShader.vertexShader, rayShader.fragmentShader) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- Particle Effect | |
-- Use this function to perform your initial setup | |
function setup() | |
displayMode(FULLSCREEN) | |
--to get ghost trails | |
backingMode(RETAINED) | |
--b=Backup("Particle Fireworks Ver 002") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- Particle Effect | |
-- Use this function to perform your initial setup | |
function setup() | |
displayMode(FULLSCREEN) | |
--to get ghost trails | |
backingMode(RETAINED) | |
--b=Backup("Particle Effect Ver 006") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder