コード例 #1
0
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     if (m_model != null && !Tile.IsHidden(Level, Location))
     {
         m_model.Draw(modelEffect);
     }
 }
コード例 #2
0
ファイル: TilePreview.cs プロジェクト: xiuzhifu/Redirection
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     if (m_visible)
     {
         m_subLevel.DepthSortEntities(modelEffect.CameraPosition);
         m_subLevel.Draw(modelEffect, pass);
     }
 }
コード例 #3
0
ファイル: ArcadeRobot.cs プロジェクト: xiuzhifu/Redirection
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     base.OnDraw(modelEffect, pass);
     if (m_screenTexture != null)
     {
         Model.DrawSingleGroupWithCustomEmissiveTexture(modelEffect, "Screen", m_screenTexture);
     }
 }
コード例 #4
0
ファイル: Robot.cs プロジェクト: xiuzhifu/Redirection
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     if (Level.InEditor && Level.Tiles[m_spawnPosition].IsHidden(Level, m_spawnPosition))
     {
         return;
     }
     m_modelInstance.Draw(modelEffect);
 }
コード例 #5
0
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     if (Level.InEditor && Tile.IsHidden(Level, Location))
     {
         return;
     }
     m_modelInstance.Draw(modelEffect);
 }
コード例 #6
0
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     if (CurrentState.State != FallState.Landed)
     {
         if (m_modelInstance != null)
         {
             m_modelInstance.Draw(modelEffect);
         }
     }
 }
コード例 #7
0
 public void DrawForeground(ModelEffectInstance effect, RenderPass pass)
 {
     if (m_foregroundModel != null && m_sky.ForegroundRenderPass == pass)
     {
         var worldMatrix = effect.WorldMatrix;
         effect.WorldMatrix = Matrix4.Identity;
         m_foregroundModel.Draw(effect);
         effect.WorldMatrix = worldMatrix;
     }
 }
コード例 #8
0
ファイル: Elevator.cs プロジェクト: xiuzhifu/Redirection
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     if (!Level.Tiles[Location].IsHidden(Level, Location))
     {
         if (m_modelInstance != null)
         {
             m_modelInstance.Draw(modelEffect);
         }
     }
 }
コード例 #9
0
ファイル: SpawnMarker.cs プロジェクト: xiuzhifu/Redirection
        protected override void OnDraw(ModelEffectInstance effect, RenderPass pass)
        {
            var alpha = CalculateCurrentGhostAlpha();

            if (alpha > 0.0f)
            {
                m_ghostModel.Alpha = alpha;
                m_ghostModel.Draw(effect);
            }

            effect.ModelMatrix     = m_ghostModel.Transform;
            effect.UVOffset        = Vector2.Zero;
            effect.UVScale         = Vector2.One;
            effect.DiffuseColour   = Vector4.One;
            effect.DiffuseTexture  = Texture.White;
            effect.SpecularColour  = Vector3.Zero;
            effect.SpecularTexture = Texture.Black;
            effect.NormalTexture   = Texture.Black;
            effect.EmissiveColour  = Vector3.One;
            effect.EmissiveTexture = Texture.White;
            effect.Bind();
            //m_shell.Draw();
        }
コード例 #10
0
ファイル: Level.cs プロジェクト: xiuzhifu/Redirection
        public void Draw(ModelEffectInstance effect, RenderPass pass)
        {
            // Draw sky
            if (m_sky != null)
            {
                m_sky.DrawForeground(effect, pass);
            }

            // Draw tilemap
            m_tileMap.RebuildIfNeeded();
            m_tileMap.Draw(effect, pass);

            // Draw entities
            if (pass == RenderPass.Translucent)
            {
                for (int i = 0; i < m_depthSortedEntities.Count; ++i)
                {
                    var e = m_depthSortedEntities[i];
                    if (!e.Dead)
                    {
                        e.Draw(effect, pass);
                    }
                }
            }
            else
            {
                for (int i = 0; i < m_entities.Count; ++i)
                {
                    var e = m_entities[i];
                    if (!e.Dead && e.NeedsRenderPass(pass))
                    {
                        e.Draw(effect, pass);
                    }
                }
            }
        }
