| 342 |
//GUIToolBar gtb = guienv.AddToolBar(guienv.RootElement, 91); |
//GUIToolBar gtb = guienv.AddToolBar(guienv.RootElement, 91); |
| 343 |
//gtb.Text = "Hi"; |
//gtb.Text = "Hi"; |
| 344 |
//gtb.AddButton(92, "Button", "Click", null, null, true, false); |
//gtb.AddButton(92, "Button", "Click", null, null, true, false); |
|
/* |
|
|
AnimatedMesh av = smgr.GetMesh("Female.x"); |
|
| 345 |
|
|
| 346 |
//int mbcount = av.GetMesh(0).MeshBufferCount; |
AnimatedMesh av = smgr.GetMesh("Female7.x"); |
| 347 |
|
|
| 348 |
|
int mbcount = av.GetMesh(0).MeshBufferCount; |
| 349 |
for (int j = 0; j < mbcount; j++) |
for (int j = 0; j < mbcount; j++) |
| 350 |
{ |
{ |
| 351 |
av.GetMesh(0).GetMeshBuffer(j).Material.Texture1 = driver.GetTexture("Green_Grass_Detailed.tga"); |
av.GetMesh(0).GetMeshBuffer(j).Material.Texture1 = driver.GetTexture("Green_Grass_Detailed.tga"); |
| 354 |
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); |
| 355 |
av.GetMesh(0).GetMeshBuffer(j).Material.Shininess = 0.80f; |
av.GetMesh(0).GetMeshBuffer(j).Material.Shininess = 0.80f; |
| 356 |
} |
} |
| 357 |
//SkinnedMesh sm = new SkinnedMesh(av.Raw); |
smgr.MeshManipulator.FlipSurfaces(av.GetMesh(0)); |
| 358 |
//sm. |
|
|
//sm.SkinMesh(); |
|
|
//sm.AnimateMesh(0, 0); |
|
| 359 |
|
|
| 360 |
|
|
| 361 |
avmeshsntest = smgr.AddAnimatedMeshSceneNode(av); |
avmeshsntest = smgr.AddAnimatedMeshSceneNode(av); |
| 362 |
//avmeshsntest.JointMode = JointUpdateOnRenderMode.Read; |
avmeshsntest.JointMode = JointUpdateOnRenderMode.Control; |
| 363 |
avmeshsntest.SetMaterialFlag(MaterialFlag.NormalizeNormals,true); |
//avmeshsntest.SetMaterialFlag(MaterialFlag.NormalizeNormals,true); |
| 364 |
|
|
| 365 |
|
System.IO.BinaryReader br = new BinaryReader(File.Open(m_startupDirectory + "\\" + Util.MakePath("media", "materials", "textures", "") + "\\coolfile.an",FileMode.Open)); |
| 366 |
|
byte[] arr = new byte[(int)br.BaseStream.Length + 20]; |
| 367 |
|
{ |
| 368 |
|
int pos = 0; |
| 369 |
|
int length = (int)br.BaseStream.Length; |
| 370 |
|
|
| 371 |
|
arr = br.ReadBytes(((int)br.BaseStream.Length)-1); |
| 372 |
|
|
| 373 |
|
|
| 374 |
|
} |
| 375 |
|
br.Close(); |
| 376 |
|
BinBVHAnimationReader anims = new BinBVHAnimationReader(arr); |
| 377 |
|
|
| 378 |
//BoneSceneNode avb = avm.GetXJointNode(1); |
//BoneSceneNode avb = avm.GetXJointNode(1); |
| 379 |
avmeshsntest.Position = new Vector3D(125, 37, 125); |
avmeshsntest.Position = new Vector3D(125, 37, 125); |
| 380 |
avmeshsntest.Scale = new Vector3D(15, 15, 15); |
avmeshsntest.Scale = new Vector3D(15, 15, 15); |
| 381 |
avmeshsntest.Rotation = new Vector3D(0, 90, 0); |
avmeshsntest.Rotation = new Vector3D(180, 0, 0); |
| 382 |
//avmeshsntest.UpdateAbsolutePosition(); |
//avmeshsntest.UpdateAbsolutePosition(); |
| 383 |
|
anims = new BinBVHAnimationReader(arr); |
| 384 |
|
for (int jointnum = 0; jointnum < anims.joints.Length; jointnum++) |
| 385 |
|
{ |
| 386 |
|
binBVHJoint jointdata = anims.joints[jointnum]; |
| 387 |
|
BoneSceneNode sn = avmeshsntest.GetJointNode(jointdata.Name); |
| 388 |
|
|
| 389 |
|
//sn.SkinningSpace = SkinningSpace.Local; |
| 390 |
|
if (sn != null) |
| 391 |
|
{ |
| 392 |
|
m_log.DebugFormat("[defaults]: Name:{0}, <{1},{2},{3}>", sn.Name, sn.Rotation.X, sn.Rotation.Y, sn.Rotation.Z); |
| 393 |
|
if (jointdata.rotationkeys[0].key_element != Vector3.Zero) |
| 394 |
|
{ |
| 395 |
|
|
| 396 |
|
m_log.DebugFormat("[ROTA]:<{0},{1},{2}>", jointdata.rotationkeys[0].key_element.Y, jointdata.rotationkeys[0].key_element.Z, jointdata.rotationkeys[0].key_element.X); |
| 397 |
|
} |
| 398 |
|
Vector3D jointeuler = sn.Rotation + new Vector3D(jointdata.rotationkeys[0].key_element.Z, jointdata.rotationkeys[0].key_element.X, jointdata.rotationkeys[0].key_element.Y); |
| 399 |
|
sn.Rotation = jointeuler;// *framecounter; |
| 400 |
|
sn.UpdateAbsolutePositionOfAllChildren(); |
| 401 |
|
} |
| 402 |
|
} |
| 403 |
|
|
| 404 |
//SkinnedMesh smm = new SkinnedMesh(avm.AnimatedMesh.Raw); |
//SkinnedMesh smm = new SkinnedMesh(avm.AnimatedMesh.Raw); |
| 405 |
//smm.SkinMesh(); |
//smm.SkinMesh(); |
| 406 |
*/ |
|
| 407 |
int minFrameTime = (int)(1.0f / maxFPS); |
int minFrameTime = (int)(1.0f / maxFPS); |
| 408 |
bool running = true; |
bool running = true; |
| 409 |
while (running) |
while (running) |
| 436 |
avmeshsntest.CurrentFrame = 1; |
avmeshsntest.CurrentFrame = 1; |
| 437 |
//avmeshsntest.DebugDataVisible = DebugSceneType.Full; |
//avmeshsntest.DebugDataVisible = DebugSceneType.Full; |
| 438 |
avmeshsntest.LoopMode = true; |
avmeshsntest.LoopMode = true; |
| 439 |
|
*/ |
| 440 |
|
|
| 441 |
|
|
|
BoneSceneNode bcn = avmeshsntest.GetJointNode("chest:2"); |
|
|
bcn.AutomaticCulling = CullingType.Off; |
|
|
bcn.DebugDataVisible = DebugSceneType.Full; |
|
|
|
|
|
bcn.AnimationMode = AnimationMode.Unanimated; |
|
|
Vector3D rot = bcn.Rotation; |
|
|
rot.X = 9; |
|
|
bcn.Rotation = rot; |
|
|
//bcn.RotationHint = 5; |
|
| 442 |
|
|
|
bcn.UpdateAbsolutePositionOfAllChildren(); |
|
| 443 |
|
|
|
avmeshsntest.AnimateJoints(false); |
|
|
*/ |
|
| 444 |
driver.BeginScene(true, true, new Color(255, 100, 101, 140)); |
driver.BeginScene(true, true, new Color(255, 100, 101, 140)); |
| 445 |
smgr.DrawAll(); |
smgr.DrawAll(); |
| 446 |
guienv.DrawAll(); |
guienv.DrawAll(); |
| 468 |
if (framecounter == uint.MaxValue) |
if (framecounter == uint.MaxValue) |
| 469 |
framecounter = 0; |
framecounter = 0; |
| 470 |
} |
} |
| 471 |
|
|
| 472 |
|
|
| 473 |
|
|
| 474 |
if ((framecounter % objectmods) == 0) |
if ((framecounter % objectmods) == 0) |
| 475 |
{ |
{ |
| 476 |
doProcessMesh(5); |
doProcessMesh(5); |
| 478 |
CheckAndApplyParent(5); |
CheckAndApplyParent(5); |
| 479 |
doTextureMods(1); |
doTextureMods(1); |
| 480 |
doSetCameraPosition(); |
doSetCameraPosition(); |
| 481 |
|
|
| 482 |
|
|
| 483 |
|
//BoneSceneNode bcn = avmeshsntest.GetJointNode("lCollar:2"); |
| 484 |
|
//bcn.Rotation = new Vector3D(0, 36 + framecounter, 0); |
| 485 |
|
//bcn.Position = new Vector3D(0, 0, 1 + framecounter); |
| 486 |
|
|
| 487 |
|
//avmeshsntest.SetMaterialFlag(MaterialFlag.NormalizeNormals, true); |
| 488 |
|
|
| 489 |
} |
} |
| 490 |
//Thread.Sleep(50); |
//Thread.Sleep(50); |
| 491 |
int frameTime = System.Environment.TickCount - tickcount; |
int frameTime = System.Environment.TickCount - tickcount; |