Skip to content

Commit a414e6b

Browse files
committed
Merge branch 'dev-2.0' into shaders
2 parents 03faf7b + ef1b09c commit a414e6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+24353
-22991
lines changed

.gitignore

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
*.DS_Store
2-
.project
3-
node_modules/*
4-
experiments/*
5-
lib_old/*
6-
lib/p5.*
7-
lib/modules
8-
docs/reference/*
9-
!*.gitkeep
10-
examples/3d/
11-
.idea
12-
dist/
13-
p5.zip
14-
bower-repo/
15-
p5-website/
16-
.vscode/settings.json
17-
.nyc_output/*
18-
coverage/
19-
lib/p5-test.js
20-
release/
21-
yarn.lock
22-
docs/data.json
23-
analyzer/
24-
preview/
1+
*.DS_Store
2+
.project
3+
node_modules/*
4+
experiments/*
5+
lib_old/*
6+
lib/p5.*
7+
lib/modules
8+
docs/reference/*
9+
!*.gitkeep
10+
examples/3d/
11+
.idea
12+
dist/
13+
p5.zip
14+
bower-repo/
15+
p5-website/
16+
.vscode/settings.json
17+
.nyc_output/*
18+
coverage/
19+
lib/p5-test.js
20+
release/
21+
yarn.lock
22+
docs/data.json
23+
analyzer/
24+
preview/
2525
__screenshots__/

package-lock.json

Lines changed: 49 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
},
2323
"version": "1.9.4",
2424
"dependencies": {
25+
"acorn": "^8.12.1",
26+
"acorn-walk": "^8.3.4",
2527
"colorjs.io": "^0.5.2",
2628
"file-saver": "^1.3.8",
2729
"gifenc": "^1.0.3",
2830
"libtess": "^1.2.2",
2931
"omggif": "^1.0.10",
30-
"opentype.js": "^1.3.1",
31-
"zod-validation-error": "^3.3.1"
32+
"opentype.js": "^1.3.1"
3233
},
3334
"devDependencies": {
3435
"@rollup/plugin-commonjs": "^25.0.7",
@@ -83,4 +84,4 @@
8384
"pre-commit": "lint-staged"
8485
}
8586
}
86-
}
87+
}

preview/index.html

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,44 @@
11
<!DOCTYPE html>
22
<html>
3+
34
<head>
45
<title>P5 test</title>
56
<meta http-equiv="pragma" content="no-cache" />
67
<meta http-equiv="cache-control" content="no-cache" />
78
<meta charset="utf-8">
89

910
<style>
10-
body{
11-
margin:0;
12-
overflow: hidden;
13-
}
11+
body {
12+
margin: 0;
13+
overflow: hidden;
14+
}
1415
</style>
1516
</head>
17+
1618
<body>
17-
<script type="module">
18-
import p5 from '../src/app.js';
19-
// import calculation from './src/math/calculation.js';
19+
<script type="module">
20+
import p5 from '../src/app.js';
21+
// import calculation from './src/math/calculation.js';
2022

21-
// p5.registerAddon(calculation);
23+
// p5.registerAddon(calculation);
2224

23-
const sketch = function(p){
24-
p.setup = function(){
25-
p.createCanvas(200, 200);
26-
};
25+
const sketch = function (p) {
26+
p.setup = function () {
27+
p.createCanvas(200, 200);
28+
};
2729

28-
p.draw = function(){
29-
p.background(0, 50, 50);
30-
p.circle(100, 100, 50);
30+
p.draw = function () {
31+
p.background(0, 50, 50);
32+
p.circle(100, 100, 50);
3133

32-
p.fill('white');
33-
p.textSize(30);
34-
p.text('hello', 10, 30);
35-
};
36-
};
34+
p.fill('white');
35+
p.textSize(30);
36+
p.text('hello', 10, 30);
37+
};
38+
};
3739

38-
new p5(sketch);
39-
</script>
40+
new p5(sketch);
41+
</script>
4042
</body>
43+
4144
</html>

src/accessibility/outputs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ function outputs(p5, fn){
543543
fn._getPos = function (x, y) {
544544
const untransformedPosition = new DOMPointReadOnly(x, y);
545545
const currentTransform = this._renderer.isP3D ?
546-
new DOMMatrix(this._renderer.uMVMatrix.mat4) :
546+
new DOMMatrix(this._renderer.states.uMVMatrix.mat4) :
547547
this.drawingContext.getTransform();
548548
const { x: transformedX, y: transformedY } = untransformedPosition
549549
.matrixTransform(currentTransform);
@@ -663,7 +663,7 @@ function outputs(p5, fn){
663663
];
664664
// Apply the inverse of the current transformations to the canvas corners
665665
const currentTransform = this._renderer.isP3D ?
666-
new DOMMatrix(this._renderer.uMVMatrix.mat4) :
666+
new DOMMatrix(this._renderer.states.uMVMatrix.mat4) :
667667
this.drawingContext.getTransform();
668668
const invertedTransform = currentTransform.inverse();
669669
const tc = canvasCorners.map(

src/app.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,12 @@ import utilities from './utilities';
6868
utilities(p5);
6969

7070
// webgl
71-
import './webgl/3d_primitives';
72-
import './webgl/interaction';
73-
import './webgl/light';
74-
import './webgl/loading';
75-
import './webgl/material';
76-
import './webgl/p5.Camera';
77-
import './webgl/p5.DataArray';
78-
import './webgl/p5.Geometry';
79-
import './webgl/p5.Matrix';
80-
import './webgl/p5.Quat';
71+
import webgl from './webgl';
72+
webgl(p5);
8173
import './webgl/p5.RendererGL.Immediate';
8274
import './webgl/p5.RendererGL';
8375
import './webgl/p5.RendererGL.Retained';
84-
import './webgl/p5.Framebuffer';
85-
import './webgl/p5.Shader';
86-
import './webgl/p5.RenderBuffer';
8776
import './webgl/p5.Texture';
88-
import './webgl/text';
8977

9078
import './core/init';
9179

src/color/setting.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,8 @@ function setting(p5, fn){
12091209
* @chainable
12101210
*/
12111211
fn.fill = function(...args) {
1212-
this._renderer._setProperty('_fillSet', true);
1213-
this._renderer._setProperty('_doFill', true);
1212+
this._renderer.states.fillSet = true;
1213+
this._renderer.states.doFill = true;
12141214
this._renderer.fill(...args);
12151215
return this;
12161216
};
@@ -1271,7 +1271,7 @@ function setting(p5, fn){
12711271
* </div>
12721272
*/
12731273
fn.noFill = function() {
1274-
this._renderer._setProperty('_doFill', false);
1274+
this._renderer.states.doFill = false;
12751275
return this;
12761276
};
12771277

@@ -1327,7 +1327,7 @@ function setting(p5, fn){
13271327
* </div>
13281328
*/
13291329
fn.noStroke = function() {
1330-
this._renderer._setProperty('_doStroke', false);
1330+
this._renderer.states.doStroke = false;
13311331
return this;
13321332
};
13331333

@@ -1581,8 +1581,8 @@ function setting(p5, fn){
15811581
*/
15821582

15831583
fn.stroke = function(...args) {
1584-
this._renderer._setProperty('_strokeSet', true);
1585-
this._renderer._setProperty('_doStroke', true);
1584+
this._renderer.states.strokeSet = true;
1585+
this._renderer.states.doStroke = true;
15861586
this._renderer.stroke(...args);
15871587
return this;
15881588
};

src/core/environment.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,9 @@ p5.prototype.frameRate = function(fps) {
410410
if (typeof fps !== 'number' || fps < 0) {
411411
return this._frameRate;
412412
} else {
413-
this._setProperty('_targetFrameRate', fps);
413+
this._targetFrameRate = fps;
414414
if (fps === 0) {
415-
this._setProperty('_frameRate', fps);
415+
this._frameRate = fps;
416416
}
417417
return this;
418418
}
@@ -770,8 +770,8 @@ p5.prototype.windowHeight = 0;
770770
* This example does not render anything.
771771
*/
772772
p5.prototype._onresize = function(e) {
773-
this._setProperty('windowWidth', getWindowWidth());
774-
this._setProperty('windowHeight', getWindowHeight());
773+
this.windowWidth = getWindowWidth();
774+
this.windowHeight = getWindowHeight();
775775
const context = this._isGlobal ? window : this;
776776
let executeDefault;
777777
if (typeof context.windowResized === 'function') {
@@ -805,8 +805,8 @@ function getWindowHeight() {
805805
* possibility of the window being resized when no sketch is active.
806806
*/
807807
p5.prototype._updateWindowSize = function() {
808-
this._setProperty('windowWidth', getWindowWidth());
809-
this._setProperty('windowHeight', getWindowHeight());
808+
this.windowWidth = getWindowWidth();
809+
this.windowHeight = getWindowHeight();
810810
};
811811

812812
/**

0 commit comments

Comments
 (0)