Esempio n. 1
0
        public override void Draw(GraphicsDevice device, Camera camera)
        {
            ModelRenderer modelrenderer = ModelRenderer.GetInstance(device);

            modelrenderer.Begin(camera, color);

            Matrix transform;

            Entity.CreateWorldTransformMatrix(ref position, ref rotation, ref size, out transform);
            modelrenderer.Add(model, ref transform);
            modelrenderer.End();
        }
Esempio n. 2
0
        public void Draw3dEntities(GraphicsDevice device, Camera camera)
        {
            if (!is_warm)
            {
                Warm(device);
            }

            Entity entity;

            modelrenderer.Begin(camera);

            for (int i = 0; i < entities.Count; i++)
            {
                entity = entities[i];

                if (entity is StaticModelEntity || entity is WallModelEntity || entity is Skybox)
                {
                    Model  model     = (entity as IHasModel).GetModel();
                    Matrix transform = entity.GetTransform();
                    modelrenderer.Add(model, ref transform);
                }
            }

            modelrenderer.End();

            //animated models appear to have messed up normals... dirty fix:
            device.RasterizerState = RasterizerState.CullNone;
            for (int i = 0; i < entities.Count; i++)
            {
                entity = entities[i];

                if (entity is AnimatedModelEntity || entity is Enemy)
                {
                    entity.Draw(device, camera);
                }
            }
            device.RasterizerState = RasterizerState.CullCounterClockwise;

            /*
             #if DEBUG
             * if (!is_debug_visible)
             *  return;
             *
             * modelrenderer.Begin(camera, Color.Red);
             *
             * for (int i = 0; i < entities.Count; i++)
             * {
             *  entity = entities[i];
             *
             *  if (entity is WallModelEntity)
             *  {
             *      Model model = (entity as IHasModel).GetModel();
             *      Matrix transform = entity.GetTransform();
             *      modelrenderer.Add(model, ref transform);
             *  }
             * }
             *
             * modelrenderer.End();
             #endif
             */
        }