コード例 #11
0
 protected override void OnDraw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     m_model.Draw(modelEffect);
 }
コード例 #12
0
        public void Draw(ModelEffectInstance modelEffect, RenderPass pass)
        {
            // Draw the geometry for the current pass
            var geometry = m_geometry[(int)pass];

            if (geometry.IndexCount > 0)
            {
                modelEffect.ModelMatrix     = Matrix4.Identity;
                modelEffect.UVOffset        = Vector2.Zero;
                modelEffect.UVScale         = Vector2.One;
                modelEffect.DiffuseColour   = Vector4.One;
                modelEffect.DiffuseTexture  = m_atlas;
                modelEffect.SpecularColour  = Vector3.One;
                modelEffect.SpecularTexture = m_atlas;
                modelEffect.NormalTexture   = m_atlas;
                modelEffect.EmissiveColour  = Vector3.One;
                modelEffect.EmissiveTexture = m_atlas;
                modelEffect.Bind();
                geometry.Draw();

                /*
                 * // Wireframe test code
                 * modelEffect.ModelMatrix = Matrix4.Identity;
                 * modelEffect.DiffuseColour = Vector4.One;
                 * modelEffect.DiffuseTexture = Texture.White;
                 * modelEffect.SpecularColour = Vector3.One;
                 * modelEffect.SpecularTexture = Texture.White;
                 * modelEffect.NormalTexture = Texture.Flat;
                 * modelEffect.Bind();
                 * using( var wireframe = geometry.ToWireframe( lines:false, normals:true, tangents:true, binormals:true ) )
                 * {
                 *  wireframe.Draw();
                 * }
                 */
            }

            foreach (var pair in m_liquidGeometry)
            {
                var behaviour      = pair.Key;
                var liquidGeometry = pair.Value;
                if (liquidGeometry.IndexCount > 0 && behaviour.Tile.RenderPass == pass)
                {
                    bool    visible;
                    Matrix4 modelMatrix;
                    Vector2 uvOffset, uvScale;
                    Vector4 colour;
                    if (behaviour.Animation != null)
                    {
                        float cameraFOV;
                        var   anim = LuaAnimation.Get(behaviour.Animation);
                        anim.Animate("Liquid", m_level.TimeMachine.RealTime, out visible, out modelMatrix, out uvOffset, out uvScale, out colour, out cameraFOV);
                    }
                    else
                    {
                        visible     = true;
                        modelMatrix = Matrix4.Identity;
                        uvOffset    = Vector2.Zero;
                        uvScale     = Vector2.One;
                        colour      = Vector4.One;
                    }
                    if (visible)
                    {
                        var surface = Texture.Get(behaviour.Texture, false);
                        surface.Wrap = true;

                        modelEffect.ModelMatrix     = modelMatrix;
                        modelEffect.UVOffset        = uvOffset;
                        modelEffect.UVScale         = uvScale;
                        modelEffect.DiffuseColour   = colour;
                        modelEffect.DiffuseTexture  = surface;
                        modelEffect.SpecularColour  = Vector3.One;
                        modelEffect.SpecularTexture = Texture.Black;
                        modelEffect.NormalTexture   = Texture.Flat;
                        modelEffect.EmissiveColour  = Vector3.One;
                        modelEffect.EmissiveTexture = Texture.Black;
                        modelEffect.Bind();
                        liquidGeometry.Draw();
                    }
                }
            }
        }
コード例 #13
0
 protected abstract void OnDraw(ModelEffectInstance modelEffect, RenderPass pass);
コード例 #14
0
 public void Draw(ModelEffectInstance modelEffect, RenderPass pass)
 {
     OnDraw(modelEffect, pass);
 }