Art Vandelay

Three.js or Babylon.js for room design

Recommended Posts

6 minutes ago, adam said:

In the case, the user should be reusing Rays.

When you call 
 

public pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo {
return this._internalPick(world => {
if (!this._pickWithRayInverseMatrix) {
this._pickWithRayInverseMatrix = Matrix.Identity();
}
world.invertToRef(this._pickWithRayInverseMatrix);
return Ray.Transform(ray, this._pickWithRayInverseMatrix);
}, predicate, fastCheck);
}

Ray.Transform returns new Ray. 

Share this post


Link to post
Share on other sites

There are actually 2 objects getting created there.  A pickingInfo object and a Ray.

The Ray creation could be eliminated by using a tmpRay in the scene.pickWithRay functions.

To eliminate the pickingInfo object creation, there would need to be a new scene.pickWithRayToRef which the user would pass a pickingInfo object. (this one looks a little difficult and might not be worth it)

Share this post


Link to post
Share on other sites
9 minutes ago, adam said:

There are actually 2 objects getting created there.  A pickingInfo object and a Ray.

The Ray creation could be eliminated by using a tmpRay in the scene.pickWithRay functions.

To eliminate the pickingInfo object creation, there would need to be a new scene.pickWithRayToRef which the user would pass a pickingInfo object. (this one looks a little difficult and might not be worth it)

Well, a pickInfo object is a necessary evil: you do need to return the result of picking :) 

Share this post


Link to post
Share on other sites

Personally, I have found BJS to not be OOP enough.  Not in the framework itself, but in ones ability to easily subclass something in typescript.  I just have been doing PR's to switch private properties / methods to protected in instances where I have hit walls.  I also reorganized Mesh a little, so cloning can be done in the constructor, otherwise you could not clone a mesh sub-class. 

FYI, there is no relationship between OOP and trash creation.  Any design can create tons of short lifetime garbage with ease. This is not as bad as burying references to objects in other objects beyond when they need them, so stuff can never fall out of scope and be garbage collected.

Share this post


Link to post
Share on other sites
16 hours ago, Deltakosh said:

Always eager to improve the engine. I will work on removing this ugly Ray.Transform

Regarding camera, the inputs are pretty well separated to me: http://doc.babylonjs.com/how_to/customizing_camera_inputs

Then each camera has a specific design (ArcRotate, Free).

 

As I said, I don't disagree with decisions made - It's just we all have our own view of what's best :)

Share this post


Link to post
Share on other sites
16 hours ago, JCPalmer said:

FYI, there is no relationship between OOP and trash creation.  Any design can create tons of short lifetime garbage with ease. This is not as bad as burying references to objects in other objects beyond when they need them, so stuff can never fall out of scope and be garbage collected.

Agreed.

Share this post


Link to post
Share on other sites

@max123 Hey thank you for your feedback Max, it's always appreciated to have constructive comments.

About the inspector, maybe I can help ? Indeed, the inspector is HTML/CSS based and I have to say it's a real pain in the ass to create a side panel :D
But you can create a div and ask the inspector to be created in this specific div (described here: http://doc.babylonjs.com/how_to/debug_layer)

Let me know if you need anything, even new features :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.