BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
22.78k stars 3.39k forks source link

Improvements for trailMesh #15125

Closed lockphase closed 1 month ago

lockphase commented 1 month ago

Added options to constructor, deprecated old constructor. Follows existing mesh creation practices for consistency and future use.

Users can now control the trailMesh's segments, sections and switch off trail tapering when not needed. Defaults apply to preserve back-compat.

Updated trail mesh creation and update function to account for trail segments and tapering. Updated clone and parse functions to use new contructor.

Pls see forum thread here, thanks!

bjsplat commented 1 month ago

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.

bjsplat commented 1 month ago

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.

bjsplat commented 1 month ago

Snapshot stored with reference name: refs/pull/15125/merge

Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15125/merge/index.html

To test a playground add it to the URL, for example:

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15125/merge/index.html#WGZLGJ#4600

Links to test babylon tools with this snapshot:

https://playground.babylonjs.com/?snapshot=refs/pull/15125/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/15125/merge https://gui.babylonjs.com/?snapshot=refs/pull/15125/merge https://nme.babylonjs.com/?snapshot=refs/pull/15125/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/15125/merge#BCU1XR#0

bjsplat commented 1 month ago

WebGL2 visualization test reporter:

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15125/merge/testResults/webgl2playwright/index.html

bjsplat commented 1 month ago

Visualization tests for WebGPU (Experimental) Important - these might fail sporadically. This is an optional test.

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15125/merge/testResults/webgpuplaywright/index.html

Popov72 commented 1 month ago

You can keep backward compatibility with the old constructor by adding some decalarations. See how it's done for VertexBuffer:

https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Buffers/buffer.ts#L470-L529

(you will have to add autoStart in the option object)

lockphase commented 1 month ago

The trailmesh demo from the docs is not working as expected

I have tested the demo from the docs on local after the fix, it is working now.

Would also be great to add a visualization test, if possible. You can add a playground to the config.json file and give a few frames to render the trail as well. If that's a problem we can do that later.

Sure, I can add after this PR accepted and new build is live, have to update the doc as well, so np.