feat: add entity render mesh helpers#8960
Conversation
| * meshInstance.visible = false; | ||
| * }); | ||
| */ | ||
| forEachRenderMeshInstance(callback, thisArg) { |
There was a problem hiding this comment.
why is it called forEachRenderMeshInstance when it works on model components.
it should be forEachMeshInstance
There was a problem hiding this comment.
This is just a draft for now - the exact names we can modify. I am just collating findings from my experiments with agents
| * // use aabb | ||
| * } | ||
| */ | ||
| getAabb(result) { |
There was a problem hiding this comment.
not sure this function is good as is, I think meshInstance.aabb is only updated during rendering, so on the first frame it's not valid. we should not expose this for now till that is sorted. separate PR.
There was a problem hiding this comment.
Still working on this - this is not merge ready at all
|
There is also related: #7844 |
4807f22 to
c427b00
Compare
280b6df to
169e748
Compare
169e748 to
5236005
Compare
Build size reportThis PR changes the size of the minified bundles.
|
Public API reportThis PR changes the public API surface (+3 / −0), per the docs' rules (@ignore / @Private / undocumented are excluded). Show API diff+Entity.forEachRenderMeshInstance(callback: RenderMeshInstanceCallback, thisArg?: any): void
+Entity.getAabb(result?: BoundingBox): BoundingBox | null
+type RenderMeshInstanceCallback = (meshInstance: MeshInstance, component: RenderComponent | ModelComponent, entity: Entity) => anyInformational only — this never fails the build. |
Refs #8958
Description
Entity#forEachRenderMeshInstance(cb)to traverse render/model mesh instances across an entity subtree.Entity#getAabb(result?)to compute subtree render bounds without reading livemeshInstancesarrays.Manual smoke test
entity.forEachRenderMeshInstance(cb)and confirmcbreceives each mesh instance with its owning component and entity.entity.getAabb()and confirm it returns a bounding box covering the rendered subtree, ornullfor an empty hierarchy.Checklist