Skip to content

Commit f44a4f3

Browse files
author
Spongman
committed
fix directionalLights in samples & tests
1 parent 80fa49d commit f44a4f3

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

src/webgl/light.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ p5.prototype.ambientLight = function(v1, v2, v3, a) {
137137
* background(0);
138138
* //move your mouse to change light direction
139139
* var dirX = (mouseX / width - 0.5) * 2;
140-
* var dirY = (mouseY / height - 0.5) * -2;
141-
* directionalLight(250, 250, 250, dirX, dirY, 0.25);
140+
* var dirY = (mouseY / height - 0.5) * 2;
141+
* directionalLight(250, 250, 250, -dirX, -dirY, 0.25);
142142
* ambientMaterial(250);
143143
* sphere(50);
144144
* }

src/webgl/p5.RendererGL.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ p5.RendererGL.prototype._resetContext = function(attr, options, callback) {
297297
* function draw() {
298298
* var t = millis() / 1000 + 1000;
299299
* background(0);
300-
* directionalLight(color('#222'), -1, -1, 1);
300+
* directionalLight(color('#222'), 1, 1, 1);
301301
*
302302
* for (var i = 0; i < lights.length; i++) {
303303
* var light = lights[i];

test/manual-test-examples/webgl/customShader/toonShader/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function draw () {
1717
background(0);
1818
var dirY = (mouseY / height - 0.5) * 2;
1919
var dirX = (mouseX / width - 0.5) * 2;
20-
directionalLight(255, 204, 204, -dirX, dirY, -1);
20+
directionalLight(255, 204, 204, -dirX, -dirY, -1);
2121
ambientMaterial(0, 255, 255);
2222
sphere(120);
2323
}

test/manual-test-examples/webgl/lights/directionalLight/sketch.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function setup(){
22
createCanvas(windowWidth, windowHeight, WEBGL);
3+
//setAttributes('perPixelLighting', true);
34
}
45

56
function draw(){
@@ -9,7 +10,7 @@ function draw(){
910
var dirX = (mouseX / width - 0.5) *2;
1011

1112
ambientLight(50);
12-
directionalLight(250, 250, 250, dirX, -dirY, 0.25);
13+
directionalLight(250, 250, 250, -dirX, -dirY, 0);
1314

1415
ambientMaterial(250);
1516
sphere(50, 64);

test/manual-test-examples/webgl/material/perPixelLighting/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function draw() {
1919
var t = millis() / 1000 + 1000;
2020
background(0);
2121

22-
directionalLight(color('#111'), -1, -1, -1);
22+
directionalLight(color('#111'), 1, 1, 1);
2323

2424
for (var i = 0; i < lights.length; i++) {
2525
var light = lights[i];

0 commit comments

Comments
 (0)