diff --git a/packages/website/src/core/awaitables/tanksFull.ts b/packages/website/src/core/awaitables/tanksFull.ts new file mode 100644 index 000000000..ff3973816 --- /dev/null +++ b/packages/website/src/core/awaitables/tanksFull.ts @@ -0,0 +1,3 @@ +import { fetchTanksFull } from '@blitzkit/core'; + +export const awaitableTanksFull = fetchTanksFull(); diff --git a/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx b/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx index 3cf1fd782..a953ae8c9 100644 --- a/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx +++ b/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx @@ -1,7 +1,10 @@ import { asset } from '@blitzkit/core'; import { OrbitControls } from '@react-three/drei'; import { Canvas, useLoader } from '@react-three/fiber'; +import { MeshBasicMaterial } from 'three'; import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { randInt } from 'three/src/math/MathUtils.js'; +import { jsxTree } from '../../../../core/blitzkit/jsxTree'; interface PageProps { id: string; @@ -24,5 +27,14 @@ export function Page({ id }: PageProps) { function Model({ id }: { id: string }) { const gltf = useLoader(GLTFLoader, asset(`/tanks/${id}/collision/hull.glb`)); - return ; + return jsxTree(gltf.scene, { + mesh: () => ({ + material: new MeshBasicMaterial({ + color: `rgb(${randInt(0, 255)}, ${randInt(0, 255)}, ${randInt( + 0, + 255, + )})`, + }), + }), + }); } diff --git a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro index 830fa9947..0b9a5c0d4 100644 --- a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro +++ b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro @@ -1,15 +1,15 @@ --- import type { GetStaticPaths } from 'astro'; -import { awaitableTanks } from '../../../../core/awaitables/tanks'; +import { awaitableTanksFull } from '../../../../core/awaitables/tanksFull'; import BaseLayout from '../../../../layouts/BaseLayout.astro'; import { getStaticPaths as parentGetStaticPaths } from '../index.astro'; import { Page } from './_index'; export const getStaticPaths = (async () => { - const tanks = await awaitableTanks; + const tanksFull = await awaitableTanksFull; const parentPaths = parentGetStaticPaths(); - return tanks.tanks + return tanksFull.tanks .map((tank) => parentPaths.map((parent) => ({ params: { ...parent.params, slug: tank.slug }, diff --git a/src/BlitzKit.CLI/Models/MonoGltf.cs b/src/BlitzKit.CLI/Models/MonoGltf.cs index 4046ba117..85e9da58a 100644 --- a/src/BlitzKit.CLI/Models/MonoGltf.cs +++ b/src/BlitzKit.CLI/Models/MonoGltf.cs @@ -38,17 +38,12 @@ namespace BlitzKit.CLI.Models ExporterOptions options = new() { TextureFormat = ETextureFormat.Jpeg }; staticMesh.TryConvert(out var convertedMesh); var lod = - convertedMesh.LODs.Find(lod => !lod.SkipLod) ?? throw new Exception("Failed to find lod0"); - - int sectionIndex = 0; - foreach (var section in lod.Sections.Value) - { - sectionIndex++; - } + convertedMesh.LODs.Find(lod => !lod.SkipLod) ?? throw new Exception("Failed to find lod0"); // first non-skippable lod is the highest quality MaterialBuilder emptyMaterial = new("empty_material"); Dictionary namedMaterials = []; + int sectionIndex = 0; foreach (var section in lod.Sections.Value) { ConfiguredMeshBuilder meshBuilder = new($"{staticMesh.Name}_section_{sectionIndex}");