Add tank catalog with USDZ models and tank selection
Introduce TankDefinition/TankCatalog loaded from Tanks.json, bundle the Drachengas USDZ tank models, add tank selection and preview views, and update the AR experience, editor and project views to use the catalog. Includes tests for catalog loading and model selection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -27,16 +27,13 @@ void tankDepthFadeSurface(realitykit::surface_parameters params)
|
||||
auto constants = params.material_constants();
|
||||
|
||||
float2 uv = params.geometry().uv0();
|
||||
// Modelle aus USDZ nutzen eine gespiegelte Y-UV.
|
||||
uv.y = 1.0 - uv.y;
|
||||
|
||||
// Basisfarbe = Tint * Textur.
|
||||
// Originale USDZ-Farbe und Textur beibehalten.
|
||||
half3 tint = (half3)constants.base_color_tint();
|
||||
half3 color = (half3)tex.base_color().sample(textureSampler, uv).rgb;
|
||||
color *= tint;
|
||||
params.surface().set_base_color(color);
|
||||
params.surface().set_base_color(color * tint);
|
||||
|
||||
// Roughness / Metallic durchreichen (wie PhysicallyBasedMaterial).
|
||||
half roughness = tex.roughness().sample(textureSampler, uv).r * constants.roughness_scale();
|
||||
params.surface().set_roughness(roughness);
|
||||
|
||||
@ -50,6 +47,13 @@ void tankDepthFadeSurface(realitykit::surface_parameters params)
|
||||
float band = max(custom.y, 1e-3);
|
||||
float belowAlpha = custom.z;
|
||||
|
||||
// Bei maximaler Transparenz wird alles unterhalb der Bodenhöhe
|
||||
// vollständig ausgeblendet – nicht nur abgeschwächt.
|
||||
if (belowAlpha <= 0.001 && worldPosition.y < groundY) {
|
||||
params.surface().set_opacity(half(0.0));
|
||||
return;
|
||||
}
|
||||
|
||||
float t = clamp((groundY - worldPosition.y) / band, 0.0, 1.0);
|
||||
float alpha = mix(1.0, belowAlpha, t);
|
||||
params.surface().set_opacity(half(alpha));
|
||||
|
||||
Reference in New Issue
Block a user