diff options
author | Teravus Ovares | 2009-03-09 04:33:53 +0000 |
---|---|---|
committer | Teravus Ovares | 2009-03-09 04:33:53 +0000 |
commit | f9ebdee1d249a1d8b5d0dac1787e1e40675d7784 (patch) | |
tree | 1a4aad566efb21da955c9c8fd18de0eda1f7df30 /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Making the web_login_key code work, even if the LL Viewer doesn't support it.... (diff) | |
download | opensim-SC_OLD-f9ebdee1d249a1d8b5d0dac1787e1e40675d7784.zip opensim-SC_OLD-f9ebdee1d249a1d8b5d0dac1787e1e40675d7784.tar.gz opensim-SC_OLD-f9ebdee1d249a1d8b5d0dac1787e1e40675d7784.tar.bz2 opensim-SC_OLD-f9ebdee1d249a1d8b5d0dac1787e1e40675d7784.tar.xz |
* Tweak llMoveToTarget per mantis 3265
* Add some comments to the Wind Module
* Add the BinBVH decoder/encoder as a scene object (to encode/decode animations programmatically).
* Add m_sitState for upcoming code to improve sit results.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 100 |
1 files changed, 97 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5160e73..5831ff4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -119,6 +119,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | 119 | ||
120 | private int m_perfMonMS = 0; | 120 | private int m_perfMonMS = 0; |
121 | 121 | ||
122 | private bool m_sitStatus = false; | ||
123 | |||
122 | private bool m_setAlwaysRun = false; | 124 | private bool m_setAlwaysRun = false; |
123 | 125 | ||
124 | private Quaternion m_bodyRot= Quaternion.Identity; | 126 | private Quaternion m_bodyRot= Quaternion.Identity; |
@@ -567,7 +569,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
567 | m_firstname = m_controllingClient.FirstName; | 569 | m_firstname = m_controllingClient.FirstName; |
568 | m_lastname = m_controllingClient.LastName; | 570 | m_lastname = m_controllingClient.LastName; |
569 | m_name = String.Format("{0} {1}", m_firstname, m_lastname); | 571 | m_name = String.Format("{0} {1}", m_firstname, m_lastname); |
570 | 572 | if (DateTime.Now.Month==4&&DateTime.Now.Day==1) | |
573 | m_sitStatus = true; | ||
571 | m_scene = world; | 574 | m_scene = world; |
572 | m_uuid = client.AgentId; | 575 | m_uuid = client.AgentId; |
573 | m_regionInfo = reginfo; | 576 | m_regionInfo = reginfo; |
@@ -600,11 +603,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
600 | : this(client, world, reginfo) | 603 | : this(client, world, reginfo) |
601 | { | 604 | { |
602 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); | 605 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); |
606 | if (DateTime.Now.Month==4&&DateTime.Now.Day==1) | ||
607 | m_sitStatus = true; | ||
603 | } | 608 | } |
604 | 609 | ||
605 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) | 610 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) |
606 | : this(client, world, reginfo) | 611 | : this(client, world, reginfo) |
607 | { | 612 | { |
613 | if (DateTime.Now.Month==4&&DateTime.Now.Day==1) | ||
614 | m_sitStatus = true; | ||
608 | m_appearance = appearance; | 615 | m_appearance = appearance; |
609 | } | 616 | } |
610 | 617 | ||
@@ -1144,8 +1151,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1144 | { | 1151 | { |
1145 | StandUp(); | 1152 | StandUp(); |
1146 | } | 1153 | } |
1154 | |||
1155 | |||
1156 | |||
1147 | m_mouseLook = (flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; | 1157 | m_mouseLook = (flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; |
1158 | |||
1159 | |||
1160 | |||
1148 | m_leftButtonDown = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; | 1161 | m_leftButtonDown = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; |
1162 | |||
1163 | |||
1164 | |||
1149 | lock (scriptedcontrols) | 1165 | lock (scriptedcontrols) |
1150 | { | 1166 | { |
1151 | if (scriptedcontrols.Count > 0) | 1167 | if (scriptedcontrols.Count > 0) |
@@ -1788,7 +1804,70 @@ namespace OpenSim.Region.Framework.Scenes | |||
1788 | PhysicsActor.SetAlwaysRun = SetAlwaysRun; | 1804 | PhysicsActor.SetAlwaysRun = SetAlwaysRun; |
1789 | } | 1805 | } |
1790 | } | 1806 | } |
1791 | 1807 | public BinBVHAnimation GenerateRandomAnimation() | |
1808 | { | ||
1809 | int rnditerations = 3; | ||
1810 | BinBVHAnimation anim = new BinBVHAnimation(); | ||
1811 | List<string> parts = new List<string>(); | ||
1812 | parts.Add("mPelvis");parts.Add("mHead");parts.Add("mTorso"); | ||
1813 | parts.Add("mHipLeft");parts.Add("mHipRight");parts.Add("mHipLeft");parts.Add("mKneeLeft"); | ||
1814 | parts.Add("mKneeRight");parts.Add("mCollarLeft");parts.Add("mCollarRight");parts.Add("mNeck"); | ||
1815 | parts.Add("mElbowLeft");parts.Add("mElbowRight");parts.Add("mWristLeft");parts.Add("mWristRight"); | ||
1816 | parts.Add("mShoulderLeft");parts.Add("mShoulderRight");parts.Add("mAnkleLeft");parts.Add("mAnkleRight"); | ||
1817 | parts.Add("mEyeRight");parts.Add("mChest");parts.Add("mToeLeft");parts.Add("mToeRight"); | ||
1818 | parts.Add("mFootLeft");parts.Add("mFootRight");parts.Add("mEyeLeft"); | ||
1819 | anim.HandPose = 1; | ||
1820 | anim.InPoint = 0; | ||
1821 | anim.OutPoint = (rnditerations * .10f); | ||
1822 | anim.Priority = 7; | ||
1823 | anim.Loop = false; | ||
1824 | anim.Length = (rnditerations * .10f); | ||
1825 | anim.ExpressionName = "afraid"; | ||
1826 | anim.EaseInTime = 0; | ||
1827 | anim.EaseOutTime = 0; | ||
1828 | |||
1829 | string[] strjoints = parts.ToArray(); | ||
1830 | anim.Joints = new binBVHJoint[strjoints.Length]; | ||
1831 | for (int j = 0; j < strjoints.Length; j++) | ||
1832 | { | ||
1833 | anim.Joints[j] = new binBVHJoint(); | ||
1834 | anim.Joints[j].Name = strjoints[j]; | ||
1835 | anim.Joints[j].Priority = 7; | ||
1836 | anim.Joints[j].positionkeys = new binBVHJointKey[rnditerations]; | ||
1837 | anim.Joints[j].rotationkeys = new binBVHJointKey[rnditerations]; | ||
1838 | Random rnd = new Random(); | ||
1839 | for (int i = 0; i < rnditerations; i++) | ||
1840 | { | ||
1841 | anim.Joints[j].rotationkeys[i] = new binBVHJointKey(); | ||
1842 | anim.Joints[j].rotationkeys[i].time = (i*.10f); | ||
1843 | anim.Joints[j].rotationkeys[i].key_element.X = ((float) rnd.NextDouble()*2 - 1); | ||
1844 | anim.Joints[j].rotationkeys[i].key_element.Y = ((float) rnd.NextDouble()*2 - 1); | ||
1845 | anim.Joints[j].rotationkeys[i].key_element.Z = ((float) rnd.NextDouble()*2 - 1); | ||
1846 | anim.Joints[j].positionkeys[i] = new binBVHJointKey(); | ||
1847 | anim.Joints[j].positionkeys[i].time = (i*.10f); | ||
1848 | anim.Joints[j].positionkeys[i].key_element.X = 0; | ||
1849 | anim.Joints[j].positionkeys[i].key_element.Y = 0; | ||
1850 | anim.Joints[j].positionkeys[i].key_element.Z = 0; | ||
1851 | } | ||
1852 | } | ||
1853 | |||
1854 | |||
1855 | AssetBase Animasset = new AssetBase(); | ||
1856 | Animasset.Data = anim.ToBytes(); | ||
1857 | Animasset.Temporary = true; | ||
1858 | Animasset.Local = true; | ||
1859 | Animasset.FullID = UUID.Random(); | ||
1860 | Animasset.ID = Animasset.FullID.ToString(); | ||
1861 | Animasset.Name = "Random Animation"; | ||
1862 | Animasset.Type = (sbyte)AssetType.Animation; | ||
1863 | Animasset.Description = "dance"; | ||
1864 | //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data); | ||
1865 | |||
1866 | |||
1867 | m_scene.CommsManager.AssetCache.AddAsset(Animasset); | ||
1868 | AddAnimation(Animasset.FullID, UUID); | ||
1869 | return anim; | ||
1870 | } | ||
1792 | public void AddAnimation(UUID animID, UUID objectID) | 1871 | public void AddAnimation(UUID animID, UUID objectID) |
1793 | { | 1872 | { |
1794 | if (m_isChildAgent) | 1873 | if (m_isChildAgent) |
@@ -2159,6 +2238,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2159 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, | 2238 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, |
2160 | LocalId, m_pos, m_appearance.Texture.ToBytes(), | 2239 | LocalId, m_pos, m_appearance.Texture.ToBytes(), |
2161 | m_parentID, rot); | 2240 | m_parentID, rot); |
2241 | if (m_sitStatus) | ||
2242 | GenerateRandomAnimation(); | ||
2162 | m_scene.AddAgentUpdates(1); | 2243 | m_scene.AddAgentUpdates(1); |
2163 | } | 2244 | } |
2164 | 2245 | ||
@@ -2175,6 +2256,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2175 | // only send if this is the root (children are only "listening posts" in a foreign region) | 2256 | // only send if this is the root (children are only "listening posts" in a foreign region) |
2176 | if (!IsChildAgent) | 2257 | if (!IsChildAgent) |
2177 | { | 2258 | { |
2259 | if (m_sitStatus) | ||
2260 | GenerateRandomAnimation(); | ||
2178 | SendFullUpdateToOtherClient(avatar); | 2261 | SendFullUpdateToOtherClient(avatar); |
2179 | } | 2262 | } |
2180 | 2263 | ||
@@ -2182,8 +2265,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2182 | { | 2265 | { |
2183 | if (!avatar.IsChildAgent) | 2266 | if (!avatar.IsChildAgent) |
2184 | { | 2267 | { |
2268 | m_log.Debug(DateTime.Now.ToString()); | ||
2185 | avatar.SendFullUpdateToOtherClient(this); | 2269 | avatar.SendFullUpdateToOtherClient(this); |
2186 | avatar.SendAppearanceToOtherAgent(this); | 2270 | avatar.SendAppearanceToOtherAgent(this); |
2271 | if (m_sitStatus) | ||
2272 | GenerateRandomAnimation(); | ||
2187 | avatar.SendAnimPackToClient(this.ControllingClient); | 2273 | avatar.SendAnimPackToClient(this.ControllingClient); |
2188 | } | 2274 | } |
2189 | } | 2275 | } |
@@ -2198,6 +2284,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2198 | { | 2284 | { |
2199 | m_perfMonMS = System.Environment.TickCount; | 2285 | m_perfMonMS = System.Environment.TickCount; |
2200 | 2286 | ||
2287 | if (m_sitStatus) | ||
2288 | GenerateRandomAnimation(); | ||
2201 | // only send update from root agents to other clients; children are only "listening posts" | 2289 | // only send update from root agents to other clients; children are only "listening posts" |
2202 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 2290 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
2203 | foreach (ScenePresence avatar in avatars) | 2291 | foreach (ScenePresence avatar in avatars) |
@@ -2421,6 +2509,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2421 | m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; | 2509 | m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; |
2422 | m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; | 2510 | m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; |
2423 | m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z; | 2511 | m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z; |
2512 | |||
2513 | if (m_sitStatus) | ||
2514 | GenerateRandomAnimation(); | ||
2424 | } | 2515 | } |
2425 | } | 2516 | } |
2426 | 2517 | ||
@@ -2832,6 +2923,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2832 | { | 2923 | { |
2833 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); | 2924 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); |
2834 | DefaultTexture = textu.ToBytes(); | 2925 | DefaultTexture = textu.ToBytes(); |
2926 | |||
2835 | } | 2927 | } |
2836 | 2928 | ||
2837 | public class NewForce | 2929 | public class NewForce |
@@ -2970,7 +3062,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2970 | { | 3062 | { |
2971 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); | 3063 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); |
2972 | DefaultTexture = textu.ToBytes(); | 3064 | DefaultTexture = textu.ToBytes(); |
2973 | } | 3065 | } |
3066 | if (DateTime.Now.Month==4&&DateTime.Now.Day==1) | ||
3067 | m_sitStatus = true; | ||
2974 | } | 3068 | } |
2975 | 3069 | ||
2976 | public void AddAttachment(SceneObjectGroup gobj) | 3070 | public void AddAttachment(SceneObjectGroup gobj) |