当前位置: 首页>>代码示例>>C#>>正文


C# Model.CopyAbsoluteBoneTransformsTo方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:bing2008,项目名称:CastNetGame,代码行数:34,代码来源:c0000da.cs

示例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();
            }
        }
开发者ID:kolpime,项目名称:Asteroids,代码行数:28,代码来源:Rollerball2.cs

示例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));
        }
开发者ID:reidyd,项目名称:jitterphysics,代码行数:26,代码来源:TriangleMesh.cs

示例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);
        }
开发者ID:hassanselim0,项目名称:GUC-Checkers,代码行数:34,代码来源:GamePlay.cs

示例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();
            }
        }
开发者ID:IzzyDoor,项目名称:hopnet,代码行数:25,代码来源:Object.cs

示例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);
        }
开发者ID:razvanalex,项目名称:XNAEnvironment,代码行数:29,代码来源:BillboardsSystem.cs

示例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();
            }
        }
开发者ID:JohanGl,项目名称:Outworld-XNA,代码行数:27,代码来源:ModelScene.cs

示例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();
            }
        }
开发者ID:Jupotter,项目名称:Nameless-Tales,代码行数:29,代码来源:DrawThings.cs

示例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);
 }
开发者ID:kwaegel,项目名称:muTracer,代码行数:7,代码来源:MovableModel.cs

示例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);
 }
开发者ID:blackEagle2012,项目名称:XNA-Game-project,代码行数:7,代码来源:Weapon.cs

示例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);
        }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:8,代码来源:EnvironmentObject.cs

示例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);
 }
开发者ID:foolmoron,项目名称:Rolling,代码行数:7,代码来源:GameObject.cs

示例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);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:7,代码来源:Level.cs

示例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);
        }
开发者ID:freddeyyy,项目名称:mmotest,代码行数:35,代码来源:Game1.cs

示例15: AnimatableModel

 public AnimatableModel(ContentManager content)
 {
     model = content.Load<Model>("SpaceShip");
     boneTransforms = new Matrix[model.Bones.Count];
     model.CopyAbsoluteBoneTransformsTo(boneTransforms);
     World = new AnimatableMatrix();
 }
开发者ID:kryptx,项目名称:Matrixplorer,代码行数:7,代码来源:AnimatableModel.cs


注:本文中的Microsoft.Xna.Framework.Graphics.Model.CopyAbsoluteBoneTransformsTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。