diff options
author | UbitUmarov | 2012-03-13 17:56:32 +0000 |
---|---|---|
committer | UbitUmarov | 2012-03-13 17:56:32 +0000 |
commit | 3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49 (patch) | |
tree | be55044dfc587d484586fd80ff6e5a4bd2283244 /OpenSim/Region | |
parent | Refactor, move OjectChangeData into it's own file and rename (diff) | |
download | opensim-SC_OLD-3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49.zip opensim-SC_OLD-3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49.tar.gz opensim-SC_OLD-3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49.tar.bz2 opensim-SC_OLD-3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49.tar.xz |
initial suport for ExtraPhysical parts parameters. Reading from llclientView to SOP including SOPserialization (not to databases). No action on physics still. No send to viewer, etc
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPMaterial.cs | 95 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 114 |
5 files changed, 230 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 18af623..23beaec 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -7006,10 +7006,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7006 | // 46,47,48 are special positions within the packet | 7006 | // 46,47,48 are special positions within the packet |
7007 | // This may change so perhaps we need a better way | 7007 | // This may change so perhaps we need a better way |
7008 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) | 7008 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) |
7009 | bool UsePhysics = (data[46] != 0) ? true : false; | 7009 | /* |
7010 | bool IsTemporary = (data[47] != 0) ? true : false; | 7010 | bool UsePhysics = (data[46] != 0) ? true : false; |
7011 | bool IsPhantom = (data[48] != 0) ? true : false; | 7011 | bool IsTemporary = (data[47] != 0) ? true : false; |
7012 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | 7012 | bool IsPhantom = (data[48] != 0) ? true : false; |
7013 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | ||
7014 | */ | ||
7015 | bool UsePhysics = flags.AgentData.UsePhysics; | ||
7016 | bool IsPhantom = flags.AgentData.IsPhantom; | ||
7017 | bool IsTemporary = flags.AgentData.IsTemporary; | ||
7018 | ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics; | ||
7019 | ExtraPhysicsData physdata = new ExtraPhysicsData(); | ||
7020 | |||
7021 | if (blocks == null || blocks.Length == 0) | ||
7022 | { | ||
7023 | physdata.PhysShapeType = PhysShapeType.invalid; | ||
7024 | } | ||
7025 | else | ||
7026 | { | ||
7027 | ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0]; | ||
7028 | physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType; | ||
7029 | physdata.Bounce = phsblock.Restitution; | ||
7030 | physdata.Density = phsblock.Density; | ||
7031 | physdata.Friction = phsblock.Friction; | ||
7032 | } | ||
7033 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | ||
7013 | } | 7034 | } |
7014 | return true; | 7035 | return true; |
7015 | } | 7036 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs new file mode 100644 index 0000000..10ac37c --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Scenes | ||
34 | { | ||
35 | public static class SOPMaterialData | ||
36 | { | ||
37 | public enum SopMaterial : int // redundante and not in use for now | ||
38 | { | ||
39 | Stone = 0, | ||
40 | Metal = 1, | ||
41 | Glass = 2, | ||
42 | Wood = 3, | ||
43 | Flesh = 4, | ||
44 | Plastic = 5, | ||
45 | Rubber = 6, | ||
46 | light = 7 // compatibility with old viewers | ||
47 | } | ||
48 | |||
49 | private struct MaterialData | ||
50 | { | ||
51 | public float friction; | ||
52 | public float bounce; | ||
53 | public MaterialData(float f, float b) | ||
54 | { | ||
55 | friction = f; | ||
56 | bounce = b; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | private static MaterialData[] m_materialdata = { | ||
61 | new MaterialData(0.8f,0.4f), // Stone | ||
62 | new MaterialData(0.3f,0.4f), // Metal | ||
63 | new MaterialData(0.2f,0.7f), // Glass | ||
64 | new MaterialData(0.6f,0.5f), // Wood | ||
65 | new MaterialData(0.9f,0.3f), // Flesh | ||
66 | new MaterialData(0.4f,0.7f), // Plastic | ||
67 | new MaterialData(0.9f,0.95f), // Rubber | ||
68 | new MaterialData(0.0f,0.0f) // light ?? | ||
69 | }; | ||
70 | |||
71 | public static Material MaxMaterial | ||
72 | { | ||
73 | get { return (Material)(m_materialdata.Length - 1); } | ||
74 | } | ||
75 | |||
76 | public static float friction(Material material) | ||
77 | { | ||
78 | int indx = (int)material; | ||
79 | if (indx < m_materialdata.Length) | ||
80 | return (m_materialdata[indx].friction); | ||
81 | else | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | public static float bounce(Material material) | ||
86 | { | ||
87 | int indx = (int)material; | ||
88 | if (indx < m_materialdata.Length) | ||
89 | return (m_materialdata[indx].bounce); | ||
90 | else | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | } | ||
95 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a3358a5..24e6eb1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4882,7 +4882,7 @@ Environment.Exit(1); | |||
4882 | 4882 | ||
4883 | private void CheckHeartbeat() | 4883 | private void CheckHeartbeat() |
4884 | { | 4884 | { |
4885 | if (m_firstHeartbeat) | 4885 | // if (m_firstHeartbeat) |
4886 | return; | 4886 | return; |
4887 | 4887 | ||
4888 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 5000) | 4888 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 5000) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index e6e3ad0..7b77ea0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1536,7 +1536,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1536 | /// <param name="SetPhantom"></param> | 1536 | /// <param name="SetPhantom"></param> |
1537 | /// <param name="remoteClient"></param> | 1537 | /// <param name="remoteClient"></param> |
1538 | protected internal void UpdatePrimFlags( | 1538 | protected internal void UpdatePrimFlags( |
1539 | uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient) | 1539 | uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient) |
1540 | { | 1540 | { |
1541 | SceneObjectGroup group = GetGroupByPrim(localID); | 1541 | SceneObjectGroup group = GetGroupByPrim(localID); |
1542 | if (group != null) | 1542 | if (group != null) |
@@ -1544,7 +1544,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1544 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1544 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) |
1545 | { | 1545 | { |
1546 | // VolumeDetect can't be set via UI and will always be off when a change is made there | 1546 | // VolumeDetect can't be set via UI and will always be off when a change is made there |
1547 | group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false); | 1547 | if (PhysData.PhysShapeType == PhysShapeType.invalid) |
1548 | group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false); | ||
1549 | else | ||
1550 | { | ||
1551 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1552 | if (part != null) | ||
1553 | part.UpdateExtraPhysics(PhysData); | ||
1554 | } | ||
1548 | } | 1555 | } |
1549 | } | 1556 | } |
1550 | } | 1557 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f647544..ace53f6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -295,7 +295,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | protected float m_buoyancy = 0.0f; | 295 | protected float m_buoyancy = 0.0f; |
296 | protected Vector3 m_force; | 296 | protected Vector3 m_force; |
297 | protected Vector3 m_torque; | 297 | protected Vector3 m_torque; |
298 | 298 | ||
299 | protected byte m_physicsShapeType = (byte)PhysShapeType.prim; | ||
300 | protected float m_density = 1000.0f; // in kg/m^3 | ||
301 | protected float m_gravitymod = 1.0f; | ||
302 | protected float m_friction = 0.6f; // wood | ||
303 | protected float m_bounce = 0.5f; // wood | ||
304 | |||
299 | /// <summary> | 305 | /// <summary> |
300 | /// Stores media texture data | 306 | /// Stores media texture data |
301 | /// </summary> | 307 | /// </summary> |
@@ -556,19 +562,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
556 | } | 562 | } |
557 | } | 563 | } |
558 | 564 | ||
559 | public byte Material | ||
560 | { | ||
561 | get { return (byte) m_material; } | ||
562 | set | ||
563 | { | ||
564 | m_material = (Material)value; | ||
565 | if (PhysActor != null) | ||
566 | { | ||
567 | PhysActor.SetMaterial((int)value); | ||
568 | } | ||
569 | } | ||
570 | } | ||
571 | |||
572 | public bool PassTouches | 565 | public bool PassTouches |
573 | { | 566 | { |
574 | get { return m_passTouches; } | 567 | get { return m_passTouches; } |
@@ -1377,6 +1370,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
1377 | } | 1370 | } |
1378 | } | 1371 | } |
1379 | 1372 | ||
1373 | public byte Material | ||
1374 | { | ||
1375 | get { return (byte)m_material; } | ||
1376 | set | ||
1377 | { | ||
1378 | if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial) | ||
1379 | { | ||
1380 | m_material = (Material)value; | ||
1381 | m_friction = SOPMaterialData.friction(m_material); | ||
1382 | m_bounce = SOPMaterialData.bounce(m_material); | ||
1383 | if (PhysActor != null) | ||
1384 | { | ||
1385 | PhysActor.SetMaterial((int)value); | ||
1386 | } | ||
1387 | } | ||
1388 | } | ||
1389 | } | ||
1390 | |||
1391 | public byte PhysicsShapeType | ||
1392 | { | ||
1393 | get { return m_physicsShapeType; } | ||
1394 | set | ||
1395 | { | ||
1396 | if (value < 0 || value >= (byte)PhysShapeType.convex) | ||
1397 | value = (byte)PhysShapeType.prim; //convex not supported ? | ||
1398 | |||
1399 | else if (value == (byte)PhysShapeType.none) | ||
1400 | { | ||
1401 | if (ParentGroup == null || ParentGroup.RootPart == this) | ||
1402 | value = (byte)PhysShapeType.prim; | ||
1403 | } | ||
1404 | m_physicsShapeType = value; | ||
1405 | } | ||
1406 | } | ||
1407 | |||
1408 | public float Density // in kg/m^3 | ||
1409 | { | ||
1410 | get { return m_density; } | ||
1411 | set | ||
1412 | { | ||
1413 | if (value >=1 && value <= 22587.0) | ||
1414 | { | ||
1415 | m_density = value; | ||
1416 | } | ||
1417 | } | ||
1418 | } | ||
1419 | |||
1420 | public float GravityModifier | ||
1421 | { | ||
1422 | get { return m_gravitymod; } | ||
1423 | set | ||
1424 | { if( value >= -1 && value <=28.0f) | ||
1425 | m_gravitymod = value; | ||
1426 | } | ||
1427 | } | ||
1428 | |||
1429 | public float Friction | ||
1430 | { | ||
1431 | get { return m_friction; } | ||
1432 | set | ||
1433 | { | ||
1434 | if (value >= 0 && value <= 255.0f) | ||
1435 | { | ||
1436 | m_friction = value; | ||
1437 | } | ||
1438 | } | ||
1439 | } | ||
1440 | |||
1441 | public float Bounciness | ||
1442 | { | ||
1443 | get { return m_bounce; } | ||
1444 | set | ||
1445 | { | ||
1446 | if (value >= 0 && value <= 1.0f) | ||
1447 | { | ||
1448 | m_bounce = value; | ||
1449 | } | ||
1450 | } | ||
1451 | } | ||
1452 | |||
1453 | |||
1380 | #endregion Public Properties with only Get | 1454 | #endregion Public Properties with only Get |
1381 | 1455 | ||
1382 | private uint ApplyMask(uint val, bool set, uint mask) | 1456 | private uint ApplyMask(uint val, bool set, uint mask) |
@@ -4334,6 +4408,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4334 | } | 4408 | } |
4335 | } | 4409 | } |
4336 | 4410 | ||
4411 | |||
4412 | public void UpdateExtraPhysics(ExtraPhysicsData physdata) | ||
4413 | { | ||
4414 | if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null) | ||
4415 | return; | ||
4416 | |||
4417 | PhysicsShapeType = (byte)physdata.PhysShapeType; | ||
4418 | Density = physdata.Density; | ||
4419 | GravityModifier = physdata.GravitationModifier; | ||
4420 | Friction = physdata.Friction; | ||
4421 | Bounciness = physdata.Bounce; | ||
4422 | } | ||
4337 | /// <summary> | 4423 | /// <summary> |
4338 | /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. | 4424 | /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. |
4339 | /// </summary> | 4425 | /// </summary> |