mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
fix(dashboard): 3D views never draw a kept manifest with the game shaders
The game shader views looked up each shader's technique in the manifest's "techniques". Property scenery manifests are cached by browsers for a day (world ones for an hour), so after the update a browser drew the property view from the manifest the older server had sent, which has no techniques: every shader fell back to LEGO, whose decal texture alpha laid the see-through tree, rock and water textures over white vertex colors. Nimbus Isle came out with white trees, rocks and water, a yellow build surface and a solid white build border. - Manifest URLs carry the conversion format the views are written for (?format=5, scenery-core.js SCENERY_FORMAT), so a kept manifest from an older server is never used; SceneryCoreJs checks it matches Scenery.cpp FORMAT_VERSION. - A manifest without techniques (an older server's) is drawn with the viewer's own lights and its textureAlpha table instead of every shader guessed as LEGO. - A material whose NiAlphaController animates its alpha is drawn at its highest key. The AnimAlpha shaders now use the material alpha, and effects resting at 0 in the file (the Venture Explorer's lightning) had vanished. Conversion format 5. Checked by rendering the world view of every zone with models and the property view of every property template (headless, fixed cameras) before and after, and the Nimbus Isle property with a manifest stripped of its techniques, which reproduced the white look. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -213,6 +213,36 @@ TEST(NifFileTests, PassesPropertiesDownTheTree) {
|
||||
EXPECT_TRUE(m.doubleSided);
|
||||
}
|
||||
|
||||
// A material whose NiAlphaController animates its alpha (flickering effects that rest at 0 in the file) is drawn at
|
||||
// its highest key; one without keeps its own alpha
|
||||
TEST(NifFileTests, DrawsAnAnimatedAlphaAtItsHighest) {
|
||||
for (const bool animated : { true, false }) {
|
||||
NifBuilder nif;
|
||||
const auto root = nif.Add("NiNode", {});
|
||||
const auto material = nif.Add("NiMaterialProperty", {});
|
||||
const auto controller = nif.Add("NiAlphaController", {});
|
||||
const auto interpolator = nif.Add("NiFloatInterpolator", {});
|
||||
const auto keys = nif.Add("NiFloatData", Bytes().Put<uint32_t>(3).Put<uint32_t>(1).Floats({ 0.0f, 0.0f, 0.5f, 0.8f, 1.0f, 0.0f }));
|
||||
// NiObjectNET with the controller, ambient, diffuse, specular, emissive, glossiness, alpha 0
|
||||
Bytes body;
|
||||
body.Put<uint32_t>(0xFFFFFFFF).Put<uint32_t>(0).Put<int32_t>(animated ? controller : -1);
|
||||
body.Floats({ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 10.0f, 0.0f });
|
||||
nif.Set(material, body);
|
||||
// NiTimeController: next, flags, frequency, phase, start, stop, target; the interpolator
|
||||
nif.Set(controller, Bytes().Put<int32_t>(-1).Put<uint16_t>(8).Floats({ 1, 0, 0, 1 }).Put<int32_t>(material).Put<int32_t>(interpolator));
|
||||
nif.Set(interpolator, Bytes().Put(0.0f).Put<int32_t>(keys));
|
||||
const auto shape = nif.Add("NiTriShape", {});
|
||||
const auto data = nif.Add("NiTriShapeData", TriShapeData());
|
||||
nif.Set(root, Node(Av(0, { 0, 0, 0 }, IDENTITY, 1.0f, { material }), { shape }));
|
||||
nif.Set(shape, Geometry(Av(0, { 0, 0, 0 }, IDENTITY, 1.0f, {}), data));
|
||||
std::string error;
|
||||
const auto model = NifFile::Parse(nif.Build({ root }), 0, error);
|
||||
ASSERT_TRUE(model) << error;
|
||||
ASSERT_EQ(model->meshes.size(), 1u);
|
||||
EXPECT_FLOAT_EQ(model->meshes[0].material.alpha, animated ? 0.8f : 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
// Two layer shaders use NiTexturingProperty's dark texture too, each texture on the UV set its flags name
|
||||
TEST(NifFileTests, ReadsTheDarkTextureAndEachTexturesUvSet) {
|
||||
NifBuilder nif;
|
||||
|
||||
Reference in New Issue
Block a user