Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions src/core/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ p5.prototype.rotate = function(angle, axis) {
* <code>
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* }
* function draw() {
* background(255);
Expand Down Expand Up @@ -311,6 +313,8 @@ p5.prototype.rotateX = function(angle) {
* <code>
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* }
* function draw() {
* background(255);
Expand Down Expand Up @@ -349,6 +353,8 @@ p5.prototype.rotateY = function(angle) {
* <code>
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* }
* function draw() {
* background(255);
Expand Down
8 changes: 8 additions & 0 deletions src/webgl/3d_primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ p5.prototype.plane = function(width, height, detailX, detailY) {
* // with width, height and depth of 50
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* describe('a white box rotating in 3D space');
* }
*
Expand Down Expand Up @@ -1026,6 +1028,8 @@ p5.prototype.ellipsoid = function(radiusX, radiusY, radiusZ, detailX, detailY) {
* // with ring radius 30 and tube radius 15
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* describe('a rotating white torus');
* }
*
Expand All @@ -1045,6 +1049,8 @@ p5.prototype.ellipsoid = function(radiusX, radiusY, radiusZ, detailX, detailY) {
* let detailX;
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* detailX = createSlider(3, 24, 3);
* detailX.position(10, height + 5);
* detailX.style('width', '80px');
Expand All @@ -1068,6 +1074,8 @@ p5.prototype.ellipsoid = function(radiusX, radiusY, radiusZ, detailX, detailY) {
* let detailY;
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* detailY = createSlider(3, 16, 3);
* detailY.position(10, height + 5);
* detailY.style('width', '80px');
Expand Down
8 changes: 8 additions & 0 deletions src/webgl/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import * as constants from '../core/constants';
* describe(
* 'Camera orbits around a box when mouse is hold-clicked & then moved.'
* );
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* }
* function draw() {
* background(200);
Expand Down Expand Up @@ -396,6 +398,7 @@ p5.prototype.orbitControl = function(
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* normalMaterial();
* debugMode();
* describe(
Expand Down Expand Up @@ -426,6 +429,7 @@ p5.prototype.orbitControl = function(
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* normalMaterial();
* debugMode(GRID);
* describe('a 3D box is centered on a grid in a 3D sketch.');
Expand All @@ -447,6 +451,7 @@ p5.prototype.orbitControl = function(
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* normalMaterial();
* debugMode(AXES);
* describe(
Expand All @@ -472,6 +477,7 @@ p5.prototype.orbitControl = function(
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* normalMaterial();
* debugMode(GRID, 100, 10, 0, 0, 0);
* describe('a 3D box is centered on a grid in a 3D sketch');
Expand All @@ -493,6 +499,7 @@ p5.prototype.orbitControl = function(
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* normalMaterial();
* debugMode(100, 10, 0, 0, 0, 20, 0, -40, 0);
* describe(
Expand Down Expand Up @@ -601,6 +608,7 @@ p5.prototype.debugMode = function(...args) {
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* normalMaterial();
* debugMode();
* describe(
Expand Down
38 changes: 26 additions & 12 deletions src/webgl/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,28 +519,34 @@ p5.prototype.pointLight = function(v1, v2, v3, x, y, z) {
* <div class="notest">
* <code>
* let img;
*
* function preload() {
* img = loadImage('assets/outdoor_image.jpg');
* }
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0 ,1, 0);
* perspective(PI/3, 1, 5, 500);
* }
* function draw() {
* background(220);
* imageMode(CENTER);
*
* push();
* translate(0, 0, -200);
* scale(2);
* image(img, 0, 0, width, height);
* camera(0, 0, 1, 0, 0, 0, 0, 1, 0);
* ortho(-1, 1, -1, 1, 0, 1);
* noLights();
* noStroke();
* texture(img);
* plane(2);
* pop();
*
* ambientLight(50);
* imageLight(img);
* specularMaterial(20);
* noStroke();
* scale(2);
* rotateX(frameCount * 0.005);
* rotateY(frameCount * 0.005);
* box(25);
* box(50);
* }
* </code>
* </div>
Expand All @@ -551,29 +557,35 @@ p5.prototype.pointLight = function(v1, v2, v3, x, y, z) {
* <code>
* let img;
* let slider;
*
* function preload() {
* img = loadImage('assets/outdoor_spheremap.jpg');
* }
* function setup() {
* createCanvas(100, 100, WEBGL);
* slider = createSlider(0, 400, 100, 1);
* slider.position(0, height);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0 ,1, 0);
* perspective(PI/3, 1, 5, 500);
* }
* function draw() {
* background(220);
* imageMode(CENTER);
*
* push();
* translate(0, 0, -200);
* scale(2);
* image(img, 0, 0, width, height);
* camera(0, 0, 1, 0, 0, 0, 0, 1, 0);
* ortho(-1, 1, -1, 1, 0, 1);
* noLights();
* noStroke();
* texture(img);
* plane(2);
* pop();
*
* ambientLight(50);
* imageLight(img);
* specularMaterial(20);
* shininess(slider.value());
* noStroke();
* scale(2);
* sphere(15);
* sphere(30);
* }
* </code>
* </div>
Expand Down Expand Up @@ -604,6 +616,8 @@ p5.prototype.imageLight = function(img){
* <code>
* function setup() {
* createCanvas(100, 100, WEBGL);
* camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);
* perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));
* describe('the light is partially ambient and partially directional');
* }
* function draw() {
Expand Down
Loading