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


C# Graphics.Model类代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Model的典型用法代码示例。如果您正苦于以下问题:C# Model类的具体用法?C# Model怎么用?C# Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Model类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Pigeon

        public Pigeon(ContentManager con)
        {
            boundingBox = new Vector3(6, 3, 6);

            distance = 0;
            rand = new Random();

            dx = (0.5-rand.NextDouble())*0.8 + 0.2;
            dy = rand.NextDouble()*1.5 + 0.7;
            dz = 0.8;

            x = 5.8;
            y = -2;
            z = 83.5;

            sx = 5.8;
            sy = -2;
            sz = 83.5;

            this.world = Matrix.CreateTranslation(new Vector3((float)x, (float)y, (float)z));

            model = con.Load<Model>(@"models/pigeon");

            isDone = false;
        }
开发者ID:richardshelby,项目名称:TargetPractice,代码行数:25,代码来源:Pigeon.cs

示例2: DrawBuildings

        public override void DrawBuildings(GameTime gameTime)
        {
            base.DrawBuildings(gameTime);

            Model[] models = new Model[1];
            models[0] = GameResources.Inst().GetTreeModel(2);

            foreach (Model m in models)
            {
                Matrix[] transforms = new Matrix[m.Bones.Count];
                m.CopyAbsoluteBoneTransformsTo(transforms);

                foreach (ModelMesh mesh in m.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {
                        effect.Alpha = 1.0f;
                        effect.LightingEnabled = true;
                        effect.AmbientLightColor = GameState.MaterialAmbientColor;
                        effect.DirectionalLight0.Direction = GameState.LightDirection;
                        effect.DirectionalLight0.DiffuseColor = GameState.LightDiffusionColor;
                        effect.DirectionalLight0.SpecularColor = GameState.LightSpecularColor;
                        effect.DirectionalLight0.Enabled = true;
                        effect.World = transforms[mesh.ParentBone.Index] * worldM;
                        effect.View = GameState.view;
                        effect.Projection = GameState.projection;
                    }
                    mesh.Draw();
                }
            }
        }
开发者ID:alenkacz,项目名称:Expanze,代码行数:31,代码来源:DesertView.cs

示例3: CarObject

        public CarObject(int asset,
            Vector3 pos,
            Model model,Model wheels, bool FWDrive,
                       bool RWDrive,
                       float maxSteerAngle,
                       float steerRate,
                       float wheelSideFriction,
                       float wheelFwdFriction,
                       float wheelTravel,
                       float wheelRadius,
                       float wheelZOffset,
                       float wheelRestingFrac,
                       float wheelDampingFrac,
                       int wheelNumRays,
                       float driveTorque,
                       float gravity)
            : base()
        {
            car = new Car(FWDrive, RWDrive, maxSteerAngle, steerRate,
                wheelSideFriction, wheelFwdFriction, wheelTravel, wheelRadius,
                wheelZOffset, wheelRestingFrac, wheelDampingFrac,
                wheelNumRays, driveTorque, gravity);

            this.Body = car.Chassis.Body;
            this.Skin= car.Chassis.Skin;
            Body.CollisionSkin = Skin;
            Body.ExternalData = this;
            this.wheel = wheels;
            CommonInit(pos, new Vector3(1, 1, 1), model, true, asset);
            SetCarMass(100.1f);

            actionManager.AddBinding((int)Actions.Acceleration, new Helper.Input.ActionBindingDelegate(SimulateAcceleration), 1);
            actionManager.AddBinding((int)Actions.Steering, new Helper.Input.ActionBindingDelegate(SimulateSteering), 1);
            actionManager.AddBinding((int)Actions.Handbrake, new Helper.Input.ActionBindingDelegate(SimulateHandbrake), 1);
        }
开发者ID:colbybhearn,项目名称:3DPhysics,代码行数:35,代码来源:CarObject.cs

