aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.sln2
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs7
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/General/OpenSim.Framework.csproj3
-rw-r--r--OpenSim/Framework/General/OpenSim.Framework.dll.build1
-rw-r--r--OpenSim/Framework/General/Types/PrimitiveBaseShape.cs106
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs12
-rw-r--r--OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj37
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs76
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs1
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs13
-rw-r--r--OpenSim/Region/Environment/OpenSim.Region.Environment.csproj6
-rw-r--r--OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build2
-rw-r--r--OpenSim/Region/Environment/Scenes/Entity.cs85
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs133
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs532
-rw-r--r--OpenSim/Region/Environment/Scenes/PrimitiveOld.cs582
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs131
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs80
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs8
24 files changed, 1169 insertions, 674 deletions
diff --git a/OpenSim.sln b/OpenSim.sln
index bd39235..66e79d2 100644
--- a/OpenSim.sln
+++ b/OpenSim.sln
@@ -1,5 +1,5 @@
1Microsoft Visual Studio Solution File, Format Version 9.00 1Microsoft Visual Studio Solution File, Format Version 9.00
2# Visual Studio 2005 2# Visual C# Express 2005
3Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\Region\Application\OpenSim.csproj", "{438A9556-0000-0000-0000-000000000000}" 3Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\Region\Application\OpenSim.csproj", "{438A9556-0000-0000-0000-000000000000}"
4EndProject 4EndProject
5Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "OpenSim\Framework\General\OpenSim.Framework.csproj", "{8ACA2445-0000-0000-0000-000000000000}" 5Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "OpenSim\Framework\General\OpenSim.Framework.csproj", "{8ACA2445-0000-0000-0000-000000000000}"
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index b17b37b..48ff40e 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -54,13 +54,16 @@ namespace OpenSim.Framework.Communications
54 #region Packet Handlers 54 #region Packet Handlers
55 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) 55 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
56 { 56 {
57 System.Text.Encoding enc = System.Text.Encoding.ASCII;
57 UserProfileData profileData = this.UserServer.GetUserProfile(uuid); 58 UserProfileData profileData = this.UserServer.GetUserProfile(uuid);
58 if (profileData != null) 59 if (profileData != null)
59 { 60 {
60 UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); 61 UUIDNameReplyPacket packet = new UUIDNameReplyPacket();
62 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
63 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
61 packet.UUIDNameBlock[0].ID = profileData.UUID; 64 packet.UUIDNameBlock[0].ID = profileData.UUID;
62 packet.UUIDNameBlock[0].FirstName = libsecondlife.Helpers.StringToField(profileData.username); 65 packet.UUIDNameBlock[0].FirstName = enc.GetBytes(profileData.username + "\0");
63 packet.UUIDNameBlock[0].LastName = libsecondlife.Helpers.StringToField(profileData.surname); 66 packet.UUIDNameBlock[0].LastName = enc.GetBytes(profileData.surname +"\0");
64 remote_client.OutPacket((Packet)packet); 67 remote_client.OutPacket((Packet)packet);
65 } 68 }
66 69
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index ea4c5c9..9c112ae 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -160,6 +160,8 @@ namespace OpenSim.Framework.Interfaces
160 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); 160 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
161 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID , uint flags); 161 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID , uint flags);
162 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags); 162 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags);
163 void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID);
164 void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID);
163 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); 165 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation);
164 } 166 }
165} 167}
diff --git a/OpenSim/Framework/General/OpenSim.Framework.csproj b/OpenSim/Framework/General/OpenSim.Framework.csproj
index 7d3d53a..a577ea3 100644
--- a/OpenSim/Framework/General/OpenSim.Framework.csproj
+++ b/OpenSim/Framework/General/OpenSim.Framework.csproj
@@ -184,6 +184,9 @@
184 <Compile Include="Types\PrimData.cs"> 184 <Compile Include="Types\PrimData.cs">
185 <SubType>Code</SubType> 185 <SubType>Code</SubType>
186 </Compile> 186 </Compile>
187 <Compile Include="Types\PrimitiveBaseShape.cs">
188 <SubType>Code</SubType>
189 </Compile>
187 <Compile Include="Types\RegionHandle.cs"> 190 <Compile Include="Types\RegionHandle.cs">
188 <SubType>Code</SubType> 191 <SubType>Code</SubType>
189 </Compile> 192 </Compile>
diff --git a/OpenSim/Framework/General/OpenSim.Framework.dll.build b/OpenSim/Framework/General/OpenSim.Framework.dll.build
index 239e3e5..10fafbf 100644
--- a/OpenSim/Framework/General/OpenSim.Framework.dll.build
+++ b/OpenSim/Framework/General/OpenSim.Framework.dll.build
@@ -43,6 +43,7 @@
43 <include name="Types/NetworkServersInfo.cs" /> 43 <include name="Types/NetworkServersInfo.cs" />
44 <include name="Types/ParcelData.cs" /> 44 <include name="Types/ParcelData.cs" />
45 <include name="Types/PrimData.cs" /> 45 <include name="Types/PrimData.cs" />
46 <include name="Types/PrimitiveBaseShape.cs" />
46 <include name="Types/RegionHandle.cs" /> 47 <include name="Types/RegionHandle.cs" />
47 <include name="Types/RegionInfo.cs" /> 48 <include name="Types/RegionInfo.cs" />
48 <include name="Types/UUID.cs" /> 49 <include name="Types/UUID.cs" />
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
new file mode 100644
index 0000000..094a8a0
--- /dev/null
+++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
@@ -0,0 +1,106 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6using OpenSim.Framework.Interfaces;
7
8namespace OpenSim.Framework.Types
9{
10 public enum ShapeType
11 {
12 Box,
13 Sphere,
14 Ring,
15 Tube,
16 Torus,
17 Prism,
18 Scuplted,
19 Cylinder
20 }
21
22 public class PrimitiveBaseShape
23 {
24 private ShapeType type;
25
26 public byte PCode;
27 public ushort PathBegin;
28 public ushort PathEnd;
29 public byte PathScaleX;
30 public byte PathScaleY;
31 public byte PathShearX;
32 public byte PathShearY;
33 public sbyte PathSkew;
34 public ushort ProfileBegin;
35 public ushort ProfileEnd;
36 public LLVector3 Scale;
37 public byte PathCurve;
38 public byte ProfileCurve;
39 public uint ParentID = 0;
40 public ushort ProfileHollow;
41 public sbyte PathRadiusOffset;
42 public byte PathRevolutions;
43 public sbyte PathTaperX;
44 public sbyte PathTaperY;
45 public sbyte PathTwist;
46 public sbyte PathTwistBegin;
47 public byte[] TextureEntry; // a LL textureEntry in byte[] format
48
49 public ShapeType PrimType
50 {
51 get
52 {
53 return this.type;
54 }
55 }
56
57 public LLVector3 PrimScale
58 {
59 get
60 {
61 return this.Scale;
62 }
63 }
64
65 public PrimitiveBaseShape()
66 {
67
68 }
69
70 //void returns need to change of course
71 public void GetMesh()
72 {
73
74 }
75
76 public static PrimitiveBaseShape DefaultCube()
77 {
78 PrimitiveBaseShape primShape = new PrimitiveBaseShape();
79
80 primShape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
81 primShape.PCode = 9;
82 primShape.ParentID = 0;
83 primShape.PathBegin = 0;
84 primShape.PathEnd = 0;
85 primShape.PathScaleX = 0;
86 primShape.PathScaleY = 0;
87 primShape.PathShearX = 0;
88 primShape.PathShearY = 0;
89 primShape.PathSkew = 0;
90 primShape.ProfileBegin = 0;
91 primShape.ProfileEnd = 0;
92 primShape.PathCurve = 16;
93 primShape.ProfileCurve = 1;
94 primShape.ProfileHollow = 0;
95 primShape.PathRadiusOffset = 0;
96 primShape.PathRevolutions = 0;
97 primShape.PathTaperX = 0;
98 primShape.PathTaperY = 0;
99 primShape.PathTwist = 0;
100 primShape.PathTwistBegin = 0;
101
102 return primShape;
103 }
104 }
105
106}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 8c8204a..681bb46 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -167,18 +167,6 @@ namespace OpenSim.Framework.Servers
167 return response; 167 return response;
168 } 168 }
169 169
170 protected virtual string ParseLLSDXML(string requestBody)
171 {
172 // dummy function for now - IMPLEMENT ME!
173 //Console.WriteLine("LLSD request "+requestBody);
174 string resp = "";
175 if (firstcaps)
176 {
177 resp = "<llsd><map><key>MapLayer</key><string>http://127.0.0.1:9000/CAPS/</string></map></llsd>";
178 firstcaps = false;
179 }
180 return resp;
181 }
182 170
183 protected virtual string ParseXMLRPC(string requestBody) 171 protected virtual string ParseXMLRPC(string requestBody)
184 { 172 {
diff --git a/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj b/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj
index 4864994..9a98ff4 100644
--- a/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj
+++ b/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,8 +6,7 @@
6 <ProjectGuid>{4B7BFD1C-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{4B7BFD1C-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon> 9 <ApplicationIcon></ApplicationIcon>
10 </ApplicationIcon>
11 <AssemblyKeyContainerName> 10 <AssemblyKeyContainerName>
12 </AssemblyKeyContainerName> 11 </AssemblyKeyContainerName>
13 <AssemblyName>OpenSim.Grid.Framework.Manager</AssemblyName> 12 <AssemblyName>OpenSim.Grid.Framework.Manager</AssemblyName>
@@ -16,11 +15,9 @@
16 <DefaultTargetSchema>IE50</DefaultTargetSchema> 15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
17 <DelaySign>false</DelaySign> 16 <DelaySign>false</DelaySign>
18 <OutputType>Library</OutputType> 17 <OutputType>Library</OutputType>
19 <AppDesignerFolder> 18 <AppDesignerFolder></AppDesignerFolder>
20 </AppDesignerFolder>
21 <RootNamespace>OpenSim.Grid.Framework.Manager</RootNamespace> 19 <RootNamespace>OpenSim.Grid.Framework.Manager</RootNamespace>
22 <StartupObject> 20 <StartupObject></StartupObject>
23 </StartupObject>
24 <FileUpgradeFlags> 21 <FileUpgradeFlags>
25 </FileUpgradeFlags> 22 </FileUpgradeFlags>
26 </PropertyGroup> 23 </PropertyGroup>
@@ -31,8 +28,7 @@
31 <ConfigurationOverrideFile> 28 <ConfigurationOverrideFile>
32 </ConfigurationOverrideFile> 29 </ConfigurationOverrideFile>
33 <DefineConstants>TRACE;DEBUG</DefineConstants> 30 <DefineConstants>TRACE;DEBUG</DefineConstants>
34 <DocumentationFile> 31 <DocumentationFile></DocumentationFile>
35 </DocumentationFile>
36 <DebugSymbols>True</DebugSymbols> 32 <DebugSymbols>True</DebugSymbols>
37 <FileAlignment>4096</FileAlignment> 33 <FileAlignment>4096</FileAlignment>
38 <Optimize>False</Optimize> 34 <Optimize>False</Optimize>
@@ -41,8 +37,7 @@
41 <RemoveIntegerChecks>False</RemoveIntegerChecks> 37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
43 <WarningLevel>4</WarningLevel> 39 <WarningLevel>4</WarningLevel>
44 <NoWarn> 40 <NoWarn></NoWarn>
45 </NoWarn>
46 </PropertyGroup> 41 </PropertyGroup>
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -51,8 +46,7 @@
51 <ConfigurationOverrideFile> 46 <ConfigurationOverrideFile>
52 </ConfigurationOverrideFile> 47 </ConfigurationOverrideFile>
53 <DefineConstants>TRACE</DefineConstants> 48 <DefineConstants>TRACE</DefineConstants>
54 <DocumentationFile> 49 <DocumentationFile></DocumentationFile>
55 </DocumentationFile>
56 <DebugSymbols>False</DebugSymbols> 50 <DebugSymbols>False</DebugSymbols>
57 <FileAlignment>4096</FileAlignment> 51 <FileAlignment>4096</FileAlignment>
58 <Optimize>True</Optimize> 52 <Optimize>True</Optimize>
@@ -61,27 +55,26 @@
61 <RemoveIntegerChecks>False</RemoveIntegerChecks> 55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
63 <WarningLevel>4</WarningLevel> 57 <WarningLevel>4</WarningLevel>
64 <NoWarn> 58 <NoWarn></NoWarn>
65 </NoWarn>
66 </PropertyGroup> 59 </PropertyGroup>
67 <ItemGroup> 60 <ItemGroup>
68 <Reference Include="libsecondlife.dll"> 61 <Reference Include="libsecondlife.dll" >
69 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> 62 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
70 <Private>False</Private> 63 <Private>False</Private>
71 </Reference> 64 </Reference>
72 <Reference Include="OpenSim.Framework"> 65 <Reference Include="OpenSim.Framework" >
73 <HintPath>OpenSim.Framework.dll</HintPath> 66 <HintPath>OpenSim.Framework.dll</HintPath>
74 <Private>False</Private> 67 <Private>False</Private>
75 </Reference> 68 </Reference>
76 <Reference Include="OpenSim.Framework.Servers"> 69 <Reference Include="OpenSim.Framework.Servers" >
77 <HintPath>..\..\..\bin\OpenSim.Framework.Servers.dll</HintPath> 70 <HintPath>OpenSim.Framework.Servers.dll</HintPath>
78 <Private>False</Private> 71 <Private>False</Private>
79 </Reference> 72 </Reference>
80 <Reference Include="System"> 73 <Reference Include="System" >
81 <HintPath>System.dll</HintPath> 74 <HintPath>System.dll</HintPath>
82 <Private>False</Private> 75 <Private>False</Private>
83 </Reference> 76 </Reference>
84 <Reference Include="XMLRPC.dll"> 77 <Reference Include="XMLRPC.dll" >
85 <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> 78 <HintPath>..\..\..\bin\XMLRPC.dll</HintPath>
86 <Private>False</Private> 79 <Private>False</Private>
87 </Reference> 80 </Reference>
@@ -103,4 +96,4 @@
103 <PostBuildEvent> 96 <PostBuildEvent>
104 </PostBuildEvent> 97 </PostBuildEvent>
105 </PropertyGroup> 98 </PropertyGroup>
106</Project> \ No newline at end of file 99</Project>
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index e683db2..5056f41 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -626,6 +626,39 @@ namespace OpenSim.Region.ClientStack
626 OutPacket(outPacket); 626 OutPacket(outPacket);
627 } 627 }
628 628
629
630 public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID)
631 {
632 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
633 outPacket.RegionData.RegionHandle = regionHandle;
634 outPacket.RegionData.TimeDilation = timeDilation;
635 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
636 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, textureID, flags);
637 outPacket.ObjectData[0].ID = localID;
638 outPacket.ObjectData[0].FullID = objectID;
639 outPacket.ObjectData[0].OwnerID = ownerID;
640 byte[] pb = pos.GetBytes();
641 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
642 byte[] rot = rotation.GetBytes();
643 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length);
644 OutPacket(outPacket);
645 }
646
647 public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID)
648 {
649 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
650 outPacket.RegionData.RegionHandle = regionHandle;
651 outPacket.RegionData.TimeDilation = timeDilation;
652 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
653 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, textureID, flags);
654 outPacket.ObjectData[0].ID = localID;
655 outPacket.ObjectData[0].FullID = objectID;
656 outPacket.ObjectData[0].OwnerID = ownerID;
657 byte[] pb = pos.GetBytes();
658 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
659
660 OutPacket(outPacket);
661 }
629 /// <summary> 662 /// <summary>
630 /// 663 ///
631 /// </summary> 664 /// </summary>
@@ -816,6 +849,22 @@ namespace OpenSim.Region.ClientStack
816 } 849 }
817 850
818 /// <summary> 851 /// <summary>
852 /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive)
853 /// </summary>
854 /// <param name="primData"></param>
855 /// <returns></returns>
856 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, LLUUID textureID, uint flags)
857 {
858 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock();
859 this.SetDefaultPrimPacketValues(objupdate);
860 objupdate.UpdateFlags = flags;
861 this.SetPrimPacketShapeData(objupdate, primShape, textureID);
862
863 return objupdate;
864 }
865
866
867 /// <summary>
819 /// Copy the data from a PrimData object to a ObjectUpdatePacket 868 /// Copy the data from a PrimData object to a ObjectUpdatePacket
820 /// </summary> 869 /// </summary>
821 /// <param name="objectData"></param> 870 /// <param name="objectData"></param>
@@ -848,6 +897,33 @@ namespace OpenSim.Region.ClientStack
848 objectData.PathTwistBegin = primData.PathTwistBegin; 897 objectData.PathTwistBegin = primData.PathTwistBegin;
849 } 898 }
850 899
900 protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData, LLUUID textureID)
901 {
902 LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID);
903 objectData.TextureEntry = ntex.ToBytes();
904 objectData.PCode = primData.PCode;
905 objectData.PathBegin = primData.PathBegin;
906 objectData.PathEnd = primData.PathEnd;
907 objectData.PathScaleX = primData.PathScaleX;
908 objectData.PathScaleY = primData.PathScaleY;
909 objectData.PathShearX = primData.PathShearX;
910 objectData.PathShearY = primData.PathShearY;
911 objectData.PathSkew = primData.PathSkew;
912 objectData.ProfileBegin = primData.ProfileBegin;
913 objectData.ProfileEnd = primData.ProfileEnd;
914 objectData.Scale = primData.Scale;
915 objectData.PathCurve = primData.PathCurve;
916 objectData.ProfileCurve = primData.ProfileCurve;
917 objectData.ParentID = primData.ParentID;
918 objectData.ProfileHollow = primData.ProfileHollow;
919 objectData.PathRadiusOffset = primData.PathRadiusOffset;
920 objectData.PathRevolutions = primData.PathRevolutions;
921 objectData.PathTaperX = primData.PathTaperX;
922 objectData.PathTaperY = primData.PathTaperY;
923 objectData.PathTwist = primData.PathTwist;
924 objectData.PathTwistBegin = primData.PathTwistBegin;
925 }
926
851 /// <summary> 927 /// <summary>
852 /// Set some default values in a ObjectUpdatePacket 928 /// Set some default values in a ObjectUpdatePacket
853 /// </summary> 929 /// </summary>
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 794ce79..0d90968 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -211,7 +211,6 @@ namespace OpenSim.Region.ClientStack
211 } 211 }
212 break; 212 break;
213 case PacketType.ObjectAdd: 213 case PacketType.ObjectAdd:
214 // m_world.AddNewPrim((ObjectAddPacket)Pack, this);
215 if (OnAddPrim != null) 214 if (OnAddPrim != null)
216 { 215 {
217 OnAddPrim(Pack, this); 216 OnAddPrim(Pack, this);
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index bacaa3e..7c7c389 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Communications.Local
45 public CommunicationsLocal(NetworkServersInfo serversInfo) 45 public CommunicationsLocal(NetworkServersInfo serversInfo)
46 : base(serversInfo) 46 : base(serversInfo)
47 { 47 {
48 UserServices = new LocalUserServices(this,this.ServersInfo.DefaultHomeLocX,this.ServersInfo.DefaultHomeLocY); 48 UserServices = new LocalUserServices(this, serversInfo);
49 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); 49 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
50 UserServer = UserServices; 50 UserServer = UserServices;
51 GridServer = SandBoxServices; 51 GridServer = SandBoxServices;
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index db9d9b9..b441a8d 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -18,13 +18,15 @@ namespace OpenSim.Region.Communications.Local
18 { 18 {
19 private CommunicationsLocal m_Parent; 19 private CommunicationsLocal m_Parent;
20 20
21 private NetworkServersInfo serversInfo;
21 private uint defaultHomeX ; 22 private uint defaultHomeX ;
22 private uint defaultHomeY; 23 private uint defaultHomeY;
23 public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY) 24 public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData)
24 { 25 {
25 m_Parent = parent; 26 m_Parent = parent;
26 defaultHomeX = defHomeX; 27 this.serversInfo = serversData;
27 defaultHomeY = defHomeY; 28 defaultHomeX = this.serversInfo.DefaultHomeLocX;
29 defaultHomeY = this.serversInfo.DefaultHomeLocY;
28 } 30 }
29 31
30 public UserProfileData GetUserProfile(string firstName, string lastName) 32 public UserProfileData GetUserProfile(string firstName, string lastName)
@@ -81,7 +83,6 @@ namespace OpenSim.Region.Communications.Local
81 ulong currentRegion = theUser.currentAgent.currentHandle; 83 ulong currentRegion = theUser.currentAgent.currentHandle;
82 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); 84 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
83 85
84
85 if (reg != null) 86 if (reg != null)
86 { 87 {
87 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + 88 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
@@ -92,7 +93,9 @@ namespace OpenSim.Region.Communications.Local
92 response.SimPort = (Int32)reg.ExternalEndPoint.Port; 93 response.SimPort = (Int32)reg.ExternalEndPoint.Port;
93 response.RegionX = reg.RegionLocX ; 94 response.RegionX = reg.RegionLocX ;
94 response.RegionY = reg.RegionLocY ; 95 response.RegionY = reg.RegionLocY ;
95 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + reg.ExternalEndPoint.Port.ToString() + "/CAPS/" + capsPath + "0000/"; 96
97 //following port needs changing as we don't want a http listener for every region (or do we?)
98 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
96 theUser.currentAgent.currentRegion = reg.SimUUID; 99 theUser.currentAgent.currentRegion = reg.SimUUID;
97 theUser.currentAgent.currentHandle = reg.RegionHandle; 100 theUser.currentAgent.currentHandle = reg.RegionHandle;
98 101
diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj
index 428f381..9e9405e 100644
--- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj
+++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj
@@ -156,12 +156,18 @@
156 <Compile Include="Scenes\Entity.cs"> 156 <Compile Include="Scenes\Entity.cs">
157 <SubType>Code</SubType> 157 <SubType>Code</SubType>
158 </Compile> 158 </Compile>
159 <Compile Include="Scenes\EntityBase.cs">
160 <SubType>Code</SubType>
161 </Compile>
159 <Compile Include="Scenes\IScenePresenceBody.cs"> 162 <Compile Include="Scenes\IScenePresenceBody.cs">
160 <SubType>Code</SubType> 163 <SubType>Code</SubType>
161 </Compile> 164 </Compile>
162 <Compile Include="Scenes\Primitive.cs"> 165 <Compile Include="Scenes\Primitive.cs">
163 <SubType>Code</SubType> 166 <SubType>Code</SubType>
164 </Compile> 167 </Compile>
168 <Compile Include="Scenes\PrimitiveOld.cs">
169 <SubType>Code</SubType>
170 </Compile>
165 <Compile Include="Scenes\Scene.cs"> 171 <Compile Include="Scenes\Scene.cs">
166 <SubType>Code</SubType> 172 <SubType>Code</SubType>
167 </Compile> 173 </Compile>
diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build
index 2fa5e76..d4b163e 100644
--- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build
+++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build
@@ -15,8 +15,10 @@
15 <include name="ParcelManager.cs" /> 15 <include name="ParcelManager.cs" />
16 <include name="RegionManager.cs" /> 16 <include name="RegionManager.cs" />
17 <include name="Scenes/Entity.cs" /> 17 <include name="Scenes/Entity.cs" />
18 <include name="Scenes/EntityBase.cs" />
18 <include name="Scenes/IScenePresenceBody.cs" /> 19 <include name="Scenes/IScenePresenceBody.cs" />
19 <include name="Scenes/Primitive.cs" /> 20 <include name="Scenes/Primitive.cs" />
21 <include name="Scenes/PrimitiveOld.cs" />
20 <include name="Scenes/Scene.cs" /> 22 <include name="Scenes/Scene.cs" />
21 <include name="Scenes/Scene.PacketHandlers.cs" /> 23 <include name="Scenes/Scene.PacketHandlers.cs" />
22 <include name="Scenes/SceneBase.cs" /> 24 <include name="Scenes/SceneBase.cs" />
diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs
index db5070d..9603f7f 100644
--- a/OpenSim/Region/Environment/Scenes/Entity.cs
+++ b/OpenSim/Region/Environment/Scenes/Entity.cs
@@ -34,29 +34,14 @@ using libsecondlife;
34 34
35namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
36{ 36{
37 public abstract class Entity 37 public abstract class Entity :EntityBase //will be phased out
38 { 38 {
39 public libsecondlife.LLUUID uuid;
40 public Quaternion rotation;
41 protected List<Entity> children;
42
43 protected PhysicsActor _physActor; 39 protected PhysicsActor _physActor;
44 protected Scene m_world;
45 protected string m_name;
46 40
47 /// <summary> 41 /// <summary>
48 /// 42 ///
49 /// </summary> 43 /// </summary>
50 public virtual string Name 44 public override LLVector3 Pos
51 {
52 get { return m_name; }
53 }
54
55 protected LLVector3 m_pos;
56 /// <summary>
57 ///
58 /// </summary>
59 public virtual LLVector3 Pos
60 { 45 {
61 get 46 get
62 { 47 {
@@ -91,12 +76,11 @@ namespace OpenSim.Region.Environment.Scenes
91 } 76 }
92 } 77 }
93 78
94 public LLVector3 velocity; 79
95
96 /// <summary> 80 /// <summary>
97 /// 81 ///
98 /// </summary> 82 /// </summary>
99 public virtual LLVector3 Velocity 83 public override LLVector3 Velocity
100 { 84 {
101 get 85 get
102 { 86 {
@@ -130,64 +114,5 @@ namespace OpenSim.Region.Environment.Scenes
130 velocity = value; 114 velocity = value;
131 } 115 }
132 } 116 }
133
134 protected uint m_localId;
135
136 public uint LocalId
137 {
138 get { return m_localId; }
139 }
140
141 /// <summary>
142 /// Creates a new Entity (should not occur on it's own)
143 /// </summary>
144 public Entity()
145 {
146 uuid = new libsecondlife.LLUUID();
147
148 m_pos = new LLVector3();
149 velocity = new LLVector3();
150 rotation = new Quaternion();
151 m_name = "(basic entity)";
152 children = new List<Entity>();
153 }
154
155 /// <summary>
156 ///
157 /// </summary>
158 public virtual void updateMovement()
159 {
160 foreach (Entity child in children)
161 {
162 child.updateMovement();
163 }
164 }
165
166 /// <summary>
167 /// Performs any updates that need to be done at each frame. This function is overridable from it's children.
168 /// </summary>
169 public virtual void update() {
170 // Do any per-frame updates needed that are applicable to every type of entity
171 foreach (Entity child in children)
172 {
173 child.update();
174 }
175 }
176
177 /// <summary>
178 /// Called at a set interval to inform entities that they should back themsleves up to the DB
179 /// </summary>
180 public virtual void BackUp()
181 {
182
183 }
184
185 /// <summary>
186 /// Infoms the entity that the land (heightmap) has changed
187 /// </summary>
188 public virtual void LandRenegerated()
189 {
190
191 }
192 } 117 }
193} 118}
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
new file mode 100644
index 0000000..edd72c5
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -0,0 +1,133 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Axiom.MathLib;
5using libsecondlife;
6
7namespace OpenSim.Region.Environment.Scenes
8{
9 public abstract class EntityBase
10 {
11 public libsecondlife.LLUUID uuid;
12
13 protected List<EntityBase> children;
14
15 protected Scene m_world;
16 protected string m_name;
17
18 /// <summary>
19 ///
20 /// </summary>
21 public virtual string Name
22 {
23 get { return m_name; }
24 }
25
26 protected LLVector3 m_pos;
27 /// <summary>
28 ///
29 /// </summary>
30 public virtual LLVector3 Pos
31 {
32 get
33 {
34 return m_pos;
35 }
36 set
37 {
38 m_pos = value;
39 }
40 }
41
42 public LLVector3 velocity;
43
44 /// <summary>
45 ///
46 /// </summary>
47 public virtual LLVector3 Velocity
48 {
49 get
50 {
51 return velocity;
52 }
53 set
54 {
55 velocity = value;
56 }
57 }
58
59 public Quaternion _rotation;
60
61 public virtual Quaternion rotation
62 {
63 get
64 {
65 return _rotation;
66 }
67 set
68 {
69 _rotation = value;
70 }
71 }
72
73 protected uint m_localId;
74
75 public uint LocalId
76 {
77 get { return m_localId; }
78 }
79
80 /// <summary>
81 /// Creates a new Entity (should not occur on it's own)
82 /// </summary>
83 public EntityBase()
84 {
85 uuid = new libsecondlife.LLUUID();
86
87 m_pos = new LLVector3();
88 velocity = new LLVector3();
89 rotation = new Quaternion();
90 m_name = "(basic entity)";
91 children = new List<EntityBase>();
92 }
93
94 /// <summary>
95 ///
96 /// </summary>
97 public virtual void updateMovement()
98 {
99 foreach (EntityBase child in children)
100 {
101 child.updateMovement();
102 }
103 }
104
105 /// <summary>
106 /// Performs any updates that need to be done at each frame. This function is overridable from it's children.
107 /// </summary>
108 public virtual void update()
109 {
110 // Do any per-frame updates needed that are applicable to every type of entity
111 foreach (EntityBase child in children)
112 {
113 child.update();
114 }
115 }
116
117 /// <summary>
118 /// Called at a set interval to inform entities that they should back themsleves up to the DB
119 /// </summary>
120 public virtual void BackUp()
121 {
122
123 }
124
125 /// <summary>
126 /// Infoms the entity that the land (heightmap) has changed
127 /// </summary>
128 public virtual void LandRenegerated()
129 {
130
131 }
132 }
133}
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 0f649b2..497196d 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -1,31 +1,3 @@
1
2/*
3* Copyright (c) Contributors, http://www.openmetaverse.org/
4* See CONTRIBUTORS.TXT for a full list of copyright holders.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the OpenSim Project nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
18* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*
28*/
29using System; 1using System;
30using System.Collections.Generic; 2using System.Collections.Generic;
31using System.Text; 3using System.Text;
@@ -38,175 +10,66 @@ using OpenSim.Framework.Inventory;
38 10
39namespace OpenSim.Region.Environment.Scenes 11namespace OpenSim.Region.Environment.Scenes
40{ 12{
41 public class Primitive : Entity 13 public class Primitive : EntityBase
42 { 14 {
43 internal PrimData primData; 15 private const uint FULL_MASK_PERMISSIONS = 2147483647;
16
44 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 17 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
45 // private Dictionary<uint, IClientAPI> m_clientThreads;
46 private ulong m_regionHandle; 18 private ulong m_regionHandle;
47 private const uint FULL_MASK_PERMISSIONS = 2147483647;
48 private bool physicsEnabled = false;
49 private byte updateFlag = 0; 19 private byte updateFlag = 0;
50 private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; 20 private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
51 21
52 private Dictionary<LLUUID, InventoryItem> inventoryItems; 22 private Dictionary<LLUUID, InventoryItem> inventoryItems;
53 23
54 #region Properties 24 public LLUUID OwnerID;
25 public Int32 CreationDate;
26 public uint OwnerMask = FULL_MASK_PERMISSIONS;
27 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
28 public uint GroupMask = FULL_MASK_PERMISSIONS;
29 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
30 public uint BaseMask = FULL_MASK_PERMISSIONS;
55 31
56 public LLVector3 Scale 32 private PrimitiveBaseShape m_Shape;
57 {
58 set
59 {
60 this.primData.Scale = value;
61 //this.dirtyFlag = true;
62 }
63 get
64 {
65 return this.primData.Scale;
66 }
67 }
68 33
69 public PhysicsActor PhysActor 34 private SceneObject m_RootParent;
70 { 35 private bool isRootPrim;
71 set 36 private EntityBase m_Parent;
72 {
73 this._physActor = value;
74 }
75 }
76 37
77 public override LLVector3 Pos 38 public override LLVector3 Pos
78 { 39 {
79 get 40 get
80 { 41 {
81 return base.Pos; 42 if (isRootPrim)
43 {
44 return this.m_pos + m_Parent.Pos;
45 }
46 else
47 {
48 return this.m_pos;
49 }
82 } 50 }
83 set 51 set
84 { 52 {
85 base.Pos = value; 53 this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position
86 } 54 }
87 }
88 #endregion
89 55
90 /// <summary>
91 ///
92 /// </summary>
93 /// <param name="clientThreads"></param>
94 /// <param name="regionHandle"></param>
95 /// <param name="world"></param>
96 public Primitive( ulong regionHandle, Scene world)
97 {
98 // m_clientThreads = clientThreads;
99 m_regionHandle = regionHandle;
100 m_world = world;
101 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
102 } 56 }
103 57
104 /// <summary> 58 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject)
105 ///
106 /// </summary>
107 /// <param name="regionHandle"></param>
108 /// <param name="world"></param>
109 /// <param name="addPacket"></param>
110 /// <param name="ownerID"></param>
111 /// <param name="localID"></param>
112 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
113 { 59 {
114 // m_clientThreads = clientThreads;
115 m_regionHandle = regionHandle; 60 m_regionHandle = regionHandle;
116 m_world = world; 61 m_world = world;
117 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 62 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
63 this.m_Parent = parent;
64 this.isRootPrim = isRoot;
65 this.m_RootParent = rootObject;
118 this.CreateFromPacket(addPacket, ownerID, localID); 66 this.CreateFromPacket(addPacket, ownerID, localID);
119 } 67 }
120 68
121 /// <summary> 69 /// <summary>
122 /// 70 ///
123 /// </summary> 71 /// </summary>
124 /// <param name="clientThreads"></param> 72 public override void update()
125 /// <param name="regionHandle"></param>
126 /// <param name="world"></param>
127 /// <param name="owner"></param>
128 /// <param name="fullID"></param>
129 /// <param name="localID"></param>
130 public Primitive( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID)
131 {
132 // m_clientThreads = clientThreads;
133 m_regionHandle = regionHandle;
134 m_world = world;
135 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
136 this.primData = new PrimData();
137 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
138 this.primData.OwnerID = owner;
139 this.primData.FullID = this.uuid = fullID;
140 this.primData.LocalID = m_localId = localID;
141 }
142
143 /// <summary>
144 /// Constructor to create a default cube
145 /// </summary>
146 /// <param name="clientThreads"></param>
147 /// <param name="regionHandle"></param>
148 /// <param name="world"></param>
149 /// <param name="owner"></param>
150 /// <param name="localID"></param>
151 /// <param name="position"></param>
152 public Primitive( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position)
153 {
154 //m_clientThreads = clientThreads;
155 m_regionHandle = regionHandle;
156 m_world = world;
157 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
158 this.primData = PrimData.DefaultCube();
159 this.primData.OwnerID = owner;
160 this.primData.LocalID = m_localId = localID;
161 this.Pos = this.primData.Position = position;
162
163 this.updateFlag = 1;
164 }
165
166 /// <summary>
167 ///
168 /// </summary>
169 /// <returns></returns>
170 public byte[] GetByteArray()
171 {
172 byte[] result = null;
173 List<byte[]> dataArrays = new List<byte[]>();
174 dataArrays.Add(primData.ToBytes());
175 foreach (Entity child in children)
176 {
177 if (child is OpenSim.Region.Environment.Scenes.Primitive)
178 {
179 dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray());
180 }
181 }
182 byte[] primstart = Helpers.StringToField("<Prim>");
183 byte[] primend = Helpers.StringToField("</Prim>");
184 int totalLength = primstart.Length + primend.Length;
185 for (int i = 0; i < dataArrays.Count; i++)
186 {
187 totalLength += dataArrays[i].Length;
188 }
189
190 result = new byte[totalLength];
191 int arraypos = 0;
192 Array.Copy(primstart, 0, result, 0, primstart.Length);
193 arraypos += primstart.Length;
194 for (int i = 0; i < dataArrays.Count; i++)
195 {
196 Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length);
197 arraypos += dataArrays[i].Length;
198 }
199 Array.Copy(primend, 0, result, arraypos, primend.Length);
200
201 return result;
202 }
203
204 #region Overridden Methods
205
206 /// <summary>
207 ///
208 /// </summary>
209 public override void update()
210 { 73 {
211 if (this.updateFlag == 1) // is a new prim just been created/reloaded 74 if (this.updateFlag == 1) // is a new prim just been created/reloaded
212 { 75 {
@@ -218,112 +81,53 @@ namespace OpenSim.Region.Environment.Scenes
218 this.SendTerseUpdateToALLClients(); 81 this.SendTerseUpdateToALLClients();
219 this.updateFlag = 0; 82 this.updateFlag = 0;
220 } 83 }
221 }
222
223 /// <summary>
224 ///
225 /// </summary>
226 public override void BackUp()
227 {
228 84
229 } 85 base.update();
230
231 #endregion
232
233 #region Packet handlers
234
235 /// <summary>
236 ///
237 /// </summary>
238 /// <param name="pos"></param>
239 public void UpdatePosition(LLVector3 pos)
240 {
241 this.Pos = new LLVector3(pos.X, pos.Y, pos.Z);
242 this.updateFlag = 2;
243 } 86 }
244 87
245 /// <summary> 88 /// <summary>
246 /// 89 ///
247 /// </summary> 90 /// </summary>
248 /// <param name="addPacket"></param> 91 /// <param name="addPacket"></param>
249 public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) 92 /// <param name="ownerID"></param>
250 { 93 /// <param name="localID"></param>
251 this.primData.PathBegin = updatePacket.PathBegin; 94 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
252 this.primData.PathEnd = updatePacket.PathEnd;
253 this.primData.PathScaleX = updatePacket.PathScaleX;
254 this.primData.PathScaleY = updatePacket.PathScaleY;
255 this.primData.PathShearX = updatePacket.PathShearX;
256 this.primData.PathShearY = updatePacket.PathShearY;
257 this.primData.PathSkew = updatePacket.PathSkew;
258 this.primData.ProfileBegin = updatePacket.ProfileBegin;
259 this.primData.ProfileEnd = updatePacket.ProfileEnd;
260 this.primData.PathCurve = updatePacket.PathCurve;
261 this.primData.ProfileCurve = updatePacket.ProfileCurve;
262 this.primData.ProfileHollow = updatePacket.ProfileHollow;
263 this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset;
264 this.primData.PathRevolutions = updatePacket.PathRevolutions;
265 this.primData.PathTaperX = updatePacket.PathTaperX;
266 this.primData.PathTaperY = updatePacket.PathTaperY;
267 this.primData.PathTwist = updatePacket.PathTwist;
268 this.primData.PathTwistBegin = updatePacket.PathTwistBegin;
269 }
270
271 /// <summary>
272 ///
273 /// </summary>
274 /// <param name="tex"></param>
275 public void UpdateTexture(byte[] tex)
276 {
277 this.primData.TextureEntry = tex;
278 }
279
280 /// <summary>
281 ///
282 /// </summary>
283 /// <param name="pack"></param>
284 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
285 {
286
287 }
288
289 /// <summary>
290 ///
291 /// </summary>
292 /// <param name="prim"></param>
293 public void AssignToParent(Primitive prim)
294 {
295
296 }
297
298 #endregion
299
300 # region Inventory Methods
301 /// <summary>
302 ///
303 /// </summary>
304 /// <param name="item"></param>
305 /// <returns></returns>
306 public bool AddToInventory(InventoryItem item)
307 { 95 {
308 return false; 96 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
309 } 97 this.OwnerID = ownerID;
98 this.Pos = addPacket.ObjectData.RayEnd;
99 this.uuid = LLUUID.Random();
100 this.m_localId = (uint)(localID);
101
102 PrimitiveBaseShape pShape = new PrimitiveBaseShape();
103 this.m_Shape = pShape;
104
105 pShape.PCode = addPacket.ObjectData.PCode;
106 pShape.PathBegin = addPacket.ObjectData.PathBegin;
107 pShape.PathEnd = addPacket.ObjectData.PathEnd;
108 pShape.PathScaleX = addPacket.ObjectData.PathScaleX;
109 pShape.PathScaleY = addPacket.ObjectData.PathScaleY;
110 pShape.PathShearX = addPacket.ObjectData.PathShearX;
111 pShape.PathShearY = addPacket.ObjectData.PathShearY;
112 pShape.PathSkew = addPacket.ObjectData.PathSkew;
113 pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
114 pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
115 pShape.Scale = addPacket.ObjectData.Scale;
116 pShape.PathCurve = addPacket.ObjectData.PathCurve;
117 pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
118 pShape.ParentID = 0;
119 pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
120 pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
121 pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
122 pShape.PathTaperX = addPacket.ObjectData.PathTaperX;
123 pShape.PathTaperY = addPacket.ObjectData.PathTaperY;
124 pShape.PathTwist = addPacket.ObjectData.PathTwist;
125 pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
310 126
311 /// <summary> 127 this.updateFlag = 1;
312 ///
313 /// </summary>
314 /// <param name="itemID"></param>
315 /// <returns></returns>
316 public InventoryItem RemoveFromInventory(LLUUID itemID)
317 {
318 return null;
319 } 128 }
320 129
321 /// <summary> 130 public void AddToChildren(SceneObject linkObject)
322 ///
323 /// </summary>
324 /// <param name="simClient"></param>
325 /// <param name="packet"></param>
326 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet)
327 { 131 {
328 132
329 } 133 }
@@ -331,53 +135,19 @@ namespace OpenSim.Region.Environment.Scenes
331 /// <summary> 135 /// <summary>
332 /// 136 ///
333 /// </summary> 137 /// </summary>
334 /// <param name="simClient"></param> 138 /// <param name="pos"></param>
335 /// <param name="xferID"></param> 139 public void UpdatePosition(LLVector3 pos)
336 public void RequestXferInventory(IClientAPI simClient, ulong xferID)
337 {
338 //will only currently work if the total size of the inventory data array is under about 1000 bytes
339 SendXferPacketPacket send = new SendXferPacketPacket();
340
341 send.XferID.ID = xferID;
342 send.XferID.Packet = 1 + 2147483648;
343 send.DataPacket.Data = this.ConvertInventoryToBytes();
344
345 simClient.OutPacket(send);
346 }
347
348 /// <summary>
349 ///
350 /// </summary>
351 /// <returns></returns>
352 public byte[] ConvertInventoryToBytes()
353 { 140 {
354 System.Text.Encoding enc = System.Text.Encoding.ASCII; 141 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
355 byte[] result = new byte[0]; 142 if (this.isRootPrim)
356 List<byte[]> inventoryData = new List<byte[]>();
357 int totallength = 0;
358 foreach (InventoryItem invItem in inventoryItems.Values)
359 { 143 {
360 byte[] data = enc.GetBytes(invItem.ExportString()); 144 this.m_Parent.Pos = newPos;
361 inventoryData.Add(data);
362 totallength += data.Length;
363 } 145 }
364 //TODO: copy arrays into the single result array 146 this.Pos = newPos;
365 147 this.updateFlag = 2;
366 return result;
367 }
368
369 /// <summary>
370 ///
371 /// </summary>
372 /// <param name="data"></param>
373 public void CreateInventoryFromBytes(byte[] data)
374 {
375
376 } 148 }
377 149
378 #endregion 150 #region Client Update Methods
379
380 #region Update viewers Methods
381 151
382 /// <summary> 152 /// <summary>
383 /// 153 ///
@@ -402,17 +172,9 @@ namespace OpenSim.Region.Environment.Scenes
402 public void SendFullUpdateToClient(IClientAPI remoteClient) 172 public void SendFullUpdateToClient(IClientAPI remoteClient)
403 { 173 {
404 LLVector3 lPos; 174 LLVector3 lPos;
405 if (this._physActor != null && this.physicsEnabled) 175 lPos = this.Pos;
406 {
407 PhysicsVector pPos = this._physActor.Position;
408 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
409 }
410 else
411 {
412 lPos = this.Pos;
413 }
414 176
415 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); 177 remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID);
416 } 178 }
417 179
418 /// <summary> 180 /// <summary>
@@ -430,22 +192,31 @@ namespace OpenSim.Region.Environment.Scenes
430 /// <summary> 192 /// <summary>
431 /// 193 ///
432 /// </summary> 194 /// </summary>
195 /// <param name="remoteClient"></param>
196 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
197 {
198 this.SendTerseUpdateToClient(remoteClient);
199 for (int i = 0; i < this.children.Count; i++)
200 {
201 if (this.children[i] is Primitive)
202 {
203 ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient);
204 }
205 }
206 }
207
208 /// <summary>
209 ///
210 /// </summary>
433 /// <param name="RemoteClient"></param> 211 /// <param name="RemoteClient"></param>
434 public void SendTerseUpdateToClient(IClientAPI RemoteClient) 212 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
435 { 213 {
436 LLVector3 lPos; 214 LLVector3 lPos;
437 Axiom.MathLib.Quaternion lRot; 215 Axiom.MathLib.Quaternion lRot;
438 if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? 216
439 { 217 lPos = this.Pos;
440 PhysicsVector pPos = this._physActor.Position; 218 lRot = this.rotation;
441 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); 219
442 lRot = this._physActor.Orientation;
443 }
444 else
445 {
446 lPos = this.Pos;
447 lRot = this.rotation;
448 }
449 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); 220 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
450 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); 221 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot);
451 } 222 }
@@ -463,120 +234,5 @@ namespace OpenSim.Region.Environment.Scenes
463 } 234 }
464 235
465 #endregion 236 #endregion
466
467 #region Create Methods
468
469 /// <summary>
470 ///
471 /// </summary>
472 /// <param name="addPacket"></param>
473 /// <param name="ownerID"></param>
474 /// <param name="localID"></param>
475 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
476 {
477 PrimData PData = new PrimData();
478 this.primData = PData;
479 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
480
481 PData.OwnerID = ownerID;
482 PData.PCode = addPacket.ObjectData.PCode;
483 PData.PathBegin = addPacket.ObjectData.PathBegin;
484 PData.PathEnd = addPacket.ObjectData.PathEnd;
485 PData.PathScaleX = addPacket.ObjectData.PathScaleX;
486 PData.PathScaleY = addPacket.ObjectData.PathScaleY;
487 PData.PathShearX = addPacket.ObjectData.PathShearX;
488 PData.PathShearY = addPacket.ObjectData.PathShearY;
489 PData.PathSkew = addPacket.ObjectData.PathSkew;
490 PData.ProfileBegin = addPacket.ObjectData.ProfileBegin;
491 PData.ProfileEnd = addPacket.ObjectData.ProfileEnd;
492 PData.Scale = addPacket.ObjectData.Scale;
493 PData.PathCurve = addPacket.ObjectData.PathCurve;
494 PData.ProfileCurve = addPacket.ObjectData.ProfileCurve;
495 PData.ParentID = 0;
496 PData.ProfileHollow = addPacket.ObjectData.ProfileHollow;
497 PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
498 PData.PathRevolutions = addPacket.ObjectData.PathRevolutions;
499 PData.PathTaperX = addPacket.ObjectData.PathTaperX;
500 PData.PathTaperY = addPacket.ObjectData.PathTaperY;
501 PData.PathTwist = addPacket.ObjectData.PathTwist;
502 PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
503 LLVector3 pos1 = addPacket.ObjectData.RayEnd;
504 this.primData.FullID = this.uuid = LLUUID.Random();
505 this.primData.LocalID = m_localId = (uint)(localID);
506 this.primData.Position = this.Pos = pos1;
507
508 this.updateFlag = 1;
509 }
510
511 /// <summary>
512 ///
513 /// </summary>
514 /// <param name="data"></param>
515 public void CreateFromBytes(byte[] data)
516 {
517
518 }
519
520 /// <summary>
521 ///
522 /// </summary>
523 /// <param name="primData"></param>
524 public void CreateFromPrimData(PrimData primData)
525 {
526 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
527 }
528
529 /// <summary>
530 ///
531 /// </summary>
532 /// <param name="primData"></param>
533 /// <param name="posi"></param>
534 /// <param name="localID"></param>
535 /// <param name="newprim"></param>
536 public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
537 {
538
539 }
540
541 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
542 {
543 // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z);
544 this.Pos = pos;
545 this.SendTerseUpdateToALLClients();
546 }
547
548 public void GetProperites(IClientAPI client)
549 {
550 //needs changing
551 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
552 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
553 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
554 proper.ObjectData[0].ItemID = LLUUID.Zero;
555 proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate;
556 proper.ObjectData[0].CreatorID = primData.OwnerID;
557 proper.ObjectData[0].FolderID = LLUUID.Zero;
558 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
559 proper.ObjectData[0].GroupID = LLUUID.Zero;
560 proper.ObjectData[0].InventorySerial = 0;
561 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
562 proper.ObjectData[0].ObjectID = this.uuid;
563 proper.ObjectData[0].OwnerID = primData.OwnerID;
564 proper.ObjectData[0].TouchName = new byte[0];
565 proper.ObjectData[0].TextureID = new byte[0];
566 proper.ObjectData[0].SitName = new byte[0];
567 proper.ObjectData[0].Name = new byte[0];
568 proper.ObjectData[0].Description = new byte[0];
569 proper.ObjectData[0].OwnerMask = primData.OwnerMask;
570 proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask;
571 proper.ObjectData[0].GroupMask = primData.GroupMask;
572 proper.ObjectData[0].EveryoneMask = primData.EveryoneMask;
573 proper.ObjectData[0].BaseMask = primData.BaseMask;
574
575 client.OutPacket(proper);
576
577 }
578
579 #endregion
580
581 } 237 }
582} 238}
diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs
new file mode 100644
index 0000000..d703857
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs
@@ -0,0 +1,582 @@
1
2/*
3* Copyright (c) Contributors, http://www.openmetaverse.org/
4* See CONTRIBUTORS.TXT for a full list of copyright holders.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the OpenSim Project nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
18* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*
28*/
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33using libsecondlife.Packets;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Physics.Manager;
36using OpenSim.Framework.Types;
37using OpenSim.Framework.Inventory;
38
39namespace OpenSim.Region.Environment.Scenes
40{
41 public class PrimitiveOld : Entity
42 {
43 internal PrimData primData;
44 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
45 // private Dictionary<uint, IClientAPI> m_clientThreads;
46 private ulong m_regionHandle;
47 private const uint FULL_MASK_PERMISSIONS = 2147483647;
48 private bool physicsEnabled = false;
49 private byte updateFlag = 0;
50 private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
51
52 private Dictionary<LLUUID, InventoryItem> inventoryItems;
53
54 #region Properties
55
56 public LLVector3 Scale
57 {
58 set
59 {
60 this.primData.Scale = value;
61 //this.dirtyFlag = true;
62 }
63 get
64 {
65 return this.primData.Scale;
66 }
67 }
68
69 public PhysicsActor PhysActor
70 {
71 set
72 {
73 this._physActor = value;
74 }
75 }
76
77 public override LLVector3 Pos
78 {
79 get
80 {
81 return base.Pos;
82 }
83 set
84 {
85 base.Pos = value;
86 }
87 }
88 #endregion
89
90 /// <summary>
91 ///
92 /// </summary>
93 /// <param name="clientThreads"></param>
94 /// <param name="regionHandle"></param>
95 /// <param name="world"></param>
96 public PrimitiveOld( ulong regionHandle, Scene world)
97 {
98 // m_clientThreads = clientThreads;
99 m_regionHandle = regionHandle;
100 m_world = world;
101 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
102 }
103
104 /// <summary>
105 ///
106 /// </summary>
107 /// <param name="regionHandle"></param>
108 /// <param name="world"></param>
109 /// <param name="addPacket"></param>
110 /// <param name="ownerID"></param>
111 /// <param name="localID"></param>
112 public PrimitiveOld(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
113 {
114 // m_clientThreads = clientThreads;
115 m_regionHandle = regionHandle;
116 m_world = world;
117 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
118 this.CreateFromPacket(addPacket, ownerID, localID);
119 }
120
121 /// <summary>
122 ///
123 /// </summary>
124 /// <param name="clientThreads"></param>
125 /// <param name="regionHandle"></param>
126 /// <param name="world"></param>
127 /// <param name="owner"></param>
128 /// <param name="fullID"></param>
129 /// <param name="localID"></param>
130 public PrimitiveOld( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID)
131 {
132 // m_clientThreads = clientThreads;
133 m_regionHandle = regionHandle;
134 m_world = world;
135 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
136 this.primData = new PrimData();
137 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
138 this.primData.OwnerID = owner;
139 this.primData.FullID = this.uuid = fullID;
140 this.primData.LocalID = m_localId = localID;
141 }
142
143 /// <summary>
144 /// Constructor to create a default cube
145 /// </summary>
146 /// <param name="clientThreads"></param>
147 /// <param name="regionHandle"></param>
148 /// <param name="world"></param>
149 /// <param name="owner"></param>
150 /// <param name="localID"></param>
151 /// <param name="position"></param>
152 public PrimitiveOld( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position)
153 {
154 //m_clientThreads = clientThreads;
155 m_regionHandle = regionHandle;
156 m_world = world;
157 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
158 this.primData = PrimData.DefaultCube();
159 this.primData.OwnerID = owner;
160 this.primData.LocalID = m_localId = localID;
161 this.Pos = this.primData.Position = position;
162
163 this.updateFlag = 1;
164 }
165
166 /// <summary>
167 ///
168 /// </summary>
169 /// <returns></returns>
170 public byte[] GetByteArray()
171 {
172 byte[] result = null;
173 List<byte[]> dataArrays = new List<byte[]>();
174 dataArrays.Add(primData.ToBytes());
175 foreach (Entity child in children)
176 {
177 if (child is OpenSim.Region.Environment.Scenes.PrimitiveOld)
178 {
179 dataArrays.Add(((OpenSim.Region.Environment.Scenes.PrimitiveOld)child).GetByteArray());
180 }
181 }
182 byte[] primstart = Helpers.StringToField("<Prim>");
183 byte[] primend = Helpers.StringToField("</Prim>");
184 int totalLength = primstart.Length + primend.Length;
185 for (int i = 0; i < dataArrays.Count; i++)
186 {
187 totalLength += dataArrays[i].Length;
188 }
189
190 result = new byte[totalLength];
191 int arraypos = 0;
192 Array.Copy(primstart, 0, result, 0, primstart.Length);
193 arraypos += primstart.Length;
194 for (int i = 0; i < dataArrays.Count; i++)
195 {
196 Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length);
197 arraypos += dataArrays[i].Length;
198 }
199 Array.Copy(primend, 0, result, arraypos, primend.Length);
200
201 return result;
202 }
203
204 #region Overridden Methods
205
206 /// <summary>
207 ///
208 /// </summary>
209 public override void update()
210 {
211 if (this.updateFlag == 1) // is a new prim just been created/reloaded
212 {
213 this.SendFullUpdateToAllClients();
214 this.updateFlag = 0;
215 }
216 if (this.updateFlag == 2) //some change has been made so update the clients
217 {
218 this.SendTerseUpdateToALLClients();
219 this.updateFlag = 0;
220 }
221 }
222
223 /// <summary>
224 ///
225 /// </summary>
226 public override void BackUp()
227 {
228
229 }
230
231 #endregion
232
233 #region Packet handlers
234
235 /// <summary>
236 ///
237 /// </summary>
238 /// <param name="pos"></param>
239 public void UpdatePosition(LLVector3 pos)
240 {
241 this.Pos = new LLVector3(pos.X, pos.Y, pos.Z);
242 this.updateFlag = 2;
243 }
244
245 /// <summary>
246 ///
247 /// </summary>
248 /// <param name="addPacket"></param>
249 public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket)
250 {
251 this.primData.PathBegin = updatePacket.PathBegin;
252 this.primData.PathEnd = updatePacket.PathEnd;
253 this.primData.PathScaleX = updatePacket.PathScaleX;
254 this.primData.PathScaleY = updatePacket.PathScaleY;
255 this.primData.PathShearX = updatePacket.PathShearX;
256 this.primData.PathShearY = updatePacket.PathShearY;
257 this.primData.PathSkew = updatePacket.PathSkew;
258 this.primData.ProfileBegin = updatePacket.ProfileBegin;
259 this.primData.ProfileEnd = updatePacket.ProfileEnd;
260 this.primData.PathCurve = updatePacket.PathCurve;
261 this.primData.ProfileCurve = updatePacket.ProfileCurve;
262 this.primData.ProfileHollow = updatePacket.ProfileHollow;
263 this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset;
264 this.primData.PathRevolutions = updatePacket.PathRevolutions;
265 this.primData.PathTaperX = updatePacket.PathTaperX;
266 this.primData.PathTaperY = updatePacket.PathTaperY;
267 this.primData.PathTwist = updatePacket.PathTwist;
268 this.primData.PathTwistBegin = updatePacket.PathTwistBegin;
269 }
270
271 /// <summary>
272 ///
273 /// </summary>
274 /// <param name="tex"></param>
275 public void UpdateTexture(byte[] tex)
276 {
277 this.primData.TextureEntry = tex;
278 }
279
280 /// <summary>
281 ///
282 /// </summary>
283 /// <param name="pack"></param>
284 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
285 {
286
287 }
288
289 /// <summary>
290 ///
291 /// </summary>
292 /// <param name="prim"></param>
293 public void AssignToParent(PrimitiveOld prim)
294 {
295
296 }
297
298 #endregion
299
300 # region Inventory Methods
301 /// <summary>
302 ///
303 /// </summary>
304 /// <param name="item"></param>
305 /// <returns></returns>
306 public bool AddToInventory(InventoryItem item)
307 {
308 return false;
309 }
310
311 /// <summary>
312 ///
313 /// </summary>
314 /// <param name="itemID"></param>
315 /// <returns></returns>
316 public InventoryItem RemoveFromInventory(LLUUID itemID)
317 {
318 return null;
319 }
320
321 /// <summary>
322 ///
323 /// </summary>
324 /// <param name="simClient"></param>
325 /// <param name="packet"></param>
326 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet)
327 {
328
329 }
330
331 /// <summary>
332 ///
333 /// </summary>
334 /// <param name="simClient"></param>
335 /// <param name="xferID"></param>
336 public void RequestXferInventory(IClientAPI simClient, ulong xferID)
337 {
338 //will only currently work if the total size of the inventory data array is under about 1000 bytes
339 SendXferPacketPacket send = new SendXferPacketPacket();
340
341 send.XferID.ID = xferID;
342 send.XferID.Packet = 1 + 2147483648;
343 send.DataPacket.Data = this.ConvertInventoryToBytes();
344
345 simClient.OutPacket(send);
346 }
347
348 /// <summary>
349 ///
350 /// </summary>
351 /// <returns></returns>
352 public byte[] ConvertInventoryToBytes()
353 {
354 System.Text.Encoding enc = System.Text.Encoding.ASCII;
355 byte[] result = new byte[0];
356 List<byte[]> inventoryData = new List<byte[]>();
357 int totallength = 0;
358 foreach (InventoryItem invItem in inventoryItems.Values)
359 {
360 byte[] data = enc.GetBytes(invItem.ExportString());
361 inventoryData.Add(data);
362 totallength += data.Length;
363 }
364 //TODO: copy arrays into the single result array
365
366 return result;
367 }
368
369 /// <summary>
370 ///
371 /// </summary>
372 /// <param name="data"></param>
373 public void CreateInventoryFromBytes(byte[] data)
374 {
375
376 }
377
378 #endregion
379
380 #region Update viewers Methods
381
382 /// <summary>
383 ///
384 /// </summary>
385 /// <param name="remoteClient"></param>
386 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
387 {
388 this.SendFullUpdateToClient(remoteClient);
389 for (int i = 0; i < this.children.Count; i++)
390 {
391 if (this.children[i] is PrimitiveOld)
392 {
393 ((PrimitiveOld)this.children[i]).SendFullUpdateForAllChildren(remoteClient);
394 }
395 }
396 }
397
398 /// <summary>
399 ///
400 /// </summary>
401 /// <param name="remoteClient"></param>
402 public void SendFullUpdateToClient(IClientAPI remoteClient)
403 {
404 LLVector3 lPos;
405 if (this._physActor != null && this.physicsEnabled)
406 {
407 PhysicsVector pPos = this._physActor.Position;
408 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
409 }
410 else
411 {
412 lPos = this.Pos;
413 }
414
415 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags);
416 }
417
418 /// <summary>
419 ///
420 /// </summary>
421 public void SendFullUpdateToAllClients()
422 {
423 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
424 for (int i = 0; i < avatars.Count; i++)
425 {
426 this.SendFullUpdateToClient(avatars[i].ControllingClient);
427 }
428 }
429
430 /// <summary>
431 ///
432 /// </summary>
433 /// <param name="RemoteClient"></param>
434 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
435 {
436 LLVector3 lPos;
437 Axiom.MathLib.Quaternion lRot;
438 if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us?
439 {
440 PhysicsVector pPos = this._physActor.Position;
441 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
442 lRot = this._physActor.Orientation;
443 }
444 else
445 {
446 lPos = this.Pos;
447 lRot = this.rotation;
448 }
449 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
450 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot);
451 }
452
453 /// <summary>
454 ///
455 /// </summary>
456 public void SendTerseUpdateToALLClients()
457 {
458 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
459 for (int i = 0; i < avatars.Count; i++)
460 {
461 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
462 }
463 }
464
465 #endregion
466
467 #region Create Methods
468
469 /// <summary>
470 ///
471 /// </summary>
472 /// <param name="addPacket"></param>
473 /// <param name="ownerID"></param>
474 /// <param name="localID"></param>
475 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
476 {
477 PrimData PData = new PrimData();
478 this.primData = PData;
479 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
480
481 PData.OwnerID = ownerID;
482 PData.PCode = addPacket.ObjectData.PCode;
483 PData.PathBegin = addPacket.ObjectData.PathBegin;
484 PData.PathEnd = addPacket.ObjectData.PathEnd;
485 PData.PathScaleX = addPacket.ObjectData.PathScaleX;
486 PData.PathScaleY = addPacket.ObjectData.PathScaleY;
487 PData.PathShearX = addPacket.ObjectData.PathShearX;
488 PData.PathShearY = addPacket.ObjectData.PathShearY;
489 PData.PathSkew = addPacket.ObjectData.PathSkew;
490 PData.ProfileBegin = addPacket.ObjectData.ProfileBegin;
491 PData.ProfileEnd = addPacket.ObjectData.ProfileEnd;
492 PData.Scale = addPacket.ObjectData.Scale;
493 PData.PathCurve = addPacket.ObjectData.PathCurve;
494 PData.ProfileCurve = addPacket.ObjectData.ProfileCurve;
495 PData.ParentID = 0;
496 PData.ProfileHollow = addPacket.ObjectData.ProfileHollow;
497 PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
498 PData.PathRevolutions = addPacket.ObjectData.PathRevolutions;
499 PData.PathTaperX = addPacket.ObjectData.PathTaperX;
500 PData.PathTaperY = addPacket.ObjectData.PathTaperY;
501 PData.PathTwist = addPacket.ObjectData.PathTwist;
502 PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
503 LLVector3 pos1 = addPacket.ObjectData.RayEnd;
504 this.primData.FullID = this.uuid = LLUUID.Random();
505 this.primData.LocalID = m_localId = (uint)(localID);
506 this.primData.Position = this.Pos = pos1;
507
508 this.updateFlag = 1;
509 }
510
511 /// <summary>
512 ///
513 /// </summary>
514 /// <param name="data"></param>
515 public void CreateFromBytes(byte[] data)
516 {
517
518 }
519
520 /// <summary>
521 ///
522 /// </summary>
523 /// <param name="primData"></param>
524 public void CreateFromPrimData(PrimData primData)
525 {
526 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
527 }
528
529 /// <summary>
530 ///
531 /// </summary>
532 /// <param name="primData"></param>
533 /// <param name="posi"></param>
534 /// <param name="localID"></param>
535 /// <param name="newprim"></param>
536 public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
537 {
538
539 }
540
541 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
542 {
543 // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z);
544 this.Pos = pos;
545 this.SendTerseUpdateToALLClients();
546 }
547
548 public void GetProperites(IClientAPI client)
549 {
550 //needs changing
551 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
552 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
553 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
554 proper.ObjectData[0].ItemID = LLUUID.Zero;
555 proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate;
556 proper.ObjectData[0].CreatorID = primData.OwnerID;
557 proper.ObjectData[0].FolderID = LLUUID.Zero;
558 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
559 proper.ObjectData[0].GroupID = LLUUID.Zero;
560 proper.ObjectData[0].InventorySerial = 0;
561 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
562 proper.ObjectData[0].ObjectID = this.uuid;
563 proper.ObjectData[0].OwnerID = primData.OwnerID;
564 proper.ObjectData[0].TouchName = new byte[0];
565 proper.ObjectData[0].TextureID = new byte[0];
566 proper.ObjectData[0].SitName = new byte[0];
567 proper.ObjectData[0].Name = new byte[0];
568 proper.ObjectData[0].Description = new byte[0];
569 proper.ObjectData[0].OwnerMask = primData.OwnerMask;
570 proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask;
571 proper.ObjectData[0].GroupMask = primData.GroupMask;
572 proper.ObjectData[0].EveryoneMask = primData.EveryoneMask;
573 proper.ObjectData[0].BaseMask = primData.BaseMask;
574
575 client.OutPacket(proper);
576
577 }
578
579 #endregion
580
581 }
582}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 1d55c4d..f3d461a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -214,12 +214,16 @@ namespace OpenSim.Region.Environment.Scenes
214 /// <param name="remoteClient"></param> 214 /// <param name="remoteClient"></param>
215 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 215 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
216 { 216 {
217 foreach (Entity ent in Entities.Values) 217 Console.WriteLine("prim selected :" + primLocalID);
218 foreach (EntityBase ent in Entities.Values)
218 { 219 {
219 if (ent.LocalId == primLocalID) 220 if (ent is SceneObject)
220 { 221 {
221 ((OpenSim.Region.Environment.Scenes.Primitive)ent).GetProperites(remoteClient); 222 if (((SceneObject)ent).rootLocalID == primLocalID)
222 break; 223 {
224 ((OpenSim.Region.Environment.Scenes.SceneObject)ent).GetProperites(remoteClient);
225 break;
226 }
223 } 227 }
224 } 228 }
225 } 229 }
@@ -228,7 +232,7 @@ namespace OpenSim.Region.Environment.Scenes
228 { 232 {
229 if (this.Entities.ContainsKey(objectID)) 233 if (this.Entities.ContainsKey(objectID))
230 { 234 {
231 ((Primitive)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); 235 ((PrimitiveOld)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
232 } 236 }
233 } 237 }
234 238
@@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
266 { 270 {
267 if (ent.LocalId == localID) 271 if (ent.LocalId == localID)
268 { 272 {
269 ((OpenSim.Region.Environment.Scenes.Primitive)ent).UpdatePosition(pos); 273 ((OpenSim.Region.Environment.Scenes.PrimitiveOld)ent).UpdatePosition(pos);
270 break; 274 break;
271 } 275 }
272 } 276 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index dbf385d..2ff3976 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -63,12 +63,12 @@ namespace OpenSim.Region.Environment.Scenes
63 private uint _primCount = 702000; 63 private uint _primCount = 702000;
64 private int storageCount; 64 private int storageCount;
65 private Mutex updateLock; 65 private Mutex updateLock;
66 66
67 protected AuthenticateSessionsBase authenticateHandler; 67 protected AuthenticateSessionsBase authenticateHandler;
68 protected RegionCommsListener regionCommsHost; 68 protected RegionCommsListener regionCommsHost;
69 protected CommunicationsManager commsManager; 69 protected CommunicationsManager commsManager;
70 70
71 protected Dictionary<LLUUID,Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); 71 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>();
72 protected BaseHttpServer httpListener; 72 protected BaseHttpServer httpListener;
73 73
74 public ParcelManager parcelManager; 74 public ParcelManager parcelManager;
@@ -121,21 +121,21 @@ namespace OpenSim.Region.Environment.Scenes
121 scriptManager = new ScriptManager(this); 121 scriptManager = new ScriptManager(this);
122 eventManager = new EventManager(); 122 eventManager = new EventManager();
123 123
124 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); 124 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance");
125 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 125 Entities = new Dictionary<libsecondlife.LLUUID, EntityBase>();
126 Avatars = new Dictionary<LLUUID, ScenePresence>(); 126 Avatars = new Dictionary<LLUUID, ScenePresence>();
127 Prims = new Dictionary<LLUUID, Primitive>(); 127 Prims = new Dictionary<LLUUID, Primitive>();
128 128
129 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); 129 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap");
130 Terrain = new TerrainEngine(); 130 Terrain = new TerrainEngine();
131 131
132 ScenePresence.LoadAnims(); 132 ScenePresence.LoadAnims();
133 this.httpListener = httpServer; 133 this.httpListener = httpServer;
134 134
135 } 135 }
136 catch (Exception e) 136 catch (Exception e)
137 { 137 {
138 OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); 138 OpenSim.Framework.Console.MainLog.Instance.Error("World.cs: Constructor failed with exception " + e.ToString());
139 } 139 }
140 } 140 }
141 #endregion 141 #endregion
@@ -218,49 +218,7 @@ namespace OpenSim.Region.Environment.Scenes
218 /// <returns></returns> 218 /// <returns></returns>
219 public bool Backup() 219 public bool Backup()
220 { 220 {
221 /* 221
222 try
223 {
224 // Terrain backup routines
225 if (Terrain.tainted > 0)
226 {
227 Terrain.tainted = 0;
228 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving.");
229 localStorage.SaveMap(Terrain.getHeights1D());
230 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics.");
231 lock (this.m_syncRoot)
232 {
233 phyScene.SetTerrain(Terrain.getHeights1D());
234 }
235 }
236
237 // Primitive backup routines
238 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives");
239 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
240 {
241 Entities[UUID].BackUp();
242 }
243
244 //Parcel backup routines
245 ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count];
246 int i = 0;
247 foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values)
248 {
249 parcels[i] = parcel.parcelData;
250 i++;
251 }
252 localStorage.SaveParcels(parcels);
253
254 // Backup successful
255 return true;
256 }
257 catch (Exception e)
258 {
259 // Backup failed
260 OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString());
261 return false;
262 }
263 */
264 return true; 222 return true;
265 } 223 }
266 #endregion 224 #endregion
@@ -432,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes
432 { 390 {
433 try 391 try
434 { 392 {
435 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); 393 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives");
436 this.localStorage.LoadPrimitives(this); 394 this.localStorage.LoadPrimitives(this);
437 } 395 }
438 catch (Exception e) 396 catch (Exception e)
@@ -469,13 +427,12 @@ namespace OpenSim.Region.Environment.Scenes
469 { 427 {
470 try 428 try
471 { 429 {
472 Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); 430 SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount);
473 431 this.Entities.Add(sceneOb.rootUUID, sceneOb);
474 this.Entities.Add(prim.uuid, prim);
475 this._primCount++; 432 this._primCount++;
476 433
477 // Trigger event for listeners 434 // Trigger event for listeners
478 eventManager.TriggerOnNewPrimitive(prim); 435 // eventManager.TriggerOnNewPrimitive(prim);
479 } 436 }
480 catch (Exception e) 437 catch (Exception e)
481 { 438 {
@@ -500,11 +457,11 @@ namespace OpenSim.Region.Environment.Scenes
500 client.OnChatFromViewer += this.SimChat; 457 client.OnChatFromViewer += this.SimChat;
501 client.OnRequestWearables += this.InformClientOfNeighbours; 458 client.OnRequestWearables += this.InformClientOfNeighbours;
502 client.OnAddPrim += this.AddNewPrim; 459 client.OnAddPrim += this.AddNewPrim;
503 client.OnUpdatePrimPosition += this.UpdatePrimPosition; 460 //client.OnUpdatePrimPosition += this.UpdatePrimPosition;
504 client.OnRequestMapBlocks += this.RequestMapBlocks; 461 client.OnRequestMapBlocks += this.RequestMapBlocks;
505 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 462 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
506 //remoteClient.OnObjectSelect += this.SelectPrim; 463 client.OnObjectSelect += this.SelectPrim;
507 client.OnGrapUpdate += this.MoveObject; 464 // client.OnGrapUpdate += this.MoveObject;
508 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 465 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
509 466
510 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 467 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
@@ -523,39 +480,39 @@ namespace OpenSim.Region.Environment.Scenes
523 { 480 {
524 ScenePresence newAvatar = null; 481 ScenePresence newAvatar = null;
525 482
526 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 483 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
527 newAvatar = new ScenePresence(client, this, this.m_regInfo); 484 newAvatar = new ScenePresence(client, this, this.m_regInfo);
528 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); 485 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world");
529 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); 486 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake ");
530 487
531 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); 488 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
532 lock (this.m_syncRoot) 489 lock (this.m_syncRoot)
490 {
491 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
492 }
493
494 lock (Entities)
495 {
496 if (!Entities.ContainsKey(client.AgentId))
533 { 497 {
534 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 498 this.Entities.Add(client.AgentId, newAvatar);
535 } 499 }
536 500 else
537 lock (Entities)
538 { 501 {
539 if (!Entities.ContainsKey(client.AgentId)) 502 Entities[client.AgentId] = newAvatar;
540 {
541 this.Entities.Add(client.AgentId, newAvatar);
542 }
543 else
544 {
545 Entities[client.AgentId] = newAvatar;
546 }
547 } 503 }
548 lock (Avatars) 504 }
505 lock (Avatars)
506 {
507 if (Avatars.ContainsKey(client.AgentId))
549 { 508 {
550 if (Avatars.ContainsKey(client.AgentId)) 509 Avatars[client.AgentId] = newAvatar;
551 {
552 Avatars[client.AgentId] = newAvatar;
553 }
554 else
555 {
556 this.Avatars.Add(client.AgentId, newAvatar);
557 }
558 } 510 }
511 else
512 {
513 this.Avatars.Add(client.AgentId, newAvatar);
514 }
515 }
559 } 516 }
560 517
561 518
@@ -634,7 +591,7 @@ namespace OpenSim.Region.Environment.Scenes
634 public void RegisterRegionWithComms() 591 public void RegisterRegionWithComms()
635 { 592 {
636 GridInfo gridSettings = new GridInfo(); 593 GridInfo gridSettings = new GridInfo();
637 this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); 594 this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings);
638 if (this.regionCommsHost != null) 595 if (this.regionCommsHost != null)
639 { 596 {
640 this.regionCommsHost.OnExpectUser += this.NewUserConnection; 597 this.regionCommsHost.OnExpectUser += this.NewUserConnection;
@@ -757,7 +714,9 @@ namespace OpenSim.Region.Environment.Scenes
757 agent.child = true; 714 agent.child = true;
758 this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); 715 this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
759 this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); 716 this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position);
717
760 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); 718 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4));
719
761 } 720 }
762 //remoteClient.SendTeleportCancel(); 721 //remoteClient.SendTeleportCancel();
763 } 722 }
@@ -771,7 +730,7 @@ namespace OpenSim.Region.Environment.Scenes
771 /// <param name="position"></param> 730 /// <param name="position"></param>
772 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) 731 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
773 { 732 {
774 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); 733 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
775 } 734 }
776 735
777 #endregion 736 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index e06acbd..00ab194 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 public abstract class SceneBase : IWorld 45 public abstract class SceneBase : IWorld
46 { 46 {
47 public Dictionary<libsecondlife.LLUUID, Entity> Entities; 47 public Dictionary<libsecondlife.LLUUID, EntityBase> Entities;
48 protected Dictionary<uint, IClientAPI> m_clientThreads; 48 protected Dictionary<uint, IClientAPI> m_clientThreads;
49 protected ulong m_regionHandle; 49 protected ulong m_regionHandle;
50 protected string m_regionName; 50 protected string m_regionName;
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index fa1bacb..ac887c0 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -15,7 +15,7 @@ namespace OpenSim.Region.Environment.Scenes
15 public delegate void OnNewPresenceDelegate(ScenePresence presence); 15 public delegate void OnNewPresenceDelegate(ScenePresence presence);
16 public event OnNewPresenceDelegate OnNewPresence; 16 public event OnNewPresenceDelegate OnNewPresence;
17 17
18 public delegate void OnNewPrimitiveDelegate(Primitive prim); 18 public delegate void OnNewPrimitiveDelegate(PrimitiveOld prim);
19 public event OnNewPrimitiveDelegate OnNewPrimitive; 19 public event OnNewPrimitiveDelegate OnNewPrimitive;
20 20
21 public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); 21 public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid);
@@ -29,7 +29,7 @@ namespace OpenSim.Region.Environment.Scenes
29 } 29 }
30 } 30 }
31 31
32 public void TriggerOnNewPrimitive(Primitive prim) 32 public void TriggerOnNewPrimitive(PrimitiveOld prim)
33 { 33 {
34 if (OnNewPrimitive != null) 34 if (OnNewPrimitive != null)
35 OnNewPrimitive(prim); 35 OnNewPrimitive(prim);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 88fb160..a228638 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -37,22 +37,46 @@ using OpenSim.Framework.Inventory;
37 37
38namespace OpenSim.Region.Environment.Scenes 38namespace OpenSim.Region.Environment.Scenes
39{ 39{
40 public class SceneObject : Entity 40 public class SceneObject : EntityBase
41 { 41 {
42 private LLUUID rootUUID; 42
43 //private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); 43 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
44 protected Primitive rootPrimitive; 44 protected Primitive rootPrimitive;
45 private Scene m_world; 45 private Scene m_world;
46 protected ulong regionHandle; 46 protected ulong m_regionHandle;
47 47
48 private bool physicsEnabled = false;
49 private PhysicsScene m_PhysScene;
50 private PhysicsActor m_PhysActor;
51
52 public LLUUID rootUUID
53 {
54 get
55 {
56 this.uuid = this.rootPrimitive.uuid;
57 return this.uuid;
58 }
59 }
60
61 public uint rootLocalID
62 {
63 get
64 {
65 this.m_localId = this.rootPrimitive.LocalId;
66 return this.LocalId;
67 }
68 }
48 /// <summary> 69 /// <summary>
49 /// 70 ///
50 /// </summary> 71 /// </summary>
51 public SceneObject() 72 public SceneObject(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
52 { 73 {
74 m_regionHandle = regionHandle;
75 m_world = world;
76 this.Pos = addPacket.ObjectData.RayEnd;
77 this.CreateFromPacket(addPacket, ownerID, localID);
53 78
54 } 79 }
55
56 /// <summary> 80 /// <summary>
57 /// 81 ///
58 /// </summary> 82 /// </summary>
@@ -61,7 +85,9 @@ namespace OpenSim.Region.Environment.Scenes
61 /// <param name="localID"></param> 85 /// <param name="localID"></param>
62 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) 86 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
63 { 87 {
64 this.rootPrimitive = new Primitive( this.regionHandle, this.m_world, addPacket, agentID, localID); 88 this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, addPacket, agentID, localID, true, this, this);
89 this.children.Add(rootPrimitive);
90 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
65 } 91 }
66 92
67 /// <summary> 93 /// <summary>
@@ -76,11 +102,19 @@ namespace OpenSim.Region.Environment.Scenes
76 /// <summary> 102 /// <summary>
77 /// 103 ///
78 /// </summary> 104 /// </summary>
79 public override void update() 105 /// <param name="primID"></param>
106 /// <returns></returns>
107 public Primitive HasChildPrim(LLUUID primID)
80 { 108 {
109 if (this.ChildPrimitives.ContainsKey(primID))
110 {
111 return this.ChildPrimitives[primID];
112 }
81 113
114 return null;
82 } 115 }
83 116
117
84 /// <summary> 118 /// <summary>
85 /// 119 ///
86 /// </summary> 120 /// </summary>
@@ -92,6 +126,18 @@ namespace OpenSim.Region.Environment.Scenes
92 /// <summary> 126 /// <summary>
93 /// 127 ///
94 /// </summary> 128 /// </summary>
129 /// <param name="offset"></param>
130 /// <param name="pos"></param>
131 /// <param name="remoteClient"></param>
132 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
133 {
134 this.Pos = pos;
135 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
136 }
137
138 /// <summary>
139 ///
140 /// </summary>
95 /// <param name="client"></param> 141 /// <param name="client"></param>
96 public void GetProperites(IClientAPI client) 142 public void GetProperites(IClientAPI client)
97 { 143 {
@@ -100,25 +146,25 @@ namespace OpenSim.Region.Environment.Scenes
100 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 146 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
101 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 147 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
102 proper.ObjectData[0].ItemID = LLUUID.Zero; 148 proper.ObjectData[0].ItemID = LLUUID.Zero;
103 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.primData.CreationDate; 149 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
104 proper.ObjectData[0].CreatorID = this.rootPrimitive.primData.OwnerID; 150 proper.ObjectData[0].CreatorID = this.rootPrimitive.OwnerID;
105 proper.ObjectData[0].FolderID = LLUUID.Zero; 151 proper.ObjectData[0].FolderID = LLUUID.Zero;
106 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 152 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
107 proper.ObjectData[0].GroupID = LLUUID.Zero; 153 proper.ObjectData[0].GroupID = LLUUID.Zero;
108 proper.ObjectData[0].InventorySerial = 0; 154 proper.ObjectData[0].InventorySerial = 0;
109 proper.ObjectData[0].LastOwnerID = LLUUID.Zero; 155 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
110 proper.ObjectData[0].ObjectID = this.uuid; 156 proper.ObjectData[0].ObjectID = this.rootUUID;
111 proper.ObjectData[0].OwnerID = this.rootPrimitive.primData.OwnerID; 157 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
112 proper.ObjectData[0].TouchName = new byte[0]; 158 proper.ObjectData[0].TouchName = new byte[0];
113 proper.ObjectData[0].TextureID = new byte[0]; 159 proper.ObjectData[0].TextureID = new byte[0];
114 proper.ObjectData[0].SitName = new byte[0]; 160 proper.ObjectData[0].SitName = new byte[0];
115 proper.ObjectData[0].Name = new byte[0]; 161 proper.ObjectData[0].Name = new byte[0];
116 proper.ObjectData[0].Description = new byte[0]; 162 proper.ObjectData[0].Description = new byte[0];
117 proper.ObjectData[0].OwnerMask = this.rootPrimitive.primData.OwnerMask; 163 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
118 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.primData.NextOwnerMask; 164 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask;
119 proper.ObjectData[0].GroupMask = this.rootPrimitive.primData.GroupMask; 165 proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask;
120 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.primData.EveryoneMask; 166 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask;
121 proper.ObjectData[0].BaseMask = this.rootPrimitive.primData.BaseMask; 167 proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask;
122 168
123 client.OutPacket(proper); 169 client.OutPacket(proper);
124 170
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 6366fb8..502d8e6 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -31,8 +31,16 @@ using System.Text;
31 31
32namespace OpenSim.Physics.Manager 32namespace OpenSim.Physics.Manager
33{ 33{
34 public delegate void PositionUpdate(PhysicsVector position);
35 public delegate void VelocityUpdate(PhysicsVector velocity);
36 public delegate void OrientationUpdate(Axiom.MathLib.Quaternion orientation);
37
34 public abstract class PhysicsActor 38 public abstract class PhysicsActor
35 { 39 {
40 public event PositionUpdate OnPositionUpdate;
41 public event VelocityUpdate OnVelocityUpdate;
42 public event OrientationUpdate OnOrientationUpdate;
43
36 public static PhysicsActor Null 44 public static PhysicsActor Null
37 { 45 {
38 get 46 get