Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[p5.js 2.0] State machines and renderer refactoring #7270

Merged
merged 58 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
6ef1afc
Concentrate DOM creation of renderer in the createCanvas method
limzykenneth Sep 20, 2024
2f7f824
Indentation
limzykenneth Sep 20, 2024
9c47a4c
Fix p5.Graphics creation
limzykenneth Sep 21, 2024
c39cfa6
p5.Graphics acts as wrapper of p5.Renderer
limzykenneth Sep 21, 2024
263ae57
Fix p5.Graphics.remove and simplify it
limzykenneth Sep 21, 2024
8427978
Fix webgl canvas creation
limzykenneth Sep 21, 2024
5c68e24
Minor adjustment to p5.Renderer and p5.Graphics remove
limzykenneth Sep 21, 2024
e3c3683
Make resizeCanvas() independent of DOM
limzykenneth Sep 22, 2024
f1d8735
Remove renderer createCanvas() method as it is redundant with constru…
limzykenneth Sep 22, 2024
7a91e53
Global width/height read directly from renderer
limzykenneth Sep 22, 2024
b07b438
Move ownership of pixel density to renderer
limzykenneth Sep 22, 2024
55c45ed
Fix a few tests
limzykenneth Sep 22, 2024
beb432f
Fix a few more tests
limzykenneth Sep 22, 2024
8a60cf3
Include p5 instance methods on p5.Graphics
limzykenneth Sep 23, 2024
40b621d
Refactor some WebGL sections to try to fix tests
limzykenneth Sep 23, 2024
418251b
Visual test use constants from direct import
limzykenneth Sep 23, 2024
eff9ac4
Refactor shape out into its own module
limzykenneth Sep 25, 2024
db6e599
Use new module API to attach methods to p5.Graphics
limzykenneth Sep 26, 2024
7cd3fb3
Attach more functions to p5.Graphics
limzykenneth Sep 27, 2024
104bd32
Move blendMode() to color/setting module
limzykenneth Sep 28, 2024
5c70636
Merge branch 'dev-2.0' into 2.0-modules
limzykenneth Oct 8, 2024
27326fe
Convert renderers to use new syntax modules
limzykenneth Oct 11, 2024
0c71618
Change how all classes are defined to be more exportable
limzykenneth Oct 13, 2024
cfa67aa
Use class imports wherever possible
limzykenneth Oct 15, 2024
5cc1555
Fix enableLighting state name inconsistency
limzykenneth Oct 15, 2024
7b59c31
Inline webgl nostroke call
limzykenneth Oct 15, 2024
beb947a
Convert a few more class usage, fix a few more tests
limzykenneth Oct 18, 2024
1ea4e25
Fix for before refactors
limzykenneth Oct 21, 2024
90bcbc0
Duplicate pixels implementation in p5.Image from p5.Renderer2D
limzykenneth Oct 21, 2024
59e5cb1
Unindent to try to reduce merge conflicts
davepagurek Oct 22, 2024
c34a511
Merge branch 'dev-2.0' into 2.0-modules
davepagurek Oct 22, 2024
a68e4c3
Put indentation back
davepagurek Oct 22, 2024
ae12ade
Move 3D primitives implementation into RendererGL
limzykenneth Oct 23, 2024
be38743
Move some lights implementation to RendererGL
limzykenneth Oct 23, 2024
1941150
Move material implementation to RendererGL
limzykenneth Oct 23, 2024
b249cb5
Fix incorrect reference to renderer
limzykenneth Oct 23, 2024
0021fa4
Move camera implementation to RendererGL
limzykenneth Oct 23, 2024
f69ad65
Fix vertexProperty
limzykenneth Oct 25, 2024
9642ee5
Fix direct call to change renderer imagemode
limzykenneth Oct 25, 2024
545621f
Fix incorrect reference to state
limzykenneth Oct 25, 2024
1f811b9
Remove some references to pInst in RendererGL
limzykenneth Oct 27, 2024
da70a0e
Fix p5.Graphics overwriting default drawing context
limzykenneth Oct 27, 2024
4314ec0
Fix text rendering
limzykenneth Oct 27, 2024
c402baa
Remove more references to pInst in RendererGL
limzykenneth Oct 27, 2024
8a3f364
Make sure ensureCompiledOnContext is called for internal shader() calls
davepagurek Oct 29, 2024
6fc9e8d
Fix createFilterShader context
davepagurek Oct 29, 2024
fd02fe4
Load images before creating canvas
davepagurek Oct 29, 2024
0f44413
Clear cached maxTextureSize for tests with stubbed value
davepagurek Oct 29, 2024
bea4d02
Make internal stroke and fill also enable stroke and fill
davepagurek Oct 29, 2024
9ae00f4
Make sure default attributes are loaded before initializing WebGL con…
davepagurek Oct 30, 2024
c0ec064
Make p5 also expose properties from the renderer like graphics do
davepagurek Nov 2, 2024
3130090
Just expose pixels on the main instance, actually
davepagurek Nov 2, 2024
fe0d85a
Refactor out need for pInst in p5.Color
limzykenneth Nov 2, 2024
24525f9
Remove console.log
limzykenneth Nov 2, 2024
d85876c
Move rest of light implementation to Renderer3D
limzykenneth Nov 2, 2024
7fd3c4f
Fix updatePixels incorrect on WebGL mode
davepagurek Nov 2, 2024
468ab53
Fix constant usage on graphic that should be on the main instance
davepagurek Nov 2, 2024
2641218
Merge branch 'dev-2.0' into 2.0-modules
limzykenneth Nov 2, 2024
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
3 changes: 0 additions & 3 deletions preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
<body>
<script type="module">
import p5 from '../src/app.js';
// import calculation from './src/math/calculation.js';

