當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。