diff --git a/libsecondlife-cs/ObjectManager.cs b/libsecondlife-cs/ObjectManager.cs
index 06ded026..c1b07e15 100644
--- a/libsecondlife-cs/ObjectManager.cs
+++ b/libsecondlife-cs/ObjectManager.cs
@@ -286,7 +286,7 @@ namespace libsecondlife
//block.JointPivot ?
//block.JointAxisOrAnchor ?
//block.PCode ?
- //block.PSBlock Particle system related
+ prim.ParticleSys = new ParticleSystem(block.PSBlock, 0);
prim.SetExtraParamsFromBytes(block.ExtraParams, 0);
prim.Scale = block.Scale;
//block.Flags ?
@@ -539,9 +539,9 @@ namespace libsecondlife
i += 12;
}
- //Unknown field, particle system?
if ((flags & 0x08) != 0)
{
+ prim.ParticleSys = new ParticleSystem(block.Data, i);
i += 86;
}
diff --git a/libsecondlife-cs/ParticleSystem.cs b/libsecondlife-cs/ParticleSystem.cs
new file mode 100644
index 00000000..48f7745a
--- /dev/null
+++ b/libsecondlife-cs/ParticleSystem.cs
@@ -0,0 +1,135 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace libsecondlife
+{
+ public class ParticleSystem
+ {
+ public uint PartStartRGBA;
+ public uint PartEndRGBA;
+
+ public LLVector3 PartStartScale;
+ public LLVector3 PartEndScale;
+
+ public float PartMaxAge;
+ public float SrcMaxAge;
+
+ public LLVector3 SrcAccel;
+
+ public float SrcAngleBegin;
+ public float SrcAngleEnd;
+
+ public int SrcBurstPartCount;
+ public float SrcBurstRadius;
+ public float SrcBurstRate;
+ public float SrcBurstSpeedMin;
+ public float SrcBurstSpeedMax;
+
+ public LLVector3 SrcOmega;
+
+ public LLUUID SrcTargetKey;
+ public LLUUID SrcTexture;
+
+ public SourcePattern SrcPattern;
+ public ParticleFlags PartFlags;
+
+ public uint Version; //???
+ public uint StartTick; //???
+
+ public enum SourcePattern
+ {
+ None = 0,
+ Drop = 0x01,
+ Explode = 0x02,
+ Angle = 0x04,
+ AngleCone = 0x08,
+ AngleConeEmpty = 0x10
+ }
+
+ [Flags]
+ public enum ParticleFlags : ushort
+ {
+ None = 0,
+ InterpColor = 0x001,
+ InterpScale = 0x002,
+ Bounce = 0x004,
+ Wind = 0x008,
+ FollowSrc = 0x010,
+ FollowVelocity = 0x20,
+ TargetPos = 0x40,
+ TargetLinear = 0x080,
+ Emissive = 0x100
+ }
+
+ public ParticleSystem(byte[] data, int pos)
+ {
+ FromBytes(data, pos);
+ }
+
+ private void FromBytes(byte[] data, int pos)
+ {
+ int i = pos;
+
+ PartMaxAge = 10.0f; //Not yet parsed.
+ SrcPattern = SourcePattern.Explode; //Not yet parsed.
+
+ if (data.Length == 0)
+ return;
+
+ Version = (uint)(data[i++] + (data[i++] << 8) +
+ (data[i++] << 16) + (data[i++] << 24));
+
+ StartTick = (uint)(data[i++] + (data[i++] << 8) +
+ (data[i++] << 16) + (data[i++] << 24));
+
+ //Unknown
+ i++;
+
+ SrcMaxAge = (data[i++] + (data[i++] << 8)) / 256.0f;
+
+ //Unknown
+ i += 2;
+
+ SrcAngleBegin = (data[i++] / 100.0f) * (float)Math.PI;
+ SrcAngleEnd = (data[i++] / 100.0f) * (float)Math.PI;
+
+ SrcBurstRate = (data[i++] + (data[i++] << 8));
+ SrcBurstRadius = (data[i++] + (data[i++] << 8));
+ SrcBurstSpeedMin = (data[i++] + (data[i++] << 8));
+ SrcBurstSpeedMax = (data[i++] + (data[i++] << 8));
+ SrcBurstPartCount = data[i++];
+
+ SrcOmega = new LLVector3();
+ SrcOmega.X = (data[i++] + (data[i++] << 8));
+ SrcOmega.Y = (data[i++] + (data[i++] << 8));
+ SrcOmega.Z = (data[i++] + (data[i++] << 8));
+
+ SrcAccel = new LLVector3();
+ SrcAccel.X = (data[i++] + (data[i++] << 8));
+ SrcAccel.Y = (data[i++] + (data[i++] << 8));
+ SrcAccel.Z = (data[i++] + (data[i++] << 8));
+
+ SrcTexture = new LLUUID(data, i);
+ i += 16;
+ SrcTargetKey = new LLUUID(data, i);
+ i += 16;
+
+ PartFlags = (ParticleFlags)(data[i++] + (data[i++] << 8));
+
+ PartStartRGBA = (uint)(data[i++] + (data[i++] << 8) +
+ (data[i++] << 16) + (data[i++] << 24));
+
+ PartEndRGBA = (uint)(data[i++] + (data[i++] << 8) +
+ (data[i++] << 16) + (data[i++] << 24));
+
+ PartStartScale = new LLVector3();
+ PartStartScale.X = data[i++] / 32.0f;
+ PartStartScale.Y = data[i++] / 32.0f;
+
+ PartEndScale = new LLVector3();
+ PartEndScale.X = data[i++] / 32.0f;
+ PartEndScale.Y = data[i++] / 32.0f;
+ }
+ }
+}
diff --git a/libsecondlife-cs/Prims.cs b/libsecondlife-cs/Prims.cs
index e5532806..6e0e87e7 100644
--- a/libsecondlife-cs/Prims.cs
+++ b/libsecondlife-cs/Prims.cs
@@ -101,6 +101,8 @@ namespace libsecondlife
public PrimFlexibleData Flexible;
///
public PrimLightData Light;
+ ///
+ public ParticleSystem ParticleSys;
private SecondLife Client;
@@ -558,17 +560,4 @@ namespace libsecondlife
Falloff = BitConverter.ToSingle(data, i + 8);
}
}
-}
-/*
- PSYS_PART_FLAGS , 0 //Comment out any of the following masks to deactivate them
- | PSYS_PART_BOUNCE_MASK //0x04 Bounce on object's z-axis
- //| PSYS_PART_WIND_MASK //0x08 Particles are moved by wind
- //| PSYS_PART_INTERP_COLOR_MASK //0x01 Colors fade from start to end
- //| PSYS_PART_INTERP_SCALE_MASK //0x02 Scale fades from beginning to end
- //| PSYS_PART_FOLLOW_SRC_MASK //0x10 Particles follow the emitter
- //| PSYS_PART_FOLLOW_VELOCITY_MASK //0x20 Particles are created at the velocity of the emitter
- //| PSYS_PART_TARGET_POS_MASK //0x40 Particles follow the target
- //| PSYS_PART_EMISSIVE_MASK //0x100 articles are self-lit (glow)
- //| PSYS_PART_TARGET_LINEAR_MASK //0x80 Undocumented--Sends particles in straight line?
- ,
-*/
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/libsecondlife-cs/libsecondlife.csproj b/libsecondlife-cs/libsecondlife.csproj
index a6df4b23..75318444 100644
--- a/libsecondlife-cs/libsecondlife.csproj
+++ b/libsecondlife-cs/libsecondlife.csproj
@@ -138,6 +138,9 @@
Code
+
+ Code
+
Code