From fa068151f9f560d1610dc0a174d8ae5310ab23b9 Mon Sep 17 00:00:00 2001 From: Tibor Udvari Date: Sun, 15 Sep 2024 22:26:28 +0200 Subject: [PATCH] chore: createCanvas override jsdoc --- src/p5xr/core/p5overrides.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/p5xr/core/p5overrides.js b/src/p5xr/core/p5overrides.js index f55fc3a..4277444 100644 --- a/src/p5xr/core/p5overrides.js +++ b/src/p5xr/core/p5overrides.js @@ -5,6 +5,19 @@ import p5ar from '../p5ar/p5ar'; import { lineVert, lineFrag } from '../shaders/lineShader'; import compareVersions from '../utilities/versionComparator'; +/** + * @method Overridden createCanvas function to handle different rendering modes: AR, VR, and default renderers. + * @param {Number} [w] + * @param {Number} [h] + * @param {string} renderer - The rendering mode. Possible values: + - P2D: 2D rendering context (default in p5.js) + - WEBGL: 3D rendering context + - AR: Augmented Reality mode (sets the renderer to WEBGL internally) + - VR: Virtual Reality mode (sets the renderer to WEBGL internally) + * @param {HTMLCanvasElement} [canvas] + * @return {p5.Renderer} + */ + const originalCreateCanvas = p5.prototype.createCanvas; p5.prototype.createCanvas = function (w, h, renderer, canvas) { let effectiveRenderer = renderer;