| 40 |
private static Queue<VObject> UnAssignedChildObjectModQueue = new Queue<VObject>(); |
private static Queue<VObject> UnAssignedChildObjectModQueue = new Queue<VObject>(); |
| 41 |
private static Queue<TextureComplete> assignTextureQueue = new Queue<TextureComplete>(); |
private static Queue<TextureComplete> assignTextureQueue = new Queue<TextureComplete>(); |
| 42 |
|
|
| 43 |
|
private static Dictionary<string, VObject> interpolationTargets = new Dictionary<string, VObject>(); |
| 44 |
|
|
| 45 |
|
|
| 46 |
private static Simulator currentSim; |
private static Simulator currentSim; |
| 47 |
|
|
| 322 |
SNGlobalwater.Position = new Vector3D(0, 0, 0); |
SNGlobalwater.Position = new Vector3D(0, 0, 0); |
| 323 |
|
|
| 324 |
mts = smgr.CreateMetaTriangleSelector(); |
mts = smgr.CreateMetaTriangleSelector(); |
| 325 |
|
GUIContextMenu gcontext = guienv.AddMenu(guienv.RootElement, 90); |
| 326 |
|
gcontext.Text = "Some Text"; |
| 327 |
|
gcontext.AddItem("SomeCooItem", 93, true, true); |
| 328 |
|
|
| 329 |
|
|
| 330 |
|
GUIToolBar gtb = guienv.AddToolBar(guienv.RootElement, 91); |
| 331 |
|
gtb.Text = "Hi"; |
| 332 |
|
gtb.AddButton(92, "Button", "Click", null, null, true, false); |
| 333 |
|
|
| 334 |
|
|
| 335 |
int minFrameTime = (int)(1.0f / maxFPS); |
int minFrameTime = (int)(1.0f / maxFPS); |
| 368 |
{ |
{ |
| 369 |
processHeldKeys(); |
processHeldKeys(); |
| 370 |
|
|
| 371 |
|
updateInterpolationTargets(); |
| 372 |
|
cam.CheckTarget(); |
| 373 |
|
|
| 374 |
mscounter = 0; |
mscounter = 0; |
| 375 |
framecounter++; |
framecounter++; |
| 376 |
|
|
| 395 |
|
|
| 396 |
} |
} |
| 397 |
|
|
| 398 |
|
private void updateInterpolationTargets() |
| 399 |
|
{ |
| 400 |
|
List<string> removestr = null; |
| 401 |
|
lock (interpolationTargets) |
| 402 |
|
{ |
| 403 |
|
foreach (string str in interpolationTargets.Keys) |
| 404 |
|
{ |
| 405 |
|
VObject obj = interpolationTargets[str]; |
| 406 |
|
if (obj == null) |
| 407 |
|
{ |
| 408 |
|
if (removestr == null) |
| 409 |
|
removestr = new List<string>(); |
| 410 |
|
|
| 411 |
|
removestr.Add(str); |
| 412 |
|
continue; |
| 413 |
|
} |
| 414 |
|
if (obj.node == null) |
| 415 |
|
{ |
| 416 |
|
if (removestr == null) |
| 417 |
|
removestr = new List<string>(); |
| 418 |
|
|
| 419 |
|
removestr.Add(str); |
| 420 |
|
continue; |
| 421 |
|
} |
| 422 |
|
if (obj.node.Raw == IntPtr.Zero) |
| 423 |
|
{ |
| 424 |
|
if (removestr == null) |
| 425 |
|
removestr = new List<string>(); |
| 426 |
|
|
| 427 |
|
removestr.Add(str); |
| 428 |
|
continue; |
| 429 |
|
} |
| 430 |
|
try |
| 431 |
|
{ |
| 432 |
|
Vector3D pos = new Vector3D(obj.node.Position.X, obj.node.Position.Y, obj.node.Position.Z); |
| 433 |
|
if (obj.prim is Avatar) |
| 434 |
|
{ |
| 435 |
|
Avatar av = (Avatar)obj.prim; |
| 436 |
|
if (obj.prim.Velocity.Z < 0 && obj.prim.Velocity.Z > -2f) |
| 437 |
|
obj.prim.Velocity.Z = 0; |
| 438 |
|
} |
| 439 |
|
obj.node.Position = pos + new Vector3D(obj.prim.Velocity.X * 0.055f, obj.prim.Velocity.Z * 0.055f, obj.prim.Velocity.Y * 0.055f); |
| 440 |
|
} |
| 441 |
|
catch (AccessViolationException) |
| 442 |
|
{ |
| 443 |
|
if (removestr == null) |
| 444 |
|
removestr = new List<string>(); |
| 445 |
|
|
| 446 |
|
removestr.Add(str); |
| 447 |
|
continue; |
| 448 |
|
} |
| 449 |
|
catch (System.Runtime.InteropServices.SEHException) |
| 450 |
|
{ |
| 451 |
|
if (removestr == null) |
| 452 |
|
removestr = new List<string>(); |
| 453 |
|
|
| 454 |
|
removestr.Add(str); |
| 455 |
|
continue; |
| 456 |
|
} |
| 457 |
|
|
| 458 |
|
} |
| 459 |
|
if (removestr != null) |
| 460 |
|
{ |
| 461 |
|
foreach (string str2 in removestr) |
| 462 |
|
{ |
| 463 |
|
if (interpolationTargets.ContainsKey(str2)) |
| 464 |
|
{ |
| 465 |
|
interpolationTargets.Remove(str2); |
| 466 |
|
} |
| 467 |
|
} |
| 468 |
|
} |
| 469 |
|
} |
| 470 |
|
|
| 471 |
|
} |
| 472 |
|
|
| 473 |
private void doTextureMods() |
private void doTextureMods() |
| 474 |
{ |
{ |
| 475 |
lock (assignTextureQueue) |
lock (assignTextureQueue) |
| 487 |
} |
} |
| 488 |
private void doSetCameraPosition() |
private void doSetCameraPosition() |
| 489 |
{ |
{ |
| 490 |
|
|
| 491 |
avatarConnection.SetCameraPosition(cam.Position); |
avatarConnection.SetCameraPosition(cam.Position); |
| 492 |
} |
} |
| 493 |
|
|
| 593 |
node.Scale = new Vector3D(0.035f, 0.035f, 0.035f); |
node.Scale = new Vector3D(0.035f, 0.035f, 0.035f); |
| 594 |
node.SetMaterialTexture(0, driver.GetTexture(avatarMaterial)); |
node.SetMaterialTexture(0, driver.GetTexture(avatarMaterial)); |
| 595 |
node.SetMaterialFlag(MaterialFlag.Lighting, true); |
node.SetMaterialFlag(MaterialFlag.Lighting, true); |
| 596 |
|
lock (interpolationTargets) |
| 597 |
|
{ |
| 598 |
|
if (interpolationTargets.ContainsKey(simhandle.ToString() + vObj.prim.LocalID.ToString())) |
| 599 |
|
{ |
| 600 |
|
interpolationTargets[simhandle.ToString() + vObj.prim.LocalID.ToString()] = vObj; |
| 601 |
|
} |
| 602 |
|
else |
| 603 |
|
{ |
| 604 |
|
interpolationTargets.Add(simhandle.ToString() + vObj.prim.LocalID.ToString(), vObj); |
| 605 |
|
} |
| 606 |
|
} |
| 607 |
} |
} |
| 608 |
else |
else |
| 609 |
{ |
{ |
| 632 |
{ |
{ |
| 633 |
if (vObj.prim is Avatar) |
if (vObj.prim is Avatar) |
| 634 |
{ |
{ |
| 635 |
m_log.WarnFormat("[AVATAR]: W:<{0},{1},{2}> R:<{3},{4},{5}>",WorldoffsetPos.X,WorldoffsetPos.Y,WorldoffsetPos.Z,vObj.prim.Position.X,vObj.prim.Position.Y,vObj.prim.Position.Z); |
//m_log.WarnFormat("[AVATAR]: W:<{0},{1},{2}> R:<{3},{4},{5}>",WorldoffsetPos.X,WorldoffsetPos.Y,WorldoffsetPos.Z,vObj.prim.Position.X,vObj.prim.Position.Y,vObj.prim.Position.Z); |
| 636 |
WorldoffsetPos = Vector3.Zero; |
WorldoffsetPos = Vector3.Zero; |
| 637 |
} |
} |
| 638 |
|
|
| 659 |
node.Position = new Vector3D(WorldoffsetPos.X + parentObj.prim.Position.X + vObj.prim.Position.X, WorldoffsetPos.Z + parentObj.prim.Position.Z + vObj.prim.Position.Z, WorldoffsetPos.Y + parentObj.prim.Position.Y + vObj.prim.Position.Y); |
node.Position = new Vector3D(WorldoffsetPos.X + parentObj.prim.Position.X + vObj.prim.Position.X, WorldoffsetPos.Z + parentObj.prim.Position.Z + vObj.prim.Position.Z, WorldoffsetPos.Y + parentObj.prim.Position.Y + vObj.prim.Position.Y); |
| 660 |
} |
} |
| 661 |
|
|
| 662 |
|
if (vObj.updateFullYN) |
| 663 |
|
{ |
| 664 |
|
if ((vObj.prim.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
| 665 |
|
{ |
| 666 |
|
lock (interpolationTargets) |
| 667 |
|
{ |
| 668 |
|
if (!interpolationTargets.ContainsKey(simhandle.ToString() + vObj.prim.LocalID.ToString())) |
| 669 |
|
interpolationTargets.Add(simhandle.ToString() + vObj.prim.LocalID.ToString(), vObj); |
| 670 |
|
} |
| 671 |
|
} |
| 672 |
|
else |
| 673 |
|
{ |
| 674 |
|
lock (interpolationTargets) |
| 675 |
|
{ |
| 676 |
|
if (interpolationTargets.ContainsKey(simhandle.ToString() + vObj.prim.LocalID.ToString())) |
| 677 |
|
interpolationTargets.Remove(simhandle.ToString() + vObj.prim.LocalID.ToString()); |
| 678 |
|
} |
| 679 |
|
} |
| 680 |
|
|
| 681 |
|
} |
| 682 |
|
|
| 683 |
//m_log.Warn(vObj.prim.Rotation.ToString()); |
//m_log.Warn(vObj.prim.Rotation.ToString()); |
| 684 |
IrrlichtNETCP.Quaternion iqu = new IrrlichtNETCP.Quaternion(vObj.prim.Rotation.X, vObj.prim.Rotation.Z, vObj.prim.Rotation.Y, vObj.prim.Rotation.W); |
IrrlichtNETCP.Quaternion iqu = new IrrlichtNETCP.Quaternion(vObj.prim.Rotation.X, vObj.prim.Rotation.Z, vObj.prim.Rotation.Y, vObj.prim.Rotation.W); |
| 804 |
AnimatedMeshSceneNode node2 = smgr.AddAnimatedMeshSceneNode(avmesh); |
AnimatedMeshSceneNode node2 = smgr.AddAnimatedMeshSceneNode(avmesh); |
| 805 |
node = node2; |
node = node2; |
| 806 |
vObj.node = node2; |
vObj.node = node2; |
| 807 |
|
|
| 808 |
|
lock (interpolationTargets) |
| 809 |
|
{ |
| 810 |
|
if (interpolationTargets.ContainsKey(simhandle.ToString() + vObj.prim.LocalID.ToString())) |
| 811 |
|
{ |
| 812 |
|
interpolationTargets[simhandle.ToString() + vObj.prim.LocalID.ToString()] = vObj; |
| 813 |
|
} |
| 814 |
|
else |
| 815 |
|
{ |
| 816 |
|
interpolationTargets.Add(simhandle.ToString() + vObj.prim.LocalID.ToString(), vObj); |
| 817 |
|
} |
| 818 |
|
} |
| 819 |
} |
} |
| 820 |
else |
else |
| 821 |
{ |
{ |
| 1351 |
|
|
| 1352 |
if (foundEntity) |
if (foundEntity) |
| 1353 |
{ |
{ |
| 1354 |
|
newObject.updateFullYN = true; |
| 1355 |
enqueueVObject(newObject); |
enqueueVObject(newObject); |
| 1356 |
} |
} |
| 1357 |
} |
} |
| 1358 |
else |
else |
| 1359 |
{ |
{ |
| 1360 |
|
newObject.updateFullYN = true; |
| 1361 |
enqueueVObject(newObject); |
enqueueVObject(newObject); |
| 1362 |
} |
} |
| 1363 |
|
|
| 1561 |
if (Entities.ContainsKey(regionHandle.ToString() + update.LocalID.ToString())) |
if (Entities.ContainsKey(regionHandle.ToString() + update.LocalID.ToString())) |
| 1562 |
{ |
{ |
| 1563 |
obj = Entities[regionHandle.ToString() + update.LocalID.ToString()]; |
obj = Entities[regionHandle.ToString() + update.LocalID.ToString()]; |
| 1564 |
|
obj.updateFullYN = false; |
| 1565 |
obj.prim.Acceleration = update.Acceleration; |
obj.prim.Acceleration = update.Acceleration; |
| 1566 |
obj.prim.AngularVelocity = update.AngularVelocity; |
obj.prim.AngularVelocity = update.AngularVelocity; |
| 1567 |
obj.prim.CollisionPlane = update.CollisionPlane; |
obj.prim.CollisionPlane = update.CollisionPlane; |
| 1595 |
m_log.Debug("[DELETE]: obj " + regionHandle.ToString() + ":" + pLocalID.ToString()); |
m_log.Debug("[DELETE]: obj " + regionHandle.ToString() + ":" + pLocalID.ToString()); |
| 1596 |
VObject obj = null; |
VObject obj = null; |
| 1597 |
|
|
| 1598 |
|
|
| 1599 |
lock (Entities) |
lock (Entities) |
| 1600 |
{ |
{ |
| 1601 |
|
|
| 1602 |
if (Entities.ContainsKey(regionHandle.ToString() + pLocalID.ToString())) |
if (Entities.ContainsKey(regionHandle.ToString() + pLocalID.ToString())) |
| 1603 |
{ |
{ |
| 1604 |
obj = Entities[regionHandle.ToString() + pLocalID.ToString()]; |
obj = Entities[regionHandle.ToString() + pLocalID.ToString()]; |
| 1605 |
|
|
| 1606 |
|
|
| 1607 |
|
|
| 1608 |
if (obj.node != null) |
if (obj.node != null) |
| 1609 |
{ |
{ |
| 1610 |
|
lock (interpolationTargets) |
| 1611 |
|
{ |
| 1612 |
|
if (interpolationTargets.ContainsKey(regionHandle.ToString() + obj.prim.LocalID.ToString())) |
| 1613 |
|
{ |
| 1614 |
|
interpolationTargets.Remove(regionHandle.ToString() + obj.prim.LocalID.ToString()); |
| 1615 |
|
} |
| 1616 |
|
|
| 1617 |
|
} |
| 1618 |
|
if (cam.SNtarget == obj.node) |
| 1619 |
|
cam.SNtarget = null; |
| 1620 |
smgr.AddToDeletionQueue(obj.node); |
smgr.AddToDeletionQueue(obj.node); |
| 1621 |
obj.node = null; |
obj.node = null; |
| 1622 |
} |
} |
| 1901 |
|
|
| 1902 |
Vector3D collisionpoint = new Vector3D(0, 0, 0); |
Vector3D collisionpoint = new Vector3D(0, 0, 0); |
| 1903 |
Triangle3D tri = new Triangle3D(0, 0, 0, 0, 0, 0, 0, 0, 0); |
Triangle3D tri = new Triangle3D(0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 1904 |
|
SceneNode node = smgr.CollisionManager.GetSceneNodeFromScreenCoordinates(new Position2D(p_event.MousePosition.X, p_event.MousePosition.Y), 0, false); |
| 1905 |
|
if (node == null) |
| 1906 |
|
{ |
| 1907 |
|
m_log.Warn("[PICKER]: Picked null"); |
| 1908 |
|
} |
| 1909 |
|
else |
| 1910 |
|
{ |
| 1911 |
|
m_log.WarnFormat("[PICK]: Picked <{0},{1},{2}>",node.Position.X,node.Position.Y,node.Position.Z); |
| 1912 |
|
if (node.Position.X == 0 && node.Position.Z == 0) |
| 1913 |
|
{ |
| 1914 |
if (smgr.CollisionManager.GetCollisionPoint(projectedray, mts, out collisionpoint, out tri)) |
if (smgr.CollisionManager.GetCollisionPoint(projectedray, mts, out collisionpoint, out tri)) |
| 1915 |
{ |
{ |
| 1916 |
//if (collisionpoint != null) |
//if (collisionpoint != null) |
| 1919 |
//} |
//} |
| 1920 |
cam.SetTarget(collisionpoint); |
cam.SetTarget(collisionpoint); |
| 1921 |
} |
} |
| 1922 |
|
} |
| 1923 |
|
else |
| 1924 |
|
{ |
| 1925 |
|
|
| 1926 |
|
cam.SetTarget(node.Position); |
| 1927 |
|
cam.SNtarget = node; |
| 1928 |
|
} |
| 1929 |
|
} |
| 1930 |
|
|
| 1931 |
|
|
| 1932 |
//else |
//else |
| 1933 |
//{ |
//{ |
| 1934 |
//if (smgr.CollisionManager.GetCollisionPoint(projectedray, terrainsel, out collisionpoint, out tri)) |
//if (smgr.CollisionManager.GetCollisionPoint(projectedray, terrainsel, out collisionpoint, out tri)) |