Beispiel #1
0
 public void Draw(Camera cam)
 {
     int ctd = (int)Math.Ceiling(cam.FarClip / celld);
     int ccx = (int)(cam.Position.X / celld);
     int ccz = (int)(cam.Position.Z / celld);
     var pool = Model3DPool.GetInstance();
     for (int x = Math.Max(0, ccx - ctd); x < Math.Min(floorWidth, ccx + ctd); x++)
         for (int z = Math.Max(0, ccz - ctd); z < Math.Min(floorHeight, ccz + ctd); z++)
         {
             Object3D model = pool.Acquire();
             model.Model = plate; model.Position = new Vector3(x * celld, 0, z * celld);
             model.Draw(cam);
             pool.Release(model);
         }
 }
        public override void Draw(Camera cam)
        {
            if (changed)
                UpdateTransformation();
            Matrix[] bones = animationPlayer.GetSkinTransforms();
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (SkinnedEffect effect in mesh.Effects)
                {
                    effect.SetBoneTransforms(bones);
                    effect.World = trans;
                    effect.View = cam.View;
                    effect.Projection = cam.Projection;

                    effect.EnableDefaultLighting();

                    effect.SpecularColor = new Vector3(0.25f);
                    effect.SpecularPower = 16;
                }

                mesh.Draw();
            }
        }
Beispiel #3
0
 public virtual void Draw(Camera cam)
 {
     if (changed)
         UpdateTransformation();
     //model.Draw(trans, cam.View, cam.Projection);
     #region AdvancedDraw
     if (model != null)
     {
         Matrix[] transform = new Matrix[model.Bones.Count];
         model.CopyAbsoluteBoneTransformsTo(transform);
         foreach (ModelMesh m in model.Meshes)
         {
             foreach (BasicEffect effect in m.Effects)
             {
                 effect.TextureEnabled = true;
                 effect.EnableDefaultLighting();
                 effect.World = transform[m.ParentBone.Index] * trans;
                 effect.View = cam.View;
                 effect.Projection = cam.Projection;
             }
             m.Draw();
         }
     }
     #endregion
 }