| 38 |
|
|
| 39 |
private static Queue<VObject> objectModQueue = new Queue<VObject>(); |
private static Queue<VObject> objectModQueue = new Queue<VObject>(); |
| 40 |
private static Queue<VObject> objectMeshQueue = new Queue<VObject>(); |
private static Queue<VObject> objectMeshQueue = new Queue<VObject>(); |
| 41 |
|
public static Dictionary<string, UUID> waitingSculptQueue = new Dictionary<string, UUID>(); |
| 42 |
|
|
| 43 |
private static Queue<VObject> UnAssignedChildObjectModQueue = new Queue<VObject>(); |
private static Queue<VObject> UnAssignedChildObjectModQueue = new Queue<VObject>(); |
| 44 |
private static Queue<TextureComplete> assignTextureQueue = new Queue<TextureComplete>(); |
private static Queue<TextureComplete> assignTextureQueue = new Queue<TextureComplete>(); |
| 93 |
public static IrrlichtNETCP.Quaternion Cordinate_XYZ_XZY = new IrrlichtNETCP.Quaternion(); |
public static IrrlichtNETCP.Quaternion Cordinate_XYZ_XZY = new IrrlichtNETCP.Quaternion(); |
| 94 |
|
|
| 95 |
private TextureManager textureMan = null; |
private TextureManager textureMan = null; |
| 96 |
|
private static TrianglePickerMapper triPicker = null; |
| 97 |
// experimental mesh code - only here temporarily - up top so it's visible |
// experimental mesh code - only here temporarily - up top so it's visible |
| 98 |
|
|
| 99 |
public Vector2D convVect2d(UVCoord uv) |
public Vector2D convVect2d(UVCoord uv) |
| 253 |
guienv = device.GUIEnvironment; |
guienv = device.GUIEnvironment; |
| 254 |
device.OnEvent += new OnEventDelegate(device_OnEvent); |
device.OnEvent += new OnEventDelegate(device_OnEvent); |
| 255 |
|
|
| 256 |
|
triPicker = new TrianglePickerMapper(smgr.CollisionManager); |
| 257 |
|
mts = smgr.CreateMetaTriangleSelector(); |
| 258 |
if (loadTextures) |
if (loadTextures) |
| 259 |
{ |
{ |
| 260 |
textureMan = new TextureManager(device, driver, "IdealistCache", avatarConnection); |
textureMan = new TextureManager(device, driver, triPicker, mts, "IdealistCache", avatarConnection); |
| 261 |
textureMan.OnTextureLoaded += textureCompleteCallback; |
textureMan.OnTextureLoaded += textureCompleteCallback; |
| 262 |
} |
} |
| 263 |
|
|
| 282 |
driver.GetTexture("irrlicht2_bk.jpg")}, 0); |
driver.GetTexture("irrlicht2_bk.jpg")}, 0); |
| 283 |
|
|
| 284 |
driver.SetTextureFlag(TextureCreationFlag.CreateMipMaps, true); |
driver.SetTextureFlag(TextureCreationFlag.CreateMipMaps, true); |
| 285 |
|
SceneNode tree = smgr.AddTreeSceneNode("Oak.xml", null, -1, new Vector3D(128, 40, 128), new Vector3D(0, 0, 0), new Vector3D(0.25f, 0.25f, 0.25f), driver.GetTexture("OakBark.png"), driver.GetTexture("OakLeaf.png"), driver.GetTexture("OakBillboard.png")); |
| 286 |
|
tree.Position = new Vector3D(129, 22, 129); |
| 287 |
|
//tree.Scale = new Vector3D(0.25f, 0.25f, 0.25f); |
| 288 |
cam = new Camera(smgr); |
cam = new Camera(smgr); |
| 289 |
|
|
| 290 |
|
|
| 306 |
|
|
| 307 |
|
|
| 308 |
|
|
| 309 |
SceneNode light = smgr.AddLightSceneNode(smgr.RootSceneNode, new Vector3D(0, 0, 0), new Colorf(1, 1, 1, 1), 90, -1); |
SceneNode light = smgr.AddLightSceneNode(smgr.RootSceneNode, new Vector3D(0, 0, 0), new Colorf(1, 0.5f, 0.5f, 0.5f), 90, -1); |
| 310 |
Animator anim = smgr.CreateFlyCircleAnimator(new Vector3D(128, 250, 128), 250.0f, 0.0010f); |
Animator anim = smgr.CreateFlyCircleAnimator(new Vector3D(128, 250, 128), 250.0f, 0.0010f); |
| 311 |
light.AddAnimator(anim); |
light.AddAnimator(anim); |
| 312 |
anim.Dispose(); |
anim.Dispose(); |
| 324 |
// samplePrimNode.SetMaterialFlag(MaterialFlag.Lighting, true); |
// samplePrimNode.SetMaterialFlag(MaterialFlag.Lighting, true); |
| 325 |
//} |
//} |
| 326 |
|
|
| 327 |
|
// dahlia's sample sculpty |
| 328 |
|
|
| 329 |
|
string sculptFileName = "d:\\sampleSculpty.bmp"; |
| 330 |
|
try |
| 331 |
|
{ |
| 332 |
|
Mesh samplePrim = null; |
| 333 |
|
System.Drawing.Image image = System.Drawing.Bitmap.FromFile(sculptFileName); |
| 334 |
|
|
| 335 |
|
samplePrim = PrimMesherG.SculptIrrMesh((System.Drawing.Bitmap)image); |
| 336 |
|
if (samplePrim != null) |
| 337 |
|
{ |
| 338 |
|
SceneNode samplePrimNode = smgr.AddMeshSceneNode(samplePrim, smgr.RootSceneNode, -1); |
| 339 |
|
samplePrimNode.Position = new Vector3D(128, 32, 128); |
| 340 |
|
samplePrimNode.SetMaterialFlag(MaterialFlag.Lighting, true); |
| 341 |
|
samplePrimNode.SetMaterialTexture(0, driver.GetTexture("d:\\sampleSculptyTexture.bmp")); |
| 342 |
|
} |
| 343 |
|
} |
| 344 |
|
catch (Exception e) |
| 345 |
|
{ |
| 346 |
|
m_log.Error("Unable to open sample sculpty file: " + sculptFileName, e); |
| 347 |
|
} |
| 348 |
|
|
| 349 |
//generateRandomPrim(4000); |
//generateRandomPrim(4000); |
| 350 |
AnimatedMesh mesh = smgr.AddHillPlaneMesh("myHill", |
AnimatedMesh mesh = smgr.AddHillPlaneMesh("myHill", |
| 351 |
new Dimension2Df(120, 120), |
new Dimension2Df(120, 120), |
| 361 |
SNGlobalwater.SetMaterialFlag(MaterialFlag.NormalizeNormals, true); |
SNGlobalwater.SetMaterialFlag(MaterialFlag.NormalizeNormals, true); |
| 362 |
SNGlobalwater.Position = new Vector3D(0, 0, 0); |
SNGlobalwater.Position = new Vector3D(0, 0, 0); |
| 363 |
|
|
| 364 |
mts = smgr.CreateMetaTriangleSelector(); |
|
| 365 |
//GUIContextMenu gcontext = guienv.AddMenu(guienv.RootElement, 90); |
//GUIContextMenu gcontext = guienv.AddMenu(guienv.RootElement, 90); |
| 366 |
//gcontext.Text = "Some Text"; |
//gcontext.Text = "Some Text"; |
| 367 |
//gcontext.AddItem("SomeCooItem", 93, true, true); |
//gcontext.AddItem("SomeCooItem", 93, true, true); |
| 376 |
int mbcount = av.GetMesh(0).MeshBufferCount; |
int mbcount = av.GetMesh(0).MeshBufferCount; |
| 377 |
for (int j = 0; j < mbcount; j++) |
for (int j = 0; j < mbcount; j++) |
| 378 |
{ |
{ |
| 379 |
av.GetMesh(0).GetMeshBuffer(j).Material.Texture1 = driver.GetTexture("Green_Grass_Detailed.tga"); |
Texture texDriver = driver.GetTexture(j.ToString() + "-" + avatarMaterial); |
| 380 |
|
if (texDriver != null) |
| 381 |
|
av.GetMesh(0).GetMeshBuffer(j).Material.Texture1 = texDriver; |
| 382 |
|
else |
| 383 |
|
av.GetMesh(0).GetMeshBuffer(j).Material.Texture1 = driver.GetTexture(avatarMaterial); |
| 384 |
|
|
| 385 |
av.GetMesh(0).GetMeshBuffer(j).Material.SpecularColor = new Color(255, 150, 150, 150); |
av.GetMesh(0).GetMeshBuffer(j).Material.SpecularColor = new Color(255, 150, 150, 150); |
| 386 |
av.GetMesh(0).GetMeshBuffer(j).Material.AmbientColor = new Color(255, 110, 110, 110); |
av.GetMesh(0).GetMeshBuffer(j).Material.AmbientColor = new Color(255, 110, 110, 110); |
| 387 |
av.GetMesh(0).GetMeshBuffer(j).Material.EmissiveColor = new Color(255, 125, 125, 125); |
av.GetMesh(0).GetMeshBuffer(j).Material.EmissiveColor = new Color(255, 125, 125, 125); |
| 389 |
} |
} |
| 390 |
smgr.MeshManipulator.FlipSurfaces(av.GetMesh(0)); |
smgr.MeshManipulator.FlipSurfaces(av.GetMesh(0)); |
| 391 |
|
|
|
|
|
|
|
|
| 392 |
avmeshsntest = smgr.AddAnimatedMeshSceneNode(av); |
avmeshsntest = smgr.AddAnimatedMeshSceneNode(av); |
| 393 |
avmeshsntest.JointMode = JointUpdateOnRenderMode.Control; |
avmeshsntest.JointMode = JointUpdateOnRenderMode.Control; |
| 394 |
//avmeshsntest.SetMaterialFlag(MaterialFlag.NormalizeNormals,true); |
//avmeshsntest.SetMaterialFlag(MaterialFlag.NormalizeNormals,true); |
| 445 |
|
|
| 446 |
running = device.Run(); |
running = device.Run(); |
| 447 |
} |
} |
| 448 |
catch (AccessViolationException) |
catch (AccessViolationException e) |
| 449 |
{ |
{ |
| 450 |
m_log.Error("[VIDEO]: Error in device"); |
m_log.Error("[VIDEO]: Error in device" + e.ToString()); |
| 451 |
} |
} |
| 452 |
if (!running) |
if (!running) |
| 453 |
break; |
break; |
| 454 |
tickcount = System.Environment.TickCount; |
tickcount = System.Environment.TickCount; |
| 455 |
UpdateTerrain(); |
|
| 456 |
//cam.Position = new Vector3D(cam.Position.X , cam.Position.Y, cam.Position.Z- 0.5f); |
//cam.Position = new Vector3D(cam.Position.X , cam.Position.Y, cam.Position.Z- 0.5f); |
| 457 |
//cam.Target = new Vector3D(0, 0, 0);//cam.Target.X - 0.5f, cam.Target.Y, cam.Target.Z); |
//cam.Target = new Vector3D(0, 0, 0);//cam.Target.X - 0.5f, cam.Target.Y, cam.Target.Z); |
| 458 |
//avm.SetMaterialFlag(MaterialFlag.NormalizeNormals, true); |
//avm.SetMaterialFlag(MaterialFlag.NormalizeNormals, true); |
| 510 |
CheckAndApplyParent(5); |
CheckAndApplyParent(5); |
| 511 |
doTextureMods(1); |
doTextureMods(1); |
| 512 |
doSetCameraPosition(); |
doSetCameraPosition(); |
| 513 |
|
UpdateTerrain(); |
| 514 |
|
|
| 515 |
//BoneSceneNode bcn = avmeshsntest.GetJointNode("lCollar:2"); |
//BoneSceneNode bcn = avmeshsntest.GetJointNode("lCollar:2"); |
| 516 |
//bcn.Rotation = new Vector3D(0, 36 + framecounter, 0); |
//bcn.Rotation = new Vector3D(0, 36 + framecounter, 0); |
| 625 |
break; |
break; |
| 626 |
|
|
| 627 |
tx = assignTextureQueue.Dequeue(); |
tx = assignTextureQueue.Dequeue(); |
| 628 |
|
// Try not to double load the texture first. |
| 629 |
|
if (!textureMan.tryGetTexture(tx.textureID, out tex)) |
| 630 |
|
{ |
| 631 |
tex = new TextureExtended(driver.GetTexture(tx.texture).Raw); |
tex = new TextureExtended(driver.GetTexture(tx.texture).Raw); |
| 632 |
} |
} |
| 633 |
|
} |
| 634 |
|
|
| 635 |
if (tx.vObj != null && tex != null) |
if (tx.vObj != null && tex != null) |
| 636 |
{ |
{ |
| 637 |
textureMan.applyTexture(tex, tx.vObj); |
|
| 638 |
|
if (tx.textureID == tx.vObj.prim.Sculpt.SculptTexture) |
| 639 |
|
{ |
| 640 |
|
tx.vObj.updateFullYN = true; |
| 641 |
|
//tx.vObj.mesh.Dispose(); |
| 642 |
|
|
| 643 |
|
if (tx.vObj.node.TriangleSelector != null) |
| 644 |
|
mts.RemoveTriangleSelector(tx.vObj.node.TriangleSelector); |
| 645 |
|
if (tx.vObj.node != null && tx.vObj.node.Raw != IntPtr.Zero) |
| 646 |
|
smgr.AddToDeletionQueue(tx.vObj.node); |
| 647 |
|
|
| 648 |
|
//tx.vObj.mesh = null; |
| 649 |
|
|
| 650 |
|
lock (objectMeshQueue) |
| 651 |
|
{ |
| 652 |
|
m_log.Warn("[SCULPT]: Got Sculpt Callback, remeshing"); |
| 653 |
|
objectMeshQueue.Enqueue(tx.vObj); |
| 654 |
|
} |
| 655 |
|
continue; |
| 656 |
|
// applyTexture will skip over textures that are not |
| 657 |
|
// defined in the textureentry |
| 658 |
|
} |
| 659 |
|
|
| 660 |
|
textureMan.applyTexture(tex, tx.vObj, tx.textureID); |
| 661 |
} |
} |
| 662 |
} |
} |
| 663 |
|
|
| 710 |
} |
} |
| 711 |
if (vObj.prim != null) |
if (vObj.prim != null) |
| 712 |
{ |
{ |
| 713 |
|
|
| 714 |
|
|
| 715 |
|
|
| 716 |
ulong simhandle = vObj.prim.RegionHandle; |
ulong simhandle = vObj.prim.RegionHandle; |
| 717 |
|
|
| 718 |
if (simhandle == 0) |
if (simhandle == 0) |
| 763 |
} |
} |
| 764 |
//} |
//} |
| 765 |
bool creatednode = false; |
bool creatednode = false; |
| 766 |
|
#region Avatar |
| 767 |
|
|
| 768 |
SceneNode node = null; |
SceneNode node = null; |
| 769 |
if (vObj.prim is Avatar) |
if (vObj.prim is Avatar) |
| 770 |
{ |
{ |
| 832 |
} |
} |
| 833 |
|
|
| 834 |
} |
} |
| 835 |
|
#endregion |
| 836 |
else |
else |
| 837 |
{ |
{ |
| 838 |
if (vObj.mesh == null) |
if (vObj.mesh == null) |
| 839 |
continue; |
continue; |
| 840 |
if (vObj.updateFullYN) |
if (vObj.updateFullYN) |
| 841 |
{ |
{ |
| 842 |
|
if (vObj.prim.Sculpt.SculptTexture != UUID.Zero) |
| 843 |
|
m_log.Warn("[SCULPT]: Sending sculpt to the scene...."); |
| 844 |
|
|
| 845 |
|
//Vertex3D vtest = vObj.mesh.GetMeshBuffer(0).GetVertex(0); |
| 846 |
|
//System.Console.WriteLine(" X:" + vtest.Position.X + " Y:" + vtest.Position.Y + " Z:" + vtest.Position.Z); |
| 847 |
node = smgr.AddMeshSceneNode(vObj.mesh, parentNode, (int)vObj.prim.LocalID); |
node = smgr.AddMeshSceneNode(vObj.mesh, parentNode, (int)vObj.prim.LocalID); |
| 848 |
|
|
| 849 |
creatednode = true; |
creatednode = true; |
| 963 |
|
|
| 964 |
TriangleSelector trisel = smgr.CreateTriangleSelector(vObj.mesh, node); |
TriangleSelector trisel = smgr.CreateTriangleSelector(vObj.mesh, node); |
| 965 |
node.TriangleSelector = trisel; |
node.TriangleSelector = trisel; |
| 966 |
|
triPicker.AddTriangleSelector(trisel, node); |
| 967 |
lock (mts) |
lock (mts) |
| 968 |
{ |
{ |
| 969 |
mts.AddTriangleSelector(trisel); |
mts.AddTriangleSelector(trisel); |
| 1123 |
|
|
| 1124 |
TriangleSelector trisel = smgr.CreateTriangleSelector(vObj.mesh, node); |
TriangleSelector trisel = smgr.CreateTriangleSelector(vObj.mesh, node); |
| 1125 |
node.TriangleSelector = trisel; |
node.TriangleSelector = trisel; |
| 1126 |
|
triPicker.AddTriangleSelector(trisel, node); |
| 1127 |
lock (mts) |
lock (mts) |
| 1128 |
{ |
{ |
| 1129 |
mts.AddTriangleSelector(trisel); |
mts.AddTriangleSelector(trisel); |
| 1176 |
|
|
| 1177 |
public void doProcessMesh(int pObjects) |
public void doProcessMesh(int pObjects) |
| 1178 |
{ |
{ |
| 1179 |
|
bool sculptYN = false; |
| 1180 |
|
TextureExtended sculpttex = null; |
| 1181 |
|
|
| 1182 |
for (int i = 0; i < pObjects; i++) |
for (int i = 0; i < pObjects; i++) |
| 1183 |
{ |
{ |
| 1184 |
|
sculptYN = false; |
| 1185 |
VObject vobj = null; |
VObject vobj = null; |
| 1186 |
lock (objectMeshQueue) |
lock (objectMeshQueue) |
| 1187 |
{ |
{ |
| 1190 |
vobj = objectMeshQueue.Dequeue(); |
vobj = objectMeshQueue.Dequeue(); |
| 1191 |
} |
} |
| 1192 |
|
|
| 1193 |
|
if (textureMan != null) |
|
vobj.mesh = PrimMesherG.PrimitiveToIrrMesh(vobj.prim); |
|
|
if (vobj.prim.Textures != null) |
|
|
{ |
|
|
if (vobj.prim.Textures.DefaultTexture != null) |
|
| 1194 |
{ |
{ |
| 1195 |
|
if (vobj.prim.Sculpt.SculptTexture != UUID.Zero) |
|
Color4 coldata = vobj.prim.Textures.DefaultTexture.RGBA; |
|
|
if (coldata != Color4.White) |
|
| 1196 |
{ |
{ |
| 1197 |
Mesh coolmesh = smgr.MeshManipulator.CreateMeshWithTangents(vobj.mesh); |
m_log.Warn("[SCULPT]: Got Sculpt"); |
| 1198 |
vobj.mesh = coolmesh; |
if (!textureMan.tryGetTexture(vobj.prim.Sculpt.SculptTexture, out sculpttex)) |
|
if (coldata.R != 1f || coldata.B != 1f || coldata.G != 1f) |
|
| 1199 |
{ |
{ |
| 1200 |
smgr.MeshManipulator.SetVertexColors(vobj.mesh, new Color((int)(coldata.A * 255), (int)(coldata.R * 255), (int)(coldata.G * 255), (int)(coldata.B * 255))); |
m_log.Warn("[SCULPT]: Didn't have texture, requesting it"); |
| 1201 |
|
textureMan.RequestImage(vobj.prim.Sculpt.SculptTexture, vobj); |
| 1202 |
|
//Sculpt textures will cause the prim to get put back into the Mesh objects queue |
| 1203 |
|
continue; |
| 1204 |
} |
} |
| 1205 |
if (coldata.A != 1f) |
else |
| 1206 |
{ |
{ |
| 1207 |
smgr.MeshManipulator.SetVertexColorAlpha(vobj.mesh,(int)(coldata.A * 256f)); |
m_log.Warn("[SCULPT]: have texture, setting sculpt to true"); |
| 1208 |
|
sculptYN = true; |
| 1209 |
|
} |
| 1210 |
} |
} |
| 1211 |
} |
} |
| 1212 |
|
else |
| 1213 |
|
{ |
| 1214 |
|
sculptYN = false; |
| 1215 |
|
} |
| 1216 |
|
|
| 1217 |
|
if (sculptYN == false || sculpttex == null) |
| 1218 |
|
{ |
| 1219 |
|
vobj.mesh = PrimMesherG.PrimitiveToIrrMesh(vobj.prim); |
| 1220 |
} |
} |
| 1221 |
|
else |
| 1222 |
|
{ |
| 1223 |
|
float LOD = 32f; |
| 1224 |
|
|
| 1225 |
|
if (sculpttex.DOTNETImage.Width < 32f) LOD = sculpttex.DOTNETImage.Width; |
| 1226 |
|
if (sculpttex.DOTNETImage.Height < 32f && sculpttex.DOTNETImage.Height < LOD ) LOD = sculpttex.DOTNETImage.Height; |
| 1227 |
|
if (LOD < 32f && LOD > 16f) LOD = 32; |
| 1228 |
|
if (LOD < 16f && LOD > 8f) LOD = 16; |
| 1229 |
|
if (LOD < 8f && LOD > 4f) LOD = 8; |
| 1230 |
|
if (LOD < 4 && LOD > 2) LOD = 4; |
| 1231 |
|
if (LOD < 2) LOD = 2; |
| 1232 |
|
|
| 1233 |
|
m_log.Warn("[SCULPT]: Resizing Sculptie......"); |
| 1234 |
|
SculptMeshLOD smLOD = new SculptMeshLOD(sculpttex.DOTNETImage,LOD); |
| 1235 |
|
m_log.Warn("[SCULPT]: Meshing Sculptie......"); |
| 1236 |
|
vobj.mesh = PrimMesherG.SculptIrrMesh(smLOD.ResultBitmap); |
| 1237 |
|
smLOD.Dispose(); |
| 1238 |
|
m_log.Warn("[SCULPT]: Sculptie Meshed"); |
| 1239 |
|
|
| 1240 |
} |
} |
| 1241 |
|
|
| 1242 |
ulong regionHandle = vobj.prim.RegionHandle; |
ulong regionHandle = vobj.prim.RegionHandle; |
| 1243 |
|
|
| 1244 |
if (vobj.prim.ParentID != 0) |
if (vobj.prim.ParentID != 0) |
| 1612 |
|
|
| 1613 |
if (terrain != null) |
if (terrain != null) |
| 1614 |
{ |
{ |
| 1615 |
|
triPicker.RemTriangleSelector(terrain.TriangleSelector); |
| 1616 |
smgr.AddToDeletionQueue(terrain); |
smgr.AddToDeletionQueue(terrain); |
|
|
|
| 1617 |
} |
} |
| 1618 |
Vector3 relTerrainPos = Vector3.Zero; |
Vector3 relTerrainPos = Vector3.Zero; |
| 1619 |
if (currentSim != null) |
if (currentSim != null) |
| 1650 |
{ |
{ |
| 1651 |
mts.RemoveTriangleSelector(terrainsels[regionhandle]); |
mts.RemoveTriangleSelector(terrainsels[regionhandle]); |
| 1652 |
terrainsels.Remove(regionhandle); |
terrainsels.Remove(regionhandle); |
| 1653 |
|
|
| 1654 |
} |
} |
| 1655 |
} |
} |
| 1656 |
|
|
| 1657 |
terrainsel = smgr.CreateTerrainTriangleSelector(terrain, 1); |
terrainsel = smgr.CreateTerrainTriangleSelector(terrain, 1); |
| 1658 |
terrain.TriangleSelector = terrainsel; |
terrain.TriangleSelector = terrainsel; |
| 1659 |
|
triPicker.AddTriangleSelector(terrainsel, terrain); |
| 1660 |
|
|
| 1661 |
lock (terrainsels) |
lock (terrainsels) |
| 1662 |
{ |
{ |
| 1663 |
terrainsels.Add(regionhandle, terrainsel); |
terrainsels.Add(regionhandle, terrainsel); |
| 1708 |
{ |
{ |
| 1709 |
if (newObject.node != null) |
if (newObject.node != null) |
| 1710 |
{ |
{ |
| 1711 |
|
if (newObject.node.TriangleSelector != null) |
| 1712 |
|
mts.RemoveTriangleSelector(newObject.node.TriangleSelector); |
| 1713 |
smgr.AddToDeletionQueue(newObject.node); |
smgr.AddToDeletionQueue(newObject.node); |
| 1714 |
newObject.node = null; |
newObject.node = null; |
| 1715 |
} |
} |
| 2000 |
if (cam.SNtarget == obj.node) |
if (cam.SNtarget == obj.node) |
| 2001 |
cam.SNtarget = null; |
cam.SNtarget = null; |
| 2002 |
|
|
| 2003 |
|
if (obj.node.TriangleSelector != null) |
| 2004 |
|
mts.RemoveTriangleSelector(obj.node.TriangleSelector); |
| 2005 |
|
|
| 2006 |
smgr.AddToDeletionQueue(obj.node); |
smgr.AddToDeletionQueue(obj.node); |
| 2007 |
obj.node = null; |
obj.node = null; |
| 2008 |
|
|
| 2290 |
|
|
| 2291 |
Vector3D collisionpoint = new Vector3D(0, 0, 0); |
Vector3D collisionpoint = new Vector3D(0, 0, 0); |
| 2292 |
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); |
| 2293 |
SceneNode node = smgr.CollisionManager.GetSceneNodeFromRay(projectedray, 0x0128, true); //smgr.CollisionManager.GetSceneNodeFromScreenCoordinates(new Position2D(p_event.MousePosition.X, p_event.MousePosition.Y), 0, false); |
SceneNode node = triPicker.GetSceneNodeFromRay(projectedray, 0x0128, true, cam.SNCamera.Position); //smgr.CollisionManager.GetSceneNodeFromScreenCoordinates(new Position2D(p_event.MousePosition.X, p_event.MousePosition.Y), 0, false); |
| 2294 |
if (node == null) |
if (node == null) |
| 2295 |
{ |
{ |
| 2296 |
m_log.Warn("[PICKER]: Picked null"); |
if (smgr.CollisionManager.GetCollisionPoint(projectedray, mts, out collisionpoint, out tri)) |
| 2297 |
|
{ |
| 2298 |
|
|
| 2299 |
|
//if (collisionpoint != null) |
| 2300 |
|
//{ |
| 2301 |
|
//m_log.DebugFormat("Found point: <{0},{1},{2}>", collisionpoint.X, collisionpoint.Y, collisionpoint.Z); |
| 2302 |
|
//} |
| 2303 |
|
cam.SetTarget(collisionpoint); |
| 2304 |
|
cam.SNtarget = null; |
| 2305 |
|
} |
| 2306 |
} |
} |
| 2307 |
else |
else |
| 2308 |
{ |
{ |
| 2312 |
if (smgr.CollisionManager.GetCollisionPoint(projectedray, mts, out collisionpoint, out tri)) |
if (smgr.CollisionManager.GetCollisionPoint(projectedray, mts, out collisionpoint, out tri)) |
| 2313 |
{ |
{ |
| 2314 |
|
|
| 2315 |
//if (collisionpoint != null) |
//if (collisionpoint != nuYesll) |
| 2316 |
//{ |
//{ |
| 2317 |
//m_log.DebugFormat("Found point: <{0},{1},{2}>", collisionpoint.X, collisionpoint.Y, collisionpoint.Z); |
//m_log.DebugFormat("Found point: <{0},{1},{2}>", collisionpoint.X, collisionpoint.Y, collisionpoint.Z); |
| 2318 |
//} |
//} |
| 2381 |
|
|
| 2382 |
#endregion |
#endregion |
| 2383 |
|
|
| 2384 |
public void textureCompleteCallback(string tex, VObject vObj) |
public void textureCompleteCallback(string tex, VObject vObj, UUID AssetID) |
| 2385 |
{ |
{ |
| 2386 |
TextureComplete tx = new TextureComplete(); |
TextureComplete tx = new TextureComplete(); |
| 2387 |
tx.texture = tex; |
tx.texture = tex; |
| 2388 |
tx.vObj = vObj; |
tx.vObj = vObj; |
| 2389 |
|
tx.textureID = AssetID; |
| 2390 |
assignTextureQueue.Enqueue(tx); |
assignTextureQueue.Enqueue(tx); |
| 2391 |
} |
} |
| 2392 |
} |
} |
| 2395 |
{ |
{ |
| 2396 |
public VObject vObj; |
public VObject vObj; |
| 2397 |
public string texture; |
public string texture; |
| 2398 |
|
public UUID textureID; |
| 2399 |
|
|
| 2400 |
} |
} |
| 2401 |
} |
} |