feat: model api

This commit is contained in:
tresabhi committed 2025-03-29 20:26:32 -05:00
1 parent e6f9b07b20
commit 838ce7f35d
4 files changed
+25 -1

No files matched your search

+1
View File
@@ -48,6 +48,7 @@ export * from './metaSortTank';
export * from './romanize';
export * from './tank';
export * from './tankArmor';
export * from './tankModel';
export * from './tanks';
export * from './tanksFull';
export * from './youtubers';
+7
View File
@@ -0,0 +1,7 @@
import { fetchPB } from '../protobuf';
import { TankModel } from '../protos';
import { asset } from './asset';
export function fetchTankModel(id: string) {
return fetchPB(asset(`tanks/${id}/model.pb`), TankModel);
}
+1 -1
View File
@@ -6,7 +6,7 @@
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Vector3 } from "./utils";
import { Vector3, createBaseVector3 } from "./utils";
export const protobufPackage = "blitzkit";
@@ -0,0 +1,16 @@
import { fetchTankModel } from '@blitzkit/core';
import type { APIRoute } from 'astro';
export { getStaticPaths } from './meta.json';
/**
* Returns information on the 3D model of the tank. i.e. how to assemble and
* position the meshes.
*
* @param id The tank id.
* @returns JSON.
*/
export const GET: APIRoute<{}, { id: string }> = async ({ params }) => {
const tank = await fetchTankModel(params.id);
return Response.json(tank);
};