// p5.registerAddon(calculation);

const sketch = function (p) {
p.setup = function () {
Expand Down
8 changes: 4 additions & 4 deletions src/accessibility/outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ function outputs(p5, fn){
this.drawingContext.getTransform();
const { x: transformedX, y: transformedY } = untransformedPosition
.matrixTransform(currentTransform);
const canvasWidth = this.width * this._pixelDensity;
const canvasHeight = this.height * this._pixelDensity;
const canvasWidth = this.width * this._renderer._pixelDensity;
const canvasHeight = this.height * this._renderer._pixelDensity;
if (transformedX < 0.4 * canvasWidth) {
if (transformedY < 0.4 * canvasHeight) {
return 'top left';
Expand Down Expand Up @@ -653,8 +653,8 @@ function outputs(p5, fn){
// (Ax( By − Cy) + Bx(Cy − Ay) + Cx(Ay − By ))/2
}
// Store the positions of the canvas corners
const canvasWidth = this.width * this._pixelDensity;
const canvasHeight = this.height * this._pixelDensity;
const canvasWidth = this.width * this._renderer._pixelDensity;
const canvasHeight = this.height * this._renderer._pixelDensity;
const canvasCorners = [
new DOMPoint(0, 0),
new DOMPoint(canvasWidth, 0),
Expand Down
26 changes: 6 additions & 20 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
// core
import p5 from './core/main';
import './core/constants';
import './core/environment';
import './core/friendly_errors/stacktrace';
import './core/friendly_errors/validate_params';
import './core/friendly_errors/file_errors';
import './core/friendly_errors/fes_core';
import './core/friendly_errors/sketch_reader';
import './core/helpers';
import './core/legacy';
// import './core/preload';
import './core/p5.Element';
import './core/p5.Graphics';
// import './core/p5.Renderer';
import './core/p5.Renderer2D';
import './core/rendering';
import './core/structure';
import './core/transform';
import './core/shape/2d_primitives';
import './core/shape/attributes';
import './core/shape/curves';
import './core/shape/vertex';
// import './core/p5.Graphics';
// import './core/rendering';
import shape from './shape';
shape(p5);

//accessibility
import accessibility from './accessibility';
Expand All @@ -40,7 +29,8 @@ import data from './data';
data(p5);

// DOM
import './dom/dom';
import dom from './dom/dom';
dom(p5, p5.prototype);

// events
import events from './events';
Expand Down Expand Up @@ -70,10 +60,6 @@ utilities(p5);
// webgl
import webgl from './webgl';
webgl(p5);
import './webgl/p5.RendererGL.Immediate';
import './webgl/p5.RendererGL';
import './webgl/p5.RendererGL.Retained';
import './webgl/p5.Texture';

import './core/init';

Expand Down
Loading
Loading