This file contains 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
--# Test | |
--[ | |
function setup() | |
img=readImage("Platformer Art:Block Grass"):copy(0,50,25,50) | |
b1=CreateBlock(10,5,5,color(255,255,0),nil,img) | |
b2=CreateBlock(10,5,5,color(255),nil,img) --b2:setColors(color(100,0,0)) | |
b1.pos=vec3(0,0,100) b1.a=0 | |
b2.pos=vec3(0,0,0) b2.a=40 | |
s=vec3(10,5,5) |
This file contains 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
function setup() | |
--this block assumes we are looking at it top down, ie using OpenGL defaults | |
blockTop=MakeBlock(20,30,50,nil,readImage("Platformer Art:Block Brick")) | |
--now make another block that will look exactly the same if viewed from the front | |
--we need to swap the y and z values, after changing the sign of the z values first | |
--I'm lazy, so first I'll just make an exact copy of the first block | |
--this saves me having to copy texture positions etc, all I need to do is modify the vertex positions | |
blockFront=MakeBlock(20,30,50,color(255,0,0),readImage("Platformer Art:Block Brick")) | |
blockFront:setColors(color(255,255,0)) --give it a tint so we see when it is used | |
--this is how you modify vertex positions in a mesh, first get a reference to them |
This file contains 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
--# Notes | |
--[[ | |
3D is a very, very big subject, with a lot to learn, so this set of demos can only scratch the surface, and cannot possibly explain everything there is to know. | |
You can simply watch the demos to see what Codea can do, but ideally,you should read up on 3D before trying to understand how the demos work, and before trying your own projects. | |
Also, this is not a set of "Wow, look what 3D can do" demos. If you look at them all without reading the notes, | |
you may not be very excited. But if you want to write your own 3D programs, this is what you need to know. (If | |
instead we had provided Wow demos, they would have been too hard for you to understand right now, and you might |
This file contains 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
--# Notes | |
--[[ | |
3D is a very, very big subject, with a lot to learn, so this set of demos can only scratch the surface, and cannot possibly explain everything there is to know. | |
You can simply watch the demos to see what Codea can do, but ideally,you should read up on 3D before trying to understand how the demos work, and before trying your own projects. | |
Also, this is not a set of "Wow, look what 3D can do" demos. If you look at them all without reading the notes, | |
you may not be very excited. But if you want to write your own 3D programs, this is what you need to know. (If | |
instead we had provided Wow demos, they would have been too hard for you to understand right now, and you might |
This file contains 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
--# Notes | |
--[[ | |
3D is a very, very big subject, with a lot to learn, so this set of demos can only scratch the surface, and cannot possibly explain everything there is to know. | |
You can simply watch the demos to see what Codea can do, but ideally,you should read up on 3D before trying to understand how the demos work, and before trying your own projects. | |
Also, this is not a set of "Wow, look what 3D can do" demos. If you look at them all without reading the notes, | |
you may not be very excited. But if you want to write your own 3D programs, this is what you need to know. (If | |
instead we had provided Wow demos, they would have been too hard for you to understand right now, and you might |
This file contains 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
--# Notes | |
--[[ | |
3D is a very, very big subject, with a lot to learn, so this set of demos can only scratch the surface, and cannot possibly explain everything there is to know. | |
You can simply watch the demos to see what Codea can do, but ideally,you should read up on 3D before trying to understand how the demos work, and before trying your own projects. | |
Also, this is not a set of "Wow, look what 3D can do" demos. If you look at them all without reading the notes, | |
you may not be very excited. But if you want to write your own 3D programs, this is what you need to know. (If | |
instead we had provided Wow demos, they would have been too hard for you to understand right now, and you might |
This file contains 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
--# Notes | |
--[[ | |
** What is a mesh? ** | |
A mesh is a quick way of drawing a shape. It is a set of points which create an outline (or wirefame) of an object | |
It is made up of triangles (groups of three points) | |
Triangles are used because a triangle has the smallest number of points that encloses an area | |
Each triangle corner is known as a VERTEX, and has a position and a colour | |
The colours of all the points inside the triangle are interpolated from the colours of the three corners |
This file contains 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
--# Notes | |
--[[ | |
This project shows how to add different types of lighting to 3D scenes (in this case, a cube) | |
--HOW TO USE THIS PROJECT | |
There are a number of tabs at the top. Press on a tab to see its code. | |
Work through the tabs from left to right, to see the project develop |
This file contains 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
--# Notes | |
--[[ | |
This project shows how to add different types of lighting to 3D scenes (in this case, a cube) | |
--HOW TO USE THIS PROJECT | |
There are a number of tabs at the top. Press on a tab to see its code. | |
Work through the tabs from left to right, to see the project develop |
This file contains 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
--# Notes | |
--[[ | |
** What is a mesh? ** | |
A mesh is a quick way of drawing a shape. It is a set of points which create an outline (or wirefame) of an object | |
It is made up of triangles (groups of three points) | |
Triangles are used because a triangle has the smallest number of points that encloses an area | |
Each triangle corner is known as a VERTEX, and has a position and a colour | |
The colours of all the points inside the triangle are interpolated from the colours of the three corners |