aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
diff options
context:
space:
mode:
authorSean Dague2008-09-03 18:04:37 +0000
committerSean Dague2008-09-03 18:04:37 +0000
commit12beaccec79319186ae2a7bf3663510584117a63 (patch)
tree0dadf7a61269ae5215d1c007a2c8b7749e84e434 /OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
parentUpdate svn properties. (diff)
downloadopensim-SC-12beaccec79319186ae2a7bf3663510584117a63.zip
opensim-SC-12beaccec79319186ae2a7bf3663510584117a63.tar.gz
opensim-SC-12beaccec79319186ae2a7bf3663510584117a63.tar.bz2
opensim-SC-12beaccec79319186ae2a7bf3663510584117a63.tar.xz
Merge branch 'cms' of http://pokgsa.ibm.com/~jbongio/public/opensim
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs98
1 files changed, 98 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
new file mode 100644
index 0000000..499d1bc
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs
@@ -0,0 +1,98 @@
1// BeamMetaEntity.cs created with MonoDevelop
2// User: bongiojp at 3:03 PMĀ 8/6/2008
3//
4// To change standard headers go to Edit->Preferences->Coding->Standard Headers
5//
6
7using System;
8using System.Collections.Generic;
9using System.Drawing;
10using libsecondlife;
11using Nini.Config;
12using OpenSim.Framework;
13using OpenSim.Region.Environment.Interfaces;
14using OpenSim.Region.Environment.Scenes;
15using log4net;
16using OpenSim.Region.Physics.Manager;
17using Axiom.Math;
18
19namespace OpenSim.Region.Environment.Modules.ContentManagement
20{
21
22
23 public class BeamMetaEntity : PointMetaEntity
24 {
25
26 public BeamMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color) : base(scene, LocalId, groupPos, transparency)
27 {
28 SetBeamToUUID(To, color);
29 }
30
31 public BeamMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color) : base(scene, uuid, LocalId, groupPos, transparency)
32 {
33 SetBeamToUUID(To, color);
34 }
35
36 public void SetBeamToUUID(SceneObjectPart To, LLVector3 color)
37 {
38 SceneObjectPart From = m_Entity.RootPart;
39 //Scale size of particles to distance objects are apart (for better visibility)
40 LLVector3 FromPos = From.GetWorldPosition();
41 LLVector3 ToPos = From.GetWorldPosition();
42 LLUUID toUUID = To.UUID;
43 float distance = (float) (Math.Sqrt(Math.Pow(FromPos.X-ToPos.X, 2) +
44 Math.Pow(FromPos.X-ToPos.Y, 2) +
45 Math.Pow(FromPos.X-ToPos.Z, 2)
46 )
47 );
48 //float rate = (float) (distance/4f);
49 float rate = 0.5f;
50 float scale = (float) (distance/128f);
51 float speed = (float) (2.0f - distance/128f);
52
53 SetBeamToUUID(From, To, color, rate, scale, speed);
54 }
55
56 public void SetBeamToUUID(SceneObjectPart From, SceneObjectPart To, LLVector3 color, float rate, float scale, float speed)
57 {
58 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
59 //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive |
60 // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS
61 prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam |
62 Primitive.ParticleSystem.ParticleDataFlags.TargetPos;
63 prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR
64 prules.PartStartColor.G = color.Y;
65 prules.PartStartColor.B = color.Z;
66 prules.PartStartColor.A = 1.0f; //PSYS_PART_START_ALPHA, transparency
67 prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR
68 prules.PartEndColor.G = color.Y;
69 prules.PartEndColor.B = color.Z;
70 prules.PartEndColor.A = 1.0f; //PSYS_PART_END_ALPHA, transparency
71 prules.PartStartScaleX = scale; //PSYS_PART_START_SCALE
72 prules.PartStartScaleY = scale;
73 prules.PartEndScaleX = scale; //PSYS_PART_END_SCALE
74 prules.PartEndScaleY = scale;
75 prules.PartMaxAge = 1.0f; //PSYS_PART_MAX_AGE
76 prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL
77 prules.PartAcceleration.Y = 0.0f;
78 prules.PartAcceleration.Z = 0.0f;
79 //prules.Pattern = Primitive.ParticleSystem.SourcePattern.Explode; //PSYS_SRC_PATTERN
80 //prules.Texture = LLUUID.Zero;//= LLUUID //PSYS_SRC_TEXTURE, default used if blank
81 prules.BurstRate = rate; //PSYS_SRC_BURST_RATE
82 prules.BurstPartCount = 1; //PSYS_SRC_BURST_PART_COUNT
83 prules.BurstRadius = 0.5f; //PSYS_SRC_BURST_RADIUS
84 prules.BurstSpeedMin = speed; //PSYS_SRC_BURST_SPEED_MIN
85 prules.BurstSpeedMax = speed; //PSYS_SRC_BURST_SPEED_MAX
86 prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE
87 prules.Target = To.UUID; //PSYS_SRC_TARGET_KEY
88 prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA
89 prules.AngularVelocity.Y = 0.0f;
90 prules.AngularVelocity.Z = 0.0f;
91 prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN
92 prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END
93
94 prules.CRC = 1; //activates the particle system??
95 From.AddNewParticleSystem(prules);
96 }
97 }
98}