Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8c89ad9
test
Aug 10, 2015
ce45716
merge texutre mapping
Aug 10, 2015
5aba5e3
further rename
Aug 10, 2015
cf72fac
fix bugs
Aug 10, 2015
0f98922
merge upstream
Aug 12, 2015
350af06
merge upstream
Aug 14, 2015
4f9f820
merge upstream
Aug 17, 2015
85ab308
merge
Aug 18, 2015
f64c15b
merge upstream
Aug 19, 2015
4e0db0f
start with multiple lights
Aug 19, 2015
6b92cf3
multiple light sources with defined numbers work
Aug 19, 2015
ae0cf2b
multiple light sources with any numbers supported
Aug 19, 2015
85aaa4d
merge upstream
Aug 19, 2015
4164554
point light added
Aug 19, 2015
259454a
start with phong algorithm
Aug 21, 2015
7ecc461
modify light
Aug 21, 2015
8df7b34
rename uModelViewMatrix
Aug 21, 2015
ad84db9
box and plane are as big as the other by default not
Aug 21, 2015
be3bf6b
add normalize method to color
Aug 21, 2015
a8bb75f
fix bug in color normalize
Aug 21, 2015
57d3a05
set camera back to before
Aug 21, 2015
ac42e37
add camera
Aug 21, 2015
911f0a9
add strokeWeight to todo list
Aug 21, 2015
3a59e2e
add defualt camera function
Aug 21, 2015
73e0aa7
for future set camera detection
Aug 21, 2015
7ef818e
fix bug for specular material
Aug 22, 2015
bda58bc
modify specular factor and geometry details
Aug 22, 2015
9ee052c
modify example sphere detail
Aug 22, 2015
8638639
move detection from frag to vert inorder to reduce calculation
Aug 22, 2015
6906c9c
abstract function away
Aug 22, 2015
e76b90d
simplify examples
Aug 22, 2015
2121779
merge upstream
Aug 23, 2015
30a9d73
Merge pull request #11 from karenpeng/master
indefinit Aug 24, 2015
c28cdb2
rename internal use functions
Aug 24, 2015
9da46e7
merge upstream
Aug 24, 2015
0665b5b
camera is optional now and modify examples
Aug 24, 2015
c879e27
add camera examples
Aug 24, 2015
3ce6fca
add _validateParameters to light and material
Aug 24, 2015
458b356
add validParameter for transform functions
Aug 24, 2015
3dea201
do valid parameters differently between 2d and 3d
Aug 24, 2015
df1fbdd
do valid parameters differently between 2d and 3d
Aug 24, 2015
40849b9
valid parameter for camera
Aug 24, 2015
5e514ec
update inline documentation for 3d primitives
Aug 24, 2015
13604e9
fix bug in valid param and modify getShader function
Aug 24, 2015
6e0d7b8
further simplify examples
Aug 24, 2015
8406eaf
recover core.js
Aug 24, 2015
4ab3b0f
3d value update(matrix and stack) is now called by draw() function
Aug 24, 2015
f89a81b
implements video as texture in webgl: WIP still buggy
indefinit Aug 25, 2015
470627a
camera now works as state machine
Aug 25, 2015
ff5cb6e
minor fix
Aug 25, 2015
65a2afd
add inline doc for lights
Aug 25, 2015
91c29e2
add inline doc for material and light
Aug 25, 2015
8203faa
adapt texture update from f89a81b
Aug 25, 2015
ad620eb
can't find p5.Texture
Aug 25, 2015
ceb9236
follow p5 inline doc convention
Aug 25, 2015
17f32c6
change inline example as well
Aug 25, 2015
309d005
Merge branch 'karenpeng-master'
indefinit Aug 27, 2015
287d3cc
merge upstream
Sep 2, 2015
4020e00
current shader works as state machine
Sep 2, 2015
5bba6ba
light supports vector as argument
Sep 2, 2015
46ced32
color, drawMode and shapeMode are now state machine as well, no more …
Sep 2, 2015
9a3fde1
add multiple light example
Sep 2, 2015
df58577
fixes xy bug in camera orbit control; updates texture to handle video…
indefinit Sep 4, 2015
21a7e99
Merge branch 'master' of https://github.com/processing/p5.js
indefinit Sep 4, 2015
8676f79
updates all webgl examples to use WEBGL global variable; removes orbi…
indefinit Sep 4, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<script language="javascript" type="text/javascript" src="../../../lib/p5.js"></script>
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
<script language="javascript" type="text/javascript" src="sketch.js"></script>
<style>
html, body {margin:0; padding:0;}
</style>
</head>
<body>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; text-align: center; color:green;">[0, 0, 0] is in the top left corner now</p>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:white; text-align: center;">Orthographic camera</p>
<script>
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
</script>

