aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorubit2012-10-08 00:55:44 +0200
committerubit2012-10-08 00:55:44 +0200
commit2d2c4e3a860756e1e0000d89cc94112abb1d0cef (patch)
tree48d9b4b4a16fdb4dfcb312da6358e0993cf2a870 /OpenSim/Region
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parent a few changes/fix (?) (diff)
downloadopensim-SC-2d2c4e3a860756e1e0000d89cc94112abb1d0cef.zip
opensim-SC-2d2c4e3a860756e1e0000d89cc94112abb1d0cef.tar.gz
opensim-SC-2d2c4e3a860756e1e0000d89cc94112abb1d0cef.tar.bz2
opensim-SC-2d2c4e3a860756e1e0000d89cc94112abb1d0cef.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs18
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs150
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs50
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs11
4 files changed, 112 insertions, 117 deletions
diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
index 2933d86..fabadd3 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
@@ -1113,17 +1113,17 @@ namespace OpenSim.Region.Physics.Meshing
1113 1113
1114 Mesh mesh = (Mesh)imesh; 1114 Mesh mesh = (Mesh)imesh;
1115 1115
1116 int curRefCount = mesh.RefCount;
1117 curRefCount--;
1118
1119 if (curRefCount > 0)
1120 {
1121 mesh.RefCount = curRefCount;
1122 return;
1123 }
1124
1125 lock (m_uniqueMeshes) 1116 lock (m_uniqueMeshes)
1126 { 1117 {
1118 int curRefCount = mesh.RefCount;
1119 curRefCount--;
1120
1121 if (curRefCount > 0)
1122 {
1123 mesh.RefCount = curRefCount;
1124 return;
1125 }
1126
1127 mesh.RefCount = 0; 1127 mesh.RefCount = 0;
1128 m_uniqueMeshes.Remove(mesh.Key); 1128 m_uniqueMeshes.Remove(mesh.Key);
1129 lock (m_uniqueReleasedMeshes) 1129 lock (m_uniqueReleasedMeshes)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
index 6bdc089..024835c 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
@@ -18,6 +18,23 @@ using OpenMetaverse;
18 18
19namespace OpenSim.Region.Physics.OdePlugin 19namespace OpenSim.Region.Physics.OdePlugin
20{ 20{
21 public enum MeshState : byte
22 {
23 noNeed = 0,
24
25 loadingAsset = 1,
26
27 AssetOK = 0x0f, // 00001111
28
29 NeedMask = 0x30, // 00110000
30 needMesh = 0x10, // 00010000
31 needAsset = 0x20, // 00100000
32
33 FailMask = 0xC0, // 11000000
34 AssetFailed = 0x40, // 01000000
35 MeshFailed = 0x80 // 10000000
36 }
37
21 public enum meshWorkerCmnds : byte 38 public enum meshWorkerCmnds : byte
22 { 39 {
23 nop = 0, 40 nop = 0,
@@ -43,13 +60,11 @@ namespace OpenSim.Region.Physics.OdePlugin
43 public byte shapetype; 60 public byte shapetype;
44 public bool hasOBB; 61 public bool hasOBB;
45 public bool hasMeshVolume; 62 public bool hasMeshVolume;
46 public AssetState assetState; 63 public MeshState meshState;
47 public UUID? assetID; 64 public UUID? assetID;
48 public meshWorkerCmnds comand; 65 public meshWorkerCmnds comand;
49 } 66 }
50 67
51
52
53 public class ODEMeshWorker 68 public class ODEMeshWorker
54 { 69 {
55 70
@@ -138,16 +153,10 @@ namespace OpenSim.Region.Physics.OdePlugin
138 repData.size = size; 153 repData.size = size;
139 repData.shapetype = shapetype; 154 repData.shapetype = shapetype;
140 155
141 // if (CheckMeshDone(repData)) 156 CheckMeshDone(repData);
142 { 157 CalcVolumeData(repData);
143 CheckMeshDone(repData); 158 m_scene.AddChange(actor, changes.PhysRepData, repData);
144 CalcVolumeData(repData); 159 return;
145 m_scene.AddChange(actor, changes.PhysRepData, repData);
146 return;
147 }
148
149// repData.comand = meshWorkerCmnds.changefull;
150// createqueue.Enqueue(repData);
151 } 160 }
152 161
153 public void NewActorPhysRep(PhysicsActor actor, PrimitiveBaseShape pbs, 162 public void NewActorPhysRep(PhysicsActor actor, PrimitiveBaseShape pbs,
@@ -159,39 +168,43 @@ namespace OpenSim.Region.Physics.OdePlugin
159 repData.size = size; 168 repData.size = size;
160 repData.shapetype = shapetype; 169 repData.shapetype = shapetype;
161 170
162 // bool done = CheckMeshDone(repData);
163
164 CheckMeshDone(repData); 171 CheckMeshDone(repData);
165 CalcVolumeData(repData); 172 CalcVolumeData(repData);
166 m_scene.AddChange(actor, changes.AddPhysRep, repData); 173 m_scene.AddChange(actor, changes.AddPhysRep, repData);
167// if (done)
168 return;
169
170// repData.comand = meshWorkerCmnds.addnew;
171// createqueue.Enqueue(repData);
172 } 174 }
173 175
174 public void RequestMeshAsset(ODEPhysRepData repData) 176 public void RequestMesh(ODEPhysRepData repData)
175 { 177 {
176 if (repData.assetState != AssetState.needAsset)
177 return;
178
179 repData.mesh = null; 178 repData.mesh = null;
180 179
181 if (repData.assetID == null || repData.assetID == UUID.Zero) 180 if (repData.meshState == MeshState.needMesh)
182 { 181 {
183 repData.assetState = AssetState.noNeedAsset;
184 repData.comand = meshWorkerCmnds.changefull; 182 repData.comand = meshWorkerCmnds.changefull;
185 createqueue.Enqueue(repData); 183 createqueue.Enqueue(repData);
186 return;
187 } 184 }
185 else if (repData.meshState == MeshState.needAsset)
186 {
187 PrimitiveBaseShape pbs = repData.pbs;
188
189 // check if we got outdated
190
191 if (!pbs.SculptEntry || pbs.SculptTexture == UUID.Zero)
192 {
193 repData.meshState = MeshState.noNeed;
194 return;
195 }
196
197 if (pbs.SculptTexture != repData.assetID)
198 return;
188 199
189 repData.assetState = AssetState.loadingAsset; 200 repData.meshState = MeshState.loadingAsset;
190 201
191 repData.comand = meshWorkerCmnds.getmesh; 202 repData.comand = meshWorkerCmnds.getmesh;
192 createqueue.Enqueue(repData); 203 createqueue.Enqueue(repData);
204 }
193 } 205 }
194 206
207 // creates and prepares a mesh to use and calls parameters estimation
195 public bool CreateActorPhysRep(ODEPhysRepData repData) 208 public bool CreateActorPhysRep(ODEPhysRepData repData)
196 { 209 {
197 getMesh(repData); 210 getMesh(repData);
@@ -210,7 +223,7 @@ namespace OpenSim.Region.Physics.OdePlugin
210 { 223 {
211 m_log.WarnFormat("[PHYSICS]: Invalid mesh data on prim {0} mesh UUID {1}", 224 m_log.WarnFormat("[PHYSICS]: Invalid mesh data on prim {0} mesh UUID {1}",
212 repData.actor.Name, repData.pbs.SculptTexture.ToString()); 225 repData.actor.Name, repData.pbs.SculptTexture.ToString());
213 repData.assetState = AssetState.AssetFailed; 226 repData.meshState = MeshState.MeshFailed;
214 repData.hasOBB = false; 227 repData.hasOBB = false;
215 repData.mesh = null; 228 repData.mesh = null;
216 m_scene.mesher.ReleaseMesh(mesh); 229 m_scene.mesher.ReleaseMesh(mesh);
@@ -237,6 +250,8 @@ namespace OpenSim.Region.Physics.OdePlugin
237 createqueue.Enqueue(repData); 250 createqueue.Enqueue(repData);
238 } 251 }
239 } 252 }
253 else
254 repData.pbs.SculptData = Utils.EmptyBytes;
240 } 255 }
241 256
242 public void DoRepDataGetMesh(ODEPhysRepData repData) 257 public void DoRepDataGetMesh(ODEPhysRepData repData)
@@ -244,7 +259,7 @@ namespace OpenSim.Region.Physics.OdePlugin
244 if (!repData.pbs.SculptEntry) 259 if (!repData.pbs.SculptEntry)
245 return; 260 return;
246 261
247 if (repData.assetState != AssetState.loadingAsset) 262 if (repData.meshState != MeshState.loadingAsset)
248 return; 263 return;
249 264
250 if (repData.assetID == null || repData.assetID == UUID.Zero) 265 if (repData.assetID == null || repData.assetID == UUID.Zero)
@@ -381,34 +396,19 @@ namespace OpenSim.Region.Physics.OdePlugin
381 return true; 396 return true;
382 } 397 }
383 398
399 // see if we need a mesh and if so if we have a cached one
400 // called with a new repData
384 public bool CheckMeshDone(ODEPhysRepData repData) 401 public bool CheckMeshDone(ODEPhysRepData repData)
385 { 402 {
386 PhysicsActor actor = repData.actor; 403 PhysicsActor actor = repData.actor;
387 PrimitiveBaseShape pbs = repData.pbs; 404 PrimitiveBaseShape pbs = repData.pbs;
388 405
389 repData.mesh = null;
390 repData.hasOBB = false;
391
392 if (!needsMeshing(pbs)) 406 if (!needsMeshing(pbs))
393 { 407 {
394 repData.assetState = AssetState.noNeedAsset; 408 repData.meshState = MeshState.noNeed;
395 return true; 409 return true;
396 } 410 }
397 411
398 if (pbs.SculptEntry)
399 {
400 if (repData.assetState == AssetState.AssetFailed)
401 {
402 if (pbs.SculptTexture == repData.assetID)
403 return true;
404 }
405 }
406 else
407 {
408 repData.assetState = AssetState.noNeedAsset;
409 repData.assetID = null;
410 }
411
412 IMesh mesh = null; 412 IMesh mesh = null;
413 413
414 Vector3 size = repData.size; 414 Vector3 size = repData.size;
@@ -425,7 +425,9 @@ namespace OpenSim.Region.Physics.OdePlugin
425 if (pbs.SculptType != (byte)SculptType.Mesh) 425 if (pbs.SculptType != (byte)SculptType.Mesh)
426 clod = (int)LevelOfDetail.Low; 426 clod = (int)LevelOfDetail.Low;
427 } 427 }
428
428 mesh = m_mesher.GetMesh(actor.Name, pbs, size, clod, true, convex); 429 mesh = m_mesher.GetMesh(actor.Name, pbs, size, clod, true, convex);
430
429 if (mesh == null) 431 if (mesh == null)
430 { 432 {
431 if (pbs.SculptEntry) 433 if (pbs.SculptEntry)
@@ -433,13 +435,13 @@ namespace OpenSim.Region.Physics.OdePlugin
433 if (pbs.SculptTexture != null && pbs.SculptTexture != UUID.Zero) 435 if (pbs.SculptTexture != null && pbs.SculptTexture != UUID.Zero)
434 { 436 {
435 repData.assetID = pbs.SculptTexture; 437 repData.assetID = pbs.SculptTexture;
436 repData.assetState = AssetState.needAsset; 438 repData.meshState = MeshState.needAsset;
437 } 439 }
438 else 440 else
439 repData.assetState = AssetState.AssetFailed; 441 repData.meshState = MeshState.MeshFailed;
440 } 442 }
441 else 443 else
442 repData.assetState = AssetState.needAsset; 444 repData.meshState = MeshState.needMesh;
443 445
444 return false; 446 return false;
445 } 447 }
@@ -447,14 +449,14 @@ namespace OpenSim.Region.Physics.OdePlugin
447 repData.mesh = mesh; 449 repData.mesh = mesh;
448 if (pbs.SculptEntry) 450 if (pbs.SculptEntry)
449 { 451 {
450 repData.assetState = AssetState.AssetOK; 452 repData.meshState = MeshState.AssetOK;
451 repData.assetID = pbs.SculptTexture; 453 repData.assetID = pbs.SculptTexture;
452 pbs.SculptData = Utils.EmptyBytes;
453 } 454 }
455
456 pbs.SculptData = Utils.EmptyBytes;
454 return true; 457 return true;
455 } 458 }
456 459
457
458 public bool getMesh(ODEPhysRepData repData) 460 public bool getMesh(ODEPhysRepData repData)
459 { 461 {
460 PhysicsActor actor = repData.actor; 462 PhysicsActor actor = repData.actor;
@@ -467,16 +469,19 @@ namespace OpenSim.Region.Physics.OdePlugin
467 if (!needsMeshing(pbs)) 469 if (!needsMeshing(pbs))
468 return false; 470 return false;
469 471
472 if (repData.meshState == MeshState.MeshFailed)
473 return false;
474
470 if (pbs.SculptEntry) 475 if (pbs.SculptEntry)
471 { 476 {
472 if (repData.assetState == AssetState.AssetFailed) 477 if (repData.meshState == MeshState.AssetFailed)
473 { 478 {
474 if (pbs.SculptTexture == repData.assetID) 479 if (pbs.SculptTexture == repData.assetID)
475 return true; 480 return true;
476 } 481 }
477 } 482 }
478 483
479 repData.assetState = AssetState.noNeedAsset; 484 repData.meshState = MeshState.noNeed;
480 485
481 IMesh mesh = null; 486 IMesh mesh = null;
482 Vector3 size = repData.size; 487 Vector3 size = repData.size;
@@ -492,7 +497,10 @@ namespace OpenSim.Region.Physics.OdePlugin
492 if (pbs.SculptType != (byte)SculptType.Mesh) 497 if (pbs.SculptType != (byte)SculptType.Mesh)
493 clod = (int)LevelOfDetail.Low; 498 clod = (int)LevelOfDetail.Low;
494 } 499 }
500
501 // check cached
495 mesh = m_mesher.GetMesh(actor.Name, pbs, size, clod, true, convex); 502 mesh = m_mesher.GetMesh(actor.Name, pbs, size, clod, true, convex);
503
496 if (mesh == null) 504 if (mesh == null)
497 { 505 {
498 if (pbs.SculptEntry) 506 if (pbs.SculptEntry)
@@ -501,17 +509,16 @@ namespace OpenSim.Region.Physics.OdePlugin
501 return false; 509 return false;
502 510
503 repData.assetID = pbs.SculptTexture; 511 repData.assetID = pbs.SculptTexture;
504 repData.assetState = AssetState.AssetOK; 512 repData.meshState = MeshState.AssetOK;
505 513
506 if (pbs.SculptData == null || pbs.SculptData.Length == 0) 514 if (pbs.SculptData == null || pbs.SculptData.Length == 0)
507 { 515 {
508 repData.assetState = AssetState.needAsset; 516 repData.meshState = MeshState.needAsset;
509 return false; 517 return false;
510 } 518 }
511 } 519 }
512 520
513 mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex); 521 mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex);
514
515 } 522 }
516 523
517 repData.mesh = mesh; 524 repData.mesh = mesh;
@@ -520,13 +527,14 @@ namespace OpenSim.Region.Physics.OdePlugin
520 if (mesh == null) 527 if (mesh == null)
521 { 528 {
522 if (pbs.SculptEntry) 529 if (pbs.SculptEntry)
523 repData.assetState = AssetState.AssetFailed; 530 repData.meshState = MeshState.AssetFailed;
531 else
532 repData.meshState = MeshState.MeshFailed;
524 533
525 return false; 534 return false;
526 } 535 }
527 536
528 if (pbs.SculptEntry) 537 repData.meshState = MeshState.AssetOK;
529 repData.assetState = AssetState.AssetOK;
530 538
531 return true; 539 return true;
532 } 540 }
@@ -866,7 +874,7 @@ namespace OpenSim.Region.Physics.OdePlugin
866 m_log = plog; 874 m_log = plog;
867 repData = pRepData; 875 repData = pRepData;
868 876
869 repData.assetState = AssetState.AssetFailed; 877 repData.meshState = MeshState.AssetFailed;
870 if (provider == null) 878 if (provider == null)
871 return; 879 return;
872 880
@@ -877,29 +885,27 @@ namespace OpenSim.Region.Physics.OdePlugin
877 if (assetID == UUID.Zero) 885 if (assetID == UUID.Zero)
878 return; 886 return;
879 887
880 repData.assetState = AssetState.loadingAsset; 888 repData.meshState = MeshState.loadingAsset;
881 provider(assetID, ODEassetReceived); 889 provider(assetID, ODEassetReceived);
882 } 890 }
883 891
884 void ODEassetReceived(AssetBase asset) 892 void ODEassetReceived(AssetBase asset)
885 { 893 {
886 repData.assetState = AssetState.AssetFailed; 894 repData.meshState = MeshState.AssetFailed;
887 if (asset != null) 895 if (asset != null)
888 { 896 {
889 if (asset.Data != null && asset.Data.Length > 0) 897 if (asset.Data != null && asset.Data.Length > 0)
890 { 898 {
899 repData.meshState = MeshState.noNeed;
900
891 if (!repData.pbs.SculptEntry) 901 if (!repData.pbs.SculptEntry)
892 return; 902 return;
893 if (repData.pbs.SculptTexture != repData.assetID) 903 if (repData.pbs.SculptTexture != repData.assetID)
894 return; 904 return;
895 905
896 // asset get may return a pointer to the same asset data
897 // for similar prims and we destroy with it
898 // so waste a lot of time stressing gc and hoping it clears things
899 // TODO avoid this
900 repData.pbs.SculptData = new byte[asset.Data.Length]; 906 repData.pbs.SculptData = new byte[asset.Data.Length];
901 asset.Data.CopyTo(repData.pbs.SculptData,0); 907 asset.Data.CopyTo(repData.pbs.SculptData,0);
902 repData.assetState = AssetState.AssetOK; 908 repData.meshState = MeshState.AssetOK;
903 m_worker.AssetLoaded(repData); 909 m_worker.AssetLoaded(repData);
904 } 910 }
905 else 911 else
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 4c16f8e..c2c4384 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.Physics.OdePlugin
146 private PrimitiveBaseShape _pbs; 146 private PrimitiveBaseShape _pbs;
147 147
148 private UUID? m_assetID; 148 private UUID? m_assetID;
149 private AssetState m_assetState; 149 private MeshState m_meshState;
150 150
151 public OdeScene _parent_scene; 151 public OdeScene _parent_scene;
152 152
@@ -1341,15 +1341,18 @@ namespace OpenSim.Region.Physics.OdePlugin
1341 1341
1342 if (vertexCount == 0 || indexCount == 0) 1342 if (vertexCount == 0 || indexCount == 0)
1343 { 1343 {
1344 m_log.WarnFormat("[PHYSICS]: Invalid mesh data on OdePrim {0} mesh UUID {1}", 1344 m_log.WarnFormat("[PHYSICS]: Invalid mesh data on OdePrim {0}, mesh {1}",
1345 Name, _pbs.SculptTexture.ToString()); 1345 Name, _pbs.SculptEntry ? _pbs.SculptTexture.ToString() : "primMesh");
1346
1346 m_hasOBB = false; 1347 m_hasOBB = false;
1347 m_OBBOffset = Vector3.Zero; 1348 m_OBBOffset = Vector3.Zero;
1348 m_OBB = _size * 0.5f; 1349 m_OBB = _size * 0.5f;
1350
1349 m_physCost = 0.1f; 1351 m_physCost = 0.1f;
1350 m_streamCost = 1.0f; 1352 m_streamCost = 1.0f;
1353
1351 _parent_scene.mesher.ReleaseMesh(mesh); 1354 _parent_scene.mesher.ReleaseMesh(mesh);
1352 m_assetState = AssetState.AssetFailed; 1355 m_meshState = MeshState.MeshFailed;
1353 m_mesh = null; 1356 m_mesh = null;
1354 return false; 1357 return false;
1355 } 1358 }
@@ -1360,7 +1363,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1360 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); 1363 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
1361 d.GeomTriMeshDataPreprocess(_triMeshData); 1364 d.GeomTriMeshDataPreprocess(_triMeshData);
1362 1365
1363 prim_geom = d.CreateTriMesh(IntPtr.Zero, _triMeshData, null, null, null); 1366 prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null);
1364 } 1367 }
1365 1368
1366 catch (Exception e) 1369 catch (Exception e)
@@ -1385,7 +1388,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1385 m_physCost = 0.1f; 1388 m_physCost = 0.1f;
1386 m_streamCost = 1.0f; 1389 m_streamCost = 1.0f;
1387 _parent_scene.mesher.ReleaseMesh(mesh); 1390 _parent_scene.mesher.ReleaseMesh(mesh);
1388 m_assetState = AssetState.AssetFailed; 1391 m_meshState = MeshState.AssetFailed;
1389 m_mesh = null; 1392 m_mesh = null;
1390 return false; 1393 return false;
1391 } 1394 }
@@ -1404,7 +1407,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1404 1407
1405 m_NoColide = false; 1408 m_NoColide = false;
1406 1409
1407 if (m_assetState == AssetState.AssetFailed) 1410 if ((m_meshState & MeshState.FailMask) != 0)
1408 m_NoColide = true; 1411 m_NoColide = true;
1409 1412
1410 else if(m_mesh != null) 1413 else if(m_mesh != null)
@@ -1422,7 +1425,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1422 { // it's a sphere 1425 { // it's a sphere
1423 try 1426 try
1424 { 1427 {
1425 geo = d.CreateSphere(IntPtr.Zero, _size.X * 0.5f); 1428 geo = d.CreateSphere(m_targetSpace, _size.X * 0.5f);
1426 } 1429 }
1427 catch (Exception e) 1430 catch (Exception e)
1428 { 1431 {
@@ -1434,7 +1437,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1434 {// do it as a box 1437 {// do it as a box
1435 try 1438 try
1436 { 1439 {
1437 geo = d.CreateBox(IntPtr.Zero, _size.X, _size.Y, _size.Z); 1440 geo = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1438 } 1441 }
1439 catch (Exception e) 1442 catch (Exception e)
1440 { 1443 {
@@ -2748,7 +2751,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2748 m_mesh = repData.mesh; 2751 m_mesh = repData.mesh;
2749 2752
2750 m_assetID = repData.assetID; 2753 m_assetID = repData.assetID;
2751 m_assetState = repData.assetState; 2754 m_meshState = repData.meshState;
2752 2755
2753 m_hasOBB = repData.hasOBB; 2756 m_hasOBB = repData.hasOBB;
2754 m_OBBOffset = repData.OBBOffset; 2757 m_OBBOffset = repData.OBBOffset;
@@ -2781,12 +2784,12 @@ namespace OpenSim.Region.Physics.OdePlugin
2781 else 2784 else
2782 MakeBody(); 2785 MakeBody();
2783 2786
2784 if (m_assetState == AssetState.needAsset) 2787 if ((m_meshState & MeshState.NeedMask) != 0)
2785 { 2788 {
2786 repData.size = _size; 2789 repData.size = _size;
2787 repData.pbs = _pbs; 2790 repData.pbs = _pbs;
2788 repData.shapetype = m_shapetype; 2791 repData.shapetype = m_shapetype;
2789 _parent_scene.m_meshWorker.RequestMeshAsset(repData); 2792 _parent_scene.m_meshWorker.RequestMesh(repData);
2790 } 2793 }
2791 } 2794 }
2792 } 2795 }
@@ -2820,7 +2823,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2820 m_mesh = repData.mesh; 2823 m_mesh = repData.mesh;
2821 2824
2822 m_assetID = repData.assetID; 2825 m_assetID = repData.assetID;
2823 m_assetState = repData.assetState; 2826 m_meshState = repData.meshState;
2824 2827
2825 m_hasOBB = repData.hasOBB; 2828 m_hasOBB = repData.hasOBB;
2826 m_OBBOffset = repData.OBBOffset; 2829 m_OBBOffset = repData.OBBOffset;
@@ -2832,12 +2835,9 @@ namespace OpenSim.Region.Physics.OdePlugin
2832 2835
2833 if (prim_geom != IntPtr.Zero) 2836 if (prim_geom != IntPtr.Zero)
2834 { 2837 {
2835 m_targetSpace = IntPtr.Zero;
2836
2837 UpdatePrimBodyData(); 2838 UpdatePrimBodyData();
2838 2839
2839 _parent_scene.actor_name_map[prim_geom] = this; 2840 _parent_scene.actor_name_map[prim_geom] = this;
2840
2841 2841
2842 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 2842 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
2843 d.Quaternion myrot = new d.Quaternion(); 2843 d.Quaternion myrot = new d.Quaternion();
@@ -2847,7 +2847,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2847 myrot.W = _orientation.W; 2847 myrot.W = _orientation.W;
2848 d.GeomSetQuaternion(prim_geom, ref myrot); 2848 d.GeomSetQuaternion(prim_geom, ref myrot);
2849 2849
2850
2851 if (m_isphysical) 2850 if (m_isphysical)
2852 { 2851 {
2853 if (chp) 2852 if (chp)
@@ -2869,13 +2868,14 @@ namespace OpenSim.Region.Physics.OdePlugin
2869 } 2868 }
2870 2869
2871 resetCollisionAccounting(); 2870 resetCollisionAccounting();
2872 if (m_assetState == AssetState.needAsset) 2871 }
2873 { 2872
2874 repData.size = _size; 2873 if ((m_meshState & MeshState.NeedMask) != 0)
2875 repData.pbs = _pbs; 2874 {
2876 repData.shapetype = m_shapetype; 2875 repData.size = _size;
2877 _parent_scene.m_meshWorker.RequestMeshAsset(repData); 2876 repData.pbs = _pbs;
2878 } 2877 repData.shapetype = m_shapetype;
2878 _parent_scene.m_meshWorker.RequestMesh(repData);
2879 } 2879 }
2880 } 2880 }
2881 2881
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 5e4c2a5..ed2a531 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -111,17 +111,6 @@ namespace OpenSim.Region.Physics.OdePlugin
111 light = 7 // compatibility with old viewers 111 light = 7 // compatibility with old viewers
112 } 112 }
113 113
114 public enum AssetState : byte
115 {
116 noNeedAsset = 0,
117 needAsset = 1,
118 loadingAsset = 2,
119 procAsset = 3,
120 AssetOK = 4,
121
122 AssetFailed = 0xff
123 }
124
125 public enum changes : int 114 public enum changes : int
126 { 115 {
127 Add = 0, // arg null. finishs the prim creation. should be used internally only ( to remove later ?) 116 Add = 0, // arg null. finishs the prim creation. should be used internally only ( to remove later ?)