/// <summary> Sets rendering mode. </summary> /// <param name="renderMode">Render mode.</param> /// <param name="viewport"> Viewport in world coordinates (meters).</param> public ConfigBuilder SetRenderOptions(RenderMode renderMode, Rectangle2d viewport) { Add <string>(@"tile/render_mode", renderMode.ToString().ToLower()); Add <float>(@"tile/viewport/w", (float)viewport.Width); Add <float>(@"tile/viewport/h", (float)viewport.Height); return(this); }
public void SetMode(RenderMode mode, Shader[] shaders) { TexturesData data = (TexturesData)GetType().GetField(mode.ToString()).GetValue(this); material.mainTexture = data.main; material.color = data.color; material.SetTexture("_BumpMap", data.normals); material.shader = shaders [(int)mode]; }
public XElement ToXml(IToXmlContext ctx) { return(new XElement("UserQueryPart", new XAttribute("UserQuery", ctx.Include(UserQuery)), new XAttribute("RenderMode", RenderMode.ToString()), new XAttribute("AllowSelection", AllowSelection.ToString()), new XAttribute("ShowFooter", ShowFooter.ToString()) )); }
public static GPURenderer Create(System.Windows.Forms.Control cltr, RenderMode renderMode) { if (Process.GetCurrentProcess().ProcessName == "devenv") { return(new GPURenderer2(cltr)); } #if SLIMDX GPURenderer r = null; try { if (!tryHardware) { r = new GPURenderer2(cltr); } else { r = new GPURenderer1(cltr); } } catch (Exception e) { Console.WriteLine("Cant create Renderer\n" + e.Message); r?.Dispose(); r = new GPURenderer2(cltr); } return(r); #else switch (renderMode) { case RenderMode.OpenGL: return(new GPURenderer3(cltr)); case RenderMode.Direct2D: return(new GPURenderer1(cltr)); case RenderMode.Software: return(new GPURenderer2(cltr)); default: throw new Exception("Unknown RenderMode " + renderMode.ToString()); } #endif }
public Canvas GetCanvasByMode(RenderMode mode, bool createIsNot = true) { Canvas c = mCanvas[(int)mode]; if (c == null && createIsNot) { GameObject obj = new GameObject(); c = obj.AddComponent <Canvas>(); c.sortingOrder = MaxSortOrder + 1; obj.name = "Canvas_s" + mode.ToString(); obj.AddComponent <CanvasScaler>(); obj.AddComponent <GraphicRaycaster>(); obj.transform.SetParent(transform); obj.layer = LayerMask.NameToLayer("UI"); c.renderMode = mode; //if(RenderMode.ScreenSpaceOverlay == mode) //{ // mDarkMask = getDarkMask(c); //} if (RenderMode.ScreenSpaceCamera == mode) { //GameObject cameraObj = new GameObject(); Camera _camera = obj.AddComponent <Camera>(); _camera.clearFlags = CameraClearFlags.Depth; _camera.nearClipPlane = 0.1f; _camera.farClipPlane = 200f; //_camera.name = "SSCamera"; _camera.cullingMask = 1 << LayerMask.NameToLayer("UI"); _camera.orthographic = true; //_camera.transform.LookAt(_camera.transform.position + Vector3.forward, Vector3.up); //cameraObj.transform.SetParent(obj.transform, false); c.worldCamera = _camera; mDarkMask = _getDarkMask(c); } SetCanvasByMode(c); //mCanvas[(int)mode] = c; } return(c); }
private void UpdateCustomData() { if (m_thruster == null) { return; } StringBuilder sb = new StringBuilder(); Dictionary <string, List <string> > settings = new Dictionary <string, List <string> >(); ParseCustomData(ref settings); settings.Remove(_CUSTOM_DATA_SECTION); foreach (var key in settings.Keys) { List <string> lines = settings[key]; sb.Append($"[{key}]\n"); foreach (var line in lines) { sb.Append($"{line}\n"); } } sb.Append($"[{_CUSTOM_DATA_SECTION}]\n"); SerializeVector(FlameIdleColor, sb); SerializeVector(FlameFullColor, sb); sb.Append($"{m_flameColorsLocked}\n"); sb.Append($"{m_renderMode.ToString()}\n"); sb.Append($"{m_hideFlames}\n"); m_thruster.CustomDataChanged -= OnCustomDataChanged; m_thruster.CustomData = sb.ToString(); m_thruster.CustomDataChanged += OnCustomDataChanged; }
private void UpdateStatusText() { _statusText.text = string.Format("<color=#dbfb76><b>{0} </b></color>\n{1}: {2}\n", LocalizeManager.GetString("ControllerData"), LocalizeManager.GetString("Status"), LocalizeManager.GetString(ControllerStatus.Text)); _statusText.text += string.Format("\n<color=#dbfb76><b>{0} </b></color>\n {1}: <color=green>{2}</color>", LocalizeManager.GetString("HandMeshData"), LocalizeManager.GetString("CurrentRenderMode"), LocalizeManager.GetString(_mode.ToString())); }
public XElement ToXml(IToXmlContext ctx) { return(new XElement("UserQueryPart", new XAttribute("UserQuery", ctx.Include(UserQuery)), new XAttribute("RenderMode", RenderMode.ToString()))); }
public void Render() { if (renderMode != RenderMode.OnDemand) { Debug.LogErrorFormat("IRenderable interface can only be used with OnDemand render mode, not {0}", renderMode.ToString()); return; } DoRenderTexture(); }
public void SetMode(RenderMode m) { CheckError(); switch (m) { case RenderMode.Draw2D: States.Disable((int)GetPName.PointSprite); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); GL.MatrixMode(MatrixMode.Projection); global::OpenTK.Matrix4 m2 = global::OpenTK.Matrix4.CreateOrthographicOffCenter(0.0f, (float)width, (float)height, 0.0f, -1.0f, 1000.0f); GL.LoadMatrix(ref m2); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); States.Disable((int)GetPName.DepthTest); States.Disable((int)GetPName.CullFace); States.Disable((int)GetPName.Lighting); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); States.Enable((int)GetPName.Blend); break; case RenderMode.Draw3D: GL.DepthMask(true); States.Disable((int)GetPName.PointSprite); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); States.ActiveTexture((int)TextureUnit.Texture0); States.Enable((int)GetPName.DepthTest); States.Enable((int)GetPName.CullFace); GL.CullFace(CullFaceMode.Back); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); States.Enable((int)GetPName.Blend); GL.LightModel(LightModelParameter.LightModelTwoSide, 1); break; case RenderMode.Draw3DWireFrame: GL.DepthMask(true); States.Disable((int)GetPName.PointSprite); States.ActiveTexture((int)TextureUnit.Texture0); States.Enable((int)GetPName.DepthTest); States.Enable((int)GetPName.CullFace); GL.CullFace(CullFaceMode.Back); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); States.Enable((int)GetPName.Blend); GL.LightModel(LightModelParameter.LightModelTwoSide, 1); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); break; case RenderMode.Draw3DPointSprite: States.ActiveTexture((int)TextureUnit.Texture0); GL.TexEnv(TextureEnvTarget.PointSprite, TextureEnvParameter.CoordReplace, 1); States.Enable((int)GetPName.PointSprite); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); UseShader(pointsprite); float m1 = 2.0f * (float)Math.Atan(cam.Fov / 2.0 / 180.0 * Math.PI); int[] vp = new int[4]; GL.GetInteger(GetPName.Viewport, vp); float v = (float)vp[3]; m1 /= v; SetUniform(pointsprite.GetUniformLocation("WorldSize"), new float[] { pointsize }); SetUniform(pointsprite.GetUniformLocation("Attenuation"), new float[] { 0,0,m1 }); break; case RenderMode.DrawSkyBox: States.Disable((int)GetPName.PointSprite); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); States.ActiveTexture((int)TextureUnit.Texture0); States.Enable((int)GetPName.CullFace); GL.CullFace(CullFaceMode.Back); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); States.Enable((int)GetPName.Blend); GL.LightModel(LightModelParameter.LightModelTwoSide, 1); States.Disable((int)GetPName.DepthTest); GL.DepthMask(false); break; default: throw new Exception("dont know rendermode " + m.ToString()); } CheckError(); }
protected void SetRenderMode(RenderMode mode) { SetPrevalue("noteRenderMode", mode.ToString()); }