diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs deleted file mode 100644 index 4a402bf..0000000 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | #region Header | ||
29 | |||
30 | // AuraMetaEntity.cs created with MonoDevelop | ||
31 | // User: bongiojp at 3:03 PMĀ 8/6/2008 | ||
32 | // | ||
33 | // To change standard headers go to Edit->Preferences->Coding->Standard Headers | ||
34 | // | ||
35 | |||
36 | #endregion Header | ||
37 | |||
38 | using System; | ||
39 | using System.Collections.Generic; | ||
40 | using System.Drawing; | ||
41 | |||
42 | using OpenMetaverse; | ||
43 | |||
44 | using Nini.Config; | ||
45 | |||
46 | using OpenSim.Framework; | ||
47 | using OpenSim.Region.Framework.Interfaces; | ||
48 | using OpenSim.Region.Framework.Scenes; | ||
49 | using OpenSim.Region.Physics.Manager; | ||
50 | |||
51 | using log4net; | ||
52 | |||
53 | namespace OpenSim.Region.OptionalModules.ContentManagement | ||
54 | { | ||
55 | public class AuraMetaEntity : PointMetaEntity | ||
56 | { | ||
57 | #region Constructors | ||
58 | |||
59 | //transparency of root part, NOT particle system. Should probably add support for changing particle system transparency. | ||
60 | public AuraMetaEntity(Scene scene, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale) | ||
61 | : base(scene, groupPos, transparency) | ||
62 | { | ||
63 | SetAura(color, scale); | ||
64 | } | ||
65 | |||
66 | public AuraMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale) | ||
67 | : base(scene, uuid, groupPos, transparency) | ||
68 | { | ||
69 | SetAura(color, scale); | ||
70 | } | ||
71 | |||
72 | #endregion Constructors | ||
73 | |||
74 | #region Private Methods | ||
75 | |||
76 | private float Average(Vector3 values) | ||
77 | { | ||
78 | return (values.X + values.Y + values.Z)/3f; | ||
79 | } | ||
80 | |||
81 | #endregion Private Methods | ||
82 | |||
83 | #region Public Methods | ||
84 | |||
85 | public void SetAura(Vector3 color, Vector3 scale) | ||
86 | { | ||
87 | SetAura(color, Average(scale) * 2.0f); | ||
88 | } | ||
89 | |||
90 | public void SetAura(Vector3 color, float radius) | ||
91 | { | ||
92 | SceneObjectPart From = m_Entity.RootPart; | ||
93 | |||
94 | //m_log.Debug("[META ENTITY] BEFORE: radius = " + radius); | ||
95 | float burstRadius = 0.1f; | ||
96 | Primitive.ParticleSystem.SourcePattern patternFlags = Primitive.ParticleSystem.SourcePattern.None; | ||
97 | float age = 1.5f; | ||
98 | float burstRate = 0.4f; | ||
99 | if (radius >= 8.0f) | ||
100 | { | ||
101 | //float sizeOfObject = radius / 2.0f; | ||
102 | burstRadius = (radius - 8.0f)/3f; | ||
103 | burstRate = 1.5f; | ||
104 | radius = 7.99f; | ||
105 | patternFlags = Primitive.ParticleSystem.SourcePattern.Explode; | ||
106 | age = 4.0f; | ||
107 | } | ||
108 | SetAura(From, color, radius, burstRadius, age, burstRate, patternFlags); | ||
109 | } | ||
110 | |||
111 | public void SetAura(SceneObjectPart From, Vector3 color, float radius, float burstRadius, float age, float burstRate, Primitive.ParticleSystem.SourcePattern patternFlags) | ||
112 | { | ||
113 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | ||
114 | //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive | | ||
115 | // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS | ||
116 | //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam | | ||
117 | // Primitive.ParticleSystem.ParticleDataFlags.TargetPos; | ||
118 | prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR | ||
119 | prules.PartStartColor.G = color.Y; | ||
120 | prules.PartStartColor.B = color.Z; | ||
121 | prules.PartStartColor.A = 0.5f; //PSYS_PART_START_ALPHA, transparency | ||
122 | prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR | ||
123 | prules.PartEndColor.G = color.Y; | ||
124 | prules.PartEndColor.B = color.Z; | ||
125 | prules.PartEndColor.A = 0.5f; //PSYS_PART_END_ALPHA, transparency | ||
126 | /*prules.PartStartScaleX = 0.5f; //PSYS_PART_START_SCALE | ||
127 | prules.PartStartScaleY = 0.5f; | ||
128 | prules.PartEndScaleX = 0.5f; //PSYS_PART_END_SCALE | ||
129 | prules.PartEndScaleY = 0.5f; | ||
130 | */ | ||
131 | prules.PartStartScaleX = radius; //PSYS_PART_START_SCALE | ||
132 | prules.PartStartScaleY = radius; | ||
133 | prules.PartEndScaleX = radius; //PSYS_PART_END_SCALE | ||
134 | prules.PartEndScaleY = radius; | ||
135 | prules.PartMaxAge = age; //PSYS_PART_MAX_AGE | ||
136 | prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL | ||
137 | prules.PartAcceleration.Y = 0.0f; | ||
138 | prules.PartAcceleration.Z = 0.0f; | ||
139 | prules.Pattern = patternFlags; //PSYS_SRC_PATTERN | ||
140 | //prules.Texture = UUID.Zero;//= UUID //PSYS_SRC_TEXTURE, default used if blank | ||
141 | prules.BurstRate = burstRate; //PSYS_SRC_BURST_RATE | ||
142 | prules.BurstPartCount = 2; //PSYS_SRC_BURST_PART_COUNT | ||
143 | //prules.BurstRadius = radius; //PSYS_SRC_BURST_RADIUS | ||
144 | prules.BurstRadius = burstRadius; //PSYS_SRC_BURST_RADIUS | ||
145 | prules.BurstSpeedMin = 0.001f; //PSYS_SRC_BURST_SPEED_MIN | ||
146 | prules.BurstSpeedMax = 0.001f; //PSYS_SRC_BURST_SPEED_MAX | ||
147 | prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE | ||
148 | //prules.Target = To; //PSYS_SRC_TARGET_KEY | ||
149 | prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA | ||
150 | prules.AngularVelocity.Y = 0.0f; | ||
151 | prules.AngularVelocity.Z = 0.0f; | ||
152 | prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN | ||
153 | prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END | ||
154 | |||
155 | prules.CRC = 1; //activates the particle system?? | ||
156 | From.AddNewParticleSystem(prules); | ||
157 | } | ||
158 | |||
159 | #endregion Public Methods | ||
160 | } | ||
161 | } | ||