aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs172
1 files changed, 94 insertions, 78 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
index 499d1bc..cea9550 100644
--- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
+++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
@@ -1,98 +1,114 @@
1#region Header
2
1// BeamMetaEntity.cs created with MonoDevelop 3// BeamMetaEntity.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
7using System; 11using System;
8using System.Collections.Generic; 12using System.Collections.Generic;
9using System.Drawing; 13using System.Drawing;
14
10using libsecondlife; 15using libsecondlife;
16
11using Nini.Config; 17using Nini.Config;
18
12using OpenSim.Framework; 19using OpenSim.Framework;
13using OpenSim.Region.Environment.Interfaces; 20using OpenSim.Region.Environment.Interfaces;
14using OpenSim.Region.Environment.Scenes; 21using OpenSim.Region.Environment.Scenes;
15using log4net;
16using OpenSim.Region.Physics.Manager; 22using OpenSim.Region.Physics.Manager;
23
24using log4net;
25
17using Axiom.Math; 26using Axiom.Math;
18 27
19namespace OpenSim.Region.Environment.Modules.ContentManagement 28namespace OpenSim.Region.Environment.Modules.ContentManagement
20{ 29{
21 30 public class BeamMetaEntity : PointMetaEntity
22 31 {
23 public class BeamMetaEntity : PointMetaEntity 32 #region Constructors
24 { 33
25 34 public BeamMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color)
26 public BeamMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color) : base(scene, LocalId, groupPos, transparency) 35 : base(scene, LocalId, groupPos, transparency)
27 { 36 {
28 SetBeamToUUID(To, color); 37 SetBeamToUUID(To, color);
29 } 38 }
30 39
31 public BeamMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color) : base(scene, uuid, LocalId, groupPos, transparency) 40 public BeamMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color)
32 { 41 : base(scene, uuid, LocalId, groupPos, transparency)
33 SetBeamToUUID(To, color); 42 {
34 } 43 SetBeamToUUID(To, color);
35 44 }
36 public void SetBeamToUUID(SceneObjectPart To, LLVector3 color) 45
37 { 46 #endregion Constructors
38 SceneObjectPart From = m_Entity.RootPart; 47
39 //Scale size of particles to distance objects are apart (for better visibility) 48 #region Public Methods
40 LLVector3 FromPos = From.GetWorldPosition(); 49
41 LLVector3 ToPos = From.GetWorldPosition(); 50 public void SetBeamToUUID(SceneObjectPart To, LLVector3 color)
42 LLUUID toUUID = To.UUID; 51 {
43 float distance = (float) (Math.Sqrt(Math.Pow(FromPos.X-ToPos.X, 2) + 52 SceneObjectPart From = m_Entity.RootPart;
44 Math.Pow(FromPos.X-ToPos.Y, 2) + 53 //Scale size of particles to distance objects are apart (for better visibility)
45 Math.Pow(FromPos.X-ToPos.Z, 2) 54 LLVector3 FromPos = From.GetWorldPosition();
46 ) 55 LLVector3 ToPos = From.GetWorldPosition();
47 ); 56 LLUUID toUUID = To.UUID;
48 //float rate = (float) (distance/4f); 57 float distance = (float) (Math.Sqrt(Math.Pow(FromPos.X-ToPos.X, 2) +
49 float rate = 0.5f; 58 Math.Pow(FromPos.X-ToPos.Y, 2) +
50 float scale = (float) (distance/128f); 59 Math.Pow(FromPos.X-ToPos.Z, 2)
51 float speed = (float) (2.0f - distance/128f); 60 )
52 61 );
53 SetBeamToUUID(From, To, color, rate, scale, speed); 62 //float rate = (float) (distance/4f);
54 } 63 float rate = 0.5f;
55 64 float scale = (float) (distance/128f);
56 public void SetBeamToUUID(SceneObjectPart From, SceneObjectPart To, LLVector3 color, float rate, float scale, float speed) 65 float speed = (float) (2.0f - distance/128f);
57 { 66
58 Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); 67 SetBeamToUUID(From, To, color, rate, scale, speed);
59 //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive | 68 }
60 // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS 69
61 prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam | 70 public void SetBeamToUUID(SceneObjectPart From, SceneObjectPart To, LLVector3 color, float rate, float scale, float speed)
62 Primitive.ParticleSystem.ParticleDataFlags.TargetPos; 71 {
63 prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR 72 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
64 prules.PartStartColor.G = color.Y; 73 //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive |
65 prules.PartStartColor.B = color.Z; 74 // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS
66 prules.PartStartColor.A = 1.0f; //PSYS_PART_START_ALPHA, transparency 75 prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam |
67 prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR 76 Primitive.ParticleSystem.ParticleDataFlags.TargetPos;
68 prules.PartEndColor.G = color.Y; 77 prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR
69 prules.PartEndColor.B = color.Z; 78 prules.PartStartColor.G = color.Y;
70 prules.PartEndColor.A = 1.0f; //PSYS_PART_END_ALPHA, transparency 79 prules.PartStartColor.B = color.Z;
71 prules.PartStartScaleX = scale; //PSYS_PART_START_SCALE 80 prules.PartStartColor.A = 1.0f; //PSYS_PART_START_ALPHA, transparency
72 prules.PartStartScaleY = scale; 81 prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR
73 prules.PartEndScaleX = scale; //PSYS_PART_END_SCALE 82 prules.PartEndColor.G = color.Y;
74 prules.PartEndScaleY = scale; 83 prules.PartEndColor.B = color.Z;
75 prules.PartMaxAge = 1.0f; //PSYS_PART_MAX_AGE 84 prules.PartEndColor.A = 1.0f; //PSYS_PART_END_ALPHA, transparency
76 prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL 85 prules.PartStartScaleX = scale; //PSYS_PART_START_SCALE
77 prules.PartAcceleration.Y = 0.0f; 86 prules.PartStartScaleY = scale;
78 prules.PartAcceleration.Z = 0.0f; 87 prules.PartEndScaleX = scale; //PSYS_PART_END_SCALE
79 //prules.Pattern = Primitive.ParticleSystem.SourcePattern.Explode; //PSYS_SRC_PATTERN 88 prules.PartEndScaleY = scale;
80 //prules.Texture = LLUUID.Zero;//= LLUUID //PSYS_SRC_TEXTURE, default used if blank 89 prules.PartMaxAge = 1.0f; //PSYS_PART_MAX_AGE
81 prules.BurstRate = rate; //PSYS_SRC_BURST_RATE 90 prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL
82 prules.BurstPartCount = 1; //PSYS_SRC_BURST_PART_COUNT 91 prules.PartAcceleration.Y = 0.0f;
83 prules.BurstRadius = 0.5f; //PSYS_SRC_BURST_RADIUS 92 prules.PartAcceleration.Z = 0.0f;
84 prules.BurstSpeedMin = speed; //PSYS_SRC_BURST_SPEED_MIN 93 //prules.Pattern = Primitive.ParticleSystem.SourcePattern.Explode; //PSYS_SRC_PATTERN
94 //prules.Texture = LLUUID.Zero;//= LLUUID //PSYS_SRC_TEXTURE, default used if blank
95 prules.BurstRate = rate; //PSYS_SRC_BURST_RATE
96 prules.BurstPartCount = 1; //PSYS_SRC_BURST_PART_COUNT
97 prules.BurstRadius = 0.5f; //PSYS_SRC_BURST_RADIUS
98 prules.BurstSpeedMin = speed; //PSYS_SRC_BURST_SPEED_MIN
85 prules.BurstSpeedMax = speed; //PSYS_SRC_BURST_SPEED_MAX 99 prules.BurstSpeedMax = speed; //PSYS_SRC_BURST_SPEED_MAX
86 prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE 100 prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE
87 prules.Target = To.UUID; //PSYS_SRC_TARGET_KEY 101 prules.Target = To.UUID; //PSYS_SRC_TARGET_KEY
88 prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA 102 prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA
89 prules.AngularVelocity.Y = 0.0f; 103 prules.AngularVelocity.Y = 0.0f;
90 prules.AngularVelocity.Z = 0.0f; 104 prules.AngularVelocity.Z = 0.0f;
91 prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN 105 prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN
92 prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END 106 prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END
93 107
94 prules.CRC = 1; //activates the particle system?? 108 prules.CRC = 1; //activates the particle system??
95 From.AddNewParticleSystem(prules); 109 From.AddNewParticleSystem(prules);
96 } 110 }
97 } 111
98} 112 #endregion Public Methods
113 }
114} \ No newline at end of file