Complete structure for the particle system
Exemplo n.º 1
0
        /// <summary>
        /// Gather all the asset uuids associated with a given object.
        /// </summary>
        /// <remarks>
        /// This includes both those directly associated with
        /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
        /// within this object).
        /// </remarks>
        /// <param name="sceneObject">The scene object for which to gather assets</param>
        /// <param name="assetUuids">
        /// A dictionary which is populated with the asset UUIDs gathered and the type of that asset.
        /// For assets where the type is not clear (e.g. UUIDs extracted from LSL and notecards), the type is Unknown.
        /// </param>
        public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, sbyte> assetUuids)
        {
//            m_log.DebugFormat(
//                "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);

            SceneObjectPart[] parts = sceneObject.Parts;
            for (int i = 0; i < parts.Length; i++)
            {
                SceneObjectPart part = parts[i];

//                m_log.DebugFormat(
//                    "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID);

                try
                {
                    Primitive.TextureEntry textureEntry = part.Shape.Textures;
                    if (textureEntry != null)
                    {
                        // Get the prim's default texture.  This will be used for faces which don't have their own texture
                        if (textureEntry.DefaultTexture != null)
                            GatherTextureEntryAssets(textureEntry.DefaultTexture, assetUuids);

                        if (textureEntry.FaceTextures != null)
                        {
                            // Loop through the rest of the texture faces (a non-null face means the face is different from DefaultTexture)
                            foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures)
                            {
                                if (texture != null)
                                    GatherTextureEntryAssets(texture, assetUuids);
                            }
                        }
                    }
                    
                    // If the prim is a sculpt then preserve this information too
                    if (part.Shape.SculptTexture != UUID.Zero)
                        assetUuids[part.Shape.SculptTexture] = (sbyte)AssetType.Texture;

                    if (part.Shape.ProjectionTextureUUID != UUID.Zero)
                        assetUuids[part.Shape.ProjectionTextureUUID] = (sbyte)AssetType.Texture;

                    if (part.CollisionSound != UUID.Zero)
                        assetUuids[part.CollisionSound] = (sbyte)AssetType.Sound;

                    if (part.ParticleSystem.Length > 0)
                    {
                        try
                        {
                            Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0);
                            if (ps.Texture != UUID.Zero)
                                assetUuids[ps.Texture] = (sbyte)AssetType.Texture;
                        }
                        catch (Exception)
                        {
                            m_log.WarnFormat(
                                "[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt.  Continuing.", 
                                part.Name, part.UUID, sceneObject.Name, sceneObject.UUID);
                        }
                    }

                    TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
                    
                    // Now analyze this prim's inventory items to preserve all the uuids that they reference
                    foreach (TaskInventoryItem tii in taskDictionary.Values)
                    {
//                        m_log.DebugFormat(
//                            "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}", 
//                            tii.Name, tii.Type, part.Name, part.UUID);

                        if (!assetUuids.ContainsKey(tii.AssetID))
                            GatherAssetUuids(tii.AssetID, (sbyte)tii.Type, assetUuids);
                    }

                    // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed
                    // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and
                    // inventory transfer.  There needs to be a way for a module to register a method without assuming a 
                    // Scene.EventManager is present.
//                    part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);


                    // still needed to retrieve textures used as materials for any parts containing legacy materials stored in DynAttrs
                    GatherMaterialsUuids(part, assetUuids); 
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[UUID GATHERER]: Failed to get part - {0}", e);
                    m_log.DebugFormat(
                        "[UUID GATHERER]: Texture entry length for prim was {0} (min is 46)", 
                        part.Shape.TextureEntry.Length);
                }
            }
        }
Exemplo n.º 2
0
        protected Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues()
        {
            Primitive.ParticleSystem ps = new Primitive.ParticleSystem();

            // TODO find out about the other defaults and add them here
            ps.PartStartColor = new Color4(1.0f, 1.0f, 1.0f, 1.0f);
            ps.PartEndColor = new Color4(1.0f, 1.0f, 1.0f, 1.0f);
            ps.PartStartScaleX = 1.0f;
            ps.PartStartScaleY = 1.0f;
            ps.PartEndScaleX = 1.0f;
            ps.PartEndScaleY = 1.0f;
            ps.BurstSpeedMin = 1.0f;
            ps.BurstSpeedMax = 1.0f;
            ps.BurstRate = 0.1f;
            ps.PartMaxAge = 10.0f;
            return ps;
        }
