* Updated _Packets_.cs against the latest message_template.msg (we should automate this)

* Some new bitpacking functions
* Removed ReservedNewbie references
* Updated Path*() functions to use ushort instead of byte
* Fixes and cleanup to the particle system code

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1143 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2007-04-25 19:58:58 +00:00
parent a5284a256d
commit f9465f8488
8 changed files with 885 additions and 1276 deletions

View File

@@ -33,25 +33,10 @@ namespace libsecondlife
}
/// <summary>
/// Flags for the particle system behavior
///
/// </summary>
[Flags]
public enum ParticleSystemFlags : uint
{
/// <summary></summary>
None = 0,
/// <summary>Acceleration and velocity for particles are
/// relative to the object rotation</summary>
ObjectRelative = 0x01,
/// <summary>Particles use new 'correct' angle parameters</summary>
UseNewAngle = 0x02
}
/// <summary>
/// Flags for the particles in this particle system
/// </summary>
[Flags]
public enum ParticleFlags : uint
public enum ParticleDataFlags : uint
{
/// <summary></summary>
None = 0,
@@ -66,9 +51,9 @@ namespace libsecondlife
/// <summary></summary>
FollowSrc = 0x010,
/// <summary></summary>
FollowVelocity = 0x20,
FollowVelocity = 0x020,
/// <summary></summary>
TargetPos = 0x40,
TargetPos = 0x040,
/// <summary></summary>
TargetLinear = 0x080,
/// <summary></summary>
@@ -77,10 +62,30 @@ namespace libsecondlife
Beam = 0x200
}
/// <summary>
///
/// </summary>
[Flags]
public enum ParticleFlags : uint
{
/// <summary></summary>
None = 0,
/// <summary>Acceleration and velocity for particles are
/// relative to the object rotation</summary>
ObjectRelative = 0x01,
/// <summary>Particles use new 'correct' angle parameters</summary>
UseNewAngle = 0x02
}
public uint CRC;
public SourcePattern Pattern = SourcePattern.None;
public ParticleSystemFlags Flags = ParticleSystemFlags.None;
/// <summary></summary>
/// <remarks>There appears to be more data packed in to this area
/// for many particle systems. It doesn't appear to be flag values
/// and serialization breaks unless there is a flag for every
/// possible bit so it is left as an unsigned integer</remarks>
public uint PartFlags;
public SourcePattern Pattern;
public float MaxAge;
public float StartAge;
public float InnerAngle;
@@ -89,20 +94,21 @@ namespace libsecondlife
public float BurstRadius;
public float BurstSpeedMin;
public float BurstSpeedMax;
public float BurstPartCount;
public byte BurstPartCount;
public LLVector3 AngularVelocity;
public LLVector3 PartAcceleration;
public LLUUID Texture;
public LLUUID Target;
//
public ParticleDataFlags PartDataFlags;
public float PartMaxAge;
public LLColor PartStartColor;
public LLColor PartEndColor;
public float PartStartScaleX;
public float PartStartScaleY;
public float PartEndScaleX;
public float PartEndScaleY;
public float PartMaxAge;
public ParticleFlags PartFlags = ParticleFlags.None;
/// <summary>
///
@@ -127,8 +133,39 @@ namespace libsecondlife
/// <returns></returns>
public byte[] GetBytes()
{
byte[] bytes = new byte[0];
// FIXME: Finish ParticleSystem.GetBytes()
byte[] bytes = new byte[86];
BitPack pack = new BitPack(bytes, 0);
pack.PackBits(CRC, 32);
pack.PackBits((uint)PartFlags, 32);
pack.PackBits((uint)Pattern, 8);
pack.PackFixed(MaxAge, false, 8, 8);
pack.PackFixed(StartAge, false, 8, 8);
pack.PackFixed(InnerAngle, false, 3, 5);
pack.PackFixed(OuterAngle, false, 3, 5);
pack.PackFixed(BurstRate, false, 8, 8);
pack.PackFixed(BurstRadius, false, 8, 8);
pack.PackFixed(BurstSpeedMin, false, 8, 8);
pack.PackFixed(BurstSpeedMax, false, 8, 8);
pack.PackBits(BurstPartCount, 8);
pack.PackFixed(AngularVelocity.X, true, 8, 7);
pack.PackFixed(AngularVelocity.Y, true, 8, 7);
pack.PackFixed(AngularVelocity.Z, true, 8, 7);
pack.PackFixed(PartAcceleration.X, true, 8, 7);
pack.PackFixed(PartAcceleration.Y, true, 8, 7);
pack.PackFixed(PartAcceleration.Z, true, 8, 7);
pack.PackUUID(Texture);
pack.PackUUID(Target);
pack.PackBits((uint)PartDataFlags, 32);
pack.PackFixed(MaxAge, false, 8, 8);
pack.PackColor(PartStartColor);
pack.PackColor(PartEndColor);
pack.PackFixed(PartStartScaleX, false, 3, 5);
pack.PackFixed(PartStartScaleY, false, 3, 5);
pack.PackFixed(PartEndScaleX, false, 3, 5);
pack.PackFixed(PartEndScaleY, false, 3, 5);
return bytes;
}
@@ -145,7 +182,7 @@ namespace libsecondlife
BitPack pack = new BitPack(data, pos);
CRC = pack.UnpackUBits(32);
Flags = (ParticleSystemFlags)pack.UnpackUBits(32);
PartFlags = pack.UnpackUBits(32);
Pattern = (SourcePattern)pack.UnpackByte();
MaxAge = pack.UnpackFixed(false, 8, 8);
StartAge = pack.UnpackFixed(false, 8, 8);
@@ -155,7 +192,7 @@ namespace libsecondlife
BurstRadius = pack.UnpackFixed(false, 8, 8);
BurstSpeedMin = pack.UnpackFixed(false, 8, 8);
BurstSpeedMax = pack.UnpackFixed(false, 8, 8);
BurstPartCount = (uint)pack.UnpackByte();
BurstPartCount = pack.UnpackByte();
float x = pack.UnpackFixed(true, 8, 7);
float y = pack.UnpackFixed(true, 8, 7);
float z = pack.UnpackFixed(true, 8, 7);
@@ -166,7 +203,8 @@ namespace libsecondlife
PartAcceleration = new LLVector3(x, y, z);
Texture = pack.UnpackUUID();
Target = pack.UnpackUUID();
PartFlags = (ParticleFlags)pack.UnpackUBits(32);
PartDataFlags = (ParticleDataFlags)pack.UnpackUBits(32);
PartMaxAge = pack.UnpackFixed(false, 8, 8);
byte r = pack.UnpackByte();
byte g = pack.UnpackByte();