Add object transparency property support
This commit is contained in:
parent
a6e667e1da
commit
001b6a944e
|
@ -111,3 +111,14 @@ public class PropString : Property
|
||||||
// value = tmpName[..Math.Min(length - 1, tmpName.Length)];
|
// value = tmpName[..Math.Min(length - 1, tmpName.Length)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PropFloat : Property
|
||||||
|
{
|
||||||
|
public float value;
|
||||||
|
|
||||||
|
public override void Read(BinaryReader reader)
|
||||||
|
{
|
||||||
|
base.Read(reader);
|
||||||
|
value = reader.ReadSingle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class DbFile
|
||||||
"P$OTxtRepr1" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr1" => new PropertyChunk<PropString>(),
|
||||||
"P$OTxtRepr2" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr2" => new PropertyChunk<PropString>(),
|
||||||
"P$OTxtRepr3" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr3" => new PropertyChunk<PropString>(),
|
||||||
|
"P$RenderAlp" => new PropertyChunk<PropFloat>(),
|
||||||
"LD$MetaProp" => new LinkDataMetaProp(),
|
"LD$MetaProp" => new LinkDataMetaProp(),
|
||||||
_ when entryName.StartsWith("L$") => new LinkChunk(),
|
_ when entryName.StartsWith("L$") => new LinkChunk(),
|
||||||
_ when entryName.StartsWith("P$") => new PropertyChunk<PropGeneric>(),
|
_ when entryName.StartsWith("P$") => new PropertyChunk<PropGeneric>(),
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class ObjectHierarchy
|
||||||
db.Chunks.TryGetValue("P$OTxtRepr1", out var txtRepl1Raw) &&
|
db.Chunks.TryGetValue("P$OTxtRepr1", out var txtRepl1Raw) &&
|
||||||
db.Chunks.TryGetValue("P$OTxtRepr2", out var txtRepl2Raw) &&
|
db.Chunks.TryGetValue("P$OTxtRepr2", out var txtRepl2Raw) &&
|
||||||
db.Chunks.TryGetValue("P$OTxtRepr3", out var txtRepl3Raw) &&
|
db.Chunks.TryGetValue("P$OTxtRepr3", out var txtRepl3Raw) &&
|
||||||
|
db.Chunks.TryGetValue("P$RenderAlp", out var renderAlphaRaw) &&
|
||||||
db.Chunks.TryGetValue("L$MetaProp", out var metaPropLinksRaw) &&
|
db.Chunks.TryGetValue("L$MetaProp", out var metaPropLinksRaw) &&
|
||||||
db.Chunks.TryGetValue("LD$MetaProp", out var metaPropLinkDataRaw))
|
db.Chunks.TryGetValue("LD$MetaProp", out var metaPropLinkDataRaw))
|
||||||
{
|
{
|
||||||
|
@ -52,6 +53,7 @@ public class ObjectHierarchy
|
||||||
var txtRepl1s = (PropertyChunk<PropString>)txtRepl1Raw;
|
var txtRepl1s = (PropertyChunk<PropString>)txtRepl1Raw;
|
||||||
var txtRepl2s = (PropertyChunk<PropString>)txtRepl2Raw;
|
var txtRepl2s = (PropertyChunk<PropString>)txtRepl2Raw;
|
||||||
var txtRepl3s = (PropertyChunk<PropString>)txtRepl3Raw;
|
var txtRepl3s = (PropertyChunk<PropString>)txtRepl3Raw;
|
||||||
|
var renderAlpha = (PropertyChunk<PropFloat>)renderAlphaRaw;
|
||||||
var metaPropLinks = (LinkChunk)metaPropLinksRaw;
|
var metaPropLinks = (LinkChunk)metaPropLinksRaw;
|
||||||
var metaPropLinkData = (LinkDataMetaProp)metaPropLinkDataRaw;
|
var metaPropLinkData = (LinkDataMetaProp)metaPropLinkDataRaw;
|
||||||
|
|
||||||
|
@ -64,6 +66,7 @@ public class ObjectHierarchy
|
||||||
gam.Chunks.TryGetValue("P$OTxtRepr1", out var gamTxtRepl1s) &&
|
gam.Chunks.TryGetValue("P$OTxtRepr1", out var gamTxtRepl1s) &&
|
||||||
gam.Chunks.TryGetValue("P$OTxtRepr2", out var gamTxtRepl2s) &&
|
gam.Chunks.TryGetValue("P$OTxtRepr2", out var gamTxtRepl2s) &&
|
||||||
gam.Chunks.TryGetValue("P$OTxtRepr3", out var gamTxtRepl3s) &&
|
gam.Chunks.TryGetValue("P$OTxtRepr3", out var gamTxtRepl3s) &&
|
||||||
|
gam.Chunks.TryGetValue("P$RenderAlp", out var gamRenderAlpha) &&
|
||||||
gam.Chunks.TryGetValue("L$MetaProp", out var gamLinks) &&
|
gam.Chunks.TryGetValue("L$MetaProp", out var gamLinks) &&
|
||||||
gam.Chunks.TryGetValue("LD$MetaProp", out var gamLinkData))
|
gam.Chunks.TryGetValue("LD$MetaProp", out var gamLinkData))
|
||||||
{
|
{
|
||||||
|
@ -74,6 +77,7 @@ public class ObjectHierarchy
|
||||||
txtRepl1s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl1s).properties);
|
txtRepl1s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl1s).properties);
|
||||||
txtRepl2s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl2s).properties);
|
txtRepl2s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl2s).properties);
|
||||||
txtRepl3s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl3s).properties);
|
txtRepl3s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl3s).properties);
|
||||||
|
renderAlpha.properties.AddRange(((PropertyChunk<PropFloat>)gamRenderAlpha).properties);
|
||||||
metaPropLinks.links.AddRange(((LinkChunk)gamLinks).links);
|
metaPropLinks.links.AddRange(((LinkChunk)gamLinks).links);
|
||||||
metaPropLinkData.linkData.AddRange(((LinkDataMetaProp)gamLinkData).linkData);
|
metaPropLinkData.linkData.AddRange(((LinkDataMetaProp)gamLinkData).linkData);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +144,10 @@ public class ObjectHierarchy
|
||||||
{
|
{
|
||||||
TryAddProp("P$OTxtRepr3", prop);
|
TryAddProp("P$OTxtRepr3", prop);
|
||||||
}
|
}
|
||||||
|
foreach (var prop in renderAlpha.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$RenderAlp", prop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,7 @@ public partial class Mission : Node3D
|
||||||
var txtRepl1 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr1");
|
var txtRepl1 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr1");
|
||||||
var txtRepl2 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr2");
|
var txtRepl2 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr2");
|
||||||
var txtRepl3 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr3");
|
var txtRepl3 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr3");
|
||||||
|
var renderAlpha = objHierarchy.GetProperty<PropFloat>(id, "P$RenderAlp");
|
||||||
var renderMode = renderTypeProp == null ? PropRenderType.Mode.Normal : renderTypeProp.mode;
|
var renderMode = renderTypeProp == null ? PropRenderType.Mode.Normal : renderTypeProp.mode;
|
||||||
|
|
||||||
if (modelNameProp == null || renderMode == PropRenderType.Mode.NotRendered)
|
if (modelNameProp == null || renderMode == PropRenderType.Mode.NotRendered)
|
||||||
|
@ -326,6 +327,11 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (renderAlpha != null)
|
||||||
|
{
|
||||||
|
model.Transparency = 1.0f - renderAlpha.value;
|
||||||
|
}
|
||||||
|
|
||||||
model.AddToGroup(OBJECT_MODELS_GROUP);
|
model.AddToGroup(OBJECT_MODELS_GROUP);
|
||||||
|
|
||||||
AddChild(model);
|
AddChild(model);
|
||||||
|
|
Loading…
Reference in New Issue