本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Model.CopyBoneTransformsFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Model.CopyBoneTransformsFrom方法的具体用法?C# Model.CopyBoneTransformsFrom怎么用?C# Model.CopyBoneTransformsFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Model
的用法示例。
在下文中一共展示了Model.CopyBoneTransformsFrom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawModel
protected override void DrawModel(GraphicsDeviceManager graphics, Model model, Matrix world)
{
#region RotateSpine
int spineBone = model.Bones["Bip01 Spine1"].Index;
boneTransforms[spineBone] = Matrix.CreateRotationZ(spineElevation) * Matrix.CreateRotationX(spineAzimuth) * boneTransforms[spineBone];
model.CopyBoneTransformsFrom(boneTransforms);
model.CopyAbsoluteBoneTransformsTo(absoTransforms);
#endregion
base.DrawModel(graphics, model, world);
}
示例2: DrawModel
private void DrawModel(GraphicsDeviceManager graphics, Model model, Matrix world)
{
// Apply the bone transforms
Matrix[] absoTransforms = new Matrix[model.Bones.Count];
model.CopyBoneTransformsFrom(boneTransforms);
model.CopyAbsoluteBoneTransformsTo(absoTransforms);
foreach (ModelMesh mesh in model.Meshes)
{
foreach (Effect effect in mesh.Effects)
{
effect.Parameters["World"].SetValue(absoTransforms[mesh.ParentBone.Index] * world);
effect.Parameters["View"].SetValue(game.Camera.View);
effect.Parameters["Projection"].SetValue(game.Camera.Projection);
effect.Parameters["yValue"].SetValue(1-2*sliming);
}
mesh.Draw();
}
}
示例3: DrawModel
private void DrawModel(GraphicsDeviceManager graphics, Model model, Matrix world)
{
// Apply the bone transforms
Matrix[] absoTransforms = new Matrix[model.Bones.Count];
model.CopyBoneTransformsFrom(boneTransforms);
model.CopyAbsoluteBoneTransformsTo(absoTransforms);
foreach (ModelMesh mesh in model.Meshes)
{
foreach (Effect effect in mesh.Effects)
{
effect.Parameters["World"].SetValue(absoTransforms[mesh.ParentBone.Index] * world);
effect.Parameters["View"].SetValue(game.Camera.View);
effect.Parameters["Projection"].SetValue(game.Camera.Projection);
effect.Parameters["Time"].SetValue((float)game.SlimeTime);
// The section the open door is in. (-1 for no open door)
int sectionOfOpenDoor = -1;
// The door that is open (null for no open door)
Door openDoor = GetOpenDoor(section);
// If the door is open, get the sectionOfOpenDoor
if (openDoor != null)
{
sectionOfOpenDoor = openDoor.GetSectionNumber();
}
//If there is an open door, set the openness.
if (sectionOfOpenDoor != -1)
{
// How open the door is (0 for no open door)
float opennessOfDoor = GetOpenDoorDegree(openDoor);
if (opennessOfDoor < 0) opennessOfDoor = 0;
if (opennessOfDoor > 1) opennessOfDoor = 1;
//If there is a slightly open door, set the color (turn it on) and set the location.
effect.Parameters["Light4Location"].SetValue(LightInfo(sectionOfOpenDoor, 6));
effect.Parameters["OpennessOfDoor"].SetValue(opennessOfDoor);
}
else
{
effect.Parameters["OpennessOfDoor"].SetValue(0);
}
}
mesh.Draw();
}
}