diff options
Diffstat (limited to 'OpenSim/Region/Environment')
8 files changed, 212 insertions, 41 deletions
diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 9e9405e..f5724dd 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.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,7 +6,8 @@ | |||
6 | <ProjectGuid>{DCBA491C-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{DCBA491C-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></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenSim.Region.Environment</AssemblyName> | 13 | <AssemblyName>OpenSim.Region.Environment</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Region.Environment</RootNamespace> | 21 | <RootNamespace>OpenSim.Region.Environment</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,34 +61,36 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="Axiom.MathLib.dll" > | 68 | <Reference Include="Axiom.MathLib.dll"> |
62 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> | 69 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="Db4objects.Db4o.dll" > | 72 | <Reference Include="Db4objects.Db4o.dll"> |
66 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | 73 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="libsecondlife.dll" > | 76 | <Reference Include="libsecondlife.dll"> |
70 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | 77 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="Microsoft.JScript" > | 80 | <Reference Include="Microsoft.JScript"> |
74 | <HintPath>Microsoft.JScript.dll</HintPath> | 81 | <HintPath>Microsoft.JScript.dll</HintPath> |
75 | <Private>False</Private> | 82 | <Private>False</Private> |
76 | </Reference> | 83 | </Reference> |
77 | <Reference Include="System" > | 84 | <Reference Include="System"> |
78 | <HintPath>System.dll</HintPath> | 85 | <HintPath>System.dll</HintPath> |
79 | <Private>False</Private> | 86 | <Private>False</Private> |
80 | </Reference> | 87 | </Reference> |
81 | <Reference Include="System.Xml" > | 88 | <Reference Include="System.Data" /> |
89 | <Reference Include="System.Xml"> | ||
82 | <HintPath>System.Xml.dll</HintPath> | 90 | <HintPath>System.Xml.dll</HintPath> |
83 | <Private>False</Private> | 91 | <Private>False</Private> |
84 | </Reference> | 92 | </Reference> |
85 | <Reference Include="XMLRPC.dll" > | 93 | <Reference Include="XMLRPC.dll"> |
86 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> | 94 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> |
87 | <Private>False</Private> | 95 | <Private>False</Private> |
88 | </Reference> | 96 | </Reference> |
@@ -92,55 +100,55 @@ | |||
92 | <Name>OpenSim.Framework</Name> | 100 | <Name>OpenSim.Framework</Name> |
93 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | 101 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> |
94 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 102 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
95 | <Private>False</Private> | 103 | <Private>False</Private> |
96 | </ProjectReference> | 104 | </ProjectReference> |
97 | <ProjectReference Include="..\..\Framework\Communications\OpenSim.Framework.Communications.csproj"> | 105 | <ProjectReference Include="..\..\Framework\Communications\OpenSim.Framework.Communications.csproj"> |
98 | <Name>OpenSim.Framework.Communications</Name> | 106 | <Name>OpenSim.Framework.Communications</Name> |
99 | <Project>{CB52B7E7-0000-0000-0000-000000000000}</Project> | 107 | <Project>{CB52B7E7-0000-0000-0000-000000000000}</Project> |
100 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 108 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
101 | <Private>False</Private> | 109 | <Private>False</Private> |
102 | </ProjectReference> | 110 | </ProjectReference> |
103 | <ProjectReference Include="..\..\Framework\Console\OpenSim.Framework.Console.csproj"> | 111 | <ProjectReference Include="..\..\Framework\Console\OpenSim.Framework.Console.csproj"> |
104 | <Name>OpenSim.Framework.Console</Name> | 112 | <Name>OpenSim.Framework.Console</Name> |
105 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | 113 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> |
106 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 114 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
107 | <Private>False</Private> | 115 | <Private>False</Private> |
108 | </ProjectReference> | 116 | </ProjectReference> |
109 | <ProjectReference Include="..\..\Framework\GenericConfig\Xml\OpenSim.Framework.GenericConfig.Xml.csproj"> | 117 | <ProjectReference Include="..\..\Framework\GenericConfig\Xml\OpenSim.Framework.GenericConfig.Xml.csproj"> |
110 | <Name>OpenSim.Framework.GenericConfig.Xml</Name> | 118 | <Name>OpenSim.Framework.GenericConfig.Xml</Name> |
111 | <Project>{C74E4A30-0000-0000-0000-000000000000}</Project> | 119 | <Project>{C74E4A30-0000-0000-0000-000000000000}</Project> |
112 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 120 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
113 | <Private>False</Private> | 121 | <Private>False</Private> |
114 | </ProjectReference> | 122 | </ProjectReference> |
115 | <ProjectReference Include="..\..\Framework\Servers\OpenSim.Framework.Servers.csproj"> | 123 | <ProjectReference Include="..\..\Framework\Servers\OpenSim.Framework.Servers.csproj"> |
116 | <Name>OpenSim.Framework.Servers</Name> | 124 | <Name>OpenSim.Framework.Servers</Name> |
117 | <Project>{2CC71860-0000-0000-0000-000000000000}</Project> | 125 | <Project>{2CC71860-0000-0000-0000-000000000000}</Project> |
118 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 126 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
119 | <Private>False</Private> | 127 | <Private>False</Private> |
120 | </ProjectReference> | 128 | </ProjectReference> |
121 | <ProjectReference Include="..\Caches\OpenSim.Region.Caches.csproj"> | 129 | <ProjectReference Include="..\Caches\OpenSim.Region.Caches.csproj"> |
122 | <Name>OpenSim.Region.Caches</Name> | 130 | <Name>OpenSim.Region.Caches</Name> |
123 | <Project>{61FCCDB3-0000-0000-0000-000000000000}</Project> | 131 | <Project>{61FCCDB3-0000-0000-0000-000000000000}</Project> |
124 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 132 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
125 | <Private>False</Private> | 133 | <Private>False</Private> |
126 | </ProjectReference> | 134 | </ProjectReference> |
127 | <ProjectReference Include="..\Capabilities\OpenSim.Region.Capabilities.csproj"> | 135 | <ProjectReference Include="..\Capabilities\OpenSim.Region.Capabilities.csproj"> |
128 | <Name>OpenSim.Region.Capabilities</Name> | 136 | <Name>OpenSim.Region.Capabilities</Name> |
129 | <Project>{39038E85-0000-0000-0000-000000000000}</Project> | 137 | <Project>{39038E85-0000-0000-0000-000000000000}</Project> |
130 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 138 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
131 | <Private>False</Private> | 139 | <Private>False</Private> |
132 | </ProjectReference> | 140 | </ProjectReference> |
133 | <ProjectReference Include="..\Physics\Manager\OpenSim.Region.Physics.Manager.csproj"> | 141 | <ProjectReference Include="..\Physics\Manager\OpenSim.Region.Physics.Manager.csproj"> |
134 | <Name>OpenSim.Region.Physics.Manager</Name> | 142 | <Name>OpenSim.Region.Physics.Manager</Name> |
135 | <Project>{F4FF31EB-0000-0000-0000-000000000000}</Project> | 143 | <Project>{F4FF31EB-0000-0000-0000-000000000000}</Project> |
136 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 144 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
137 | <Private>False</Private> | 145 | <Private>False</Private> |
138 | </ProjectReference> | 146 | </ProjectReference> |
139 | <ProjectReference Include="..\Terrain.BasicTerrain\OpenSim.Region.Terrain.BasicTerrain.csproj"> | 147 | <ProjectReference Include="..\Terrain.BasicTerrain\OpenSim.Region.Terrain.BasicTerrain.csproj"> |
140 | <Name>OpenSim.Region.Terrain.BasicTerrain</Name> | 148 | <Name>OpenSim.Region.Terrain.BasicTerrain</Name> |
141 | <Project>{C9E0F891-0000-0000-0000-000000000000}</Project> | 149 | <Project>{C9E0F891-0000-0000-0000-000000000000}</Project> |
142 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 150 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
143 | <Private>False</Private> | 151 | <Private>False</Private> |
144 | </ProjectReference> | 152 | </ProjectReference> |
145 | </ItemGroup> | 153 | </ItemGroup> |
146 | <ItemGroup> | 154 | <ItemGroup> |
@@ -215,4 +223,4 @@ | |||
215 | <PostBuildEvent> | 223 | <PostBuildEvent> |
216 | </PostBuildEvent> | 224 | </PostBuildEvent> |
217 | </PropertyGroup> | 225 | </PropertyGroup> |
218 | </Project> | 226 | </Project> \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 2874ae2..99ca021 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using Axiom.MathLib; | 2 | using Axiom.Math; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Scenes | 5 | namespace OpenSim.Region.Environment.Scenes |
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 803bd28..24dc115 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using Axiom.MathLib; | 3 | using Axiom.Math; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using libsecondlife.Packets; | 5 | using libsecondlife.Packets; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
@@ -45,6 +45,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
45 | public bool isRootPrim; | 45 | public bool isRootPrim; |
46 | public EntityBase m_Parent; | 46 | public EntityBase m_Parent; |
47 | 47 | ||
48 | #region Properties | ||
48 | public override LLVector3 Pos | 49 | public override LLVector3 Pos |
49 | { | 50 | { |
50 | get | 51 | get |
@@ -69,6 +70,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
69 | 70 | ||
70 | } | 71 | } |
71 | 72 | ||
73 | public LLVector3 WorldPos | ||
74 | { | ||
75 | get | ||
76 | { | ||
77 | if (!this.isRootPrim) | ||
78 | { | ||
79 | Primitive parentPrim = (Primitive)this.m_Parent; | ||
80 | return this.m_pos + parentPrim.WorldPos; | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | return this.Pos; | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | |||
72 | public string Description | 89 | public string Description |
73 | { | 90 | { |
74 | get | 91 | get |
@@ -92,7 +109,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
92 | return this.m_Shape.Scale; | 109 | return this.m_Shape.Scale; |
93 | } | 110 | } |
94 | } | 111 | } |
112 | #endregion | ||
95 | 113 | ||
114 | #region Constructors | ||
96 | public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject) | 115 | public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject) |
97 | { | 116 | { |
98 | m_regionHandle = regionHandle; | 117 | m_regionHandle = regionHandle; |
@@ -102,9 +121,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
102 | this.isRootPrim = isRoot; | 121 | this.isRootPrim = isRoot; |
103 | this.m_RootParent = rootObject; | 122 | this.m_RootParent = rootObject; |
104 | this.CreateFromPacket(addPacket, ownerID, localID); | 123 | this.CreateFromPacket(addPacket, ownerID, localID); |
105 | this.rotation = Axiom.MathLib.Quaternion.Identity; | 124 | this.rotation = Axiom.Math.Quaternion.Identity; |
106 | } | 125 | } |
126 | #endregion | ||
107 | 127 | ||
128 | #region Override from EntityBase | ||
108 | /// <summary> | 129 | /// <summary> |
109 | /// | 130 | /// |
110 | /// </summary> | 131 | /// </summary> |
@@ -126,7 +147,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
126 | child.update(); | 147 | child.update(); |
127 | } | 148 | } |
128 | } | 149 | } |
150 | #endregion | ||
129 | 151 | ||
152 | #region Setup | ||
130 | /// <summary> | 153 | /// <summary> |
131 | /// | 154 | /// |
132 | /// </summary> | 155 | /// </summary> |
@@ -169,7 +192,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
169 | 192 | ||
170 | this.updateFlag = 1; | 193 | this.updateFlag = 1; |
171 | } | 194 | } |
195 | #endregion | ||
172 | 196 | ||
197 | #region Linking / unlinking | ||
173 | /// <summary> | 198 | /// <summary> |
174 | /// | 199 | /// |
175 | /// </summary> | 200 | /// </summary> |
@@ -196,28 +221,49 @@ namespace OpenSim.Region.Environment.Scenes | |||
196 | this.isRootPrim = false; | 221 | this.isRootPrim = false; |
197 | this.m_Parent = newParent; | 222 | this.m_Parent = newParent; |
198 | this.ParentID = newParent.LocalId; | 223 | this.ParentID = newParent.LocalId; |
199 | this.SetRootParent(rootParent); | 224 | this.m_RootParent = rootParent; |
225 | this.m_RootParent.AddChildToList(this); | ||
200 | this.Pos = oldPos; | 226 | this.Pos = oldPos; |
201 | Axiom.MathLib.Vector3 axPos = new Axiom.MathLib.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); | 227 | Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); |
202 | axPos = this.m_Parent.rotation.Inverse() * axPos; | 228 | axPos = this.m_Parent.rotation.Inverse() * axPos; |
203 | this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); | 229 | this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); |
204 | this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); | 230 | this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); |
205 | this.updateFlag = 1; | 231 | this.updateFlag = 1; |
206 | 232 | ||
233 | foreach (Primitive child in children) | ||
234 | { | ||
235 | child.SetRootParent(rootParent, newParent, oldPos); | ||
236 | } | ||
237 | children.Clear(); | ||
238 | |||
239 | |||
207 | } | 240 | } |
208 | 241 | ||
209 | /// <summary> | 242 | /// <summary> |
210 | /// | 243 | /// |
211 | /// </summary> | 244 | /// </summary> |
212 | /// <param name="newRoot"></param> | 245 | /// <param name="newRoot"></param> |
213 | public void SetRootParent(SceneObject newRoot) | 246 | public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition) |
214 | { | 247 | { |
248 | LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); | ||
249 | oldPos += oldParentPosition; | ||
250 | this.isRootPrim = false; | ||
251 | this.m_Parent = newParent; | ||
252 | this.ParentID = newParent.LocalId; | ||
253 | newParent.AddToChildrenList(this); | ||
215 | this.m_RootParent = newRoot; | 254 | this.m_RootParent = newRoot; |
216 | this.m_RootParent.AddChildToList(this); | 255 | this.m_RootParent.AddChildToList(this); |
256 | this.Pos = oldPos; | ||
257 | Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); | ||
258 | axPos = this.m_Parent.rotation.Inverse() * axPos; | ||
259 | this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); | ||
260 | this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); | ||
261 | this.updateFlag = 1; | ||
217 | foreach (Primitive child in children) | 262 | foreach (Primitive child in children) |
218 | { | 263 | { |
219 | child.SetRootParent(newRoot); | 264 | child.SetRootParent(newRoot, newParent, oldPos); |
220 | } | 265 | } |
266 | children.Clear(); | ||
221 | } | 267 | } |
222 | 268 | ||
223 | public void AddOffsetToChildren(LLVector3 offset) | 269 | public void AddOffsetToChildren(LLVector3 offset) |
@@ -229,6 +275,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
229 | } | 275 | } |
230 | } | 276 | } |
231 | 277 | ||
278 | public void AddToChildrenList(Primitive prim) | ||
279 | { | ||
280 | this.children.Add(prim); | ||
281 | } | ||
282 | #endregion | ||
283 | |||
232 | #region Resizing/Scale | 284 | #region Resizing/Scale |
233 | public void ResizeGoup(LLVector3 scale) | 285 | public void ResizeGoup(LLVector3 scale) |
234 | { | 286 | { |
@@ -252,6 +304,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
252 | } | 304 | } |
253 | #endregion | 305 | #endregion |
254 | 306 | ||
307 | #region Position | ||
255 | /// <summary> | 308 | /// <summary> |
256 | /// | 309 | /// |
257 | /// </summary> | 310 | /// </summary> |
@@ -264,19 +317,73 @@ namespace OpenSim.Region.Environment.Scenes | |||
264 | this.updateFlag = 2; | 317 | this.updateFlag = 2; |
265 | } | 318 | } |
266 | 319 | ||
320 | public void UpdateSinglePosition(LLVector3 pos) | ||
321 | { | ||
322 | //Console.WriteLine("updating single prim position"); | ||
323 | if (this.isRootPrim) | ||
324 | { | ||
325 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
326 | LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); | ||
327 | LLVector3 diff = oldPos - newPos; | ||
328 | Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | ||
329 | axDiff = this.rotation.Inverse() * axDiff; | ||
330 | diff.X = axDiff.x; | ||
331 | diff.Y = axDiff.y; | ||
332 | diff.Z = axDiff.z; | ||
333 | this.Pos = newPos; | ||
334 | |||
335 | foreach (Primitive prim in this.children) | ||
336 | { | ||
337 | prim.m_pos += diff; | ||
338 | prim.updateFlag = 2; | ||
339 | } | ||
340 | this.updateFlag = 2; | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
345 | this.m_pos = newPos; | ||
346 | this.updateFlag = 2; | ||
347 | } | ||
348 | } | ||
349 | |||
350 | #endregion | ||
351 | |||
352 | #region Rotation | ||
267 | public void UpdateRotation(LLQuaternion rot) | 353 | public void UpdateRotation(LLQuaternion rot) |
268 | { | 354 | { |
269 | this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); | 355 | this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); |
356 | this.updateFlag = 2; | ||
357 | } | ||
358 | |||
359 | public void UpdateSingleRotation(LLQuaternion rot) | ||
360 | { | ||
361 | Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); | ||
362 | Axiom.Math.Quaternion oldParentRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); | ||
363 | this.rotation = axRot; | ||
364 | foreach (Primitive prim in this.children) | ||
365 | { | ||
366 | Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z); | ||
367 | axPos = oldParentRot * axPos; | ||
368 | axPos = axRot.Inverse() * axPos; | ||
369 | prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); | ||
370 | prim.rotation = prim.rotation * oldParentRot; | ||
371 | prim.rotation = prim.rotation * axRot.Inverse(); | ||
372 | prim.updateFlag = 2; | ||
373 | } | ||
270 | this.updateFlag = 2; | 374 | this.updateFlag = 2; |
271 | } | 375 | } |
272 | 376 | ||
273 | public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) | 377 | public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) |
274 | { | 378 | { |
275 | this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); | 379 | this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); |
276 | this.Pos = pos; | 380 | this.Pos = pos; |
277 | this.updateFlag = 2; | 381 | this.updateFlag = 2; |
278 | } | 382 | } |
279 | 383 | ||
384 | #endregion | ||
385 | |||
386 | #region Shape | ||
280 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) | 387 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) |
281 | { | 388 | { |
282 | this.m_Shape.PathBegin = shapeBlock.PathBegin; | 389 | this.m_Shape.PathBegin = shapeBlock.PathBegin; |
@@ -299,6 +406,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
299 | this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; | 406 | this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; |
300 | this.updateFlag = 1; | 407 | this.updateFlag = 1; |
301 | } | 408 | } |
409 | #endregion | ||
302 | 410 | ||
303 | #region Client Update Methods | 411 | #region Client Update Methods |
304 | 412 | ||
diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs index 4213a18..247ff87 100644 --- a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs +++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs | |||
@@ -29,7 +29,7 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using Axiom.MathLib; | 32 | using Axiom.Math; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using libsecondlife.Packets; | 34 | using libsecondlife.Packets; |
35 | using OpenSim.Framework.Interfaces; | 35 | using OpenSim.Framework.Interfaces; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 0927903..b3d9d15 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
107 | /// <param name="fromAgentID"></param> | 107 | /// <param name="fromAgentID"></param> |
108 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 108 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
109 | { | 109 | { |
110 | Console.WriteLine("Chat message"); | 110 | // Console.WriteLine("Chat message"); |
111 | ScenePresence avatar = null; | 111 | ScenePresence avatar = null; |
112 | foreach (IClientAPI client in m_clientThreads.Values) | 112 | foreach (IClientAPI client in m_clientThreads.Values) |
113 | { | 113 | { |
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
118 | avatar = this.Avatars[client.AgentId]; | 118 | avatar = this.Avatars[client.AgentId]; |
119 | // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | 119 | // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); |
120 | dis= (int)avatar.Pos.GetDistanceTo(fromPos); | 120 | dis= (int)avatar.Pos.GetDistanceTo(fromPos); |
121 | Console.WriteLine("found avatar at " +dis); | 121 | //Console.WriteLine("found avatar at " +dis); |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
@@ -314,13 +314,27 @@ namespace OpenSim.Region.Environment.Scenes | |||
314 | 314 | ||
315 | public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | 315 | public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) |
316 | { | 316 | { |
317 | Primitive prim = null; | ||
318 | foreach (EntityBase ent in Entities.Values) | ||
319 | { | ||
320 | if (ent is SceneObject) | ||
321 | { | ||
322 | prim = ((SceneObject)ent).HasChildPrim(objectID); | ||
323 | if (prim != null) | ||
324 | { | ||
325 | ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); | ||
326 | break; | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | /* | ||
317 | if (this.Entities.ContainsKey(objectID)) | 331 | if (this.Entities.ContainsKey(objectID)) |
318 | { | 332 | { |
319 | if (this.Entities[objectID] is SceneObject) | 333 | if (this.Entities[objectID] is SceneObject) |
320 | { | 334 | { |
321 | ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); | 335 | ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); |
322 | } | 336 | } |
323 | } | 337 | }*/ |
324 | } | 338 | } |
325 | 339 | ||
326 | /// <summary> | 340 | /// <summary> |
@@ -368,6 +382,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
368 | } | 382 | } |
369 | } | 383 | } |
370 | 384 | ||
385 | public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient) | ||
386 | { | ||
387 | Primitive prim = null; | ||
388 | foreach (EntityBase ent in Entities.Values) | ||
389 | { | ||
390 | if (ent is SceneObject) | ||
391 | { | ||
392 | prim = ((SceneObject)ent).HasChildPrim(localID); | ||
393 | if (prim != null) | ||
394 | { | ||
395 | prim.UpdateSinglePosition(pos); | ||
396 | break; | ||
397 | } | ||
398 | } | ||
399 | } | ||
400 | } | ||
401 | |||
371 | /// <summary> | 402 | /// <summary> |
372 | /// | 403 | /// |
373 | /// </summary> | 404 | /// </summary> |
@@ -419,6 +450,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
419 | /// | 450 | /// |
420 | /// </summary> | 451 | /// </summary> |
421 | /// <param name="localID"></param> | 452 | /// <param name="localID"></param> |
453 | /// <param name="rot"></param> | ||
454 | /// <param name="remoteClient"></param> | ||
455 | public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) | ||
456 | { | ||
457 | Primitive prim = null; | ||
458 | foreach (EntityBase ent in Entities.Values) | ||
459 | { | ||
460 | if (ent is SceneObject) | ||
461 | { | ||
462 | prim = ((SceneObject)ent).HasChildPrim(localID); | ||
463 | if (prim != null) | ||
464 | { | ||
465 | prim.UpdateSingleRotation(rot); | ||
466 | break; | ||
467 | } | ||
468 | } | ||
469 | } | ||
470 | } | ||
471 | |||
472 | /// <summary> | ||
473 | /// | ||
474 | /// </summary> | ||
475 | /// <param name="localID"></param> | ||
422 | /// <param name="scale"></param> | 476 | /// <param name="scale"></param> |
423 | /// <param name="remoteClient"></param> | 477 | /// <param name="remoteClient"></param> |
424 | public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) | 478 | public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 838d722..0797566 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -453,8 +453,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
453 | client.OnRequestWearables += this.InformClientOfNeighbours; | 453 | client.OnRequestWearables += this.InformClientOfNeighbours; |
454 | client.OnAddPrim += this.AddNewPrim; | 454 | client.OnAddPrim += this.AddNewPrim; |
455 | client.OnUpdatePrimPosition += this.UpdatePrimPosition; | 455 | client.OnUpdatePrimPosition += this.UpdatePrimPosition; |
456 | client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition; | ||
456 | client.OnUpdatePrimRotation += this.UpdatePrimRotation; | 457 | client.OnUpdatePrimRotation += this.UpdatePrimRotation; |
457 | client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; | 458 | client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; |
459 | client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation; | ||
458 | client.OnUpdatePrimScale += this.UpdatePrimScale; | 460 | client.OnUpdatePrimScale += this.UpdatePrimScale; |
459 | client.OnUpdatePrimShape += this.UpdatePrimShape; | 461 | client.OnUpdatePrimShape += this.UpdatePrimShape; |
460 | client.OnRequestMapBlocks += this.RequestMapBlocks; | 462 | client.OnRequestMapBlocks += this.RequestMapBlocks; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 9a46fbf..00d7c63 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs | |||
@@ -178,8 +178,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
178 | /// <param name="remoteClient"></param> | 178 | /// <param name="remoteClient"></param> |
179 | public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | 179 | public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) |
180 | { | 180 | { |
181 | //this.Pos = pos; | 181 | this.rootPrimitive.Pos = pos ; |
182 | this.rootPrimitive.Pos = pos; | ||
183 | this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); | 182 | this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); |
184 | } | 183 | } |
185 | 184 | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 98fa2ed..14b7b2f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -28,7 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using Axiom.MathLib; | 31 | using Axiom.Math; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |