repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
mrjs | github_2023 | javascript | 581 | Volumetrics-io | hanbollar | @@ -124,7 +136,9 @@ export class MRModelEntity extends MRDivEntity {
this.loading = false;
- if (modelChange) {
+ this.loaded = true; | having both of these as variables can be a little confusing, can you change one of their names to be more distinct (or if one of them is no longer used, remove the redundant one) |
mrjs | github_2023 | javascript | 576 | Volumetrics-io | hanbollar | @@ -227,7 +238,7 @@ export class MREntity extends MRElement {
rotation = {
get: () => {
- return this.dataset.rotation;
+ return mrjsUtils.string.stringToVector(this.dataset.position); | typo, looks like a misplaced copy-paste - this should still have `this.dataset.rotation` inside the utils function |
mrjs | github_2023 | javascript | 573 | Volumetrics-io | hanbollar | @@ -105,11 +105,11 @@ export class MRDivEntity extends MREntity {
* @description Removing an entity as a sub-object of this panel (for example an mr-model, button, etc).
* @param {MREntity} entity - the entity to be removed added.
*/
- remove(entity) {
+ removeEntity(entity) {
// `this`... | the `let panel` line should probably be within the if statement instead and if no panel exists, we should throw an error (mrjsUtils.error.err) since an mrdiv element cannot exist without a panel |
mrjs | github_2023 | javascript | 546 | Volumetrics-io | michaelthatsit | @@ -56,183 +41,124 @@ export class MRTextAreaEntity extends MRTextInputEntity {
*/
fillInHiddenInputElementWithUserData() {
// name: The name associated with the <textarea> for form submission and backend processing.
- this.hiddenInput.name = this.getAttribute('name') ?? this.defaults.name;
+... | This really shouldn't be necessary if we're using the `hiddenInput`, right? you can get the selection (cursor position) directly from that. |
mrjs | github_2023 | javascript | 561 | Volumetrics-io | michaelthatsit | @@ -40,10 +40,10 @@ export class MRTextEntity extends MRDivEntity {
/**
* @function
- * @description (async) sets up the textObject of the text item.
+ * @description Helper for anytime text is manually touched - in connected and by use of `innerText`.
+ * Handles setting `innerText` like expec... | Why is this needed? Aren't we checking `entity.textContent == entity.textObj.text` every frame? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -33,6 +33,8 @@ window.mobileCheck = function () {
return mrjsUtils.display.mobileCheckFunction();
};
+const GLOBAL_UPDATE_EVENTS = ['enterxr', 'exitxr', 'load', 'anchored', 'panelupdate', 'engine-started', 'resize']; | add documentation note for why here and why order |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -393,22 +382,32 @@ export class MREntity extends MRElement {
this.triggerMaterialStyleUpdate();
});
- const intersectionObserver = new IntersectionObserver((entries) => {
- for (const entry of entries) {
- this._boundingClientRect = entry.boundingClientRect;
-... | add small comment here explaining why |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -111,6 +97,17 @@ export class MRSystem {
*/
eventUpdate() {}
+ /**
+ *
+ * @param entity
+ */ | look at the jsdoc warnings in the files section of github - make sure theyre filled out |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -120,10 +117,10 @@ export class MRSystem {
/**
* @function
- * @description Called when the entity component is initialized
+ * @description (async) Called when the entity component is initialized | i like that you added this here in the documentation 💛 |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -307,13 +307,13 @@ export class MREntity extends MRElement {
* @function
* @description Callback function of MREntity - does nothing. Is called by the connectedCallback.
*/
- connected() {}
+ async connected() {}
/**
* @function
* @description The connectedCallback function... | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -307,13 +307,13 @@ export class MREntity extends MRElement {
* @function
* @description Callback function of MREntity - does nothing. Is called by the connectedCallback. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -145,9 +142,9 @@ export class MRSystem {
* @description Handles the component and registry aspect of the event when an entity component attaches to this system. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -42,8 +42,18 @@ export class AnimationSystem extends MRSystem {
* @description Called when the entity component is initialized | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -42,8 +42,18 @@ export class AnimationSystem extends MRSystem {
* @description Called when the entity component is initialized
* @param {object} entity - the entity being attached/initialized.
*/
- attachedComponent(entity) {
+ async attachedComponent(entity) {
let comp = entity.comp... | add expln in docs for why we need to keep checking |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -119,7 +119,7 @@ export class MRDivEntity extends MREntity {
* @function
* @description Callback function of MREntity - connects the background geometry of this item to an actual UIPlane geometry. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -53,7 +53,7 @@ export default class MRHyperlinkEntity extends MRTextEntity {
* @description Callback function of MREntity - makes sure the link object is created and sets up event | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -43,7 +43,8 @@ export class MRImageEntity extends MRMediaEntity {
* @function
* @description Callback function of MREntity - handles setting up this Image and associated 3D geometry style (from css) once it is connected to run as an entity component. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -22,7 +22,7 @@ export class MRLightEntity extends MREntity {
* @function
* @description Callback function of MREntity - handles setting up this Light once it is connected to run as an entity component. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -117,7 +117,7 @@ export class MRMediaEntity extends MRDivEntity {
* @function
* @description Callback function of MREntity - handles setting up this media and associated 3D geometry style (from css) once it is connected to run as an entity component. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -54,7 +54,8 @@ export class MRPanelEntity extends MRDivEntity {
* @description Callback function of MREntity - handles setting up this Panel once it is connected to run as an entity component. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -57,7 +57,8 @@ export class MRSkyBoxEntity extends MREntity {
* @description Lifecycle method that is called when the entity is connected. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -78,8 +78,8 @@ export class MRTextAreaEntity extends MRTextInputEntity {
/**
* Overrides the connected method to include setup for handling multiline text. | this function needs proper jsdoc descriptions not just function body
@function
@description
and - can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -51,7 +51,8 @@ export class MRTextInputEntity extends MRTextEntity {
* @function
* @description Callback function of MREntity - handles setting up this textarea once it is connected to run as an entity component. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -59,7 +59,8 @@ export class MRVideoEntity extends MRMediaEntity {
* @function
* @description Callback function of MREntity - handles setting up this video and associated 3D geometry style (from css) once it is connected to run as an entity component. | can you add `(async)` to the description like you did for the other newly async functions? |
mrjs | github_2023 | javascript | 557 | Volumetrics-io | hanbollar | @@ -42,9 +42,14 @@ export class MRTextEntity extends MRDivEntity {
* @function
* @description Callback function of MREntity - sets up the textObject of the text item.
*/
- connected() {
- const text = this.textContent.trim();
+ async connected() {
+ await super.connected();
+ ... | reminder - pls remove this `dispatchEvent` line - you told me to say this 👀 |
mrjs | github_2023 | javascript | 551 | Volumetrics-io | hanbollar | @@ -92,6 +92,14 @@ export class MRModelEntity extends MRDivEntity {
this.loaded = true;
+ this.object3D.traverse(object => { | if you're traversing over `this.object3D` make sure to use `MREntity`'s [`traverseObjects`](https://github.com/Volumetrics-io/mrjs/blob/main/src/core/MREntity.js#L542) instead of just `object3D.traverse`
it adds in an extra check for if it's the actual root object to reduce redunant checks |
mrjs | github_2023 | javascript | 549 | Volumetrics-io | hanbollar | @@ -30,10 +30,10 @@ export class MREntity extends MRElement {
constructor() {
super();
- Object.defineProperty(this, 'isApp', {
- value: false,
- writable: false,
- });
+ // Object.defineProperty(this, 'isApp', {
+ // value: false,
+ // wr... | delete commented code - or if leaving for later, add comment as to why |
mrjs | github_2023 | javascript | 549 | Volumetrics-io | hanbollar | @@ -47,7 +47,7 @@ export class MREntity extends MRElement {
this.scale = 1;
- this.componentMutated = this.componentMutated.bind(this);
+ // this.componentMutated = this.componentMutated.bind(this); | delete commented code - or if leaving for later, add comment as to why |
mrjs | github_2023 | javascript | 545 | Volumetrics-io | hanbollar | @@ -267,7 +269,11 @@ export class PhysicsSystem extends MRSystem {
updateUIBody(entity) {
this.tempBBox.setFromCenterAndSize(entity.object3D.position, new THREE.Vector3(entity.width, entity.height, 0.002));
- this.tempWorldScale.setFromMatrixScale(entity.object3D.matrixWorld);
+ if (entity... | it would be better to do this as
```
this.tempWorldScale.setFromMatrixScale( (entity instanceof MRPanelEntity) ? entity.panel.matrixWorld : entity.object3D.matrixWorld );
``` |
mrjs | github_2023 | javascript | 508 | Volumetrics-io | hanbollar | @@ -0,0 +1,59 @@
+import { mrjsUtils } from 'mrjs';
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRStats } from 'mrjs/core/entities/MRStats';
+
+import Stats from 'stats.js';
+
+import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
+import { InteractiveGroup } from 'three/addons/interacti... | Unless @michaelthatsit states otherwise - seems a worthwhile bump for our purposes 👍 |
mrjs | github_2023 | javascript | 508 | Volumetrics-io | hanbollar | @@ -0,0 +1,20 @@
+import { MRDivEntity } from '../MRDivEntity';
+
+// TODO: JSDoc
+
+export class MRStats extends MRDivEntity {
| MRStats should be an `MREntity` instead of `MRDivEntity`
think of `MRDivEntity` items to be (except for MRModel) the UI elements - that is theyre the ones that are situated on an mr-panel almost as if that mr-panel is a website in 3D space
Since we want MRStats to be its own object regardless of an mr-panel and t... |
mrjs | github_2023 | javascript | 508 | Volumetrics-io | hanbollar | @@ -113,7 +114,15 @@ export class MRApp extends MRElement {
this.observer = new MutationObserver(this.mutationCallback);
this.observer.observe(this, { attributes: true, childList: true });
+ if (this.getAttribute('stats')) {
+ const statsEl = document.createElement('mr-stats');
+ ... | this would be better off in the constructor of `StatsSystem` as we should only have a stats system if `this.getAttribute('stats')` is true |
mrjs | github_2023 | javascript | 508 | Volumetrics-io | hanbollar | @@ -0,0 +1,59 @@
+import { mrjsUtils } from 'mrjs';
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRStats } from 'mrjs/core/entities/MRStats';
+
+import Stats from 'stats.js';
+
+import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
+import { InteractiveGroup } from 'three/addons/interacti... | this section should be in the entity's `connected` function - this is the function that gets called when the entity is 'connected to an app (meaning the app exists and <mr-stats> is in the html within it)
[mr-hyperlink's use of connected ](https://github.com/Volumetrics-io/mrjs/blob/main/src/core/entities/MRHyperlin... |
mrjs | github_2023 | javascript | 508 | Volumetrics-io | hanbollar | @@ -0,0 +1,59 @@
+import { mrjsUtils } from 'mrjs';
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRStats } from 'mrjs/core/entities/MRStats';
+
+import Stats from 'stats.js';
+
+import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
+import { InteractiveGroup } from 'three/addons/interacti... | every MRSystem has a 'this.registry' which is a set for every entity associated with a system
`this.statsEntities.push(entity)` --> `this.registry.add(entity);`
----
an additional note:
at the moment, we do not remove entities from this set once theyre added
in future if we ever have live entity deletio... |
mrjs | github_2023 | javascript | 508 | Volumetrics-io | hanbollar | @@ -0,0 +1,59 @@
+import { mrjsUtils } from 'mrjs';
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRStats } from 'mrjs/core/entities/MRStats';
+
+import Stats from 'stats.js';
+
+import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
+import { InteractiveGroup } from 'three/addons/interacti... | not entirely sure at first glance - i'll take a quick look in headset and get back to you on that |
mrjs | github_2023 | javascript | 516 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,81 @@
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+import { MRPanel } from 'mrjs/core/entities/MRPanel';
+
+/**
+ * @function
+ * @description Observe a target MRDivEntity and make the associated object visible only if it is in visible position in a r... | ROVSystem (Region of Visibility)? |
mrjs | github_2023 | javascript | 516 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,81 @@
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+import { MRPanel } from 'mrjs/core/entities/MRPanel';
+
+/**
+ * @function
+ * @description Observe a target MRDivEntity and make the associated object visible only if it is in visible position in a r... | oof. so this overrides the other systems? Calling it earlier in the Systems order might fix it. They're stepped sequentially, so any subsequent system would override this one. |
mrjs | github_2023 | javascript | 516 | Volumetrics-io | hanbollar | @@ -0,0 +1,81 @@
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+import { MRPanel } from 'mrjs/core/entities/MRPanel';
+
+/**
+ * @function
+ * @description Observe a target MRDivEntity and make the associated object visible only if it is in visible position in a r... | I think that delay is fine for now - as long as fixing the order per [link](https://github.com/Volumetrics-io/mrjs/pull/516/files#r1536268465) lets things run smoothly (ie the other systems can override / run what they need to) then it should be okay |
mrjs | github_2023 | javascript | 516 | Volumetrics-io | hanbollar | @@ -0,0 +1,90 @@
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+import { MRPanel } from 'mrjs/core/entities/MRPanel';
+
+/**
+ * @function
+ * @description Observe a target MRDivEntity and make the associated object visible only if it is in visible position in a r... | noting this todo as important |
mrjs | github_2023 | javascript | 125 | Volumetrics-io | takahirox | @@ -315,7 +315,7 @@ export default class Entity extends MRElement {
const children = Array.from(this.children);
for (const child of children) {
// if o is an object, traverse it again
- if (!child instanceof Entity) {
+ if ((!child) instanceof Entity) { | Is this change intentional? `!child` would be boolean (true/false) then `((!child) instanceof Entity)` would be always false. I guess you wanted to write `!(child instanceof Entity)`. |
mrjs | github_2023 | javascript | 511 | Volumetrics-io | takahirox | @@ -202,6 +202,16 @@ export class MRApp extends MRElement {
this.renderer.toneMapping = THREE.ACESFilmicToneMapping;
this.renderer.toneMappingExposure = 1;
this.renderer.localClippingEnabled = true;
+ if (this.getAttribute('preserve-drawing-buffer') ?? false) {
+ // There's ... | `preserveDrawingBuffer` flag must be passed via the `WebGLRenderer` constructor.
https://threejs.org/docs/#api/en/renderers/WebGLRenderer |
mrjs | github_2023 | javascript | 511 | Volumetrics-io | michaelthatsit | @@ -193,6 +195,19 @@ export class MRApp extends MRElement {
*/
init() {
this.debug = this.getAttribute('debug') ?? false;
+
+ this.renderer = new THREE.WebGLRenderer({
+ antialias: true,
+ alpha: true,
+ // There's issues in the timing to enable taking screen... | Maybe we shorten it to `preserve-buffer`? Could just be my aversion to long attribute names. |
mrjs | github_2023 | javascript | 306 | Volumetrics-io | takahirox | @@ -45,6 +45,23 @@ export class MRTextEntity extends MRDivEntity {
this.needsStyleUpdate = true;
}
}
+
+ /**
+ * @function
+ * @description Runs the passed through function on this object and every child of this object.
+ * @param {Function} callBack - the function to run recur... | Is this `this.object3D.children` (Three.js Object3D collection) intentional although parent `MREntity` traverses `.children` (HTMLElement collection)? I guess it isn't. This function it very trouble some because callback function doesn't expect `Object3D` argument if this method is called from parent entities. |
mrjs | github_2023 | javascript | 497 | Volumetrics-io | michaelthatsit | @@ -49,36 +49,31 @@ export class PhysicsSystem extends MRSystem {
}
}
+ /**
+ * @function
+ * @description The per global scene event update call. Based on the captured physics events for the frame, handles all items appropriately.
+ */
eventUpdate = () => {
+ mrjsUtils.physi... | `eventUpdate` is only meant to be called on events, not per frame. |
mrjs | github_2023 | javascript | 497 | Volumetrics-io | michaelthatsit | @@ -49,36 +49,31 @@ export class PhysicsSystem extends MRSystem {
}
}
+ /**
+ * @function
+ * @description The per global scene event update call. Based on the captured physics events for the frame, handles all items appropriately.
+ */
eventUpdate = () => {
+ mrjsUtils.physi... | We need to keep the updates here. Updating colliders per frame causes a significant hit to performance. |
mrjs | github_2023 | javascript | 494 | Volumetrics-io | hanbollar | @@ -52,6 +52,7 @@ export class MREntity extends MRElement {
});
this.object3D = new THREE.Group();
+ this.object3D.userData.isEntityObject3DRoot = true; | one shorter solution is leaning into the assumption that if object3D is a group, then object3D.children[0] is the root in question
reasoning - when the entities are set up it'll be either the first background object for any mrdiv or the 'object' that should be representing the entity itself given how we instantiate ... |
mrjs | github_2023 | javascript | 492 | Volumetrics-io | hanbollar | @@ -66,82 +134,88 @@ export class MaskingSystem extends MRSystem {
// leave for when needed.
}
+ /**
+ * @function
+ * @description Copy the source world matrices to the objects writing to stencil buffer
+ */
+ sync() {
+ // TODO: Move to update().
+ // This method needs ... | I think switching to ShaderMaterial would be good but if I remember correctly when I've done that before in mrjs it can hit a weird edge case for some aspect of physics our bounding box updates (i forget exactly where)
just noting this here for future if that ends up being something you'd want to chase down
not b... |
mrjs | github_2023 | javascript | 492 | Volumetrics-io | hanbollar | @@ -66,82 +134,88 @@ export class MaskingSystem extends MRSystem {
// leave for when needed.
}
+ /**
+ * @function
+ * @description Copy the source world matrices to the objects writing to stencil buffer
+ */
+ sync() {
+ // TODO: Move to update().
+ // This method needs ... | A bit confused by this comment - Where is this? We might be able to do a workaround to get the sync back into the update loop
Not a blocker if this isnt possible in the current setup - just want to make sure im understanding and maybe we can find a way for it to work as you're proposing in the TODO. |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,242 @@
+import * as THREE from 'three';
+
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+
+import { mrjsUtils } from 'mrjs';
+
+/**
+ * @class MRMedia
+ * @classdesc Base html media entity represented in 3D space. `mr-media`
+ * @augments MRDivEntity
+ */
+export class MRMedia extends MRDivEntity {
+... | super is a good solution! |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | takahirox | @@ -82,13 +82,39 @@ material.loadTextureAsync = function (src) {
};
material.loadVideoTextureAsync = function (video) {
+ video.src = html.resolvePath(video.src);
+
+ video.muted = true; // Mute the video to allow autoplay
+ video.autoplay = false; //true; // Attempt to autoplay
+
return new Promise((... | Nit for an existing issue: Isn't the name `textureLoader` for `VideoTexture` instance confusing because Three.js has `TextureLoader` class? Maybe `texture` or `videoTexture` would be clearer? |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | takahirox | @@ -36,6 +36,9 @@ export class MaterialStyleSystem extends MRSystem {
if (entity instanceof MRDivEntity) {
this.setBackground(entity);
}
+ if (entity instanceof MRVideo && entity.playing) {
+ entity.texture.needsUpdate = true;
+ } | Is a texture of `MRVideo` guaranteed to be as `VideoTexture`? If so we may not need to manually call `texture.needsUpdate = true` because it's automatically (and more efficiently with [requestVideoFrameCallback](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/requestVideoFrameCallback)) set
https:/... |
mrjs | github_2023 | others | 464 | Volumetrics-io | takahirox | @@ -37,81 +28,74 @@
<footer>
<script>
- let rig = document.querySelector('#rig')
- let panels = document.querySelectorAll('.layout')
+ let rig = document.querySelector('#rig');
+ let panels = document.querySelectorAll('.layout');
+ let videoEl = document.querySelector('#vide... | Nit: Duplicated ";" |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | takahirox | @@ -0,0 +1,242 @@
+import * as THREE from 'three';
+
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+
+import { mrjsUtils } from 'mrjs';
+
+/**
+ * @class MRMedia
+ * @classdesc Base html media entity represented in 3D space. `mr-media`
+ * @augments MRDivEntity
+ */
+export class MRMedia extends MRDivEntity {
+... | I would like to suggest to always use `const` specifier instead of `let` for immutable variables to avoid unexpected reassignment. (Depending on the team coding style tho) |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | takahirox | @@ -0,0 +1,242 @@
+import * as THREE from 'three';
+
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+
+import { mrjsUtils } from 'mrjs';
+
+/**
+ * @class MRMedia
+ * @classdesc Base html media entity represented in 3D space. `mr-media`
+ * @augments MRDivEntity
+ */
+export class MRMedia extends MRDivEntity {
+... | Using named Three.js constants, `THREE.FrontSide` in this case, would be more readable |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | takahirox | @@ -0,0 +1,242 @@
+import * as THREE from 'three';
+
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+
+import { mrjsUtils } from 'mrjs';
+
+/**
+ * @class MRMedia
+ * @classdesc Base html media entity represented in 3D space. `mr-media`
+ * @augments MRDivEntity
+ */
+export class MRMedia extends MRDivEntity {
+... | Not a review comment but just a question for existing code so not blocking: What is this `renderOrder = 3` for? Adding a comment would be helpful to users. |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | takahirox | @@ -0,0 +1,242 @@
+import * as THREE from 'three';
+
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+
+import { mrjsUtils } from 'mrjs';
+
+/**
+ * @class MRMedia
+ * @classdesc Base html media entity represented in 3D space. `mr-media`
+ * @augments MRDivEntity
+ */
+export class MRMedia extends MRDivEntity {
+... | Nit, not blocking issue: Do we want to throw an error here? We may be able to more easily detect in cases if we forgot to override this method in child classes. |
mrjs | github_2023 | javascript | 464 | Volumetrics-io | takahirox | @@ -82,13 +82,39 @@ material.loadTextureAsync = function (src) {
};
material.loadVideoTextureAsync = function (video) {
+ video.src = html.resolvePath(video.src);
+
+ video.muted = true; // Mute the video to allow autoplay
+ video.autoplay = false; //true; // Attempt to autoplay
+
return new Promise((... | Curious, which line above in try can throw an un-caught error? video play error stuffs seems to be caught above. |
mrjs | github_2023 | others | 436 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,120 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>mr.js - video</title>
+ <meta name="description" content="mr.js example - video">
+ <script src="/mr.js"></script>
+ <link rel="stylesheet" type="text/css" href="video-style.css" />
+ <meta name="viewport" content="... | This is really cool! but probably shouldn't make it into the simple example. Also it doesn't work when in headset. Maybe we replace it with a loop button? |
mrjs | github_2023 | javascript | 436 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,211 @@
+import * as THREE from 'three';
+
+import { MRDivEntity } from 'mrjs/core/MRDivEntity';
+
+import { mrjsUtils } from 'mrjs';
+
+/**
+ * @class MRVideo
+ * @classdesc Base html video represented in 3D space. `mr-video`
+ * @augments MRDivEntity
+ */
+export class MRVideo extends MRDivEntity { | @hanbollar you're currently working on the fix for `object-fit`, MRVideo should be treated the same as MRImage. Perhaps we can extract their common features out into MRMedia? that wouldn't need to be exposed as a tag itself, but might make it easy for us to apply the same responsiveness logic to both. |
mrjs | github_2023 | javascript | 403 | Volumetrics-io | hanbollar | @@ -102,7 +102,7 @@ export class LayoutSystem extends MRSystem {
if (entity.compStyle.zIndex != 'auto') {
// default zIndex values in css are in the 1000s - using this arbitrary divide to convert to an actual usable threejs value.
- entity.object3D.position.setZ(parseFloat(entity.comp... | do we also need this fix in the panel system? |
mrjs | github_2023 | others | 382 | Volumetrics-io | hanbollar | @@ -9,21 +9,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
- <mr-app debug="false">
+ <mr-app debug="true"> | switch this back |
mrjs | github_2023 | others | 382 | Volumetrics-io | hanbollar | @@ -9,21 +9,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
- <mr-app>
+ <mr-app debug="true"> | this should be swapped back |
mrjs | github_2023 | others | 382 | Volumetrics-io | hanbollar | @@ -2,34 +2,33 @@
<html>
<head>
<meta charset="utf-8">
- <title>mr.js - anchors</title>
- <meta name="description" content="mr.js example - anchors">
+ <title>mr.js - panels</title>
+ <meta name="description" content="mr.js example - panels">
<script src="/mr.js"></script>
<link rel="styl... | are all examples debug=true now? (just realized a lot of them switched to this - if yes, ignore my prev comments, if no, just make sure to swap the rest of them and i'll stop commenting as part of the review here to not overspam) |
mrjs | github_2023 | javascript | 382 | Volumetrics-io | hanbollar | @@ -89,29 +90,210 @@ export class ControlSystem extends MRSystem {
this.leftHand.setMesh();
this.rightHand.setMesh();
+ mrjsUtils.physics.eventQueue.drainCollisionEvents((handle1, handle2, started) => {
+ /* Handle the collision event. */
+
+ if (started) {
+ ... | this should be simplified for readability and better branching to:
```
if (joint && entity) {
if (joint.includes('hover')) {
this.touchStart...
} else {
this.hoverStart...
}
}
``` |
mrjs | github_2023 | javascript | 382 | Volumetrics-io | hanbollar | @@ -89,29 +90,210 @@ export class ControlSystem extends MRSystem {
this.leftHand.setMesh();
this.rightHand.setMesh();
+ mrjsUtils.physics.eventQueue.drainCollisionEvents((handle1, handle2, started) => {
+ /* Handle the collision event. */
+
+ if (started) {
+ ... | same comment as before for the if () { if else } - and if there will eventually be more logic here, this should be separated out in another function, if this is the main plan for these then no need to separate out |
mrjs | github_2023 | javascript | 382 | Volumetrics-io | hanbollar | @@ -89,29 +90,210 @@ export class ControlSystem extends MRSystem {
this.leftHand.setMesh();
this.rightHand.setMesh();
+ mrjsUtils.physics.eventQueue.drainCollisionEvents((handle1, handle2, started) => {
+ /* Handle the collision event. */
+
+ if (started) {
+ ... | what does this comment mean? |
mrjs | github_2023 | javascript | 382 | Volumetrics-io | hanbollar | @@ -58,230 +57,160 @@ export class PhysicsSystem extends MRSystem {
* @param {object} frame - given frame information to be used for any feature changes
*/
update(deltaTime, frame) {
- this.app.physicsWorld.step(this.eventQueue);
-
- this.eventQueue.drainCollisionEvents((handle1, handle2,... | we have the open issue of MRModel possibly being moved to inherit from MRDivEntity instead of MREntity - will there be a case where MRModel also needs initUIEntityBody? if so, make sure this reflects that or has a todo comment to warn for when we make that change |
mrjs | github_2023 | javascript | 382 | Volumetrics-io | hanbollar | @@ -58,230 +57,160 @@ export class PhysicsSystem extends MRSystem {
* @param {object} frame - given frame information to be used for any feature changes
*/
update(deltaTime, frame) {
- this.app.physicsWorld.step(this.eventQueue);
-
- this.eventQueue.drainCollisionEvents((handle1, handle2,... | it's better to use threejs's `toArray` function here instead of [vertex.x, vertex.y, vertex.z] |
mrjs | github_2023 | javascript | 382 | Volumetrics-io | hanbollar | @@ -290,49 +219,65 @@ export class PhysicsSystem extends MRSystem {
* @param {MREntity} entity - the entity being updated
*/
updateBody(entity) {
- if (entity.physics.type == 'none') {
+ if (!entity.physics.body) {
return;
}
- entity.object3D.getWorldPosition(... | this is the same commentary as before:
we have the open issue of MRModel possibly being moved to inherit from MRDivEntity instead of MREntity - make sure this reflects that or has a todo comment to warn for when we make that change |
mrjs | github_2023 | others | 378 | Volumetrics-io | hanbollar | @@ -1,18 +1,18 @@

-An extensible WebComponents library for the Spatial Web
+An extensible Web Components library for the Spatial Web | Components should be singular here (--> Component) |
mrjs | github_2023 | others | 378 | Volumetrics-io | hanbollar | @@ -50,24 +50,24 @@ npm run server
### Documentation:
-Check [docs.mrjs.io](https://docs.mrjs.io) for the full documentation or our [repository](https://github.com/Volumetrics-io/documentation).
+Check [docs.mrjs.io](https://docs.mrjs.io) for the full documentation, or our [repository](https://github.com/Volumetri... | We should actually just change this to :
Check [docs.mrjs.io](https://docs.mrjs.io) or our [repository](https://github.com/Volumetrics-io/documentation) for the full documentation. |
mrjs | github_2023 | others | 378 | Volumetrics-io | hanbollar | @@ -169,9 +168,9 @@ customElements.get('mr-spacecraft') || customElements.define('mr-spacecraft', Sp
#### Systems
-A System contains logic that is applied to all entities that have a corresponding Component, using the data stored by the component. Unlike Entities & Components, Systems have no HTML representation a... | need to add a to after attached, so - `attached to` , since we have detached from |
mrjs | github_2023 | javascript | 369 | Volumetrics-io | hanbollar | @@ -226,12 +228,12 @@ export class MRApp extends MRElement {
// allows embedded mr-app to be independently scrollable
if (this.compStyle.overflow == 'scroll') {
- this.renderer.domElement.addEventListener('wheel', (event) => {
- // Assuming vertical scrolling
- ... | if this commented code isnt needed anymore - dont forget to remove ~ |
mrjs | github_2023 | javascript | 369 | Volumetrics-io | hanbollar | @@ -0,0 +1,83 @@
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRPanel } from '../entities/MRPanel';
+
+
+/**
+ * @class PanelManagementSystem
+ * @classdesc A system that manages the screen relative position of UI panels
+ * @augments MRSystem
+ */
+export class PanelManagementSystem extends MRSystem { | `PanelManagementSystem` titling is misleading since we also have object managers as well as systems - renaming to something like `MultiPanelSystem` or `PanelSystem` makes more sense |
mrjs | github_2023 | javascript | 369 | Volumetrics-io | hanbollar | @@ -0,0 +1,83 @@
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRPanel } from '../entities/MRPanel'; | make sure your imports start from `mrjs/core/...` so `mrjs/core/entities/MRPanel` |
mrjs | github_2023 | javascript | 369 | Volumetrics-io | hanbollar | @@ -23,6 +23,7 @@ import { SkyBoxSystem } from 'mrjs/core/componentSystems/SkyBoxSystem';
import { StyleSystem } from 'mrjs/core/componentSystems/StyleSystem';
import { TextSystem } from 'mrjs/core/componentSystems/TextSystem';
import { AudioSystem } from './componentSystems/AudioSystem';
+import { PanelManagementSy... | make sure your imports start from `mrjs/core/...` |
mrjs | github_2023 | javascript | 369 | Volumetrics-io | hanbollar | @@ -13,28 +13,29 @@ import { mrjsUtils } from 'mrjs';
* @augments MRDivEntity
*/
export class MRPanel extends MRDivEntity {
- /**
- * @function
- * @description Calculates the height of the Entity. If in Mixed Reality, adjusts the value appropriately.
- * @returns {number} - the resolved height
- ... | if this commented code isnt needed anymore - make sure to remove |
mrjs | github_2023 | javascript | 356 | Volumetrics-io | michaelthatsit | @@ -147,7 +147,21 @@ export class MREntity extends MRElement {
* @function
* @description
*/
- updateStyle() {}
+ updateStyle() {
+ this.setVisibility();
+ }
+
+ setVisibility() { | On principle and scalability I'd prefer this be done in a system. if we start putting more logic into MREntity it'll balloon pretty quickly.
Can we try doing it in the StyleSystem? you could even take a crack at breaking StyleSystem in 2, with anything Geometry related in one and everything else (position, color, vi... |
mrjs | github_2023 | javascript | 337 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,49 @@
+import { MRSystem } from 'mrjs/core/MRSystem';
+import { MRSkyBox } from 'mrjs/core/entities/MRSkyBox';
+
+/**
+ * @class SkyBoxSystem
+ * @classdesc Handles skybox interactions and updates for all items.
+ * @augments MRSystem
+ */
+export class SkyBoxSystem extends MRSystem {
+ /**
+ * @class... | You're mixing up style.scale with object3D.scale here. it's causing some of the skyboxes to not show up in headset.
this should do it:
`entity.object3D.scale.setScalar((this.registry.size == 0) ? 1 : this._lastItem.object3D.scale.z + SCALING_OFFSET);`
also you can reduce your scaling offset even more. |
mrjs | github_2023 | javascript | 348 | Volumetrics-io | hanbollar | @@ -30,6 +30,13 @@ const mrjsUtils = {
Physics,
StringUtils,
xr,
+
+ get appScale() { | this should be a function within mr-app even if it is not object dependent - there should be a way to do a `static` function of the class in javascript for it |
mrjs | github_2023 | javascript | 311 | Volumetrics-io | michaelthatsit | @@ -81,7 +75,11 @@ export class TextSystem extends MRSystem {
* Relies on the parent's implementation. (see [MRSystem.needsSystemUpdate](https://docs.mrjs.io/javascript-api/#mrsystem.needssystemupdate) for default).
*/
set needsSystemUpdate(bool) {
- super.needsSystemUpdate = bool;
+ cons... | is this log necessary? |
mrjs | github_2023 | javascript | 309 | Volumetrics-io | hanbollar | @@ -65,6 +65,8 @@ export class MREntity extends MRElement {
this.touch = false;
this.grabbed = false;
this.focus = false;
+
+ this.ignoreStencil = true | question - this should make all entities ignored by masking, even div entities - meaning we're not masking at all anymore - is this needed in this pr?
if so - make sure to add `this.ignoreStencil = false` to all mrdiventity items (or at a basis, mrdiventity) |
mrjs | github_2023 | javascript | 236 | Volumetrics-io | michaelthatsit | @@ -14,13 +14,34 @@ export class StyleSystem extends MRSystem {
*/
constructor() {
super(false);
- this.cssUpdateNeeded = true;
+
+ // want this system to run based on the true/false trigger
+ this.needsSystemUpdate = true;
document.addEventListener('panel-mutated', (... | this needs to be always true and we need to stick with checking `entity.needsStyleUpdate` due to some asynchronous loading of text and event driven styles such as hover and click. `needsSystemUpdate` blocks these. |
mrjs | github_2023 | javascript | 236 | Volumetrics-io | michaelthatsit | @@ -71,10 +93,13 @@ export class MRSystem {
* @param {number} deltaTime - given timestep to be used for any feature changes
* @param {object} frame - given frame information to be used for any feature changes
*/
- __update(deltaTime, frame) {
- if (!this.needsUpdate(deltaTime, frame)) {
+ ... | remove log |
mrjs | github_2023 | javascript | 236 | Volumetrics-io | michaelthatsit | @@ -71,10 +93,13 @@ export class MRSystem {
* @param {number} deltaTime - given timestep to be used for any feature changes
* @param {object} frame - given frame information to be used for any feature changes
*/
- __update(deltaTime, frame) {
- if (!this.needsUpdate(deltaTime, frame)) {
+ ... | remove log |
mrjs | github_2023 | javascript | 259 | Volumetrics-io | hanbollar | @@ -4,6 +4,7 @@ import { MRSystem } from 'mrjs/core/MRSystem';
import { MRDivEntity } from 'mrjs/core/MRDivEntity';
import { MREntity } from 'mrjs/core/MREntity';
import { MRPanel } from 'mrjs/core/entities/MRPanel';
+import { MRTextEntity } from '../MRTextEntity'; | change this to `import { MRTextEntity } from 'mrjs/core/MRTextEntity';` |
mrjs | github_2023 | javascript | 259 | Volumetrics-io | hanbollar | @@ -89,6 +89,7 @@ export class ClippingSystem extends MRSystem {
* @param {MREntity} entity - the entity to which we're adding the clipping planes information
*/
addClippingPlanes(entity) {
+ console.log(entity); | if this is for just-this-pr debugging dont forget to remove |
mrjs | github_2023 | javascript | 235 | Volumetrics-io | hanbollar | @@ -87,6 +88,11 @@ export class TextSystem extends MRSystem {
}
this.updateStyle(entity);
+ if (entity instanceof Button) { | just checking - is button the only current divEntity that needs a special case? or is it all div entities that can be within text |
mrjs | github_2023 | javascript | 235 | Volumetrics-io | hanbollar | @@ -0,0 +1,122 @@
+import { mrjsUtils } from 'mrjs';
+import { MRPlane } from '../../datatypes/MRPlane';
+
+/**
+ * @class MRPlaneManager
+ * @classdesc creates and manages the mr.js representation of XR planes.
+ * The resulting planes have RAPIER rigid bodies and THREE.js meshes that occlude virtual content by defaul... | is this console.log still needed? |
mrjs | github_2023 | javascript | 235 | Volumetrics-io | hanbollar | @@ -0,0 +1,8 @@
+/**
+ * @namespace xr
+ * @description Useful namespace for helping with xr utility functions.
+ * this is set within the MRApp to access various WebXR API features
+ */
+let xr = {}; | Can we use `XR` instead of `xr` ? |
mrjs | github_2023 | javascript | 235 | Volumetrics-io | hanbollar | @@ -60,7 +61,7 @@ export class SkyBox extends MREntity {
textureNames.map((name) => (path ? path + name : name)),
this.onTextureLoaded.bind(this) // Ensuring the correct context
);
- const geometry = new THREE.SphereGeometry(1000, 32, 16);
+ const geometry = new THREE.Sp... | just curious on the change to 900, was it a render issue? |
mrjs | github_2023 | javascript | 235 | Volumetrics-io | hanbollar | @@ -0,0 +1,122 @@
+import { mrjsUtils } from 'mrjs';
+import { MRPlane } from '../../datatypes/MRPlane';
+
+/**
+ * @class MRPlaneManager
+ * @classdesc creates and manages the mr.js representation of XR planes.
+ * The resulting planes have RAPIER rigid bodies and THREE.js meshes that occlude virtual content by defaul... | if this is a manager and not a system we need to figure somewhere else for this to go
i'd prefer we default it back to keeping inline with the ECS setup we're going for: just change this into a System and just have an empty update function (like how the `MaskingSystem` is setup) |
mrjs | github_2023 | javascript | 144 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,116 @@
+/**
+ *
+ */
+class InstancingSystem extends System {
+ // System that allows for instancing of meshes based on a given
+ // entity where the instances can be modified separately.
+
+ /**
+ *
+ */
+ constructor() {
+ super();
+
+ this.instanceCount = 5;
+ this... | Is there a difference between `.merge` and [mergeGeometries](https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.mergeGeometries)? |
mrjs | github_2023 | javascript | 153 | Volumetrics-io | michaelthatsit | @@ -0,0 +1,32 @@
+class SkyBox extends Entity {
+ constructor() {
+ super();
+ }
+
+ /**
+ *
+ */
+ connected() {
+ // you can have texturesList be all individual textures
+ // or you can store them in a specified path and just
+ // load them up solely by filename in that... | @hanbollar what do we thing about using `src` instead of textures? We could also use the 'background' css property which would be sick. |
mrjs | github_2023 | javascript | 153 | Volumetrics-io | michaelthatsit | @@ -11,20 +11,21 @@ class SkyBox extends Entity {
// or you can store them in a specified path and just
// load them up solely by filename in that path.
- this.texturesList = this.getAttribute('textures');
+ this.texturesList = this.getAttribute('src');
if (!this.textu... | ah so you wouldn't set compStyle.background really ever. that's done with css. Rather I'd expect you'd use `this.compStyle.background` as an alternative to `src`.
something like:
```
this.texturesList = this.compStyle.backgroundImages
...
const textureNames = texturesList.split([some regex to parse list of pat... |
mrjs | github_2023 | javascript | 177 | Volumetrics-io | hanbollar | @@ -59,6 +59,35 @@ export class MRUIEntity extends Entity {
this.windowHorizontalScale = 1;
}
+ /**
+ *
+ * @param entity
+ */
+ add(entity) {
+ let container = this.closest('mr-panel');
+
+ if (container && entity instanceof MRUIEntity) {
+ container.add(entit... | needs comment above this line for why this bump is necessary |
mrjs | github_2023 | javascript | 177 | Volumetrics-io | hanbollar | @@ -36,6 +36,8 @@ export class MRImage extends MRUIEntity {
}
});
this.object3D.material.map = this.texture;
+
+ this.object3D.position.z += 0.00001; | needs comment above this line for why this bump is necessary |
mrjs | github_2023 | javascript | 177 | Volumetrics-io | hanbollar | @@ -63,15 +63,18 @@ export class TextSystem extends System {
entity.blur();
}
} else {
- text = entity.textContent.replace(/(\n)\s+/g, '$1').trim();
+ text = entity.textContent
+ .replace(/(\n)\s+/g, '$1')
+ ... | need comment above this explaining why this swap is needed and safe |
mrjs | github_2023 | javascript | 177 | Volumetrics-io | hanbollar | @@ -49,8 +50,9 @@ export default class Entity extends MRElement {
*
*/
get height() {
- const styleHeight = this.compStyle.height.split('px')[0] > 0 ? this.compStyle.height.split('px')[0] : window.innerHeight;
- return (styleHeight / window.innerHeight) * global.viewPortHeight;
+ c... | can this line be deleted? |
mrjs | github_2023 | javascript | 177 | Volumetrics-io | hanbollar | @@ -15,9 +15,9 @@ export class Model extends Entity {
/**
*
*/
- get height() {
- return this.contentHeight;
- }
+ // get height() {
+ // return this.contentHeight;
+ // } | can the above be deleted? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.