Compare commits

...
4 Commits
Author SHA1 Message Date
tresabhi b6c4c4e852 Merge branch 'main' into ue 2026-03-11 16:53:56 -05:00
tresabhi 8394f2ec1e feat: logs 2026-03-11 16:51:32 -05:00
tresabhi f14e73d811 fix: alpha clipping 2026-03-11 16:50:18 -05:00
tresabhi f193d5c503 feat: port to linux 2026-03-11 16:43:58 -05:00
10 changed files with 39 additions and 17 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
# BlitzKit 1.29.15
## Fixes
- Tanks now use alpha clipping to render translucency, fixing a lot of "ghostly" looking tanks
@@ -0,0 +1,3 @@
export function bufferToBigInt(buffer: ArrayBuffer) {
return new DataView(buffer).getBigUint64(0, true);
}
+2
View File
@@ -1,4 +1,5 @@
export * from './buffer'; export * from './buffer';
export * from './bufferToBigInt';
export * from './dds'; export * from './dds';
export * from './dids'; export * from './dids';
export * from './pvr'; export * from './pvr';
@@ -7,3 +8,4 @@ export * from './sc2';
export * from './scg'; export * from './scg';
export * from './scpg'; export * from './scpg';
export * from './windows'; export * from './windows';
-1
View File
@@ -6,7 +6,6 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<NodeApiAssemblyJSModuleType>esm</NodeApiAssemblyJSModuleType> <NodeApiAssemblyJSModuleType>esm</NodeApiAssemblyJSModuleType>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="../cue4parse/CUE4Parse/CUE4Parse.csproj" /> <ProjectReference Include="../cue4parse/CUE4Parse/CUE4Parse.csproj" />
+1 -1
View File
@@ -1 +1 @@
export * from "../bin/Debug/net9.0/win-x64/game"; export * from "../bin/Debug/net9.0/game";
@@ -12,12 +12,14 @@ export async function tankModels() {
using uploader = new AssetUploader("tank models"); using uploader = new AssetUploader("tank models");
const nodeIO = new NodeIO().registerExtensions(ALL_EXTENSIONS); const nodeIO = new NodeIO().registerExtensions(ALL_EXTENSIONS);
const nations = vfs.dir(`Data/XML/item_defs/vehicles`).filter((nation) => nation !== "common") const nations = vfs
.dir(`Data/XML/item_defs/vehicles`)
.filter((nation) => nation !== "common");
for (const nationIndex in nations) { for (const nationIndex in nations) {
const nation = nations[nationIndex]; const nation = nations[nationIndex];
const tanks = await vfs.xml<{ root: VehicleDefinitionList }>( const tanks = await vfs.xml<{ root: VehicleDefinitionList }>(
`Data/XML/item_defs/vehicles/${nation}/list.xml` `Data/XML/item_defs/vehicles/${nation}/list.xml`,
); );
const entries = Object.entries(tanks.root); const entries = Object.entries(tanks.root);
@@ -26,11 +28,11 @@ export async function tankModels() {
const id = toUniqueId(nation, tank.id); const id = toUniqueId(nation, tank.id);
const parameters = await vfs.yaml<TankParameters>( const parameters = await vfs.yaml<TankParameters>(
`Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml` `Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`,
); );
const model = await extractModel( const model = await extractModel(
vfs, vfs,
parameters.resourcesPath.blitzModelPath.replace(/\.sc2$/, "") parameters.resourcesPath.blitzModelPath.replace(/\.sc2$/, ""),
); );
const content = Buffer.from(await nodeIO.writeBinary(model)); const content = Buffer.from(await nodeIO.writeBinary(model));
@@ -6,13 +6,13 @@ import {
} from "@blitzkit/core"; } from "@blitzkit/core";
import { Accessor, Document, Node, Scene } from "@gltf-transform/core"; import { Accessor, Document, Node, Scene } from "@gltf-transform/core";
import { times } from "lodash-es"; import { times } from "lodash-es";
import { SteamVFS } from "../vfs/steam"; import { AbstractVFS } from "../vfs/abstract";
import { import {
vertexAttributeGLTFName, vertexAttributeGLTFName,
vertexAttributeGltfVectorSizes, vertexAttributeGltfVectorSizes,
} from "./extractModel/constants"; } from "./extractModel/constants";
export async function extractArmor(vfs: SteamVFS, fileName: string) { export async function extractArmor(vfs: AbstractVFS, fileName: string) {
const sc2Path = `Data/3d/Tanks/CollisionMeshes/${fileName}.sc2`; const sc2Path = `Data/3d/Tanks/CollisionMeshes/${fileName}.sc2`;
const scgPath = `Data/3d/Tanks/CollisionMeshes/${fileName}.scg`; const scgPath = `Data/3d/Tanks/CollisionMeshes/${fileName}.scg`;
const sc2 = new Sc2ReadStream( const sc2 = new Sc2ReadStream(
@@ -1,4 +1,5 @@
import { import {
bufferToBigInt,
Hierarchy, Hierarchy,
Sc2ReadStream, Sc2ReadStream,
ScgReadStream, ScgReadStream,
@@ -9,7 +10,7 @@ import { Document, Material, Node, Scene } from "@gltf-transform/core";
import { dedup, prune } from "@gltf-transform/functions"; import { dedup, prune } from "@gltf-transform/functions";
import { times } from "lodash-es"; import { times } from "lodash-es";
import { dirname } from "path"; import { dirname } from "path";
import { SteamVFS } from "../../vfs/steam"; import { AbstractVFS } from "../../vfs/abstract";
import { readBaseColor } from "../readBaseColor"; import { readBaseColor } from "../readBaseColor";
import { readNormal } from "../readNormal"; import { readNormal } from "../readNormal";
import { readRoughnessMetallic } from "../readRoughnessMetallic"; import { readRoughnessMetallic } from "../readRoughnessMetallic";
@@ -25,7 +26,7 @@ const omitMeshNames = {
end: ["_POINT"], end: ["_POINT"],
}; };
export async function extractModel(vfs: SteamVFS, path: string) { export async function extractModel(vfs: AbstractVFS, path: string) {
const sc2Path = `Data/3d/${path}.sc2`; const sc2Path = `Data/3d/${path}.sc2`;
const scgPath = `Data/3d/${path}.scg`; const scgPath = `Data/3d/${path}.scg`;
const sc2 = new Sc2ReadStream( const sc2 = new Sc2ReadStream(
@@ -40,7 +41,7 @@ export async function extractModel(vfs: SteamVFS, path: string) {
const materials = new Map<bigint, Material | bigint | undefined>(); const materials = new Map<bigint, Material | bigint | undefined>();
for (const node of sc2["#dataNodes"]) { for (const node of sc2["#dataNodes"]) {
const id = new DataView(node["#id"]).getBigUint64(0, true); const id = bufferToBigInt(node["#id"]);
if (node.parentMaterialKey !== undefined) { if (node.parentMaterialKey !== undefined) {
/** /**
@@ -80,8 +81,20 @@ export async function extractModel(vfs: SteamVFS, path: string) {
configIndex < node.configCount; configIndex < node.configCount;
configIndex++ configIndex++
) { ) {
if (!hasAlpha) continue; const archive = node[`configArchive_${configIndex}`];
material.setAlphaMode("BLEND").setDoubleSided(true);
if (
archive.configName !== "Default" ||
!archive.enabledPresets?.AlphaTest
) {
continue;
}
const view = new DataView(archive.properties.alphatestThreshold);
const _ = view.getUint8(0); // only god knows what these flags are
const alphaCutoff = view.getFloat32(1, true);
material.setAlphaMode("MASK").setAlphaCutoff(alphaCutoff);
} }
} }
@@ -116,7 +129,7 @@ export async function extractModel(vfs: SteamVFS, path: string) {
); );
} }
materials.set(new DataView(node["#id"]).getBigUint64(0, true), material); materials.set(id, material);
} }
} }
@@ -3,8 +3,6 @@ import { Text } from "../Text";
import styles from "./index.module.css"; import styles from "./index.module.css";
export function TankCard({ id }: PopularTank) { export function TankCard({ id }: PopularTank) {
const tanks = useAwait(api.tanks, "tanks");
return ( return (
<div className={styles["tank-card"]}> <div className={styles["tank-card"]}>
<div className={styles["icon-wrapper"]}> <div className={styles["icon-wrapper"]}>
+1 -1
View File
@@ -1,5 +1,5 @@
import { GameInterface } from "@blitzkit/game"; import { GameInterface } from "@blitzkit/game";
export const game = new GameInterface( export const game = new GameInterface(
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest", "/mnt/c/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest",
); );