-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement data deserialization of UPolys and FPoly for UE1, UE2, and …
…UE3.
- Loading branch information
Showing
8 changed files
with
392 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
using UELib.Engine; | ||
using UELib.ObjectModel.Annotations; | ||
|
||
namespace UELib.Core | ||
{ | ||
/// <summary> | ||
/// Implements UModel/Engine.Model | ||
/// Implements UModel/Engine.Model | ||
/// </summary> | ||
[Output("Brush")] | ||
[UnrealRegisterClass] | ||
public class UModel : UObject | ||
{ | ||
[Output] | ||
public UPolys Polys; | ||
|
||
public UModel() | ||
{ | ||
ShouldDeserializeOnDemand = true; | ||
} | ||
|
||
protected override void Deserialize() | ||
{ | ||
base.Deserialize(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using UELib.Annotations; | ||
using UELib.Branch; | ||
using UELib.Core; | ||
using UELib.Flags; | ||
using UELib.ObjectModel.Annotations; | ||
|
||
namespace UELib.Engine | ||
{ | ||
/// <summary> | ||
/// Implements UPolys/Engine.Polys | ||
/// </summary> | ||
[Output("PolyList")] | ||
[UnrealRegisterClass] | ||
public class UPolys : UObject | ||
{ | ||
[CanBeNull] public UObject ElementOwner; | ||
|
||
[Output] | ||
public UArray<Poly> Element; | ||
|
||
public UPolys() | ||
{ | ||
ShouldDeserializeOnDemand = true; | ||
} | ||
|
||
protected override void Deserialize() | ||
{ | ||
base.Deserialize(); | ||
|
||
// Faster serialization for cooked packages, no don't have to check for the package's version here. | ||
if (Package.Summary.PackageFlags.HasFlag(PackageFlags.Cooked)) | ||
{ | ||
ElementOwner = _Buffer.ReadObject(); | ||
Record(nameof(ElementOwner), ElementOwner); | ||
|
||
_Buffer.ReadArray(out Element); | ||
Record(nameof(Element), Element); | ||
return; | ||
} | ||
|
||
int num, max; | ||
|
||
num = _Buffer.ReadInt32(); | ||
Record(nameof(num), num); | ||
max = _Buffer.ReadInt32(); | ||
Record(nameof(max), max); | ||
|
||
if (_Buffer.Version >= (uint)PackageObjectLegacyVersion.ElementOwnerAddedToUPolys) | ||
{ | ||
ElementOwner = _Buffer.ReadObject(); | ||
Record(nameof(ElementOwner), ElementOwner); | ||
} | ||
|
||
Element = new UArray<Poly>(num); | ||
if (num > 0) | ||
{ | ||
_Buffer.ReadArray(out Element, num); | ||
Record(nameof(Element), Element); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using UELib.Core; | ||
|
||
namespace UELib.Engine | ||
{ | ||
/// <summary> | ||
/// Implements UProcBuildingRuleset/Engine.ProcBuildingRuleset | ||
/// </summary> | ||
[UnrealRegisterClass] | ||
[BuildGeneration(BuildGeneration.UE3)] | ||
public class UProcBuildingRuleset : UObject | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
namespace UELib.Engine | ||
{ | ||
/// <summary> | ||
/// See LightingChannelContainer in Engine/Classes/LightComponent.uc | ||
/// </summary> | ||
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 4)] | ||
public struct LightingChannelContainer : IUnrealAtomicStruct | ||
{ | ||
[MarshalAs(UnmanagedType.I1)] public bool Initialized; | ||
[MarshalAs(UnmanagedType.I1)] public bool BSP; | ||
[MarshalAs(UnmanagedType.I1)] public bool Static; | ||
[MarshalAs(UnmanagedType.I1)] public bool Dynamic; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using System.ComponentModel; | ||
using System.Runtime.InteropServices; | ||
using UELib.Branch; | ||
|
||
namespace UELib.Engine | ||
{ | ||
/// <summary> | ||
/// Implements FLightmassPrimitiveSettings | ||
/// </summary> | ||
[StructLayout(LayoutKind.Sequential)] | ||
public struct LightmassPrimitiveSettings : IUnrealSerializableClass | ||
{ | ||
[MarshalAs(UnmanagedType.I1)] public bool UseTwoSidedLighting; | ||
[MarshalAs(UnmanagedType.I1)] public bool ShadowIndirectOnly; | ||
[MarshalAs(UnmanagedType.I1)] public bool UseEmissiveForStaticLighting; | ||
|
||
public float EmissiveLightFalloffExponent; | ||
public float EmissiveLightExplicitInfluenceRadius; | ||
public float EmissiveBoost; | ||
public float DiffuseBoost; | ||
public float SpecularBoost; | ||
|
||
[DefaultValue(1.0f)] public float FullyOccludedSamplesFraction; | ||
|
||
public void Deserialize(IUnrealStream stream) | ||
{ | ||
if (stream.Version >= (uint)PackageObjectLegacyVersion.LightmassShadowIndirectOnlyOptionAdded) | ||
{ | ||
stream.Read(out UseTwoSidedLighting); | ||
stream.Read(out ShadowIndirectOnly); | ||
stream.Read(out FullyOccludedSamplesFraction); | ||
} | ||
|
||
if (stream.Version >= (uint)PackageObjectLegacyVersion.LightmassAdded) | ||
{ | ||
stream.Read(out UseEmissiveForStaticLighting); | ||
stream.Read(out EmissiveLightFalloffExponent); | ||
} | ||
|
||
if (stream.Version >= (uint)PackageObjectLegacyVersion.LightmassExplicitEmissiveLightRadiusAdded) | ||
{ | ||
stream.Read(out EmissiveLightExplicitInfluenceRadius); | ||
} | ||
|
||
stream.Read(out EmissiveBoost); | ||
stream.Read(out DiffuseBoost); | ||
stream.Read(out SpecularBoost); | ||
} | ||
|
||
public void Serialize(IUnrealStream stream) | ||
{ | ||
if (stream.Version >= (uint)PackageObjectLegacyVersion.LightmassShadowIndirectOnlyOptionAdded) | ||
{ | ||
stream.Write(UseTwoSidedLighting); | ||
stream.Write(ShadowIndirectOnly); | ||
stream.Write(FullyOccludedSamplesFraction); | ||
} | ||
|
||
if (stream.Version >= (uint)PackageObjectLegacyVersion.LightmassAdded) | ||
{ | ||
stream.Write(UseEmissiveForStaticLighting); | ||
stream.Write(EmissiveLightFalloffExponent); | ||
} | ||
|
||
if (stream.Version >= (uint)PackageObjectLegacyVersion.LightmassExplicitEmissiveLightRadiusAdded) | ||
{ | ||
stream.Write(EmissiveLightExplicitInfluenceRadius); | ||
} | ||
|
||
stream.Write(EmissiveBoost); | ||
stream.Write(DiffuseBoost); | ||
stream.Write(SpecularBoost); | ||
} | ||
} | ||
} |
Oops, something went wrong.