diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs | 210 |
1 files changed, 116 insertions, 94 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs index 2155b4c..3188c6c 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs | |||
@@ -1,114 +1,136 @@ | |||
1 | #region Header | ||
2 | |||
1 | // AuraMetaEntity.cs created with MonoDevelop | 3 | // AuraMetaEntity.cs created with MonoDevelop |
2 | // User: bongiojp at 3:03 PM 8/6/2008 | 4 | // User: bongiojp at 3:03 PM 8/6/2008 |
3 | // | 5 | // |
4 | // To change standard headers go to Edit->Preferences->Coding->Standard Headers | 6 | // To change standard headers go to Edit->Preferences->Coding->Standard Headers |
5 | // | 7 | // |
6 | 8 | ||
9 | #endregion Header | ||
10 | |||
7 | using System; | 11 | using System; |
8 | using System.Collections.Generic; | 12 | using System.Collections.Generic; |
9 | using System.Drawing; | 13 | using System.Drawing; |
14 | |||
10 | using libsecondlife; | 15 | using libsecondlife; |
16 | |||
11 | using Nini.Config; | 17 | using Nini.Config; |
18 | |||
12 | using OpenSim.Framework; | 19 | using OpenSim.Framework; |
13 | using OpenSim.Region.Environment.Interfaces; | 20 | using OpenSim.Region.Environment.Interfaces; |
14 | using OpenSim.Region.Environment.Scenes; | 21 | using OpenSim.Region.Environment.Scenes; |
15 | using log4net; | ||
16 | using OpenSim.Region.Physics.Manager; | 22 | using OpenSim.Region.Physics.Manager; |
23 | |||
24 | using log4net; | ||
25 | |||
17 | using Axiom.Math; | 26 | using Axiom.Math; |
18 | 27 | ||
19 | namespace OpenSim.Region.Environment.Modules.ContentManagement | 28 | namespace OpenSim.Region.Environment.Modules.ContentManagement |
20 | { | 29 | { |
21 | 30 | public class AuraMetaEntity : PointMetaEntity | |
22 | 31 | { | |
23 | public class AuraMetaEntity : PointMetaEntity | 32 | #region Constructors |
24 | { | 33 | |
25 | //transparency of root part, NOT particle system. Should probably add support for changing particle system transparency. | 34 | //transparency of root part, NOT particle system. Should probably add support for changing particle system transparency. |
26 | public AuraMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale) : base(scene, LocalId, groupPos, transparency) | 35 | public AuraMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale) |
27 | { | 36 | : base(scene, LocalId, groupPos, transparency) |
28 | SetAura(color, scale); | 37 | { |
29 | } | 38 | SetAura(color, scale); |
30 | 39 | } | |
31 | public AuraMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale) : base(scene, uuid, LocalId, groupPos, transparency) | 40 | |
32 | { | 41 | public AuraMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale) |
33 | SetAura(color, scale); | 42 | : base(scene, uuid, LocalId, groupPos, transparency) |
34 | } | 43 | { |
35 | 44 | SetAura(color, scale); | |
36 | private float Average(LLVector3 values) | 45 | } |
37 | { | 46 | |
38 | return (values.X + values.Y + values.Z)/3f; | 47 | #endregion Constructors |
39 | } | 48 | |
40 | 49 | #region Private Methods | |
41 | public void SetAura(LLVector3 color, LLVector3 scale) | 50 | |
42 | { | 51 | private float Average(LLVector3 values) |
43 | SetAura(color, Average(scale) * 2.0f); | 52 | { |
44 | } | 53 | return (values.X + values.Y + values.Z)/3f; |
45 | 54 | } | |
46 | public void SetAura(LLVector3 color, float radius) | 55 | |
47 | { | 56 | #endregion Private Methods |
48 | SceneObjectPart From = m_Entity.RootPart; | 57 | |
49 | 58 | #region Public Methods | |
50 | //m_log.Debug("[META ENTITY] BEFORE: radius = " + radius); | 59 | |
51 | float burstRadius = 0.1f; | 60 | public void SetAura(LLVector3 color, LLVector3 scale) |
52 | Primitive.ParticleSystem.SourcePattern patternFlags = Primitive.ParticleSystem.SourcePattern.None; | 61 | { |
53 | float age = 1.5f; | 62 | SetAura(color, Average(scale) * 2.0f); |
54 | float burstRate = 0.4f; | 63 | } |
55 | if (radius >= 8.0f) | 64 | |
56 | { | 65 | public void SetAura(LLVector3 color, float radius) |
57 | //float sizeOfObject = radius / 2.0f; | 66 | { |
58 | burstRadius = (radius - 8.0f)/3f; | 67 | SceneObjectPart From = m_Entity.RootPart; |
59 | burstRate = 1.5f; | 68 | |
60 | radius = 7.99f; | 69 | //m_log.Debug("[META ENTITY] BEFORE: radius = " + radius); |
61 | patternFlags = Primitive.ParticleSystem.SourcePattern.Explode; | 70 | float burstRadius = 0.1f; |
62 | age = 4.0f; | 71 | Primitive.ParticleSystem.SourcePattern patternFlags = Primitive.ParticleSystem.SourcePattern.None; |
63 | } | 72 | float age = 1.5f; |
64 | SetAura(From, color, radius, burstRadius, age, burstRate, patternFlags); | 73 | float burstRate = 0.4f; |
65 | } | 74 | if (radius >= 8.0f) |
66 | public void SetAura(SceneObjectPart From, LLVector3 color, float radius, float burstRadius, float age, float burstRate, libsecondlife.Primitive.ParticleSystem.SourcePattern patternFlags) | 75 | { |
67 | { | 76 | //float sizeOfObject = radius / 2.0f; |
68 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | 77 | burstRadius = (radius - 8.0f)/3f; |
69 | //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive | | 78 | burstRate = 1.5f; |
70 | // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS | 79 | radius = 7.99f; |
71 | //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam | | 80 | patternFlags = Primitive.ParticleSystem.SourcePattern.Explode; |
72 | // Primitive.ParticleSystem.ParticleDataFlags.TargetPos; | 81 | age = 4.0f; |
73 | prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR | 82 | } |
74 | prules.PartStartColor.G = color.Y; | 83 | SetAura(From, color, radius, burstRadius, age, burstRate, patternFlags); |
75 | prules.PartStartColor.B = color.Z; | 84 | } |
76 | prules.PartStartColor.A = 0.5f; //PSYS_PART_START_ALPHA, transparency | 85 | |
77 | prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR | 86 | public void SetAura(SceneObjectPart From, LLVector3 color, float radius, float burstRadius, float age, float burstRate, libsecondlife.Primitive.ParticleSystem.SourcePattern patternFlags) |
78 | prules.PartEndColor.G = color.Y; | 87 | { |
79 | prules.PartEndColor.B = color.Z; | 88 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); |
80 | prules.PartEndColor.A = 0.5f; //PSYS_PART_END_ALPHA, transparency | 89 | //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive | |
81 | /*prules.PartStartScaleX = 0.5f; //PSYS_PART_START_SCALE | 90 | // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS |
82 | prules.PartStartScaleY = 0.5f; | 91 | //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam | |
83 | prules.PartEndScaleX = 0.5f; //PSYS_PART_END_SCALE | 92 | // Primitive.ParticleSystem.ParticleDataFlags.TargetPos; |
84 | prules.PartEndScaleY = 0.5f; | 93 | prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR |
85 | */ | 94 | prules.PartStartColor.G = color.Y; |
86 | prules.PartStartScaleX = radius; //PSYS_PART_START_SCALE | 95 | prules.PartStartColor.B = color.Z; |
87 | prules.PartStartScaleY = radius; | 96 | prules.PartStartColor.A = 0.5f; //PSYS_PART_START_ALPHA, transparency |
88 | prules.PartEndScaleX = radius; //PSYS_PART_END_SCALE | 97 | prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR |
89 | prules.PartEndScaleY = radius; | 98 | prules.PartEndColor.G = color.Y; |
90 | prules.PartMaxAge = age; //PSYS_PART_MAX_AGE | 99 | prules.PartEndColor.B = color.Z; |
91 | prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL | 100 | prules.PartEndColor.A = 0.5f; //PSYS_PART_END_ALPHA, transparency |
92 | prules.PartAcceleration.Y = 0.0f; | 101 | /*prules.PartStartScaleX = 0.5f; //PSYS_PART_START_SCALE |
93 | prules.PartAcceleration.Z = 0.0f; | 102 | prules.PartStartScaleY = 0.5f; |
94 | prules.Pattern = patternFlags; //PSYS_SRC_PATTERN | 103 | prules.PartEndScaleX = 0.5f; //PSYS_PART_END_SCALE |
95 | //prules.Texture = LLUUID.Zero;//= LLUUID //PSYS_SRC_TEXTURE, default used if blank | 104 | prules.PartEndScaleY = 0.5f; |
96 | prules.BurstRate = burstRate; //PSYS_SRC_BURST_RATE | 105 | */ |
97 | prules.BurstPartCount = 2; //PSYS_SRC_BURST_PART_COUNT | 106 | prules.PartStartScaleX = radius; //PSYS_PART_START_SCALE |
98 | //prules.BurstRadius = radius; //PSYS_SRC_BURST_RADIUS | 107 | prules.PartStartScaleY = radius; |
99 | prules.BurstRadius = burstRadius; //PSYS_SRC_BURST_RADIUS | 108 | prules.PartEndScaleX = radius; //PSYS_PART_END_SCALE |
100 | prules.BurstSpeedMin = 0.001f; //PSYS_SRC_BURST_SPEED_MIN | 109 | prules.PartEndScaleY = radius; |
110 | prules.PartMaxAge = age; //PSYS_PART_MAX_AGE | ||
111 | prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL | ||
112 | prules.PartAcceleration.Y = 0.0f; | ||
113 | prules.PartAcceleration.Z = 0.0f; | ||
114 | prules.Pattern = patternFlags; //PSYS_SRC_PATTERN | ||
115 | //prules.Texture = LLUUID.Zero;//= LLUUID //PSYS_SRC_TEXTURE, default used if blank | ||
116 | prules.BurstRate = burstRate; //PSYS_SRC_BURST_RATE | ||
117 | prules.BurstPartCount = 2; //PSYS_SRC_BURST_PART_COUNT | ||
118 | //prules.BurstRadius = radius; //PSYS_SRC_BURST_RADIUS | ||
119 | prules.BurstRadius = burstRadius; //PSYS_SRC_BURST_RADIUS | ||
120 | prules.BurstSpeedMin = 0.001f; //PSYS_SRC_BURST_SPEED_MIN | ||
101 | prules.BurstSpeedMax = 0.001f; //PSYS_SRC_BURST_SPEED_MAX | 121 | prules.BurstSpeedMax = 0.001f; //PSYS_SRC_BURST_SPEED_MAX |
102 | prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE | 122 | prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE |
103 | //prules.Target = To; //PSYS_SRC_TARGET_KEY | 123 | //prules.Target = To; //PSYS_SRC_TARGET_KEY |
104 | prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA | 124 | prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA |
105 | prules.AngularVelocity.Y = 0.0f; | 125 | prules.AngularVelocity.Y = 0.0f; |
106 | prules.AngularVelocity.Z = 0.0f; | 126 | prules.AngularVelocity.Z = 0.0f; |
107 | prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN | 127 | prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN |
108 | prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END | 128 | prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END |
109 | 129 | ||
110 | prules.CRC = 1; //activates the particle system?? | 130 | prules.CRC = 1; //activates the particle system?? |
111 | From.AddNewParticleSystem(prules); | 131 | From.AddNewParticleSystem(prules); |
112 | } | 132 | } |
113 | } | 133 | |
114 | } | 134 | #endregion Public Methods |
135 | } | ||
136 | } \ No newline at end of file | ||