</body>
</html>
</html>
19 changes: 19 additions & 0 deletions examples/3d/camera/ortho/sketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function setup(){
createCanvas(windowWidth, windowHeight, WEBGL);
ortho(-width/2, width/2, height/2, -height/2, 0.1, 100);
}

function draw(){
background(0);
rotateX(map(mouseY, 0, height, 0, TWO_PI));
rotateY(map(mouseX, 0, width, 0, TWO_PI));

for(var i = -5; i < 6; i++){
for(var j = -5; j < 6; j++){
push();
translate(i*100, 0, j*100);
box(20);
pop();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<script language="javascript" type="text/javascript" src="../../../lib/p5.js"></script>
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
<script language="javascript" type="text/javascript" src="sketch.js"></script>
<style>
html, body {margin:0; padding:0;}
</style>
</head>
<body>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:black;">Move Mouse To Rotate The Geometries</p>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:white; text-align: center;">Perspective camera</p>
<script>
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
</script>
Expand Down
18 changes: 18 additions & 0 deletions examples/3d/camera/perspective/sketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function setup(){
createCanvas(windowWidth, windowHeight, WEBGL);
perspective(60 / 180 * PI, width/height, 0.1, 100);
}

function draw(){
background(0);
rotateX(map(mouseY, 0, height, 0, TWO_PI));
rotateY(map(mouseX, 0, width, 0, TWO_PI));
for(var i = -5; i < 6; i++){
for(var j = -5; j < 6; j++){
push();
translate(i*100, 0, j*100);
sphere(20);
pop();
}
}
}
29 changes: 0 additions & 29 deletions examples/3d/center_origin/sketch.js

This file was deleted.

69 changes: 0 additions & 69 deletions examples/3d/directional_light/sketch.js

This file was deleted.

2 changes: 1 addition & 1 deletion examples/3d/geometry/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</style>
</head>
<body>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:black;">Move Mouse To Rotate The Geometries</p>
<p style="width:1000px; margin:10px auto; text-align: center; color:black;">Move mouse to spin geometries</p>
<script>
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
</script>
Expand Down
17 changes: 8 additions & 9 deletions examples/3d/geometry/sketch.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
function setup(){
createCanvas(windowWidth, windowHeight, 'webgl');
createCanvas(windowWidth, windowHeight, WEBGL);
}

var theta = 0;

function draw(){
background(255, 255, 255, 255);

translate(-width/2, 0, -800);
translate(-width/2, 0, 0);
normalMaterial();
push();
rotateZ(theta * mouseX * 0.001);
rotateX(theta * mouseX * 0.001);
rotateY(theta * mouseX * 0.001);
plane(80, 80);
plane(50);
pop();
translate(250, 0, 0);
push();
rotateZ(theta * mouseX * 0.001);
rotateX(theta * mouseX * 0.001);
rotateY(theta * mouseX * 0.001);
box(80, 80, 80);
box(50, 50, 50);
pop();
translate(250, 0, 0);
push();
rotateZ(theta * mouseX * 0.001);
rotateX(theta * mouseX * 0.001);
rotateY(theta * mouseX * 0.001);
cylinder(80, 80);
cylinder(50, 50);
pop();
translate(250, 0, 0);
push();
rotateZ(theta * mouseX * 0.001);
rotateX(theta * mouseX * 0.001);
rotateY(theta * mouseX * 0.001);
cone(80, 80);
cone(50, 50);
pop();
translate(250, 0, 0);
push();
rotateZ(theta * mouseX * 0.001);
rotateX(theta * mouseX * 0.001);
rotateY(theta * mouseX * 0.001);
torus(80, 20);
torus(50, 10);
pop();
translate(250, 0, 0);
push();
rotateZ(theta * mouseX * 0.001);
rotateX(theta * mouseX * 0.001);
rotateY(theta * mouseX * 0.001);
sphere(80, 80);
sphere(50);
pop();
theta += 0.05;
}
1 change: 1 addition & 0 deletions examples/3d/immediateMode/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</style>
</head>
<body>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; text-align: center; color:black;">Drag mouse to toggle the world</p>
<script>
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
</script>
Expand Down
60 changes: 22 additions & 38 deletions examples/3d/immediateMode/sketch.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,42 @@
var theta = 0;

function setup(){
createCanvas(windowWidth, windowHeight, 'webgl');
createCanvas(windowWidth, windowHeight, WEBGL);
}

function draw(){

background('white');
colorMode(HSB);

translate(0, 0, -1000);
orbitControl();

rotateY(frameCount * 0.01);
translate(0, -height/2, 0);

//point
stroke(0, 200, 200);
point(0, 0, 0);

//lines
translate(100, 0, 0);
for(var i = 0; i < 500; i+=100){
push();
rotateX(frameCount * 0.01);
for(var i = 0 ; i < 12; i++){
var offset = i * PI / 6;
fill(i * 20, 100, 100);
line(0, 0, 0, 200 * sin(offset + frameCount*0.01), 200 * cos(offset + frameCount*0.01), 0);
}
pop();
fill(i * 0.1, 100, 100);

//line
translate(0, 100, 0);
line(-100, 0, i, 100, 0, i);

//triangles
translate(400, 0, 0);
push();
for(var i = 0; i < 3; i++){
fill(i * 30 + 200, 100, 100);
translate(100, 50, 0);
translate(0, 100, 0);
triangle(
100, 0, 0,
60 * sin(frameCount * 0.1 + i), 0, 0,
0, 100, 0);
}
pop();
0, sin( i + frameCount * 0.1) * 10, i,
60, 60, i,
-60, 60, i);

//quad
translate(0, 200, 0);
quad(
-100, 0, i,
100, 0, i,
-100, 100, i,
100, 100, i
);


//triangle strip
translate(200, 0, 0);
for(var i = 0; i < 30; i++){
fill(i * 10, 120, 120);
translate(100, -50, 0);
beginShape('TRIANGLE_STRIP')
vertex(0, 0, (cos(frameCount * 0.1 + i) + 1) * 100);
vertex(0, 200, 100);
vertex(100, 100, 100);
vertex(100, 0, (sin(frameCount * 0.1 + i) + 1) * 100);
endShape();
pop();
}
}
2 changes: 1 addition & 1 deletion examples/3d/interaction/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</style>
</head>
<body>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:green; text-align: center;">Press Mouse To Toggle The World</p>
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:black; text-align: center;">Press mouse to toggle the world</p>
<script>
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
</script>
Expand Down
20 changes: 6 additions & 14 deletions examples/3d/interaction/sketch.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
function setup(){
createCanvas(windowWidth, windowHeight, 'webgl');
createCanvas(windowWidth, windowHeight, WEBGL);
}

function draw(){
background(250, 250, 250, 255);
background(250);
var radius = width;
translate(0, 0, -1600);
orbitControl();

if(!mouseIsPressed){
rotateY(frameCount * 0.001);
}
orbitControl();

normalMaterial();
translate(0, 0, -1000);
for(var i = 0; i <= 20; i++){
for(var j = 0; j <= 20; j++){
push();
var a = j/20 * PI;
var b = i/20 * PI
translate(sin(2 * a) * radius * sin(b), cos(b) * radius / 2 , cos(2 * a) * radius * sin(b));
if(j % 2 === 0) {
box(60, 60, 60);
}
else{
cone(60, 60);
}
translate(sin(2 * a) * radius * sin(b), cos(b) * radius / 2 , cos(2 * a) * radius * sin(b));
cone();
pop();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<script language="javascript" type="text/javascript" src="../../../lib/p5.js"></script>
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
<script language="javascript" type="text/javascript" src="sketch.js"></script>
<style>
html, body {margin:0; padding:0;}
Expand Down
Loading