diff options
author | UbitUmarov | 2016-11-25 18:35:23 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-25 18:35:23 +0000 |
commit | 935510d87956f080f1425982b3da918009c32feb (patch) | |
tree | 4298ca103968aafe9e8381eb74c5ac6dd0cc68eb /OpenSim | |
parent | change llScaleByFactor (sorry Mandarinka). (diff) | |
download | opensim-SC_OLD-935510d87956f080f1425982b3da918009c32feb.zip opensim-SC_OLD-935510d87956f080f1425982b3da918009c32feb.tar.gz opensim-SC_OLD-935510d87956f080f1425982b3da918009c32feb.tar.bz2 opensim-SC_OLD-935510d87956f080f1425982b3da918009c32feb.tar.xz |
add llGetMaxScaleFactor and llGetMinScaleFactor
Diffstat (limited to 'OpenSim')
4 files changed, 111 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 739d23d..6cdbac5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -4258,6 +4258,83 @@ namespace OpenSim.Region.Framework.Scenes | |||
4258 | return true; | 4258 | return true; |
4259 | } | 4259 | } |
4260 | 4260 | ||
4261 | public float GetMaxGroupResizeScale() | ||
4262 | { | ||
4263 | if (Scene == null || IsDeleted || inTransit) | ||
4264 | return 1.0f; | ||
4265 | |||
4266 | float maxsize = Scene.m_maxNonphys; | ||
4267 | PhysicsActor pa = m_rootPart.PhysActor; | ||
4268 | // assuming physics is more restrictive | ||
4269 | if (pa != null && pa.IsPhysical) | ||
4270 | maxsize = Scene.m_maxPhys; | ||
4271 | |||
4272 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4273 | float larger = float.MinValue; | ||
4274 | |||
4275 | for(int i = 0; i < parts.Length; i++) | ||
4276 | { | ||
4277 | SceneObjectPart obPart = parts[i]; | ||
4278 | Vector3 oldSize = new Vector3(obPart.Scale); | ||
4279 | if(larger < oldSize.X) | ||
4280 | larger = oldSize.X; | ||
4281 | |||
4282 | if(larger < oldSize.Y) | ||
4283 | larger = oldSize.Y; | ||
4284 | |||
4285 | if(larger < oldSize.Z) | ||
4286 | larger = oldSize.Z; | ||
4287 | } | ||
4288 | |||
4289 | if(larger >= maxsize) | ||
4290 | return 1.0f; | ||
4291 | |||
4292 | larger += 1e-3f; | ||
4293 | float fscale = maxsize / larger; | ||
4294 | |||
4295 | return fscale; | ||
4296 | } | ||
4297 | |||
4298 | public float GetMinGroupResizeScale() | ||
4299 | { | ||
4300 | if (Scene == null || IsDeleted || inTransit) | ||
4301 | return 1.0f; | ||
4302 | |||
4303 | float minsize = Scene.m_minNonphys; | ||
4304 | PhysicsActor pa = m_rootPart.PhysActor; | ||
4305 | // assuming physics is more restrictive | ||
4306 | if (pa != null && pa.IsPhysical) | ||
4307 | minsize = Scene.m_minPhys; | ||
4308 | |||
4309 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4310 | float smaller = float.MaxValue; | ||
4311 | |||
4312 | for(int i = 0; i < parts.Length; i++) | ||
4313 | { | ||
4314 | SceneObjectPart obPart = parts[i]; | ||
4315 | Vector3 oldSize = new Vector3(obPart.Scale); | ||
4316 | if(smaller > oldSize.X) | ||
4317 | smaller = oldSize.X; | ||
4318 | |||
4319 | if(smaller > oldSize.Y) | ||
4320 | smaller = oldSize.Y; | ||
4321 | |||
4322 | if(smaller > oldSize.Z) | ||
4323 | smaller = oldSize.Z; | ||
4324 | } | ||
4325 | |||
4326 | if(smaller <= minsize) | ||
4327 | return 1.0f; | ||
4328 | |||
4329 | if(smaller > 2e-3f) | ||
4330 | smaller -= 1e-3f; | ||
4331 | float fscale = minsize / smaller; | ||
4332 | if(fscale < 1e-8f) | ||
4333 | fscale = 1e-8f; | ||
4334 | |||
4335 | return fscale; | ||
4336 | } | ||
4337 | |||
4261 | #endregion | 4338 | #endregion |
4262 | 4339 | ||
4263 | #region Position | 4340 | #region Position |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c43aef5..a9c5789 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1828,6 +1828,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1828 | return ScriptBaseClass.FALSE; | 1828 | return ScriptBaseClass.FALSE; |
1829 | } | 1829 | } |
1830 | 1830 | ||
1831 | public LSL_Float llGetMaxScaleFactor() | ||
1832 | { | ||
1833 | m_host.AddScriptLPS(1); | ||
1834 | SceneObjectGroup group = m_host.ParentGroup; | ||
1835 | |||
1836 | if (group == null || group.IsDeleted || group.inTransit) | ||
1837 | return 1.0f; | ||
1838 | |||
1839 | return (LSL_Float)group.GetMaxGroupResizeScale(); | ||
1840 | } | ||
1841 | |||
1842 | public LSL_Float llGetMinScaleFactor() | ||
1843 | { | ||
1844 | m_host.AddScriptLPS(1); | ||
1845 | SceneObjectGroup group = m_host.ParentGroup; | ||
1846 | |||
1847 | if (group == null || group.IsDeleted || group.inTransit) | ||
1848 | return 1.0f; | ||
1849 | |||
1850 | return (LSL_Float)group.GetMinGroupResizeScale(); | ||
1851 | } | ||
1852 | |||
1831 | public void llSetScale(LSL_Vector scale) | 1853 | public void llSetScale(LSL_Vector scale) |
1832 | { | 1854 | { |
1833 | m_host.AddScriptLPS(1); | 1855 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index ea0b6f9..cc52403 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -327,6 +327,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
327 | LSL_Integer llSameGroup(string agent); | 327 | LSL_Integer llSameGroup(string agent); |
328 | void llSay(int channelID, string text); | 328 | void llSay(int channelID, string text); |
329 | LSL_Integer llScaleByFactor(double scaling_factor); | 329 | LSL_Integer llScaleByFactor(double scaling_factor); |
330 | LSL_Float llGetMaxScaleFactor(); | ||
331 | LSL_Float llGetMinScaleFactor(); | ||
330 | void llScaleTexture(double u, double v, int face); | 332 | void llScaleTexture(double u, double v, int face); |
331 | LSL_Integer llScriptDanger(LSL_Vector pos); | 333 | LSL_Integer llScriptDanger(LSL_Vector pos); |
332 | void llScriptProfiler(LSL_Integer flag); | 334 | void llScriptProfiler(LSL_Integer flag); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 6aaf930..9d36341 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1470,6 +1470,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1470 | return m_LSL_Functions.llScaleByFactor(scaling_factor); | 1470 | return m_LSL_Functions.llScaleByFactor(scaling_factor); |
1471 | } | 1471 | } |
1472 | 1472 | ||
1473 | public LSL_Float llGetMaxScaleFactor() | ||
1474 | { | ||
1475 | return m_LSL_Functions.llGetMaxScaleFactor(); | ||
1476 | } | ||
1477 | |||
1478 | public LSL_Float llGetMinScaleFactor() | ||
1479 | { | ||
1480 | return m_LSL_Functions.llGetMinScaleFactor(); | ||
1481 | } | ||
1482 | |||
1473 | public void llScaleTexture(double u, double v, int face) | 1483 | public void llScaleTexture(double u, double v, int face) |
1474 | { | 1484 | { |
1475 | m_LSL_Functions.llScaleTexture(u, v, face); | 1485 | m_LSL_Functions.llScaleTexture(u, v, face); |