Exemplo n.º 3
0
        protected Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues()
        {
            Primitive.ParticleSystem ps = new Primitive.ParticleSystem();

            // TODO find out about the other defaults and add them here
            ps.PartStartColor = new Color4(1.0f, 1.0f, 1.0f, 1.0f);
            ps.PartEndColor = new Color4(1.0f, 1.0f, 1.0f, 1.0f);
            ps.PartStartScaleX = 1.0f;
            ps.PartStartScaleY = 1.0f;
            ps.PartEndScaleX = 1.0f;
            ps.PartEndScaleY = 1.0f;
            ps.BurstSpeedMin = 1.0f;
            ps.BurstSpeedMax = 1.0f;
            ps.BurstRate = 0.1f;
            ps.PartMaxAge = 10.0f;
            ps.BurstPartCount = 1;
            ps.BlendFuncSource = ScriptBaseClass.PSYS_PART_BF_SOURCE_ALPHA;
            ps.BlendFuncDest = ScriptBaseClass.PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA;
            ps.PartStartGlow = 0.0f;
            ps.PartEndGlow = 0.0f;

            return ps;
        }
Exemplo n.º 4
0
        public void SetAura(SceneObjectPart From, Vector3 color, float radius, float burstRadius, float age, float burstRate, Primitive.ParticleSystem.SourcePattern patternFlags)
        {
            Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
            //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive |
            //      Primitive.ParticleSystem.ParticleDataFlags.FollowSrc;   //PSYS_PART_FLAGS
            //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam |
            //    Primitive.ParticleSystem.ParticleDataFlags.TargetPos;
            prules.PartStartColor.R = color.X;                                               //PSYS_PART_START_COLOR
            prules.PartStartColor.G = color.Y;
            prules.PartStartColor.B = color.Z;
            prules.PartStartColor.A = 0.5f;                                               //PSYS_PART_START_ALPHA, transparency
            prules.PartEndColor.R = color.X;                                                 //PSYS_PART_END_COLOR
            prules.PartEndColor.G = color.Y;
            prules.PartEndColor.B = color.Z;
            prules.PartEndColor.A = 0.5f;                                                 //PSYS_PART_END_ALPHA, transparency
            /*prules.PartStartScaleX = 0.5f;                                                //PSYS_PART_START_SCALE
            prules.PartStartScaleY = 0.5f;
            prules.PartEndScaleX = 0.5f;                                                  //PSYS_PART_END_SCALE
            prules.PartEndScaleY = 0.5f;
            */
            prules.PartStartScaleX = radius;                                                //PSYS_PART_START_SCALE
            prules.PartStartScaleY = radius;
            prules.PartEndScaleX = radius;                                                  //PSYS_PART_END_SCALE
            prules.PartEndScaleY = radius;
            prules.PartMaxAge = age;                                                     //PSYS_PART_MAX_AGE
            prules.PartAcceleration.X = 0.0f;                                             //PSYS_SRC_ACCEL
            prules.PartAcceleration.Y = 0.0f;
            prules.PartAcceleration.Z = 0.0f;
            prules.Pattern = patternFlags;                 //PSYS_SRC_PATTERN
            //prules.Texture = UUID.Zero;//= UUID                                                     //PSYS_SRC_TEXTURE, default used if blank
            prules.BurstRate = burstRate;                                                      //PSYS_SRC_BURST_RATE
            prules.BurstPartCount = 2;                                                   //PSYS_SRC_BURST_PART_COUNT
            //prules.BurstRadius = radius;                                                    //PSYS_SRC_BURST_RADIUS
            prules.BurstRadius = burstRadius;                                                    //PSYS_SRC_BURST_RADIUS
            prules.BurstSpeedMin = 0.001f;                                                  //PSYS_SRC_BURST_SPEED_MIN
            prules.BurstSpeedMax = 0.001f;                                                  //PSYS_SRC_BURST_SPEED_MAX
            prules.MaxAge = 0.0f;                                                         //PSYS_SRC_MAX_AGE
            //prules.Target = To;                                                 //PSYS_SRC_TARGET_KEY
            prules.AngularVelocity.X = 0.0f;                                              //PSYS_SRC_OMEGA
            prules.AngularVelocity.Y = 0.0f;
            prules.AngularVelocity.Z = 0.0f;
            prules.InnerAngle = 0.0f;                                                     //PSYS_SRC_ANGLE_BEGIN
            prules.OuterAngle = 0.0f;                                                     //PSYS_SRC_ANGLE_END

            prules.CRC = 1;  //activates the particle system??
            From.AddNewParticleSystem(prules);
        }
 /// <summary>
 /// Construct a new instance of the ParticleUpdateEventArgs class
 /// </summary>
 /// <param name="simulator">The simulator the packet originated from</param>
 /// <param name="particlesystem">The ParticleSystem data</param>
 /// <param name="source">The Primitive source</param>
 public ParticleUpdateEventArgs(Simulator simulator, Primitive.ParticleSystem particlesystem, Primitive source)
 {
     this.m_Simulator = simulator;
     this.m_ParticleSystem = particlesystem;
     this.m_Source = source;
 }
Exemplo n.º 6
0
 public void AddGenericField(string key, object Value)
 {
     if (Value is byte[])
     {
         byte[] V = Value as byte[];
         Primitive.ParticleSystem PS = new Primitive.ParticleSystem(V, 0);
         m_GenericData[key] = PS.GetOSD();
     }
     else
     {
         m_GenericData[key] = OSD.FromObject(Value);
     }
 }