Skip to content

Commit

Permalink
Merge branch 'dev-2.0' into shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
davepagurek committed Oct 17, 2024
2 parents 03faf7b + ef1b09c commit a414e6b
Show file tree
Hide file tree
Showing 74 changed files with 24,353 additions and 22,991 deletions.
48 changes: 24 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
*.DS_Store
.project
node_modules/*
experiments/*
lib_old/*
lib/p5.*
lib/modules
docs/reference/*
!*.gitkeep
examples/3d/
.idea
dist/
p5.zip
bower-repo/
p5-website/
.vscode/settings.json
.nyc_output/*
coverage/
lib/p5-test.js
release/
yarn.lock
docs/data.json
analyzer/
preview/
*.DS_Store
.project
node_modules/*
experiments/*
lib_old/*
lib/p5.*
lib/modules
docs/reference/*
!*.gitkeep
examples/3d/
.idea
dist/
p5.zip
bower-repo/
p5-website/
.vscode/settings.json
.nyc_output/*
coverage/
lib/p5-test.js
release/
yarn.lock
docs/data.json
analyzer/
preview/
__screenshots__/
80 changes: 49 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
},
"version": "1.9.4",
"dependencies": {
"acorn": "^8.12.1",
"acorn-walk": "^8.3.4",
"colorjs.io": "^0.5.2",
"file-saver": "^1.3.8",
"gifenc": "^1.0.3",
"libtess": "^1.2.2",
"omggif": "^1.0.10",
"opentype.js": "^1.3.1",
"zod-validation-error": "^3.3.1"
"opentype.js": "^1.3.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
Expand Down Expand Up @@ -83,4 +84,4 @@
"pre-commit": "lint-staged"
}
}
}
}
47 changes: 25 additions & 22 deletions preview/index.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
<!DOCTYPE html>
<html>

<head>
<title>P5 test</title>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta charset="utf-8">

<style>
body{
margin:0;
overflow: hidden;
}
body {
margin: 0;
overflow: hidden;
}
</style>
</head>

<body>
<script type="module">
import p5 from '../src/app.js';
// import calculation from './src/math/calculation.js';
<script type="module">
import p5 from '../src/app.js';
// import calculation from './src/math/calculation.js';

// p5.registerAddon(calculation);
// p5.registerAddon(calculation);

const sketch = function(p){
p.setup = function(){
p.createCanvas(200, 200);
};
const sketch = function (p) {
p.setup = function () {
p.createCanvas(200, 200);
};

p.draw = function(){
p.background(0, 50, 50);
p.circle(100, 100, 50);
p.draw = function () {
p.background(0, 50, 50);
p.circle(100, 100, 50);

p.fill('white');
p.textSize(30);
p.text('hello', 10, 30);
};
};
p.fill('white');
p.textSize(30);
p.text('hello', 10, 30);
};
};

new p5(sketch);
</script>
new p5(sketch);
</script>
</body>

</html>
4 changes: 2 additions & 2 deletions src/accessibility/outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ function outputs(p5, fn){
fn._getPos = function (x, y) {
const untransformedPosition = new DOMPointReadOnly(x, y);
const currentTransform = this._renderer.isP3D ?
new DOMMatrix(this._renderer.uMVMatrix.mat4) :
new DOMMatrix(this._renderer.states.uMVMatrix.mat4) :
this.drawingContext.getTransform();
const { x: transformedX, y: transformedY } = untransformedPosition
.matrixTransform(currentTransform);
Expand Down Expand Up @@ -663,7 +663,7 @@ function outputs(p5, fn){
];
// Apply the inverse of the current transformations to the canvas corners
const currentTransform = this._renderer.isP3D ?
new DOMMatrix(this._renderer.uMVMatrix.mat4) :
new DOMMatrix(this._renderer.states.uMVMatrix.mat4) :
this.drawingContext.getTransform();
const invertedTransform = currentTransform.inverse();
const tc = canvasCorners.map(
Expand Down
16 changes: 2 additions & 14 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,12 @@ import utilities from './utilities';
utilities(p5);

// webgl
import './webgl/3d_primitives';
import './webgl/interaction';
import './webgl/light';
import './webgl/loading';
import './webgl/material';
import './webgl/p5.Camera';
import './webgl/p5.DataArray';
import './webgl/p5.Geometry';
import './webgl/p5.Matrix';
import './webgl/p5.Quat';
import webgl from './webgl';
webgl(p5);
import './webgl/p5.RendererGL.Immediate';
import './webgl/p5.RendererGL';
import './webgl/p5.RendererGL.Retained';
import './webgl/p5.Framebuffer';
import './webgl/p5.Shader';
import './webgl/p5.RenderBuffer';
import './webgl/p5.Texture';
import './webgl/text';

import './core/init';

Expand Down
12 changes: 6 additions & 6 deletions src/color/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,8 @@ function setting(p5, fn){
* @chainable
*/
fn.fill = function(...args) {
this._renderer._setProperty('_fillSet', true);
this._renderer._setProperty('_doFill', true);
this._renderer.states.fillSet = true;
this._renderer.states.doFill = true;
this._renderer.fill(...args);
return this;
};
Expand Down Expand Up @@ -1271,7 +1271,7 @@ function setting(p5, fn){
* </div>
*/
fn.noFill = function() {
this._renderer._setProperty('_doFill', false);
this._renderer.states.doFill = false;
return this;
};

Expand Down Expand Up @@ -1327,7 +1327,7 @@ function setting(p5, fn){
* </div>
*/
fn.noStroke = function() {
this._renderer._setProperty('_doStroke', false);
this._renderer.states.doStroke = false;
return this;
};

Expand Down Expand Up @@ -1581,8 +1581,8 @@ function setting(p5, fn){
*/

fn.stroke = function(...args) {
this._renderer._setProperty('_strokeSet', true);
this._renderer._setProperty('_doStroke', true);
this._renderer.states.strokeSet = true;
this._renderer.states.doStroke = true;
this._renderer.stroke(...args);
return this;
};
Expand Down
12 changes: 6 additions & 6 deletions src/core/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ p5.prototype.frameRate = function(fps) {
if (typeof fps !== 'number' || fps < 0) {
return this._frameRate;
} else {
this._setProperty('_targetFrameRate', fps);
this._targetFrameRate = fps;
if (fps === 0) {
this._setProperty('_frameRate', fps);
this._frameRate = fps;
}
return this;
}
Expand Down Expand Up @@ -770,8 +770,8 @@ p5.prototype.windowHeight = 0;
* This example does not render anything.
*/
p5.prototype._onresize = function(e) {
this._setProperty('windowWidth', getWindowWidth());
this._setProperty('windowHeight', getWindowHeight());
this.windowWidth = getWindowWidth();
this.windowHeight = getWindowHeight();
const context = this._isGlobal ? window : this;
let executeDefault;
if (typeof context.windowResized === 'function') {
Expand Down Expand Up @@ -805,8 +805,8 @@ function getWindowHeight() {
* possibility of the window being resized when no sketch is active.
*/
p5.prototype._updateWindowSize = function() {
this._setProperty('windowWidth', getWindowWidth());
this._setProperty('windowHeight', getWindowHeight());
this.windowWidth = getWindowWidth();
this.windowHeight = getWindowHeight();
};

/**
Expand Down
Loading

0 comments on commit a414e6b

Please sign in to comment.