本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Model.CopyAbsoluteBoneTransformsTo方法的典型用法代码示例。如果您正苦于以下问题:C# Model.CopyAbsoluteBoneTransformsTo方法的具体用法?C# Model.CopyAbsoluteBoneTransformsTo怎么用?C# Model.CopyAbsoluteBoneTransformsTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Model
的用法示例。
在下文中一共展示了Model.CopyAbsoluteBoneTransformsTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: c0000da
public c0000da(Model p0, c0000b5 p1, c0000db p2)
{
this.f00008e = p1;
this.f000018 = p2;
this.f00007a = new Dictionary<string, c0000dc>();
foreach (string str in this.f00008e.Keys)
{
this.f00007a.Add(str, new c0000dc(this.f00008e[str]));
}
this.f0000e1 = new Matrix[p0.Bones.Count];
p0.CopyAbsoluteBoneTransformsTo(this.f0000e1);
Dictionary<string, object> tag = (Dictionary<string, object>) p0.Tag;
if (tag == null)
{
throw new Exception("Model Processor must subclass AnimatedModelProcessor.");
}
this.f00013c = (c00008f[]) tag["SkinInfo"];
if (this.f00013c == null)
{
throw new Exception("Model processor must pass skinning info through the tag.");
}
this.f00013d = new Matrix[p0.Meshes.Count][];
for (int i = 0; i < this.f00013c.Length; i++)
{
if (c0000dd.m0001a9(p0.Meshes[i]))
{
this.f00013d[i] = new Matrix[this.f00013c[i].Count];
}
else
{
this.f00013d[i] = null;
}
}
}
示例2: DrawBall
public void DrawBall(float aspectRatio, Vector3 cameraPosition, Model ball, float xrotation,float yrotation)
{
// assign random number to roid1modelPosition.x or y
// Copy any parent transforms.
Matrix[] transforms = new Matrix[ball.Bones.Count];
ball.CopyAbsoluteBoneTransformsTo(transforms);
// Draw the model. A model can have multiple meshes, so loop.
foreach (ModelMesh mesh in ball.Meshes)
{
// This is where the mesh orientation is set, as well as our camera and projection.
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] //* Matrix.CreateRotationZ(Roid1modelRotation)
* Matrix.CreateRotationX(xrotation) * Matrix.CreateRotationY(yrotation)
* Matrix.CreateTranslation(new Vector3(3750, -2750, 0));
effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
aspectRatio, 1.0f, 10000.0f);
}
// Draw the mesh, using the effects set above.
mesh.Draw();
}
}
示例3: Build
public override void Build()
{
model = Demo.Content.Load<Model>("staticmesh");
boneTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(boneTransforms);
List<TriangleVertexIndices> indices = new List<TriangleVertexIndices>();
List<Vector3> vertices = new List<Vector3>();
ExtractData(vertices, indices, model);
List<JVector> jvertices = new List<JVector>(vertices.Count);
foreach(Vector3 vertex in vertices) jvertices.Add(Conversion.ToJitterVector(vertex));
Octree octree = new Octree(jvertices, indices);
TriangleMeshShape tms = new TriangleMeshShape(octree);
RigidBody body = new RigidBody(tms);
body.IsStatic = true;
//body.EnableDebugDraw = true;
body.Tag = BodyTag.DontDrawMe;
Demo.World.AddBody(body);
AddCar(new JVector(-20, 20, 0));
}
示例4: LoadContent
public override void LoadContent(ContentManager Content)
{
Board.setModel(Content.Load<Model>("Models\\board"));
Piece.setModel(Content.Load<Model>("Models\\piece"));
selector = Content.Load<Model>("Models\\selector");
selectorTrans = new Matrix[selector.Bones.Count];
selector.CopyAbsoluteBoneTransformsTo(selectorTrans);
((BasicEffect)selector.Meshes[0].Effects[0]).Alpha = 0.6f;
((BasicEffect)selector.Meshes[0].Effects[0]).DiffuseColor = Vector3.UnitX;
Player.LoadContent(Content);
background = Content.Load<Texture2D>("Images\\background");
Viewport v = Program.game.GraphicsDevice.Viewport;
destRect = new Rectangle(0, 0, v.Width, v.Height);
int x, y, w, h;
if (background.Width / background.Height > destRect.Width / destRect.Height)
{
h = background.Height;
w = background.Height * destRect.Width / destRect.Height;
y = 0;
x = (background.Width - w) / 2;
}
else
{
h = background.Width * destRect.Height / destRect.Width;
w = background.Width;
y = (background.Height - h) / 2;
x = 0;
}
srcRect = new Rectangle(x, y, w, h);
}
示例5: Draw
public void Draw(float aspectRatio, Vector3 cameraPosition,Model mesh)
{
transforms = new Matrix[mesh.Bones.Count];
mesh.CopyAbsoluteBoneTransformsTo(transforms);
foreach (var singleMesh in mesh.Meshes)
{
// This is where the mesh orientation is set, as well as our camera and projection.
foreach (BasicEffect effect in singleMesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[singleMesh.ParentBone.Index] * Matrix.CreateRotationY(ObjectArrangement.Rotation.Y)
* Matrix.CreateTranslation(ObjectArrangement.Position) * Matrix.CreateScale(ObjectArrangement.Scale);
effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
aspectRatio, 1.0f, 10000.0f);
}
singleMesh.Draw();
}
}
示例6: BillboardsSystem
public BillboardsSystem(ContentManager content, BillboardMode mode, Model model,
Matrix[] instancedModelBones, Matrix[] instanceTransforms,
Vector3 position, Vector3 rotation, Vector3 scale,
Vector3 LightDirection, Vector3 LightColor, Vector3 AmbientLight,
GraphicsDevice graphicsDevice)
{
this.model = model;
modelTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(modelTransforms);
buildBoundingSphere();
this.position = position;
this.rotation = rotation;
this.scale = scale;
this.graphicsDevice = graphicsDevice;
this.instancedModelBones = instancedModelBones;
this.instanceTransforms = instanceTransforms;
// this.LightDirection = LightDirection;
// this.LightColor = LightColor;
// this.AmbientColor = AmbientLight;
this.mode = mode;
effect = content.Load<Effect>("Effects//AlphaBlending");
_effect = content.Load<Effect>("shaders//LPPMainEffect");
//SetModelEffect(effect, false);
}
示例7: DrawModel
private void DrawModel(Model m)
{
Matrix[] transforms = new Matrix[m.Bones.Count];
float aspectRatio = Context.Graphics.Device.Viewport.AspectRatio;
m.CopyAbsoluteBoneTransformsTo(transforms);
Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
Matrix view = Matrix.CreateLookAt(new Vector3(0.0f, 2.0f, 10f), Vector3.Zero, Vector3.Up);
var state = new RasterizerState();
state.CullMode = CullMode.None;
Context.Graphics.Device.RasterizerState = state;
foreach (ModelMesh mesh in m.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.DiffuseColor = new Vector3(1, 1, 1);
effect.View = view;
effect.Projection = projection;
effect.World = Matrix.Identity * transforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(Position) * Matrix.CreateRotationY(MathHelper.ToRadians(angle));
}
mesh.Draw();
}
}
示例8: drawMesh
public void drawMesh(Model myModel, Vector3 modelPosition, float modelRotation, Camera camera)
{
float aspectRatio = (float)Tools.Quick.graphics.GraphicsDevice.Viewport.Width /
(float)Tools.Quick.graphics.GraphicsDevice.Viewport.Height;
// Copy any parent transforms.
Matrix[] transforms = new Matrix[myModel.Bones.Count];
myModel.CopyAbsoluteBoneTransformsTo(transforms);
Tools.Quick.device.RasterizerState = RasterizerState.CullNone; // vertex order doesn't matter
Tools.Quick.device.BlendState = BlendState.Opaque; // use alpha blending
Tools.Quick.device.DepthStencilState = DepthStencilState.Default; // don't bother with the depth/stencil buffer
// Draw the model. A model can have multiple meshes, so loop.
foreach (ModelMesh mesh in myModel.Meshes)
{
// This is where the mesh orientation is set, as well as our camera and projection.
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(modelRotation) * Matrix.CreateTranslation(modelPosition); //modelPosition
effect.View = camera.getview();
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
aspectRatio, 1.0f, 1000000.0f);
}
// Draw the mesh, using the effects set above.
mesh.Draw();
}
}
示例9: MovableModel
public MovableModel(Model model, Matrix4 transform)
: base(transform)
{
m_model = model;
m_transforms = new Matrix[m_model.Bones.Count];
m_model.CopyAbsoluteBoneTransformsTo (m_transforms);
}
示例10: Weapon
public Weapon(Game1 game,Player player, Model model, Unit unit)
: base(game, unit, new CModel(game, model))
{
this.player = player;
Matrix[] transforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(transforms);
}
示例11: EnvironmentObject
//Ctor used for items like key which wont nescessarily be visible in the world
public EnvironmentObject(string modelPath, ContentManager content)
{
model = content.Load<Model>(modelPath);
transformation = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(transformation);
}
示例12: Load
public void Load(ContentManager content)
{
this.model = content.Load<Model>(path);
// Copy any parent transforms.
transforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(transforms);
}
示例13: Level
public Level(Game game, string levelModelFilename)
: base(game)
{
model = game.Content.Load<Model>(levelModelFilename);
boneTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(boneTransforms);
}
示例14: Draw
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
// Copy any parent transforms.
spriteBatch = new SpriteBatch(GraphicsDevice);
myModel = Content.Load<Model>("Models\\test");
aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
Matrix[] transforms = new Matrix[myModel.Bones.Count];
myModel.CopyAbsoluteBoneTransformsTo(transforms);
// Draw the model. A model can have multiple meshes, so loop.
foreach (ModelMesh mesh in myModel.Meshes)
{
// This is where the mesh orientation is set, as well
// as our camera and projection.
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateRotationY(modelRotation)
* Matrix.CreateTranslation(modelPosition);
effect.View = Matrix.CreateLookAt(cameraPosition,
Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f), aspectRatio,
1.0f, 10000.0f);
}
// Draw the mesh, using the effects set above.
mesh.Draw();
}
base.Draw(gameTime);
}
示例15: AnimatableModel
public AnimatableModel(ContentManager content)
{
model = content.Load<Model>("SpaceShip");
boneTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(boneTransforms);
World = new AnimatableMatrix();
}