mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 09:28:07 +08:00
* Implement original PAL3 effects and editor with formatting checks * Add native PAL3A effect playback and SPar diagnostics Enable shared playback for supported PAL3A groups with POL models, model opacity, and explosive geometry. Parse SPar resources for complete dependency diagnostics while retaining whole-group private fallback for pending simulation. Preserve the last effect position when actors are missing or removed in both games, and keep actor-specific shape changes and private fallback guarded. Expand the editor and viewer to both variants and fix opaque alpha for RGB TGA textures. Validation: PAL3/PAL3A effect suites 54/54 each; general regressions 278/278 and 295/295. Both-variant formatting and diff checks passed. * Implement native SPar playback and PAL3A transport effects Add SPar emitter simulation, native blending and billboard rendering for the remaining 26 script/scene groups. Restore PAL3A transport geometry and seven styles in game, the editor and ResourceViewer. Preserve native live-state initial-frame behavior and mark the runtime UV table non-serialized. Update the README and add format, playback, geometry and resource-lifetime regression coverage. Validation: targeted tests 106/106 for both variants; general regressions PAL3 293/293 and PAL3A 310/310. Both-variant formatting checks passed. * Remove prefab effect fallback and simplify effect editing
89 lines
2.8 KiB
C#
89 lines
2.8 KiB
C#
// ------------------------------------------------------------------------
|
|
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
|
// See LICENSE file in the project root for license information.
|
|
// ------------------------------------------------------------------------
|
|
|
|
namespace Pal3.Core.DataReader.Par
|
|
{
|
|
using System;
|
|
using Primitives;
|
|
|
|
public sealed class ParticleCurve
|
|
{
|
|
public int Channels;
|
|
public string Name;
|
|
public GameBoxVector3[][] Samples;
|
|
|
|
public Func<float, int, float> OverrideEvaluation
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
public float Evaluate(float time, int channel = 0)
|
|
{
|
|
if (OverrideEvaluation != null)
|
|
return OverrideEvaluation(time, channel);
|
|
if (channel < 0 || channel >= Channels)
|
|
return 0;
|
|
int lo = 0, hi = 100;
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
int mid = (hi + lo) / 2;
|
|
if (Samples[0][mid].X <= time)
|
|
lo = mid;
|
|
else
|
|
hi = mid;
|
|
}
|
|
for (int i = lo; i < hi; i++)
|
|
{
|
|
if (Samples[0][i].X > time || Samples[0][i + 1].X < time)
|
|
continue;
|
|
GameBoxVector3 a = Samples[channel][i], b = Samples[channel][i + 1];
|
|
return b.X == a.X ? a.Y : a.Y + (b.Y - a.Y) * ((time - a.X) / (b.X - a.X));
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public sealed class ParticleDescription
|
|
{
|
|
public string Name, Texture;
|
|
public float Gravity, NoResistanceSpeed, Resistance;
|
|
public int VelocityResistancePower, SizeResistancePower, TextureSize, AnimationType, Fps;
|
|
public bool RandomFirstFrame, RandomRotationDirection, MirrorX, MirrorY;
|
|
public int RotationStart, RotationEnd, Rows, Columns, BlendMode;
|
|
public ParticleCurve Size, Rotation, Alpha, Color;
|
|
}
|
|
|
|
public sealed class ParticleEmitter
|
|
{
|
|
public string Name, ShapePath;
|
|
public GameBoxVector3 Position, Scope, BoxMin, BoxMax;
|
|
public int Shape;
|
|
public float SpeedMultiplier, CycleMin, CycleMax, Hotspot, Falloff;
|
|
public bool Loop;
|
|
public ParticleCurve Direction, RandomVelocity, Emission, Life, Size, Rotation;
|
|
}
|
|
|
|
public sealed class ParticleController
|
|
{
|
|
public string Name;
|
|
public int ParticleIndex, EmitterIndex, Capacity;
|
|
}
|
|
|
|
public sealed class ParticleFile
|
|
{
|
|
public uint Version;
|
|
public int Capacity, Space, Overflow;
|
|
public float Scale;
|
|
public ParticleDescription[] Particles;
|
|
public ParticleEmitter[] Emitters;
|
|
public ParticleController[] Controllers;
|
|
}
|
|
|
|
public sealed class ParticleShapeFile
|
|
{
|
|
public GameBoxVector3[] Points;
|
|
}
|
|
}
|