aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
authorDahlia Trimble2008-07-18 00:03:28 +0000
committerDahlia Trimble2008-07-18 00:03:28 +0000
commit49adb6e09f42b1b4022d6127379c79ce01b64192 (patch)
treebf00948691271a557dd3af37b5380d94bf995daf /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
parentfix build break (diff)
downloadopensim-SC-49adb6e09f42b1b4022d6127379c79ce01b64192.zip
opensim-SC-49adb6e09f42b1b4022d6127379c79ce01b64192.tar.gz
opensim-SC-49adb6e09f42b1b4022d6127379c79ce01b64192.tar.bz2
opensim-SC-49adb6e09f42b1b4022d6127379c79ce01b64192.tar.xz
refactor - commenting out needsMeshing() and all references as createMesh() has the same logic and obsoletes the need for it.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs366
1 files changed, 241 insertions, 125 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index f7fbaf1..59655d7 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -917,15 +917,19 @@ namespace OpenSim.Region.Physics.OdePlugin
917 917
918 m_targetSpace = targetspace; 918 m_targetSpace = targetspace;
919 919
920 if (_mesh == null) 920 //if (_mesh == null)
921 { 921 //{
922 if (_parent_scene.needsMeshing(_pbs)) 922 // if (_parent_scene.needsMeshing(_pbs))
923 { 923 // {
924 // Don't need to re-enable body.. it's done in SetMesh 924 // // Don't need to re-enable body.. it's done in SetMesh
925 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); 925 // _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
926 // createmesh returns null when it's a shape that isn't a cube. 926 // // createmesh returns null when it's a shape that isn't a cube.
927 } 927 // }
928 } 928 //}
929
930 if (_mesh == null )
931 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
932
929 933
930 lock (OdeScene.OdeLock) 934 lock (OdeScene.OdeLock)
931 { 935 {
@@ -1285,8 +1289,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1285 { 1289 {
1286 //if (!_parent_scene.geom_name_map.ContainsKey(prim_geom)) 1290 //if (!_parent_scene.geom_name_map.ContainsKey(prim_geom))
1287 //{ 1291 //{
1288 // m_taintsize = _size; 1292 // m_taintsize = _size;
1289 //return; 1293 //return;
1290 //} 1294 //}
1291 string oldname = _parent_scene.geom_name_map[prim_geom]; 1295 string oldname = _parent_scene.geom_name_map[prim_geom];
1292 1296
@@ -1300,7 +1304,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1300 // Cleanup meshing here 1304 // Cleanup meshing here
1301 } 1305 }
1302 //kill body to rebuild 1306 //kill body to rebuild
1303 if (IsPhysical && Body != (IntPtr) 0) 1307 if (IsPhysical && Body != (IntPtr)0)
1304 { 1308 {
1305 disableBody(); 1309 disableBody();
1306 } 1310 }
@@ -1314,7 +1318,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1314 // we don't need to do space calculation because the client sends a position update also. 1318 // we don't need to do space calculation because the client sends a position update also.
1315 1319
1316 // Construction of new prim 1320 // Construction of new prim
1317 if (_parent_scene.needsMeshing(_pbs)) 1321 //if (_parent_scene.needsMeshing(_pbs))
1318 { 1322 {
1319 float meshlod = _parent_scene.meshSculptLOD; 1323 float meshlod = _parent_scene.meshSculptLOD;
1320 1324
@@ -1322,7 +1326,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1322 meshlod = _parent_scene.MeshSculptphysicalLOD; 1326 meshlod = _parent_scene.MeshSculptphysicalLOD;
1323 // Don't need to re-enable body.. it's done in SetMesh 1327 // Don't need to re-enable body.. it's done in SetMesh
1324 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 1328 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1325 // createmesh returns null when it's a shape that isn't a cube. 1329
1326 if (mesh != null) 1330 if (mesh != null)
1327 { 1331 {
1328 setMesh(_parent_scene, mesh); 1332 setMesh(_parent_scene, mesh);
@@ -1368,18 +1372,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1368 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); 1372 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1369 } 1373 }
1370 } 1374 }
1371 //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight) 1375
1372 //{
1373 //Cyllinder
1374 //if (_size.X == _size.Y)
1375 //{
1376 // prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
1377 //}
1378 //else
1379 //{
1380 //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1381 //}
1382 //}
1383 else 1376 else
1384 { 1377 {
1385 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1378 _parent_scene.waitForSpaceUnlock(m_targetSpace);
@@ -1395,55 +1388,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1395 d.GeomSetQuaternion(prim_geom, ref myrot); 1388 d.GeomSetQuaternion(prim_geom, ref myrot);
1396 } 1389 }
1397 } 1390 }
1398 else
1399 {
1400 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
1401 {
1402 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
1403 {
1404 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1405 SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
1406 }
1407 else
1408 {
1409 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1410 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1411 }
1412 }
1413 //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight)
1414 //{
1415 //Cyllinder
1416 //if (_size.X == _size.Y)
1417 //{
1418 //prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
1419 //}
1420 //else
1421 //{
1422 //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1423 //}
1424 //}
1425 else
1426 {
1427 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1428 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1429 }
1430 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1431 d.Quaternion myrot = new d.Quaternion();
1432 myrot.W = _orientation.w;
1433 myrot.X = _orientation.x;
1434 myrot.Y = _orientation.y;
1435 myrot.Z = _orientation.z;
1436 d.GeomSetQuaternion(prim_geom, ref myrot);
1437
1438 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1439 if (IsPhysical && Body == (IntPtr) 0)
1440 {
1441 // Re creates body on size.
1442 // EnableBody also does setMass()
1443 enableBody();
1444 d.BodyEnable(Body);
1445 }
1446 }
1447 1391
1448 _parent_scene.geom_name_map[prim_geom] = oldname; 1392 _parent_scene.geom_name_map[prim_geom] = oldname;
1449 1393
@@ -1453,6 +1397,178 @@ namespace OpenSim.Region.Physics.OdePlugin
1453 m_taintsize = _size; 1397 m_taintsize = _size;
1454 } 1398 }
1455 1399
1400 //public void changesize(float timestamp)
1401 //{
1402 // //if (!_parent_scene.geom_name_map.ContainsKey(prim_geom))
1403 // //{
1404 // // m_taintsize = _size;
1405 // //return;
1406 // //}
1407 // string oldname = _parent_scene.geom_name_map[prim_geom];
1408
1409 // if (_size.X <= 0) _size.X = 0.01f;
1410 // if (_size.Y <= 0) _size.Y = 0.01f;
1411 // if (_size.Z <= 0) _size.Z = 0.01f;
1412
1413 // // Cleanup of old prim geometry
1414 // if (_mesh != null)
1415 // {
1416 // // Cleanup meshing here
1417 // }
1418 // //kill body to rebuild
1419 // if (IsPhysical && Body != (IntPtr) 0)
1420 // {
1421 // disableBody();
1422 // }
1423 // if (d.SpaceQuery(m_targetSpace, prim_geom))
1424 // {
1425 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1426 // d.SpaceRemove(m_targetSpace, prim_geom);
1427 // }
1428 // d.GeomDestroy(prim_geom);
1429 // prim_geom = (IntPtr)0;
1430 // // we don't need to do space calculation because the client sends a position update also.
1431
1432 // // Construction of new prim
1433 // if (_parent_scene.needsMeshing(_pbs))
1434 // {
1435 // float meshlod = _parent_scene.meshSculptLOD;
1436
1437 // if (IsPhysical)
1438 // meshlod = _parent_scene.MeshSculptphysicalLOD;
1439 // // Don't need to re-enable body.. it's done in SetMesh
1440 // IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1441 // // createmesh returns null when it's a shape that isn't a cube.
1442 // if (mesh != null)
1443 // {
1444 // setMesh(_parent_scene, mesh);
1445 // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1446 // d.Quaternion myrot = new d.Quaternion();
1447 // myrot.W = _orientation.w;
1448 // myrot.X = _orientation.x;
1449 // myrot.Y = _orientation.y;
1450 // myrot.Z = _orientation.z;
1451 // d.GeomSetQuaternion(prim_geom, ref myrot);
1452
1453 // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1454 // if (IsPhysical && Body == (IntPtr)0)
1455 // {
1456 // // Re creates body on size.
1457 // // EnableBody also does setMass()
1458 // enableBody();
1459 // d.BodyEnable(Body);
1460 // }
1461 // }
1462 // else
1463 // {
1464 // if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
1465 // {
1466 // if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
1467 // {
1468 // if (((_size.X / 2f) > 0f) && ((_size.X / 2f) < 1000))
1469 // {
1470 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1471 // SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
1472 // }
1473 // else
1474 // {
1475 // m_log.Info("[PHYSICS]: Failed to load a sphere bad size");
1476 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1477 // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1478 // }
1479
1480 // }
1481 // else
1482 // {
1483 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1484 // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1485 // }
1486 // }
1487 // //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight)
1488 // //{
1489 // //Cyllinder
1490 // //if (_size.X == _size.Y)
1491 // //{
1492 // // prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
1493 // //}
1494 // //else
1495 // //{
1496 // //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1497 // //}
1498 // //}
1499 // else
1500 // {
1501 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1502 // SetGeom(prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1503 // }
1504 // //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1505 // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1506 // d.Quaternion myrot = new d.Quaternion();
1507 // myrot.W = _orientation.w;
1508 // myrot.X = _orientation.x;
1509 // myrot.Y = _orientation.y;
1510 // myrot.Z = _orientation.z;
1511 // d.GeomSetQuaternion(prim_geom, ref myrot);
1512 // }
1513 // }
1514 // else
1515 // {
1516 // if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
1517 // {
1518 // if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
1519 // {
1520 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1521 // SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
1522 // }
1523 // else
1524 // {
1525 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1526 // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1527 // }
1528 // }
1529 // //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight)
1530 // //{
1531 // //Cyllinder
1532 // //if (_size.X == _size.Y)
1533 // //{
1534 // //prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
1535 // //}
1536 // //else
1537 // //{
1538 // //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1539 // //}
1540 // //}
1541 // else
1542 // {
1543 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1544 // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1545 // }
1546 // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1547 // d.Quaternion myrot = new d.Quaternion();
1548 // myrot.W = _orientation.w;
1549 // myrot.X = _orientation.x;
1550 // myrot.Y = _orientation.y;
1551 // myrot.Z = _orientation.z;
1552 // d.GeomSetQuaternion(prim_geom, ref myrot);
1553
1554 // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1555 // if (IsPhysical && Body == (IntPtr) 0)
1556 // {
1557 // // Re creates body on size.
1558 // // EnableBody also does setMass()
1559 // enableBody();
1560 // d.BodyEnable(Body);
1561 // }
1562 // }
1563
1564 // _parent_scene.geom_name_map[prim_geom] = oldname;
1565
1566 // changeSelectedStatus(timestamp);
1567
1568 // resetCollisionAccounting();
1569 // m_taintsize = _size;
1570 //}
1571
1456 public void changefloatonwater(float timestep) 1572 public void changefloatonwater(float timestep)
1457 { 1573 {
1458 m_collidesWater = m_taintCollidesWater; 1574 m_collidesWater = m_taintCollidesWater;
@@ -1488,7 +1604,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1488 if (_size.Z <= 0) _size.Z = 0.01f; 1604 if (_size.Z <= 0) _size.Z = 0.01f;
1489 // Construction of new prim 1605 // Construction of new prim
1490 1606
1491 if (_parent_scene.needsMeshing(_pbs)) 1607 //if (_parent_scene.needsMeshing(_pbs))
1492 { 1608 {
1493 // Don't need to re-enable body.. it's done in SetMesh 1609 // Don't need to re-enable body.. it's done in SetMesh
1494 float meshlod = _parent_scene.meshSculptLOD; 1610 float meshlod = _parent_scene.meshSculptLOD;
@@ -1568,55 +1684,55 @@ namespace OpenSim.Region.Physics.OdePlugin
1568 d.GeomSetQuaternion(prim_geom, ref myrot); 1684 d.GeomSetQuaternion(prim_geom, ref myrot);
1569 } 1685 }
1570 } 1686 }
1571 else 1687 //else
1572 { 1688 //{
1573 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) 1689 // if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
1574 { 1690 // {
1575 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) 1691 // if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
1576 { 1692 // {
1577 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1693 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1578 SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2)); 1694 // SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
1579 } 1695 // }
1580 else 1696 // else
1581 { 1697 // {
1582 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1698 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1583 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); 1699 // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1584 } 1700 // }
1585 } 1701 // }
1586 //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight) 1702 // //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight)
1587 //{ 1703 // //{
1588 //Cyllinder 1704 // //Cyllinder
1589 //if (_size.X == _size.Y) 1705 // //if (_size.X == _size.Y)
1590 //{ 1706 // //{
1591 //prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z); 1707 // //prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
1592 //} 1708 // //}
1593 //else 1709 // //else
1594 //{ 1710 // //{
1595 //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 1711 // //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1596 //} 1712 // //}
1597 //} 1713 // //}
1598 else 1714 // else
1599 { 1715 // {
1600 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1716 // _parent_scene.waitForSpaceUnlock(m_targetSpace);
1601 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); 1717 // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1602 } 1718 // }
1603 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 1719 // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1604 d.Quaternion myrot = new d.Quaternion(); 1720 // d.Quaternion myrot = new d.Quaternion();
1605 myrot.W = _orientation.w; 1721 // myrot.W = _orientation.w;
1606 myrot.X = _orientation.x; 1722 // myrot.X = _orientation.x;
1607 myrot.Y = _orientation.y; 1723 // myrot.Y = _orientation.y;
1608 myrot.Z = _orientation.z; 1724 // myrot.Z = _orientation.z;
1609 d.GeomSetQuaternion(prim_geom, ref myrot); 1725 // d.GeomSetQuaternion(prim_geom, ref myrot);
1610 1726
1611 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); 1727 // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1612 if (IsPhysical && Body == (IntPtr)0) 1728 // if (IsPhysical && Body == (IntPtr)0)
1613 { 1729 // {
1614 // Re creates body on size. 1730 // // Re creates body on size.
1615 // EnableBody also does setMass() 1731 // // EnableBody also does setMass()
1616 enableBody(); 1732 // enableBody();
1617 d.BodyEnable(Body); 1733 // d.BodyEnable(Body);
1618 } 1734 // }
1619 } 1735 //}
1620 1736
1621 _parent_scene.geom_name_map[prim_geom] = oldname; 1737 _parent_scene.geom_name_map[prim_geom] = oldname;
1622 1738