public override void OnBeginDrawModel(Model model, RenderSettings renderSettings, IEnumerable<IDecorator> decorators) { if (renderSettings.Parameters.AntiAliasingEnabled != _currentAntiAliasing) { _currentAntiAliasing = renderSettings.Parameters.AntiAliasingEnabled; _device.SetRenderState(RenderState.MultisampleAntialias, _currentAntiAliasing); } }
public int WorldObjectBaseY; // Y unit around which world objects are based. #endregion Fields #region Methods // Establish static (global) reference void Awake() { if (LoadedConfig == null) { LoadedConfig = this; //DontDestroyOnLoad(LoadedConfig); } else if (LoadedConfig != this) { Destroy(gameObject); } }
internal int GetLightingTypeFlags(RenderSettings renderSettings) { int flags = 0; if (!IsUnlit) flags |= LightTechniqueFlag.Lit; if (ReceiveShadow && renderSettings.EnableShadows) flags |= LightTechniqueFlag.ReceiveShadows; if (ReceiveShadow && renderSettings.EnableShadows && renderSettings.EnableSoftShadows) flags |= LightTechniqueFlag.SoftShadows; if (DiffuseTexture != null) flags |= LightTechniqueFlag.UseTexture; return flags; }
public ForwardSceneRenderer(GameContext context, SceneEffect effect, RenderSettings settings) : base(context) { _device = context.GetService<GraphicsDevice>(); _sceneEffect = effect; RenderSettings = settings; _allDrawables = new List<DrawableElement>(); _initializingDrawables = new List<DrawableElement>(); _allCameras = new List<Camera>(); _allLights = new List<Light>(); _directionalLightShadowMap = new RenderTarget2D(_device, RenderSettings.ShadowMapSize, RenderSettings.ShadowMapSize, false, SurfaceFormat.Single, DepthFormat.Depth24); var width = context.ScreenBounds.Width; var height = context.ScreenBounds.Height; _activeInputSource = new RenderTarget2D(_device, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PlatformContents); _activeRenderTarget = new RenderTarget2D(_device, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PlatformContents); _shadowCasterQueueSolid = new RenderQueue(context, HandleShadowCasterObjects, GetShadowCasterSceneNodes, _sceneEffect) { BlendState = BlendState.Opaque, DepthStencilState = DepthStencilState.Default, RasterizerState = RasterizerState.CullCounterClockwise, IsEnabled = true, SortNodesBackToFront = false, }; _shadowCasterQueueTransparent = new RenderQueue(context, HandleShadowCasterObjects, GetShadowCasterSceneNodesTransparent, _sceneEffect) { BlendState = BlendState.AlphaBlend, DepthStencilState = DepthStencilState.DepthRead, RasterizerState = RasterizerState.CullCounterClockwise, IsEnabled = true, SortNodesBackToFront = true, }; _renderQueues = new List<RenderQueue> { new RenderQueue(context, HandleSolidObjects, GetSolidObjects, _sceneEffect) { DepthStencilState = DepthStencilState.Default, BlendState = BlendState.Opaque, RasterizerState = RasterizerState.CullCounterClockwise, }, new RenderQueue(context, HandleEffectTransparentObjects, GetTransparentObjects, _sceneEffect) { DepthStencilState = DepthStencilState.DepthRead, BlendState = BlendState.AlphaBlend, RasterizerState = RasterizerState.CullCounterClockwise, SortNodesBackToFront = true } }; }
public override bool IsActive(RenderSettings settings) { switch (settings.Parameters.FillMode) { case FillMode.Solid: _fillMode = SlimDX.Direct3D9.FillMode.Solid; return true; case FillMode.Wireframe: _fillMode = SlimDX.Direct3D9.FillMode.Wireframe; return true; default: return false; } }
public void OnBeginDrawMesh(ModelMesh mesh, RenderSettings renderSettings) { mesh.Effect.LightViewProjection = _lightViewProjection; if (_creatingShadowMap) { mesh.Effect.CurrentTechnique = "RenderShadowMap"; } else { mesh.Effect.CurrentTechnique = "RenderScene"; mesh.Effect.ShadowsEnabled = true; mesh.Effect.ShadowMap = _shadowRenderTarget; mesh.Effect.ShadowMapSize = ShadowMapSize; } }
static int _CreateRenderSettings(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { RenderSettings obj = new RenderSettings(); LuaScriptMgr.Push(L, obj); return 1; } else { LuaDLL.luaL_error(L, "invalid arguments to method: RenderSettings.New"); } return 0; }
public override void OnEndDrawMesh(ModelMesh mesh, RenderSettings renderSettings) { NormalBuffers normalBuffers = GetNormalBuffers(mesh); _device.VertexDeclaration = _lineVertexDeclaration; _device.SetStreamSource(0, normalBuffers.Vertices, 0, VertexPositionColor.SizeInBytes); _device.Indices = normalBuffers.Indices; _lineEffect.WorldViewProjection = renderSettings.ViewMatrix * renderSettings.ProjectionMatrix; int passes = _lineEffect.Begin(); for (int pass = 0; pass < passes; ++pass) { _lineEffect.BeginPass(pass); _device.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, normalBuffers.VertexCount, 0, normalBuffers.PrimitiveCount); _lineEffect.EndPass(); } }
public void OnBeginDrawModel(Model model, RenderSettings renderSettings, IEnumerable<IDecorator> decorators) { if (_creatingShadowMap) return; _creatingShadowMap = true; _cameraFrustum.Matrix = renderSettings.ViewMatrix * renderSettings.ProjectionMatrix; // Update the lights ViewProjection matrix based on the // current camera frustum _lightViewProjection = CreateLightViewProjectionMatrix(model, renderSettings.Parameters.LightDirection); // Save the current back buffer. _savedBackBuffer = _device.GetRenderTarget(0); // Set our render target to our floating point render target _device.SetRenderTarget(0, _shadowRenderTarget.GetSurfaceLevel(0)); // Save the current stencil buffer _savedDepthBuffer = _device.DepthStencilSurface; // Set the graphics device to use the shadow depth stencil buffer _device.DepthStencilSurface = _shadowDepthBuffer; // Clear the render target to white or all 1's // We set the clear to white since that represents the // furthest the object could be away _device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, new SlimDX.Color4(1, 1, 1), 1, 0); model.DrawInternal(renderSettings, decorators); _creatingShadowMap = false; // Now blur shadow map. //_blur.InputTexture = _shadowRenderTarget; //_blur.Draw(); //_shadowRenderTarget = _blur.OutputTexture; // Set render target back to the back buffer _device.SetRenderTarget(0, _savedBackBuffer); // Reset the depth buffer _device.DepthStencilSurface = _savedDepthBuffer; //_shadowRenderTarget.GenerateMipSublevels(); }
public MainWindow() { CheckUpdateDownloaded(); InitializeComponent(); windowTabs.VersionName = metaSettings.VersionName; SourceInitialized += (s, e) => { IntPtr handle = (new WindowInteropHelper(this)).Handle; HwndSource.FromHwnd(handle).AddHook(new HwndSourceHook(WindowProc)); }; tempoMultSlider.nudToSlider = v => Math.Log(v, 2); tempoMultSlider.sliderToNud = v => Math.Pow(2, v); bool dontUpdateLanguages = false; if (!File.Exists("Settings/settings.json")) { var sett = new JObject(); sett.Add("defaultBackground", ""); sett.Add("ignoreKDMAPI", "false"); sett.Add("defaultPlugin", "Classic"); sett.Add("ignoreLanguageUpdates", "false"); File.WriteAllText("Settings/settings.json", JsonConvert.SerializeObject(sett)); } { dynamic sett = JsonConvert.DeserializeObject(File.ReadAllText("Settings/settings.json")); if (sett.defaultBackground != "") { try { bgImagePath.Text = sett.defaultBackground; settings.BGImage = bgImagePath.Text; } catch { settings.BGImage = null; if (bgImagePath.Text != "") { MessageBox.Show("Couldn't load default background image"); } } } if ((bool)sett.ignoreKDMAPI) { foundOmniMIDI = false; } defaultPlugin = (string)sett.defaultPlugin; dontUpdateLanguages = (bool)sett.ignoreLanguageUpdates; } Task omnimidiLoader = null; Task languageLoader = null; if (!dontUpdateLanguages) { Task.Run(RunLanguageCheck); } Task updateLoader = Task.Run(RunUpdateCheck); if (foundOmniMIDI) { omnimidiLoader = Task.Run(() => { try { KDMAPI.InitializeKDMAPIStream(); Console.WriteLine("Loaded KDMAPI!"); } catch { Console.WriteLine("Failed to load KDMAPI, disabling"); foundOmniMIDI = false; } }); } if (!foundOmniMIDI) { disableKDMAPI.IsEnabled = false; } settings = new RenderSettings(); settings.PauseToggled += ToggledPause; InitialiseSettingsValues(); creditText.Text = "Video was rendered with Zenith\nhttps://arduano.github.io/Zenith-MIDI/start"; if (languageLoader != null) { languageLoader.Wait(); } var languagePacks = Directory.GetDirectories("Languages"); foreach (var language in languagePacks) { var resources = Directory.GetFiles(language).Where((l) => l.EndsWith(".xaml")).ToList(); if (resources.Count == 0) { continue; } Dictionary <string, ResourceDictionary> fullDict = new Dictionary <string, ResourceDictionary>(); foreach (var r in resources) { ResourceDictionary file = new ResourceDictionary(); file.Source = new Uri(Path.GetFullPath(r), UriKind.RelativeOrAbsolute); var name = Path.GetFileNameWithoutExtension(r); fullDict.Add(name, file); } if (!fullDict.ContainsKey("window")) { continue; } if (fullDict["window"].Contains("LanguageName") && fullDict["window"]["LanguageName"].GetType() == typeof(string)) { Languages.Add(fullDict); } } Languages.Sort(new Comparison <Dictionary <string, ResourceDictionary> >((d1, d2) => { if ((string)d1["window"]["LanguageName"] == "English") { return(-1); } if ((string)d2["window"]["LanguageName"] == "English") { return(1); } else { return(0); } })); foreach (var lang in Languages) { var item = new ComboBoxItem() { Content = lang["window"]["LanguageName"] }; languageSelect.Items.Add(item); } languageSelect.SelectedIndex = 0; if (omnimidiLoader != null) { omnimidiLoader.Wait(); } }
public override bool IsActive(RenderSettings settings) { return true; }
public abstract bool IsActive(RenderSettings settings);
public virtual void OnEndDrawMesh(ModelMesh mesh, RenderSettings renderSettings) { }
public RenderSettingsViewModel(RenderSettings rs) { _rs = rs; }
private void ResetSettings(object userData, string[] options, int selected) { RenderSettings.Reset(); LightmapEditorSettings.Reset(); LightmapSettings.Reset(); }
public override void OnEndDrawModel(Model model, RenderSettings renderSettings) { _device.SetRenderState(RenderState.FillMode, FillMode.Solid); }
private static int get_ambientGroundColor(IntPtr L) { ToLua.Push(L, RenderSettings.get_ambientGroundColor()); return(1); }
byte[] RenderPageToByteArray(PDFPage page, int width, int height, IPDFColoredRectListProvider rectsProvider, RenderSettings settings) { if (m_Bitmap == null || !m_Bitmap.HasSameSize(width, height)) { if (m_Bitmap != null) { m_Bitmap.Dispose(); } m_Bitmap = new PDFBitmap(width, height, false); } m_Bitmap.FillRect(0, 0, width, height, int.MaxValue); int flags = settings == null ? RenderSettings.defaultRenderSettings.ComputeRenderingFlags() : settings.ComputeRenderingFlags(); FPDF_RenderPageBitmap(m_Bitmap.NativePointer, page.NativePointer, 0, 0, width, height, 0, flags); IntPtr bufferPtr = m_Bitmap.GetBuffer(); if (bufferPtr == IntPtr.Zero) { return(null); } int length = width * height * 4; if (m_IntermediateBuffer == null || m_IntermediateBuffer.Length < length) { m_IntermediateBuffer = new byte[width * height * 4]; } Marshal.Copy(bufferPtr, m_IntermediateBuffer, 0, width * height * 4); #if !UNITY_WEBGL IList <PDFColoredRect> coloredRects = rectsProvider != null ? rectsProvider.GetBackgroundColoredRectList(page) : null; if (coloredRects != null && coloredRects.Count > 0) { foreach (PDFColoredRect coloredRect in coloredRects) { var r = (int)(coloredRect.color.r * 255) & 0xFF; var g = (int)(coloredRect.color.g * 255) & 0xFF; var b = (int)(coloredRect.color.b * 255) & 0xFF; var a = (int)(coloredRect.color.a * 255) & 0xFF; float alpha = (a / (float)255); float reverseAlpha = 1.0f - alpha; Rect deviceRect = page.ConvertPageRectToDeviceRect(coloredRect.pageRect, new Vector2(width, height)); for (int y = 0; y < -(int)deviceRect.height; ++y) { for (int x = 0; x < (int)deviceRect.width; ++x) { int s = (((int)deviceRect.y + y + (int)deviceRect.height) * width + (int)deviceRect.x + x) * 4; var sr = m_IntermediateBuffer[s]; var sg = m_IntermediateBuffer[s + 1]; var sb = m_IntermediateBuffer[s + 2]; m_IntermediateBuffer[s] = (byte)Mathf.Clamp(alpha * r + (reverseAlpha * sr), 0, 255); m_IntermediateBuffer[s + 1] = (byte)Mathf.Clamp(alpha * g + (reverseAlpha * sg), 0, 255); m_IntermediateBuffer[s + 2] = (byte)Mathf.Clamp(alpha * b + (reverseAlpha * sb), 0, 255); m_IntermediateBuffer[s + 3] = 0xFF; } } } } #endif return(m_IntermediateBuffer); }
public void Update() { if (!m_isHeadless) { RenderSettings.Update(); } // TODO (petera) remove this hack once we know exactly when renderer is available... if (!pipeSetup) { var hdpipe = RenderPipelineManager.currentPipeline as HDRenderPipeline; if (hdpipe != null) { hdpipe.DebugLayer2DCallback = DebugOverlay.Render; hdpipe.DebugLayer3DCallback = DebugOverlay.Render3D; var layer = LayerMask.NameToLayer("PostProcess Volumes"); if (layer == -1) { GameDebug.LogWarning("Unable to find layer mask for camera fader"); } else { m_Exposure = ScriptableObject.CreateInstance <AutoExposure>(); m_Exposure.active = false; m_Exposure.enabled.Override(true); m_Exposure.keyValue.Override(0); m_ExposureVolume = PostProcessManager.instance.QuickVolume(layer, 100.0f, m_Exposure); } pipeSetup = true; } } if (m_ExposureReleaseCount > 0) { m_ExposureReleaseCount--; if (m_ExposureReleaseCount == 0) { BlackFade(false); } } // Verify if camera was somehow destroyed and pop it if (m_CameraStack.Count > 1 && m_CameraStack[m_CameraStack.Count - 1] == null) { PopCamera(null); } #if UNITY_EDITOR // Ugly hack to force focus to game view when using scriptable renderloops. if (Time.frameCount < 4) { try { var gameViewType = typeof(UnityEditor.EditorWindow).Assembly.GetType("UnityEditor.GameView"); var gameView = (EditorWindow)Resources.FindObjectsOfTypeAll(gameViewType)[0]; gameView.Focus(); } catch (System.Exception) { /* too bad */ } } #endif frameTime = (double)m_Clock.ElapsedTicks / m_StopwatchFrequency; // Switch game loop if needed if (m_RequestedGameLoopTypes.Count > 0) { // Multiple running gameloops only allowed in editor #if !UNITY_EDITOR ShutdownGameLoops(); #endif bool initSucceeded = false; for (int i = 0; i < m_RequestedGameLoopTypes.Count; i++) { try { IGameLoop gameLoop = (IGameLoop)System.Activator.CreateInstance(m_RequestedGameLoopTypes[i]); initSucceeded = gameLoop.Init(m_RequestedGameLoopArguments[i]); if (!initSucceeded) { break; } m_gameLoops.Add(gameLoop); } catch (System.Exception e) { GameDebug.Log(string.Format("Game loop initialization threw exception : ({0})\n{1}", e.Message, e.StackTrace)); } } if (!initSucceeded) { ShutdownGameLoops(); GameDebug.Log("Game loop initialization failed ... reverting to boot loop"); } m_RequestedGameLoopTypes.Clear(); m_RequestedGameLoopArguments.Clear(); } try { if (!m_ErrorState) { foreach (var gameLoop in m_gameLoops) { gameLoop.Update(); } levelManager.Update(); } } catch (System.Exception e) { HandleGameloopException(e); throw; } if (m_SoundSystem != null) { m_SoundSystem.Update(); } if (clientFrontend != null) { clientFrontend.UpdateGame(); } Console.ConsoleUpdate(); WindowFocusUpdate(); UpdateCPUStats(); sqpClient.Update(); endUpdateEvent?.Invoke(); }
public void Awake() { GameDebug.Assert(game == null); DontDestroyOnLoad(gameObject); game = this; m_StopwatchFrequency = System.Diagnostics.Stopwatch.Frequency; m_Clock = new System.Diagnostics.Stopwatch(); m_Clock.Start(); var buildInfo = FindObjectOfType <BuildInfo>(); if (buildInfo != null) { _buildId = buildInfo.buildId; } var commandLineArgs = new List <string>(System.Environment.GetCommandLineArgs()); #if UNITY_STANDALONE_LINUX m_isHeadless = true; #else m_isHeadless = commandLineArgs.Contains("-batchmode"); #endif var consoleRestoreFocus = commandLineArgs.Contains("-consolerestorefocus"); if (m_isHeadless) { #if UNITY_STANDALONE_WIN string consoleTitle; var overrideTitle = ArgumentForOption(commandLineArgs, "-title"); if (overrideTitle != null) { consoleTitle = overrideTitle; } else { consoleTitle = Application.productName + " Console"; } consoleTitle += " [" + System.Diagnostics.Process.GetCurrentProcess().Id + "]"; var consoleUI = new ConsoleTextWin(consoleTitle, consoleRestoreFocus); #elif UNITY_STANDALONE_LINUX var consoleUI = new ConsoleTextLinux(); #else UnityEngine.Debug.Log("WARNING: starting without a console"); var consoleUI = new ConsoleNullUI(); #endif Console.Init(consoleUI); } else { var consoleUI = Instantiate(Resources.Load <ConsoleGUI>("Prefabs/ConsoleGUI")); DontDestroyOnLoad(consoleUI); Console.Init(consoleUI); m_DebugOverlay = Instantiate(Resources.Load <DebugOverlay>("DebugOverlay")); DontDestroyOnLoad(m_DebugOverlay); m_DebugOverlay.Init(); var hdpipe = RenderPipelineManager.currentPipeline as HDRenderPipeline; if (hdpipe != null) { hdpipe.DebugLayer2DCallback = DebugOverlay.Render; hdpipe.DebugLayer3DCallback = DebugOverlay.Render3D; } m_GameStatistics = new GameStatistics(); } // If -logfile was passed, we try to put our own logs next to the engine's logfile var engineLogFileLocation = "."; var logfileArgIdx = commandLineArgs.IndexOf("-logfile"); if (logfileArgIdx >= 0 && commandLineArgs.Count >= logfileArgIdx) { engineLogFileLocation = System.IO.Path.GetDirectoryName(commandLineArgs[logfileArgIdx + 1]); } var logName = m_isHeadless ? "game_" + DateTime.UtcNow.ToString("yyyyMMdd_HHmmss_fff") : "game"; GameDebug.Init(engineLogFileLocation, logName); ConfigVar.Init(); Console.EnqueueCommandNoHistory("exec -s " + k_UserConfigFilename); // Default is to allow no frame cap, i.e. as fast as possible if vsync is disabled Application.targetFrameRate = -1; if (m_isHeadless) { Application.targetFrameRate = serverTickRate.IntValue; QualitySettings.vSyncCount = 0; // Needed to make targetFramerate work; even in headless mode #if !UNITY_STANDALONE_LINUX if (!commandLineArgs.Contains("-nographics")) { GameDebug.Log("WARNING: running -batchmod without -nographics"); } #endif } else { RenderSettings.Init(); } // Out of the box game behaviour is driven by boot.cfg unless you ask it not to if (!commandLineArgs.Contains("-noboot")) { Console.EnqueueCommandNoHistory("exec -s " + k_BootConfigFilename); } var forceClientSystem = commandLineArgs.Contains("-forceclientsystems"); if (!m_isHeadless || forceClientSystem) { m_SoundSystem = new SoundSystem(); m_SoundSystem.Init(audioMixer); m_SoundSystem.MountBank(defaultBank); GameObject go = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/ClientFrontend", typeof(GameObject))); UnityEngine.Object.DontDestroyOnLoad(go); clientFrontend = go.GetComponentInChildren <ClientFrontend>(); } sqpClient = new SQP.SQPClient(); GameDebug.Log("FPS Sample initialized"); #if UNITY_EDITOR GameDebug.Log("Build type: editor"); #elif DEVELOPMENT_BUILD GameDebug.Log("Build type: development"); #else GameDebug.Log("Build type: release"); #endif GameDebug.Log("BuildID: " + buildId); GameDebug.Log("Cwd: " + System.IO.Directory.GetCurrentDirectory()); SimpleBundleManager.Init(); GameDebug.Log("SimpleBundleManager initialized"); levelManager = new LevelManager(); levelManager.Init(); GameDebug.Log("LevelManager initialized"); inputSystem = new InputSystem(); GameDebug.Log("InputSystem initialized"); // TODO (petera) added Instantiate here to avoid making changes to asset file. // Feels like maybe SO is not really the right tool here. config = Instantiate((GameConfiguration)Resources.Load("GameConfiguration")); GameDebug.Log("Loaded game config"); // Game loops Console.AddCommand("preview", CmdPreview, "Start preview mode"); Console.AddCommand("serve", CmdServe, "Start server listening"); Console.AddCommand("client", CmdClient, "client: Enter client mode. Looking for servers"); Console.AddCommand("boot", CmdBoot, "Go back to boot loop"); Console.AddCommand("connect", CmdConnect, "connect <ip>: Connect to server on ip (default: localhost)"); Console.AddCommand("menu", CmdMenu, "show the main menu"); Console.AddCommand("load", CmdLoad, "Load level"); Console.AddCommand("quit", CmdQuit, "Quits"); Console.AddCommand("screenshot", CmdScreenshot, "Capture screenshot. Optional argument is destination folder or filename."); Console.AddCommand("crashme", (string[] args) => { GameDebug.Assert(false); }, "Crashes the game next frame "); Console.AddCommand("saveconfig", CmdSaveConfig, "Save the user config variables"); Console.AddCommand("loadconfig", CmdLoadConfig, "Load the user config variables"); #if UNITY_STANDALONE_WIN Console.AddCommand("windowpos", CmdWindowPosition, "Position of window. e.g. windowpos 100,100"); #endif Console.SetOpen(true); Console.ProcessCommandLineArguments(commandLineArgs.ToArray()); PushCamera(bootCamera); }
public SaudiRenderSettings(RenderSettings defaultSettings, string typeField, Dictionary <string, Color> roadtypeColors) { this.defaultSettings = defaultSettings; BuildColorList(defaultSettings, typeField, roadtypeColors); }
/// <summary> /// Constructs a new QuantileCustomRenderSettings instance /// </summary> /// <param name="renderSettings">Reference to a ShapeFile RenderSettings</param> /// <param name="quantileColors">Array of Colors to use. The number of Color elements should be 1 more than the number of quantile elements</param> /// <param name="quantiles">Array of quantile values. Each successive element must be greater than the previous element. Example - {10, 50, 75}</param> /// <param name="shapeFieldName">The name of the shapefile dbf field used to determine what color to render a shape </param> public QuantileCustomRenderSettings(RenderSettings renderSettings, Color[] quantileColors, double[] quantiles, string shapeFieldName) : this(renderSettings, quantileColors, quantiles, shapeFieldName, null) { }
/// <summary> /// Constructs a new set of GUI elements for inspecting the post process settings object. /// </summary> /// <param name="settings">Initial values to assign to the GUI elements.</param> /// <param name="layout">Layout to append the GUI elements to.</param> /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state. /// </param> public RenderSettingsGUI(RenderSettings settings, GUILayout layout, SerializableProperties properties) { this.settings = settings; this.properties = properties; // Enable HDR enableHDRField.OnChanged += x => { this.settings.EnableHDR = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(enableHDRField); // Enable lighting enableLightingField.OnChanged += x => { this.settings.EnableLighting = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(enableLightingField); // Enable indirect lighting enableIndirectLightingField.OnChanged += x => { this.settings.EnableIndirectLighting = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(enableIndirectLightingField); // Overlay only overlayOnlyField.OnChanged += x => { this.settings.OverlayOnly = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(overlayOnlyField); // Shadows enableShadowsField.OnChanged += x => { this.settings.EnableShadows = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(enableShadowsField); shadowsFoldout.AcceptsKeyFocus = false; shadowsFoldout.OnToggled += x => { properties.SetBool("shadows_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(shadowsFoldout); shadowsLayout = layout.AddLayoutX(); { shadowsLayout.AddSpace(10); GUILayoutY contentsLayout = shadowsLayout.AddLayoutY(); shadowsGUI = new ShadowSettingsGUI(settings.ShadowSettings, contentsLayout); shadowsGUI.OnChanged += x => { this.settings.ShadowSettings = x; MarkAsModified(); }; shadowsGUI.OnConfirmed += ConfirmModify; } // Auto exposure enableAutoExposureField.OnChanged += x => { this.settings.EnableAutoExposure = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(enableAutoExposureField); autoExposureFoldout.AcceptsKeyFocus = false; autoExposureFoldout.OnToggled += x => { properties.SetBool("autoExposure_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(autoExposureFoldout); autoExposureLayout = layout.AddLayoutX(); { autoExposureLayout.AddSpace(10); GUILayoutY contentsLayout = autoExposureLayout.AddLayoutY(); autoExposureGUI = new AutoExposureSettingsGUI(settings.AutoExposure, contentsLayout); autoExposureGUI.OnChanged += x => { this.settings.AutoExposure = x; MarkAsModified(); }; autoExposureGUI.OnConfirmed += ConfirmModify; } // Tonemapping enableToneMappingField.OnChanged += x => { this.settings.EnableTonemapping = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(enableToneMappingField); //// Tonemapping settings toneMappingFoldout.AcceptsKeyFocus = false; toneMappingFoldout.OnToggled += x => { properties.SetBool("toneMapping_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(toneMappingFoldout); toneMappingLayout = layout.AddLayoutX(); { toneMappingLayout.AddSpace(10); GUILayoutY contentsLayout = toneMappingLayout.AddLayoutY(); toneMappingGUI = new TonemappingSettingsGUI(settings.Tonemapping, contentsLayout); toneMappingGUI.OnChanged += x => { this.settings.Tonemapping = x; MarkAsModified(); }; toneMappingGUI.OnConfirmed += ConfirmModify; } //// White balance settings whiteBalanceFoldout.AcceptsKeyFocus = false; whiteBalanceFoldout.OnToggled += x => { properties.SetBool("whiteBalance_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(whiteBalanceFoldout); whiteBalanceLayout = layout.AddLayoutX(); { whiteBalanceLayout.AddSpace(10); GUILayoutY contentsLayout = whiteBalanceLayout.AddLayoutY(); whiteBalanceGUI = new WhiteBalanceSettingsGUI(settings.WhiteBalance, contentsLayout); whiteBalanceGUI.OnChanged += x => { this.settings.WhiteBalance = x; MarkAsModified(); }; whiteBalanceGUI.OnConfirmed += ConfirmModify; } //// Color grading settings colorGradingFoldout.AcceptsKeyFocus = false; colorGradingFoldout.OnToggled += x => { properties.SetBool("colorGrading_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(colorGradingFoldout); colorGradingLayout = layout.AddLayoutX(); { colorGradingLayout.AddSpace(10); GUILayoutY contentsLayout = colorGradingLayout.AddLayoutY(); colorGradingGUI = new ColorGradingSettingsGUI(settings.ColorGrading, contentsLayout); colorGradingGUI.OnChanged += x => { this.settings.ColorGrading = x; MarkAsModified(); }; colorGradingGUI.OnConfirmed += ConfirmModify; } // Gamma gammaField.OnChanged += x => { this.settings.Gamma = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(gammaField); // Exposure scale exposureScaleField.OnChanged += x => { this.settings.ExposureScale = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(exposureScaleField); //// Depth of field settings depthOfFieldFoldout.AcceptsKeyFocus = false; depthOfFieldFoldout.OnToggled += x => { properties.SetBool("depthOfField_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(depthOfFieldFoldout); depthOfFieldLayout = layout.AddLayoutX(); { depthOfFieldLayout.AddSpace(10); GUILayoutY contentsLayout = depthOfFieldLayout.AddLayoutY(); depthOfFieldGUI = new DepthOfFieldSettingsGUI(settings.DepthOfField, contentsLayout); depthOfFieldGUI.OnChanged += x => { this.settings.DepthOfField = x; MarkAsModified(); }; depthOfFieldGUI.OnConfirmed += ConfirmModify; } //// Ambient occlusion settings ambientOcclusionFoldout.AcceptsKeyFocus = false; ambientOcclusionFoldout.OnToggled += x => { properties.SetBool("ambientOcclusion_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(ambientOcclusionFoldout); ambientOcclusionLayout = layout.AddLayoutX(); { ambientOcclusionLayout.AddSpace(10); GUILayoutY contentsLayout = ambientOcclusionLayout.AddLayoutY(); ambientOcclusionGUI = new AmbientOcclusionSettingsGUI(settings.AmbientOcclusion, contentsLayout); ambientOcclusionGUI.OnChanged += x => { this.settings.AmbientOcclusion = x; MarkAsModified(); }; ambientOcclusionGUI.OnConfirmed += ConfirmModify; } //// Screen space reflections settings screenSpaceReflectionsFoldout.AcceptsKeyFocus = false; screenSpaceReflectionsFoldout.OnToggled += x => { properties.SetBool("screenSpaceReflections_Expanded", x); ToggleFoldoutFields(); }; layout.AddElement(screenSpaceReflectionsFoldout); screenSpaceReflectionsLayout = layout.AddLayoutX(); { screenSpaceReflectionsLayout.AddSpace(10); GUILayoutY contentsLayout = screenSpaceReflectionsLayout.AddLayoutY(); screenSpaceReflectionsGUI = new ScreenSpaceReflectionsSettingsGUI(settings.ScreenSpaceReflections, contentsLayout); screenSpaceReflectionsGUI.OnChanged += x => { this.settings.ScreenSpaceReflections = x; MarkAsModified(); }; screenSpaceReflectionsGUI.OnConfirmed += ConfirmModify; } // FXAA enableFXAAField.OnChanged += x => { this.settings.EnableFXAA = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(enableFXAAField); ToggleFoldoutFields(); }
private void OnGUI() { if (Input.GetKeyUp((KeyCode)276) || Input.GetKeyUp((KeyCode)275) || Input.GetKeyUp((KeyCode)274)) { this.isButtonPressed = false; } if (GUI.Button(new Rect(10f * this.dpiScale, 15f * this.dpiScale, 135f * this.dpiScale, 37f * this.dpiScale), "PREVIOUS EFFECT") || !this.isButtonPressed && Input.GetKeyDown((KeyCode)276)) { this.isButtonPressed = true; this.ChangeCurrent(-1); } if (GUI.Button(new Rect(160f * this.dpiScale, 15f * this.dpiScale, 135f * this.dpiScale, 37f * this.dpiScale), "NEXT EFFECT") || !this.isButtonPressed && Input.GetKeyDown((KeyCode)275)) { this.isButtonPressed = true; this.ChangeCurrent(1); } float num1 = 0.0f; if (GUI.Button(new Rect(10f * this.dpiScale, 63f * this.dpiScale + num1, 285f * this.dpiScale, 37f * this.dpiScale), "Day / Night") || !this.isButtonPressed && Input.GetKeyDown((KeyCode)274)) { this.isButtonPressed = true; if (Object.op_Inequality((Object)this.ReflectionProbe, (Object)null)) { this.ReflectionProbe.RenderProbe(); } this.Sun.set_intensity(this.isDay ? this.startSunIntensity : 0.05f); this.Sun.set_shadows(!this.isDay ? (LightShadows)0 : (LightShadows)(int)this.startLightShadows); foreach (Light nightLight in this.NightLights) { nightLight.set_shadows(this.isDay ? (LightShadows)0 : (LightShadows)(int)this.startLightShadows); } ((Component)this.Sun).get_transform().set_rotation(!this.isDay ? Quaternion.Euler(350f, 30f, 90f) : this.startSunRotation); RenderSettings.set_ambientLight(this.isDay ? this.startAmbientLight : new Color(0.2f, 0.2f, 0.2f)); float num2 = this.UseMobileVersion ? 0.3f : 1f; RenderSettings.set_ambientIntensity(!this.isDay ? num2 : this.startAmbientIntencity); RenderSettings.set_reflectionIntensity(!this.isDay ? 0.2f : this.startReflectionIntencity); this.isDay = !this.isDay; } GUI.Label(new Rect(400f * this.dpiScale, (float)(15.0 * (double)this.dpiScale + (double)num1 / 2.0), 100f * this.dpiScale, 20f * this.dpiScale), "Prefab name is \"" + ((Object)this.Prefabs[this.currentNomber]).get_name() + "\" \r\nHold any mouse button that would move the camera", this.guiStyleHeader); GUI.DrawTexture(new Rect(12f * this.dpiScale, 140f * this.dpiScale + num1, 285f * this.dpiScale, 15f * this.dpiScale), this.HUETexture, (ScaleMode)0, false, 0.0f); float colorHue = this.colorHUE; this.colorHUE = GUI.HorizontalSlider(new Rect(12f * this.dpiScale, 147f * this.dpiScale + num1, 285f * this.dpiScale, 15f * this.dpiScale), this.colorHUE, 0.0f, 360f); if ((double)Mathf.Abs(colorHue - this.colorHUE) <= 0.001) { return; } PSMeshRendererUpdater componentInChildren1 = (PSMeshRendererUpdater)this.characterInstance.GetComponentInChildren <PSMeshRendererUpdater>(); if (Object.op_Inequality((Object)componentInChildren1, (Object)null)) { componentInChildren1.UpdateColor(this.colorHUE / 360f); } PSMeshRendererUpdater componentInChildren2 = (PSMeshRendererUpdater)this.modelInstance.GetComponentInChildren <PSMeshRendererUpdater>(); if (!Object.op_Inequality((Object)componentInChildren2, (Object)null)) { return; } componentInChildren2.UpdateColor(this.colorHUE / 360f); }
private static int get_ambientLight(IntPtr L) { ToLua.Push(L, RenderSettings.get_ambientLight()); return(1); }
public void OnEndDrawModel(Model model, RenderSettings renderSettings) { //DrawShadowMapToScreen(); }
private static int get_ambientProbe(IntPtr L) { ToLua.PushValue(L, RenderSettings.get_ambientProbe()); return(1); }
public void ParseRender(RenderSettings rs) { var ren = statedyn["render"]; rs.MipmapMode = (uint?) ren["mipmap_mode"] ?? 0; rs.Mipmaps = (uint?) ren["mipmaps"] ?? 0; rs.LodBias = (float?) ren["lod_bias"] ?? 0; rs.Anisotropy = (uint?) ren["anisotropy"] ?? 0; rs.Antialias = (bool?) ren["antialias"] ?? false; rs.AntialiasSamples = (int?) ren["antialias_samples"] ?? 0; rs.TextureBorder = (int?) ren["texture_border"] ?? 0; rs.SaveTextureMemory = (bool?) ren["save_texture_memory"] ?? false; rs.Zdepth = (int?) ren["z_depth"] ?? 0; rs.FogEnabled = (bool?) ren["fog_enabled"] ?? false; rs.FogStart_depth = (float?) ren["fog_start_depth"] ?? 0; rs.FogEnd_depth = (float?) ren["fog_end_depth"] ?? 0; rs.FogColor[0] = (float?) ren["fog_color"]["r"] / 255.0f ?? 0; rs.FogColor[1] = (float?) ren["fog_color"]["g"] / 255.0f ?? 0; rs.FogColor[2] = (float?) ren["fog_color"]["b"] / 255.0f ?? 0; rs.FogColor[3] = 1; rs.UseGL3 = (bool?) ren["use_gl3"] ?? false; if (rs.Zdepth != 8 && rs.Zdepth != 16 && rs.Zdepth != 24) rs.Zdepth = 24; }
private static int get_reflectionBounces(IntPtr L) { LuaDLL.lua_pushinteger(L, RenderSettings.get_reflectionBounces()); return(1); }
public virtual void OnBeginDrawModel(Model model, RenderSettings renderSettings, IEnumerable<IDecorator> activeDecorators) { }
private static int get_haloStrength(IntPtr L) { LuaDLL.lua_pushnumber(L, (double)RenderSettings.get_haloStrength()); return(1); }
public virtual void OnEndDrawModel(Model model, RenderSettings renderSettings) { }
private static int get_flareFadeSpeed(IntPtr L) { LuaDLL.lua_pushnumber(L, (double)RenderSettings.get_flareFadeSpeed()); return(1); }
public DatamodelApiExtension(IEaProvider provider, RenderSettings renderSettings) { Parser = new DatamodelApiSyntax(); Renderer = new DatamodelApiRenderer(provider, renderSettings); }
private static int get_skybox(IntPtr L) { ToLua.Push(L, RenderSettings.get_skybox()); return(1); }
public override void OnBeginDrawMesh(ModelMesh mesh, RenderSettings renderSettings) { mesh.Effect.SpecularEnabled = !renderSettings.Parameters.NoSpecular; }
private static int get_defaultReflectionMode(IntPtr L) { ToLua.Push(L, RenderSettings.get_defaultReflectionMode()); return(1); }
public static SceneRenderer Create(GameContext gameContext, SceneEffect effect, RenderSettings settings) { return new ForwardSceneRenderer(gameContext, effect, settings); }
private static int get_defaultReflectionResolution(IntPtr L) { LuaDLL.lua_pushinteger(L, RenderSettings.get_defaultReflectionResolution()); return(1); }
public bool ConfigureFromSettings(RenderSettings settings) { Settings = settings; return(ValidateSettings()); }
private static int get_customReflection(IntPtr L) { ToLua.Push(L, RenderSettings.get_customReflection()); return(1); }
public override void OnBeginDrawModel(Model model, RenderSettings renderSettings, IEnumerable<IDecorator> decorators) { _device.SetRenderState(RenderState.FillMode, _fillMode); }
public override bool IsActive(RenderSettings settings) { return settings.Parameters.ShowNormals; }
public void OnEndDrawMesh(ModelMesh mesh, RenderSettings renderSettings) { if (!_creatingShadowMap) { mesh.Effect.ShadowsEnabled = false; mesh.Effect.ShadowMap = null; } }
public CacheProvider(EaProvider eaProvider, JsonProvider jsonProvider, RenderSettings renderSettings) { _eaProvider = eaProvider; _jsonProvider = jsonProvider; _renderSettings = renderSettings; }
public bool IsActive(RenderSettings settings) { return settings.Parameters.ShowShadows; }
private static int get_fogDensity(IntPtr L) { LuaDLL.lua_pushnumber(L, (double)RenderSettings.get_fogDensity()); return(1); }
private static int get_fogEndDistance(IntPtr L) { LuaDLL.lua_pushnumber(L, (double)RenderSettings.get_fogEndDistance()); return(1); }
/// <summary> /// Processes provided Mask thru post processing stack. /// </summary> /// <param name="iMask">Raw Occlusion mask with R and G channels.</param> /// <param name="iDestination">Write Destination texture.</param> /// <param name="iRenderSettings">Settings to use</param> public void BlurOcclusionMask(RenderTexture iMask, RenderSettings iRenderSettings, float iCameraSize) { // Blur G channel only. Blur(iMask, mMaterialContainer.fovBlurMaterial, iRenderSettings.fovBlurInterpolation, iRenderSettings.fovBlurIterations, blurRenderTexture, iCameraSize); }
private static int get_fog(IntPtr L) { LuaDLL.lua_pushboolean(L, RenderSettings.get_fog()); return(1); }
void ResetEnvironmentSettings(object userData, string[] options, int selected) { Undo.RecordObjects(new[] { RenderSettings.GetRenderSettings() }, "Reset Environment Settings"); Unsupported.SmartReset(RenderSettings.GetRenderSettings()); }
private static int get_fogColor(IntPtr L) { ToLua.Push(L, RenderSettings.get_fogColor()); return(1); }
public EaProvider(RepositoryWrapper repository, RenderSettings renderSettings) { _repository = repository; _folder = renderSettings.GetExtensionFolder(FileNames.ENTERPRISE_ARCHITECT); }