Exemplo n.º 1
0
 static void EnableRenderModule(MyRenderModuleEnum module, bool enable)
 {
     foreach (MyRenderStage stage in Enum.GetValues(typeof(MyRenderStage)))
     {
         MyRender.MyRenderModuleItem renderModule = MyRender.GetRenderModules(stage).Find((x) => x.Name == module);
         if (renderModule != null)
             renderModule.Enabled = enable;
     }
 }
Exemplo n.º 2
0
        internal static bool IsModuleEnabled(MyRenderStage stage, MyRenderModuleEnum module)
        {
            if (!(CurrentRenderSetup.EnabledRenderStages == null || CurrentRenderSetup.EnabledRenderStages.Contains(stage)))
                return false;

            List<MyRenderModuleItem> renderModules = m_renderModules[(int)stage];
            if (!(CurrentRenderSetup.EnabledModules == null || CurrentRenderSetup.EnabledModules.Contains(module)))
                return false;

            foreach (var moduleItem in renderModules)
            {
                if (moduleItem.Name == module)
                {
                    return moduleItem.Enabled;
                }
            }
            return false;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Removes render module from the list
 /// </summary>
 /// <param name="name"></param>
 internal static void UnregisterRenderModule(MyRenderModuleEnum name)
 {
     for (int i = 0; i < m_renderModules.Length; i++)
     {
         List<MyRenderModuleItem> modules = m_renderModules[i];
         foreach (MyRenderModuleItem module in modules)
         {
             if (module.Name == name)
             {
                 modules.Remove(module);
                 return;
             }
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Register renderer event handler to make specific behaviour in several render stage
        /// </summary>
        /// <param name="displayName"></param>
        /// <param name="handler"></param>
        /// <param name="renderStage"></param>
        /// <param name="priority">0 - first item, higher number means lower priority</param>
        internal static void RegisterRenderModule(MyRenderModuleEnum module, string displayName, DrawEventHandler handler, MyRenderStage renderStage, int priority, bool enabled)
        {
            Debug.Assert(!m_renderModules[(int)renderStage].Any(x => x.Name == module));

            m_renderModules[(int)renderStage].Add(new MyRenderModuleItem { Name = module, DisplayName = displayName, Priority = priority, Handler = handler, Enabled = enabled });
            m_renderModules[(int)renderStage].Sort((p1, p2) => p1.Priority.CompareTo(p2.Priority));
        }
Exemplo n.º 5
0
 internal static void RegisterRenderModule(MyRenderModuleEnum module, string displayName, DrawEventHandler handler, MyRenderStage renderStage, bool enabled)
 {
     RegisterRenderModule(module, displayName, handler, renderStage, MyRenderConstants.DEFAULT_RENDER_MODULE_PRIORITY, enabled);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Register renderer event handler to make specific behaviour in several render stage
 /// </summary>
 /// <param name="displayName"></param>
 /// <param name="handler"></param>
 /// <param name="renderStage"></param>
 /// <param name="priority"></param>
 public static void RegisterRenderModule(MyRenderModuleEnum module, string displayName, DrawEventHandler handler, MyRenderStage renderStage)
 {
     RegisterRenderModule(module, displayName, handler, renderStage, MyRenderConstants.DEFAULT_RENDER_MODULE_PRIORITY, true);
 }