示例4: TileMap3D

            public TileMap3D(GraphicsDevice graphicsDevice, ContentManager contentManager, int width, int height)
            {
                this.GraphicsDevice = graphicsDevice;
                Wall = contentManager.Load<Model>("Models/TileMap3D/Wall");
                FloorTile = contentManager.Load<Model>("Models/TileMap3D/FloorTile");
                Dirt = contentManager.Load<Model>("Models/TileMap3D/Dirt");
                Cleaner = contentManager.Load<Model>("Models/TileMap3D/Cleaner");

                ((BasicEffect)Wall.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)FloorTile.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Dirt.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Cleaner.Meshes[0].Effects[0]).EnableDefaultLighting();
                foreach (BasicEffect effect in Cleaner.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;
                foreach (BasicEffect effect in FloorTile.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;

                dss.DepthBufferEnable = true;
                dss.DepthBufferFunction = CompareFunction.LessEqual;
                dss.DepthBufferWriteEnable = true;
                rs.CullMode = CullMode.CullCounterClockwiseFace;
                ss.AddressU = TextureAddressMode.Wrap;
                ss.AddressV = TextureAddressMode.Wrap;
                ss.Filter = TextureFilter.Anisotropic;

                Camera = new Camera(graphicsDevice.Viewport.AspectRatio, graphicsDevice);
            }
开发者ID:Troilk,项目名称:VacuumCleaner,代码行数:27,代码来源:TileMap3D.cs

示例5: AABBTree

        public static AABBTree AABBTree(Model model, AABBNodeInfo tree_info)
        {
            List<TriangleVertexIndices> indices = new List<TriangleVertexIndices>();
              List<Vector3> points = new List<Vector3>();
              AABBFactory.ExtractData(model, points, indices, true);

              VertexPositionColor[] vertices = new VertexPositionColor[indices.Count * 3];

              List<float[]> triangles = new List<float[]>();

              int i = 0;
              foreach (TriangleVertexIndices index in indices)
              {
            vertices[i++] = new VertexPositionColor(points[index.I0], Color.White);
            vertices[i++] = new VertexPositionColor(points[index.I1], Color.White);
            vertices[i++] = new VertexPositionColor(points[index.I2], Color.White);

            float[] tri = new float[3];
            tri[0] = points[index.I0].X;
            tri[1] = points[index.I1].Y;
            tri[2] = points[index.I2].Z;
            triangles.Add(tri);
              }
              return new AABBTree(triangles, tree_info);
        }
开发者ID:DigitalLibrarian,项目名称:xna-forever,代码行数:25,代码来源:AABBFactory.cs

示例6: Gun

 public Gun(int RoundsInClip, int TotalRounds, int GunCode, Model GunModel)
 {
     this.RoundsInClip = RoundsInClip;
     this.TotalRounds = TotalRounds;
     this.GunCode = GunCode;
     this.GunModel = GunModel;
 }
开发者ID:narfman0,项目名称:SunshineSlashers,代码行数:7,代码来源:Gun.cs

示例7: ModelContainer

        public ModelContainer(Model modelpass, Pose posepass, SkeletonPose skeletonpass)
        {
            _model = modelpass;
            _pose = posepass;
            _skeleton = skeletonpass;

            var additionalData = (Dictionary<string,object>)_model.Tag;
            var animations = (Dictionary<string, SkeletonKeyFrameAnimation>)additionalData["Animations"];
            int index = 0;

            _animations = new ITimeline[animations.Count];

                _animations[0] = new AnimationClip<SkeletonPose>(animations["First"])
                {
                    LoopBehavior = LoopBehavior.Cycle,
                    Duration = TimeSpan.MaxValue
                };
                index++;

                _animations[1] = new AnimationClip<SkeletonPose>(animations["Second"]);

                _animations[2] = new AnimationClip<SkeletonPose>(animations["Second"])
                {
                    LoopBehavior = LoopBehavior.Cycle,
                    Duration = TimeSpan.MaxValue
                };
        }
开发者ID:HATtrick-games,项目名称:ICT309,代码行数:27,代码来源:ModelContainer.cs

示例8: Ent

 public Ent()
 {
     sprite = defaultSprite;
     model = defaultModel;
     size = model.Meshes[0].BoundingSphere.Radius;
     pendingRemoval = false;
 }
开发者ID:er1,项目名称:c376balloon3d,代码行数:7,代码来源:Ent.cs

示例9: SkyBox

        public SkyBox(Game1 newGame, Vector3 newCenter, string newName)
        {
            Game = newGame;
            center = newCenter;

            skyBoxModel=LoadModel(newName, out skyBoxTextures);
        }
开发者ID:BibleUs,项目名称:Terrain-Engine,代码行数:7,代码来源:SkyBox.cs

示例10: Prota

        public Prota(Model text,Model[] disp)
        {
            g_nave = new modelo(text);
            t_disp=disp;

            box = new caja(new Vector3(pos.X - 10f, pos.Y - 10f, -10f), new Vector3(pos.X + 10f, pos.Y + 10f, 10f));
        }
开发者ID:OrlandoAguilar,项目名称:SpaceShipWar,代码行数:7,代码来源:Prota.cs

示例11: Gobject

        /// <summary>
        /// Single Primitive Constructor with predefined MaterialProperty
        /// </summary>
        /// <param name="position">Initial Body Position</param>
        /// <param name="scale">Scale</param>
        /// <param name="primative">Primitive to add to Skin</param>
        /// <param name="propId">Predefined Material Properties of Primitive</param>
        public Gobject(Vector3 position, Vector3 scale, Primitive primative, MaterialTable.MaterialID propId, Model model)
            : this()
        {
            Skin.AddPrimitive(primative, (int)propId);

            CommonInit(position, scale, model, true);
        }
开发者ID:colbybhearn,项目名称:3DPhysics,代码行数:14,代码来源:Gobject.cs

示例12: cTree

 public cTree(Model treeModel, Matrix view, Matrix projection, Vector3 position)
 {
     //instantiate the tree
     loadModel(treeModel, view, projection);
     setScaleFactor(0.5f, 0.5f, 0.5f);
     setPosition(position);
 }
开发者ID:mbrews10,项目名称:GP3-Coursework,代码行数:7,代码来源:cTree.cs

示例13: HeightmapObject

        public HeightmapObject(Game game, Model model,Vector2 shift)
            : base(game, model)
        {
            body = new Body(); // just a dummy. The PhysicObject uses its position to get the draw pos
            collision = new CollisionSkin(null);

            HeightMapInfo heightMapInfo = model.Tag as HeightMapInfo;
            Array2D field = new Array2D(heightMapInfo.heights.GetUpperBound(0), heightMapInfo.heights.GetUpperBound(1));

            for (int x = 0; x < heightMapInfo.heights.GetUpperBound(0); x++)
            {
                for (int z = 0; z < heightMapInfo.heights.GetUpperBound(1); z++)
                {
                    field.SetAt(x,z,heightMapInfo.heights[x,z]);
                }
            }

            // move the body. The body (because its not connected to the collision
            // skin) is just a dummy. But the base class shoudl know where to
            // draw the model.
            body.MoveTo(new Vector3(shift.X,0,shift.Y), Matrix.Identity);

            collision.AddPrimitive(new Heightmap(field, shift.X, shift.Y, 1, 1), new MaterialProperties(0.7f,0.7f,0.6f));

            PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.AddCollisionSkin(collision);
        }
开发者ID:shakalandro,项目名称:3DTestGame,代码行数:26,代码来源:HeightmapObject.cs

示例14: DisplayEntityModel

 /// <summary>
 /// Constructs a new display model.
 /// </summary>
 /// <param name="entity">Entity to follow.</param>
 /// <param name="model">Model to draw on the entity.</param>
 /// <param name="modelDrawer">Model drawer to use.</param>
 public DisplayEntityModel(Entity entity, Model model, ModelDrawer modelDrawer)
     : base(modelDrawer)
 {
     OffsetTransform = Matrix.Identity;
     Entity = entity;
     Model = model;
 }
开发者ID:gpforde,项目名称:GPBrakes,代码行数:13,代码来源:DisplayEntityModel.cs

示例15: Googoo

        public Googoo(Model model, Game game, Vector3 startPosition, Vector3 wanderPosition, int faceId, ModelManager modelManager)
            : base(model, game)
        {
            this.game = game;
            this.googoo = model;
            texture = modelManager.screenManager.texManager.getGoogooTexture();
            this.face = faceId;

            // init velocity, acceleration and friction
            acceleration = FaceDirection * accel;
            velocity = acceleration;
            friction = -FaceDirection * frictionValue;

            this.position = startPosition;

            this.startPosition = startPosition;
            this.wanderPosition = wanderPosition;

            //navigate.Add(startPosition); //first location in list
            //navigate.Add(wanderPosition); //last location in list

            this.modelManager = modelManager;
            effect = ((Spectrum)game).grayEffect;
            handelOrientation();

            loadStateFile();
        }
开发者ID:jrutschke,项目名称:project,代码行数:27,代码来源:Googoo.cs


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