diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 91c589a697..ff6b7f5c71 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -68,76 +68,33 @@ namespace OpenSim.Framework public class PrimitiveBaseShape { private static readonly LLObject.TextureEntry m_defaultTexture; + public byte[] ExtraParams; + private byte[] m_textureEntry; - public byte State; - public byte PCode; public ushort PathBegin; + public byte PathCurve; public ushort PathEnd; + public sbyte PathRadiusOffset; + public byte PathRevolutions; public byte PathScaleX; public byte PathScaleY; public byte PathShearX; public byte PathShearY; public sbyte PathSkew; - public ushort ProfileBegin; - public ushort ProfileEnd; - public LLVector3 Scale; - public byte PathCurve; - - [XmlIgnore] // -- this one is re-constructed from ProfileShape and ProfileHollow - public byte ProfileCurve; - - public ushort ProfileHollow; - public sbyte PathRadiusOffset; - public byte PathRevolutions; public sbyte PathTaperX; public sbyte PathTaperY; public sbyte PathTwist; public sbyte PathTwistBegin; + public byte PCode; + public ushort ProfileBegin; - [XmlIgnore] - public LLObject.TextureEntry Textures - { - get { return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } - - set { m_textureEntry = value.ToBytes(); } - } - - private byte[] m_textureEntry; - - public byte[] TextureEntry - { - get { return m_textureEntry; } - - set { m_textureEntry = value; } - } - - public byte[] ExtraParams; - - public ProfileShape ProfileShape - { - get { return (ProfileShape)(ProfileCurve & 0xf); } - set - { - byte oldValueMasked = (byte)(ProfileCurve & 0xf0); - ProfileCurve = (byte)(oldValueMasked | (byte)value); - } - } - - public HollowShape HollowShape - { - get { return (HollowShape)(ProfileCurve & 0xf0); } - set - { - byte oldValueMasked = (byte)(ProfileCurve & 0x0f); - ProfileCurve = (byte)(oldValueMasked | (byte)value); - } - } - - public LLVector3 PrimScale - { - get { return Scale; } - } + [XmlIgnore] // -- this one is re-constructed from ProfileShape and ProfileHollow + public byte ProfileCurve; + public ushort ProfileEnd; + public ushort ProfileHollow; + public LLVector3 Scale; + public byte State; static PrimitiveBaseShape() { @@ -147,40 +104,49 @@ namespace OpenSim.Framework public PrimitiveBaseShape() { - PCode = (byte)PCodeEnum.Primitive; + PCode = (byte) PCodeEnum.Primitive; ExtraParams = new byte[1]; Textures = m_defaultTexture; } - public static PrimitiveBaseShape Create() + [XmlIgnore] + public LLObject.TextureEntry Textures { - PrimitiveBaseShape shape = new PrimitiveBaseShape(); - return shape; + get { return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } + + set { m_textureEntry = value.ToBytes(); } } - public static PrimitiveBaseShape CreateBox() + public byte[] TextureEntry { - PrimitiveBaseShape shape = Create(); + get { return m_textureEntry; } - shape.PathCurve = (byte)Extrusion.Straight; - shape.ProfileShape = ProfileShape.Square; - shape.PathScaleX = 100; - shape.PathScaleY = 100; - - return shape; + set { m_textureEntry = value; } } - public static PrimitiveBaseShape CreateCylinder() + public ProfileShape ProfileShape { - PrimitiveBaseShape shape = Create(); + get { return (ProfileShape) (ProfileCurve & 0xf); } + set + { + byte oldValueMasked = (byte) (ProfileCurve & 0xf0); + ProfileCurve = (byte) (oldValueMasked | (byte) value); + } + } - shape.PathCurve = (byte)Extrusion.Curve1; - shape.ProfileShape = ProfileShape.Square; + public HollowShape HollowShape + { + get { return (HollowShape) (ProfileCurve & 0xf0); } + set + { + byte oldValueMasked = (byte) (ProfileCurve & 0x0f); + ProfileCurve = (byte) (oldValueMasked | (byte) value); + } + } - shape.PathScaleX = 100; - shape.PathScaleY = 100; - - return shape; + public LLVector3 PrimScale + { + get { return Scale; } } public static PrimitiveBaseShape Default @@ -195,6 +161,38 @@ namespace OpenSim.Framework } } + + public static PrimitiveBaseShape Create() + { + PrimitiveBaseShape shape = new PrimitiveBaseShape(); + return shape; + } + + public static PrimitiveBaseShape CreateBox() + { + PrimitiveBaseShape shape = Create(); + + shape.PathCurve = (byte) Extrusion.Straight; + shape.ProfileShape = ProfileShape.Square; + shape.PathScaleX = 100; + shape.PathScaleY = 100; + + return shape; + } + + public static PrimitiveBaseShape CreateCylinder() + { + PrimitiveBaseShape shape = Create(); + + shape.PathCurve = (byte) Extrusion.Curve1; + shape.ProfileShape = ProfileShape.Square; + + shape.PathScaleX = 100; + shape.PathScaleY = 100; + + return shape; + } + public void SetScale(float side) { Scale = new LLVector3(side, side, side); @@ -207,7 +205,7 @@ namespace OpenSim.Framework public void SetRadius(float radius) { - Scale.X = Scale.Y = radius * 2f; + Scale.X = Scale.Y = radius*2f; } //void returns need to change of course @@ -217,29 +215,29 @@ namespace OpenSim.Framework public PrimitiveBaseShape Copy() { - return (PrimitiveBaseShape)MemberwiseClone(); + return (PrimitiveBaseShape) MemberwiseClone(); } public static PrimitiveBaseShape CreateCylinder(float radius, float heigth) { - PrimitiveBaseShape shape = CreateCylinder( ); + PrimitiveBaseShape shape = CreateCylinder(); - shape.SetHeigth( heigth ); - shape.SetRadius( radius ); + shape.SetHeigth(heigth); + shape.SetRadius(radius); return shape; } - public void SetPathRange( LLVector3 pathRange ) + public void SetPathRange(LLVector3 pathRange) { PathBegin = LLObject.PackBeginCut(pathRange.X); PathEnd = LLObject.PackEndCut(pathRange.Y); } - public void SetProfileRange( LLVector3 profileRange ) + public void SetProfileRange(LLVector3 profileRange) { ProfileBegin = LLObject.PackBeginCut(profileRange.X); ProfileEnd = LLObject.PackEndCut(profileRange.Y); } } -} +} \ No newline at end of file