aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/world
diff options
context:
space:
mode:
authorMW2007-03-07 22:25:13 +0000
committerMW2007-03-07 22:25:13 +0000
commit778e302133283e3c4ea9c26431b46b3abe23dc1a (patch)
tree53f0bcec8bb9eccc587187326fa8ceac8ddffd12 /src/world
parentHopefully fixed the Session logout bug. (diff)
downloadopensim-SC-778e302133283e3c4ea9c26431b46b3abe23dc1a.zip
opensim-SC-778e302133283e3c4ea9c26431b46b3abe23dc1a.tar.gz
opensim-SC-778e302133283e3c4ea9c26431b46b3abe23dc1a.tar.bz2
opensim-SC-778e302133283e3c4ea9c26431b46b3abe23dc1a.tar.xz
Primitives movement and rotation updates are now sent to all clients
Diffstat (limited to 'src/world')
-rw-r--r--src/world/Avatar.cs2
-rw-r--r--src/world/Primitive.cs91
-rw-r--r--src/world/World.cs1
3 files changed, 91 insertions, 3 deletions
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
index 1a53acc..cf95f76 100644
--- a/src/world/Avatar.cs
+++ b/src/world/Avatar.cs
@@ -104,7 +104,6 @@ namespace OpenSim.world
104 104
105 public static void SetupTemplate(string name) 105 public static void SetupTemplate(string name)
106 { 106 {
107
108 int i = 0; 107 int i = 0;
109 FileInfo fInfo = new FileInfo(name); 108 FileInfo fInfo = new FileInfo(name);
110 long numBytes = fInfo.Length; 109 long numBytes = fInfo.Length;
@@ -127,7 +126,6 @@ namespace OpenSim.world
127 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); 126 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
128 127
129 Avatar.AvatarTemplate = objdata; 128 Avatar.AvatarTemplate = objdata;
130
131 } 129 }
132 130
133 public void CompleteMovement(World RegionInfo) { 131 public void CompleteMovement(World RegionInfo) {
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs
index 7b1f69a..1fb7142 100644
--- a/src/world/Primitive.cs
+++ b/src/world/Primitive.cs
@@ -13,8 +13,21 @@ namespace OpenSim.world
13 protected float mesh_cutend; 13 protected float mesh_cutend;
14 protected PrimData primData; 14 protected PrimData primData;
15 protected bool newPrimFlag; 15 protected bool newPrimFlag;
16 protected bool updateFlag;
16 protected ObjectUpdatePacket OurPacket; 17 protected ObjectUpdatePacket OurPacket;
17 18
19 public bool UpdateFlag
20 {
21 get
22 {
23 return updateFlag;
24 }
25 set
26 {
27 updateFlag = value;
28 }
29 }
30
18 public Primitive() 31 public Primitive()
19 { 32 {
20 mesh_cutbegin = 0.0f; 33 mesh_cutbegin = 0.0f;
@@ -44,6 +57,18 @@ namespace OpenSim.world
44 } 57 }
45 this.newPrimFlag = false; 58 this.newPrimFlag = false;
46 } 59 }
60 else if(this.updateFlag)
61 {
62 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
63 terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
64 terse.RegionData.TimeDilation = 64096;
65 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
66 terse.ObjectData[0] = this.CreateImprovedBlock();
67 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
68 client.OutPacket(terse);
69 }
70 this.updateFlag = false;
71 }
47 } 72 }
48 73
49 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) 74 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
@@ -109,6 +134,72 @@ namespace OpenSim.world
109 this.position = pos1; 134 this.position = pos1;
110 this.OurPacket = objupdate; 135 this.OurPacket = objupdate;
111 } 136 }
137
138 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
139 {
140 uint ID = this.localid;
141 byte[] bytes = new byte[60];
142
143
144 int i = 0;
145 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
146 dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry;
147
148 bytes[i++] = (byte)(ID % 256);
149 bytes[i++] = (byte)((ID >> 8) % 256);
150 bytes[i++] = (byte)((ID >> 16) % 256);
151 bytes[i++] = (byte)((ID >> 24) % 256);
152 bytes[i++]= 0;
153 bytes[i++]= 0;
154
155 byte[] pb = this.position.GetBytes();
156 Array.Copy(pb, 0, bytes, i, pb.Length);
157 i += 12;
158 ushort ac = 32767;
159
160 //vel
161 bytes[i++] = (byte)(ac % 256);
162 bytes[i++] = (byte)((ac >> 8) % 256);
163 bytes[i++] = (byte)(ac % 256);
164 bytes[i++] = (byte)((ac >> 8) % 256);
165 bytes[i++] = (byte)(ac % 256);
166 bytes[i++] = (byte)((ac >> 8) % 256);
167
168 //accel
169 bytes[i++] = (byte)(ac % 256);
170 bytes[i++] = (byte)((ac >> 8) % 256);
171 bytes[i++] = (byte)(ac % 256);
172 bytes[i++] = (byte)((ac >> 8) % 256);
173 bytes[i++] = (byte)(ac % 256);
174 bytes[i++] = (byte)((ac >> 8) % 256);
175
176 ushort rw, rx,ry,rz;
177 rw = (ushort)(32768 * (this.rotation.w+1));
178 rx = (ushort)(32768 * (this.rotation.x+1));
179 ry = (ushort)(32768 * (this.rotation.y+1));
180 rz = (ushort)(32768 * (this.rotation.z+1));
181
182 //rot
183 bytes[i++] = (byte)(rx % 256);
184 bytes[i++] = (byte)((rx >> 8) % 256);
185 bytes[i++] = (byte)(ry % 256);
186 bytes[i++] = (byte)((ry >> 8) % 256);
187 bytes[i++] = (byte)(rz % 256);
188 bytes[i++] = (byte)((rz >> 8) % 256);
189 bytes[i++] = (byte)(rw % 256);
190 bytes[i++] = (byte)((rw >> 8) % 256);
191
192 //rotation vel
193 bytes[i++] = (byte)(ac % 256);
194 bytes[i++] = (byte)((ac >> 8) % 256);
195 bytes[i++] = (byte)(ac % 256);
196 bytes[i++] = (byte)((ac >> 8) % 256);
197 bytes[i++] = (byte)(ac % 256);
198 bytes[i++] = (byte)((ac >> 8) % 256);
199
200 dat.Data=bytes;
201 return dat;
202 }
112 } 203 }
113 204
114 public class PrimData 205 public class PrimData
diff --git a/src/world/World.cs b/src/world/World.cs
index 41a7a34..f6f58c7 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -29,7 +29,6 @@ namespace OpenSim.world
29 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 29 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
30 TerrainManager = new TerrainManager(new SecondLife()); 30 TerrainManager = new TerrainManager(new SecondLife());
31 Avatar.SetupTemplate("avatar-template.dat"); 31 Avatar.SetupTemplate("avatar-template.dat");
32
33 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); 32 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
34 // Initialise this only after the world has loaded 33 // Initialise this only after the world has loaded
35 // Scripts = new ScriptEngine(this); 34 // Scripts = new ScriptEngine(this);