Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

LT21: shapeFromChildren reads a Text3D's and a BufferMesh's props as their own types again, one if per type, so tools/sdk-props sees BufferMesh's seven props read (positions, normals, uvs, colors, indices, attributes, copies: 0 unread). The fragment-aware loop is kept: a shape inside a fragment is still the mesh's shape (conformance/detail.test.tsx).

shinyobjectzdf8c577fc3e0
diff --git a/sdk/render/src/3d/shapes.tsx b/sdk/render/src/3d/shapes.tsx
index f7dcd524..8235ece8 100644
--- a/sdk/render/src/3d/shapes.tsx
+++ b/sdk/render/src/3d/shapes.tsx
@@ -448,8 +448,13 @@ const flat = (kids: ReactNode): ReactElement[] => Children.toArray(kids).flatMap
export function shapeFromChildren(children: ReactNode): string | undefined {
for (const child of flat(children)) {
- const props = child.props as Record<string, unknown>;
- const s = child.type === Text3D ? text3dShape(props as unknown as Text3DProps) : child.type === BufferMesh ? bufferShape(props as unknown as BufferMeshProps) : GEOMETRY_SHAPES.get(child.type)?.(props);
+ if (child.type === Text3D) {
+ return text3dShape((child as ReactElement<Text3DProps>).props);
+ }
+ if (child.type === BufferMesh) {
+ return bufferShape((child as ReactElement<BufferMeshProps>).props);
+ }
+ const s = GEOMETRY_SHAPES.get(child.type)?.((child as ReactElement<Record<string, unknown>>).props);
if (s !== undefined) return s;
}
return undefined;