diff options
author | UbitUmarov | 2012-10-03 19:33:28 +0100 |
---|---|---|
committer | UbitUmarov | 2012-10-03 19:33:28 +0100 |
commit | 7137b234b4e99d8d19e83dfb5268674c72f46479 (patch) | |
tree | 7c9a899940be65e1fcda108af16207dcebf489ca | |
parent | Attempt to fix Mantis #6311. Honor a destination folder if one is given (diff) | |
download | opensim-SC-7137b234b4e99d8d19e83dfb5268674c72f46479.zip opensim-SC-7137b234b4e99d8d19e83dfb5268674c72f46479.tar.gz opensim-SC-7137b234b4e99d8d19e83dfb5268674c72f46479.tar.bz2 opensim-SC-7137b234b4e99d8d19e83dfb5268674c72f46479.tar.xz |
introduce a ODEMeshWorker class, should be pure cosmetic changes for now
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/Manager/IMesher.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/ZeroMesher.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs | 199 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 166 |
7 files changed, 262 insertions, 163 deletions
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index a8c99f7..06f3c8b 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs | |||
@@ -37,7 +37,8 @@ namespace OpenSim.Region.Physics.Manager | |||
37 | { | 37 | { |
38 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); | 38 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); |
39 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); | 39 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); |
40 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical,bool convex); | 40 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex); |
41 | IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex); | ||
41 | void ReleaseMesh(IMesh mesh); | 42 | void ReleaseMesh(IMesh mesh); |
42 | void ExpireReleaseMeshs(); | 43 | void ExpireReleaseMeshs(); |
43 | } | 44 | } |
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index f555cb9..61da9f3 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs | |||
@@ -79,6 +79,12 @@ namespace OpenSim.Region.Physics.Manager | |||
79 | 79 | ||
80 | return null; | 80 | return null; |
81 | } | 81 | } |
82 | |||
83 | public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) | ||
84 | { | ||
85 | return null; | ||
86 | } | ||
87 | |||
82 | public void ReleaseMesh(IMesh mesh) { } | 88 | public void ReleaseMesh(IMesh mesh) { } |
83 | public void ExpireReleaseMeshs() { } | 89 | public void ExpireReleaseMeshs() { } |
84 | } | 90 | } |
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 3c4f737..143648e 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -763,6 +763,11 @@ namespace OpenSim.Region.Physics.Meshing | |||
763 | 763 | ||
764 | return mesh; | 764 | return mesh; |
765 | } | 765 | } |
766 | public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) | ||
767 | { | ||
768 | return null; | ||
769 | } | ||
770 | |||
766 | public void ReleaseMesh(IMesh imesh) { } | 771 | public void ReleaseMesh(IMesh imesh) { } |
767 | public void ExpireReleaseMeshs() { } | 772 | public void ExpireReleaseMeshs() { } |
768 | } | 773 | } |
diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs index 4c40175..44c8972 100644 --- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs | |||
@@ -1061,6 +1061,42 @@ namespace OpenSim.Region.Physics.Meshing | |||
1061 | 1061 | ||
1062 | private static Vector3 m_MeshUnitSize = new Vector3(0.5f, 0.5f, 0.5f); | 1062 | private static Vector3 m_MeshUnitSize = new Vector3(0.5f, 0.5f, 0.5f); |
1063 | 1063 | ||
1064 | public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) | ||
1065 | { | ||
1066 | Mesh mesh = null; | ||
1067 | |||
1068 | if (size.X < 0.01f) size.X = 0.01f; | ||
1069 | if (size.Y < 0.01f) size.Y = 0.01f; | ||
1070 | if (size.Z < 0.01f) size.Z = 0.01f; | ||
1071 | |||
1072 | AMeshKey key = GetMeshUniqueKey(primShape, size, (byte)lod, convex); | ||
1073 | lock (m_uniqueMeshes) | ||
1074 | { | ||
1075 | m_uniqueMeshes.TryGetValue(key, out mesh); | ||
1076 | |||
1077 | if (mesh != null) | ||
1078 | { | ||
1079 | mesh.RefCount++; | ||
1080 | return mesh; | ||
1081 | } | ||
1082 | } | ||
1083 | |||
1084 | // try to find a identical mesh on meshs recently released | ||
1085 | lock (m_uniqueReleasedMeshes) | ||
1086 | { | ||
1087 | m_uniqueReleasedMeshes.TryGetValue(key, out mesh); | ||
1088 | if (mesh != null) | ||
1089 | { | ||
1090 | m_uniqueReleasedMeshes.Remove(key); | ||
1091 | lock (m_uniqueMeshes) | ||
1092 | m_uniqueMeshes.Add(key, mesh); | ||
1093 | mesh.RefCount = 1; | ||
1094 | return mesh; | ||
1095 | } | ||
1096 | } | ||
1097 | return null; | ||
1098 | } | ||
1099 | |||
1064 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) | 1100 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) |
1065 | { | 1101 | { |
1066 | #if SPAM | 1102 | #if SPAM |
@@ -1068,15 +1104,13 @@ namespace OpenSim.Region.Physics.Meshing | |||
1068 | #endif | 1104 | #endif |
1069 | 1105 | ||
1070 | Mesh mesh = null; | 1106 | Mesh mesh = null; |
1071 | // ulong key = 0; | ||
1072 | |||
1073 | 1107 | ||
1074 | if (size.X < 0.01f) size.X = 0.01f; | 1108 | if (size.X < 0.01f) size.X = 0.01f; |
1075 | if (size.Y < 0.01f) size.Y = 0.01f; | 1109 | if (size.Y < 0.01f) size.Y = 0.01f; |
1076 | if (size.Z < 0.01f) size.Z = 0.01f; | 1110 | if (size.Z < 0.01f) size.Z = 0.01f; |
1077 | 1111 | ||
1078 | // try to find a identical mesh on meshs in use | 1112 | // try to find a identical mesh on meshs in use |
1079 | // key = primShape.GetMeshKey(size, lod, convex); | 1113 | |
1080 | AMeshKey key = GetMeshUniqueKey(primShape,size,(byte)lod, convex); | 1114 | AMeshKey key = GetMeshUniqueKey(primShape,size,(byte)lod, convex); |
1081 | 1115 | ||
1082 | lock (m_uniqueMeshes) | 1116 | lock (m_uniqueMeshes) |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs new file mode 100644 index 0000000..81d59a6 --- /dev/null +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs | |||
@@ -0,0 +1,199 @@ | |||
1 | /* | ||
2 | * AJLDuarte 2012 | ||
3 | */ | ||
4 | |||
5 | using System; | ||
6 | using System.Threading; | ||
7 | using System.Collections.Generic; | ||
8 | using System.Reflection; | ||
9 | using System.Runtime.InteropServices; | ||
10 | using System.Text; | ||
11 | using OpenSim.Framework; | ||
12 | using OpenSim.Region.Physics.Manager; | ||
13 | using OdeAPI; | ||
14 | using log4net; | ||
15 | using Nini.Config; | ||
16 | using OpenMetaverse; | ||
17 | |||
18 | namespace OpenSim.Region.Physics.OdePlugin | ||
19 | { | ||
20 | public class ODEMeshWorker | ||
21 | { | ||
22 | private ILog m_log; | ||
23 | private OdeScene m_scene; | ||
24 | private IMesher m_mesher; | ||
25 | |||
26 | public bool meshSculptedPrim = true; | ||
27 | public bool forceSimplePrimMeshing = false; | ||
28 | public float meshSculptLOD = 32; | ||
29 | public float MeshSculptphysicalLOD = 32; | ||
30 | |||
31 | |||
32 | public ODEMeshWorker(OdeScene pScene, ILog pLog, IMesher pMesher, IConfig pConfig) | ||
33 | { | ||
34 | m_scene = pScene; | ||
35 | m_log = pLog; | ||
36 | m_mesher = pMesher; | ||
37 | |||
38 | if (pConfig != null) | ||
39 | { | ||
40 | forceSimplePrimMeshing = pConfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing); | ||
41 | meshSculptedPrim = pConfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim); | ||
42 | meshSculptLOD = pConfig.GetFloat("mesh_lod", meshSculptLOD); | ||
43 | MeshSculptphysicalLOD = pConfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | |||
48 | |||
49 | /// <summary> | ||
50 | /// Routine to figure out if we need to mesh this prim with our mesher | ||
51 | /// </summary> | ||
52 | /// <param name="pbs"></param> | ||
53 | /// <returns></returns> | ||
54 | public bool needsMeshing(PrimitiveBaseShape pbs) | ||
55 | { | ||
56 | // check sculpts or meshs | ||
57 | if (pbs.SculptEntry) | ||
58 | { | ||
59 | if (meshSculptedPrim) | ||
60 | return true; | ||
61 | |||
62 | if (pbs.SculptType == (byte)SculptType.Mesh) // always do meshs | ||
63 | return true; | ||
64 | |||
65 | return false; | ||
66 | } | ||
67 | |||
68 | if (forceSimplePrimMeshing) | ||
69 | return true; | ||
70 | |||
71 | // if it's a standard box or sphere with no cuts, hollows, twist or top shear, return false since ODE can use an internal representation for the prim | ||
72 | |||
73 | if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) | ||
74 | || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 | ||
75 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)) | ||
76 | { | ||
77 | |||
78 | if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0 | ||
79 | && pbs.ProfileHollow == 0 | ||
80 | && pbs.PathTwist == 0 && pbs.PathTwistBegin == 0 | ||
81 | && pbs.PathBegin == 0 && pbs.PathEnd == 0 | ||
82 | && pbs.PathTaperX == 0 && pbs.PathTaperY == 0 | ||
83 | && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 | ||
84 | && pbs.PathShearX == 0 && pbs.PathShearY == 0) | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | // following code doesn't give meshs to boxes and spheres ever | ||
91 | // and it's odd.. so for now just return true if asked to force meshs | ||
92 | // hopefully mesher will fail if doesn't suport so things still get basic boxes | ||
93 | |||
94 | int iPropertiesNotSupportedDefault = 0; | ||
95 | |||
96 | if (pbs.ProfileHollow != 0) | ||
97 | iPropertiesNotSupportedDefault++; | ||
98 | |||
99 | if ((pbs.PathBegin != 0) || pbs.PathEnd != 0) | ||
100 | iPropertiesNotSupportedDefault++; | ||
101 | |||
102 | if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) | ||
103 | iPropertiesNotSupportedDefault++; | ||
104 | |||
105 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) | ||
106 | iPropertiesNotSupportedDefault++; | ||
107 | |||
108 | if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100)) | ||
109 | iPropertiesNotSupportedDefault++; | ||
110 | |||
111 | if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0)) | ||
112 | iPropertiesNotSupportedDefault++; | ||
113 | |||
114 | if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight) | ||
115 | iPropertiesNotSupportedDefault++; | ||
116 | |||
117 | if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 && (pbs.Scale.X != pbs.Scale.Y || pbs.Scale.Y != pbs.Scale.Z || pbs.Scale.Z != pbs.Scale.X)) | ||
118 | iPropertiesNotSupportedDefault++; | ||
119 | |||
120 | if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) | ||
121 | iPropertiesNotSupportedDefault++; | ||
122 | |||
123 | // test for torus | ||
124 | if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | ||
125 | { | ||
126 | if (pbs.PathCurve == (byte)Extrusion.Curve1) | ||
127 | { | ||
128 | iPropertiesNotSupportedDefault++; | ||
129 | } | ||
130 | } | ||
131 | else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | ||
132 | { | ||
133 | if (pbs.PathCurve == (byte)Extrusion.Straight) | ||
134 | { | ||
135 | iPropertiesNotSupportedDefault++; | ||
136 | } | ||
137 | |||
138 | // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits | ||
139 | else if (pbs.PathCurve == (byte)Extrusion.Curve1) | ||
140 | { | ||
141 | iPropertiesNotSupportedDefault++; | ||
142 | } | ||
143 | } | ||
144 | else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) | ||
145 | { | ||
146 | if (pbs.PathCurve == (byte)Extrusion.Curve1 || pbs.PathCurve == (byte)Extrusion.Curve2) | ||
147 | { | ||
148 | iPropertiesNotSupportedDefault++; | ||
149 | } | ||
150 | } | ||
151 | else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) | ||
152 | { | ||
153 | if (pbs.PathCurve == (byte)Extrusion.Straight) | ||
154 | { | ||
155 | iPropertiesNotSupportedDefault++; | ||
156 | } | ||
157 | else if (pbs.PathCurve == (byte)Extrusion.Curve1) | ||
158 | { | ||
159 | iPropertiesNotSupportedDefault++; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | if (iPropertiesNotSupportedDefault == 0) | ||
164 | { | ||
165 | return false; | ||
166 | } | ||
167 | return true; | ||
168 | } | ||
169 | |||
170 | public IMesh getMesh(PhysicsActor actor, PrimitiveBaseShape ppbs, Vector3 psize, byte pshapetype) | ||
171 | { | ||
172 | if (!(actor is OdePrim)) | ||
173 | return null; | ||
174 | |||
175 | IMesh mesh = null; | ||
176 | PrimitiveBaseShape pbs = ppbs; | ||
177 | Vector3 size = psize; | ||
178 | byte shapetype = pshapetype; | ||
179 | |||
180 | if (needsMeshing(pbs) && (pbs.SculptData.Length > 0)) | ||
181 | { | ||
182 | bool convex; | ||
183 | int clod = (int)LevelOfDetail.High; | ||
184 | if (shapetype == 0) | ||
185 | convex = false; | ||
186 | else | ||
187 | { | ||
188 | convex = true; | ||
189 | if (pbs.SculptType != (byte)SculptType.Mesh) | ||
190 | clod = (int)LevelOfDetail.Low; | ||
191 | } | ||
192 | mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex); | ||
193 | if(mesh == null) | ||
194 | mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex); | ||
195 | } | ||
196 | return mesh; | ||
197 | } | ||
198 | } | ||
199 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index f2f4725..545bd27 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -1080,7 +1080,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1080 | bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce; | 1080 | bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce; |
1081 | 1081 | ||
1082 | CalcPrimBodyData(); | 1082 | CalcPrimBodyData(); |
1083 | 1083 | /* | |
1084 | m_mesh = null; | 1084 | m_mesh = null; |
1085 | if (_parent_scene.needsMeshing(pbs) && (pbs.SculptData.Length > 0)) | 1085 | if (_parent_scene.needsMeshing(pbs) && (pbs.SculptData.Length > 0)) |
1086 | { | 1086 | { |
@@ -1096,6 +1096,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1096 | } | 1096 | } |
1097 | m_mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, clod, true, convex); | 1097 | m_mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, clod, true, convex); |
1098 | } | 1098 | } |
1099 | */ | ||
1100 | m_mesh = _parent_scene.m_meshWorker.getMesh(this, pbs, _size, m_shapetype); | ||
1099 | 1101 | ||
1100 | m_building = true; // control must set this to false when done | 1102 | m_building = true; // control must set this to false when done |
1101 | 1103 | ||
@@ -1476,7 +1478,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1476 | hasOOBoffsetFromMesh = false; | 1478 | hasOOBoffsetFromMesh = false; |
1477 | m_NoColide = false; | 1479 | m_NoColide = false; |
1478 | 1480 | ||
1479 | if (_parent_scene.needsMeshing(_pbs)) | 1481 | if (_parent_scene.m_meshWorker.needsMeshing(_pbs)) |
1480 | { | 1482 | { |
1481 | haveMesh = setMesh(_parent_scene); // this will give a mesh to non trivial known prims | 1483 | haveMesh = setMesh(_parent_scene); // this will give a mesh to non trivial known prims |
1482 | if (!haveMesh) | 1484 | if (!haveMesh) |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index f126644..7c00600 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -230,11 +230,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
230 | private float minimumGroundFlightOffset = 3f; | 230 | private float minimumGroundFlightOffset = 3f; |
231 | public float maximumMassObject = 10000.01f; | 231 | public float maximumMassObject = 10000.01f; |
232 | 232 | ||
233 | public bool meshSculptedPrim = true; | ||
234 | public bool forceSimplePrimMeshing = false; | ||
235 | |||
236 | public float meshSculptLOD = 32; | ||
237 | public float MeshSculptphysicalLOD = 32; | ||
238 | 233 | ||
239 | public float geomDefaultDensity = 10.000006836f; | 234 | public float geomDefaultDensity = 10.000006836f; |
240 | 235 | ||
@@ -328,7 +323,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
328 | private PhysicsScene m_parentScene = null; | 323 | private PhysicsScene m_parentScene = null; |
329 | 324 | ||
330 | private ODERayCastRequestManager m_rayCastManager; | 325 | private ODERayCastRequestManager m_rayCastManager; |
331 | 326 | public ODEMeshWorker m_meshWorker; | |
332 | 327 | ||
333 | /* maybe needed if ode uses tls | 328 | /* maybe needed if ode uses tls |
334 | private void checkThread() | 329 | private void checkThread() |
@@ -361,6 +356,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
361 | nearCallback = near; | 356 | nearCallback = near; |
362 | 357 | ||
363 | m_rayCastManager = new ODERayCastRequestManager(this); | 358 | m_rayCastManager = new ODERayCastRequestManager(this); |
359 | |||
360 | |||
364 | lock (OdeLock) | 361 | lock (OdeLock) |
365 | { | 362 | { |
366 | // Create the world and the first space | 363 | // Create the world and the first space |
@@ -440,9 +437,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
440 | 437 | ||
441 | int contactsPerCollision = 80; | 438 | int contactsPerCollision = 80; |
442 | 439 | ||
440 | IConfig physicsconfig = null; | ||
441 | |||
443 | if (m_config != null) | 442 | if (m_config != null) |
444 | { | 443 | { |
445 | IConfig physicsconfig = m_config.Configs["ODEPhysicsSettings"]; | 444 | physicsconfig = m_config.Configs["ODEPhysicsSettings"]; |
446 | if (physicsconfig != null) | 445 | if (physicsconfig != null) |
447 | { | 446 | { |
448 | gravityx = physicsconfig.GetFloat("world_gravityx", gravityx); | 447 | gravityx = physicsconfig.GetFloat("world_gravityx", gravityx); |
@@ -469,27 +468,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
469 | 468 | ||
470 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); | 469 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); |
471 | bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); | 470 | bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); |
472 | /* | 471 | |
473 | bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", bodyPIDD); | ||
474 | bodyPIDG = physicsconfig.GetFloat("body_pid_gain", bodyPIDG); | ||
475 | */ | ||
476 | forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing); | ||
477 | meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim); | ||
478 | meshSculptLOD = physicsconfig.GetFloat("mesh_lod", meshSculptLOD); | ||
479 | MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD); | ||
480 | /* | ||
481 | if (Environment.OSVersion.Platform == PlatformID.Unix) | ||
482 | { | ||
483 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", avPIDD); | ||
484 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_linux", avPIDP); | ||
485 | } | ||
486 | else | ||
487 | { | ||
488 | |||
489 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", avPIDD); | ||
490 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", avPIDP); | ||
491 | } | ||
492 | */ | ||
493 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); | 472 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); |
494 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); | 473 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); |
495 | physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); | 474 | physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); |
@@ -499,6 +478,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
499 | } | 478 | } |
500 | } | 479 | } |
501 | 480 | ||
481 | m_meshWorker = new ODEMeshWorker(this, m_log, meshmerizer, physicsconfig); | ||
482 | |||
502 | HalfOdeStep = ODE_STEPSIZE * 0.5f; | 483 | HalfOdeStep = ODE_STEPSIZE * 0.5f; |
503 | odetimestepMS = (int)(1000.0f * ODE_STEPSIZE +0.5f); | 484 | odetimestepMS = (int)(1000.0f * ODE_STEPSIZE +0.5f); |
504 | 485 | ||
@@ -1615,135 +1596,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1615 | 1596 | ||
1616 | #endregion | 1597 | #endregion |
1617 | 1598 | ||
1618 | /// <summary> | ||
1619 | /// Routine to figure out if we need to mesh this prim with our mesher | ||
1620 | /// </summary> | ||
1621 | /// <param name="pbs"></param> | ||
1622 | /// <returns></returns> | ||
1623 | public bool needsMeshing(PrimitiveBaseShape pbs) | ||
1624 | { | ||
1625 | // check sculpts or meshs | ||
1626 | if (pbs.SculptEntry) | ||
1627 | { | ||
1628 | if (meshSculptedPrim) | ||
1629 | return true; | ||
1630 | |||
1631 | if (pbs.SculptType == (byte)SculptType.Mesh) // always do meshs | ||
1632 | return true; | ||
1633 | |||
1634 | return false; | ||
1635 | } | ||
1636 | |||
1637 | if (forceSimplePrimMeshing) | ||
1638 | return true; | ||
1639 | |||
1640 | // if it's a standard box or sphere with no cuts, hollows, twist or top shear, return false since ODE can use an internal representation for the prim | ||
1641 | |||
1642 | if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) | ||
1643 | || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 | ||
1644 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)) | ||
1645 | { | ||
1646 | |||
1647 | if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0 | ||
1648 | && pbs.ProfileHollow == 0 | ||
1649 | && pbs.PathTwist == 0 && pbs.PathTwistBegin == 0 | ||
1650 | && pbs.PathBegin == 0 && pbs.PathEnd == 0 | ||
1651 | && pbs.PathTaperX == 0 && pbs.PathTaperY == 0 | ||
1652 | && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 | ||
1653 | && pbs.PathShearX == 0 && pbs.PathShearY == 0) | ||
1654 | { | ||
1655 | #if SPAM | ||
1656 | m_log.Warn("NonMesh"); | ||
1657 | #endif | ||
1658 | return false; | ||
1659 | } | ||
1660 | } | ||
1661 | |||
1662 | // following code doesn't give meshs to boxes and spheres ever | ||
1663 | // and it's odd.. so for now just return true if asked to force meshs | ||
1664 | // hopefully mesher will fail if doesn't suport so things still get basic boxes | ||
1665 | |||
1666 | int iPropertiesNotSupportedDefault = 0; | ||
1667 | |||
1668 | if (pbs.ProfileHollow != 0) | ||
1669 | iPropertiesNotSupportedDefault++; | ||
1670 | |||
1671 | if ((pbs.PathBegin != 0) || pbs.PathEnd != 0) | ||
1672 | iPropertiesNotSupportedDefault++; | ||
1673 | |||
1674 | if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) | ||
1675 | iPropertiesNotSupportedDefault++; | ||
1676 | |||
1677 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) | ||
1678 | iPropertiesNotSupportedDefault++; | ||
1679 | |||
1680 | if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100)) | ||
1681 | iPropertiesNotSupportedDefault++; | ||
1682 | |||
1683 | if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0)) | ||
1684 | iPropertiesNotSupportedDefault++; | ||
1685 | |||
1686 | if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight) | ||
1687 | iPropertiesNotSupportedDefault++; | ||
1688 | |||
1689 | if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 && (pbs.Scale.X != pbs.Scale.Y || pbs.Scale.Y != pbs.Scale.Z || pbs.Scale.Z != pbs.Scale.X)) | ||
1690 | iPropertiesNotSupportedDefault++; | ||
1691 | |||
1692 | if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1) | ||
1693 | iPropertiesNotSupportedDefault++; | ||
1694 | |||
1695 | // test for torus | ||
1696 | if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | ||
1697 | { | ||
1698 | if (pbs.PathCurve == (byte)Extrusion.Curve1) | ||
1699 | { | ||
1700 | iPropertiesNotSupportedDefault++; | ||
1701 | } | ||
1702 | } | ||
1703 | else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | ||
1704 | { | ||
1705 | if (pbs.PathCurve == (byte)Extrusion.Straight) | ||
1706 | { | ||
1707 | iPropertiesNotSupportedDefault++; | ||
1708 | } | ||
1709 | |||
1710 | // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits | ||
1711 | else if (pbs.PathCurve == (byte)Extrusion.Curve1) | ||
1712 | { | ||
1713 | iPropertiesNotSupportedDefault++; | ||
1714 | } | ||
1715 | } | ||
1716 | else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) | ||
1717 | { | ||
1718 | if (pbs.PathCurve == (byte)Extrusion.Curve1 || pbs.PathCurve == (byte)Extrusion.Curve2) | ||
1719 | { | ||
1720 | iPropertiesNotSupportedDefault++; | ||
1721 | } | ||
1722 | } | ||
1723 | else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) | ||
1724 | { | ||
1725 | if (pbs.PathCurve == (byte)Extrusion.Straight) | ||
1726 | { | ||
1727 | iPropertiesNotSupportedDefault++; | ||
1728 | } | ||
1729 | else if (pbs.PathCurve == (byte)Extrusion.Curve1) | ||
1730 | { | ||
1731 | iPropertiesNotSupportedDefault++; | ||
1732 | } | ||
1733 | } | ||
1734 | |||
1735 | if (iPropertiesNotSupportedDefault == 0) | ||
1736 | { | ||
1737 | #if SPAM | ||
1738 | m_log.Warn("NonMesh"); | ||
1739 | #endif | ||
1740 | return false; | ||
1741 | } | ||
1742 | #if SPAM | ||
1743 | m_log.Debug("Mesh"); | ||
1744 | #endif | ||
1745 | return true; | ||
1746 | } | ||
1747 | 1599 | ||
1748 | /// <summary> | 1600 | /// <summary> |
1749 | /// Called to queue a change to a actor | 1601 | /// Called to queue a change to a actor |