mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: model api
This commit is contained in:
1 parent
e6f9b07b20
commit
838ce7f35d
4 files changed
+25
-1
No files matched your search
@@ -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';
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
};
|
||||
Reference in new issue
Block a user