public UnityEngine.Material GetMaterial(RenderPrimitive renderPrimitive) { // Universal method if (renderPrimitive.IsAATextured) { return(Material_AA); } else { UnityEngine.Material material = Material_Solid; if (material != null) { UnityEngine.Texture texture = Texture; if (texture == null) { texture = ImageTexture; if (texture == null) { return(null); } } // Set texture material.mainTexture = texture; } return(material); } }
public UnityEngine.Material GetMaterial(RenderPrimitive renderPrimitive) { if (renderPrimitive.IsAATextured) { return(Material_AA); } return(Material_Solid); }
public static float[] ShadowMapLimit; // diameter of shadow map far edge from camera internal RenderProcess(Game game) { this.game = game; gameForm = (Form)Control.FromHandle(game.Window.Handle); watchdogToken = new WatchdogToken(System.Threading.Thread.CurrentThread); Profiler = new Profiler("Render"); Profiler.SetThread(); game.SetThreadLanguage(); game.Window.Title = "Open Rails"; GraphicsDeviceManager = new GraphicsDeviceManager(game); var windowSizeParts = game.Settings.WindowSize.Split(new[] { 'x' }, 2); gameWindowSize = new System.Drawing.Size(Convert.ToInt32(windowSizeParts[0]), Convert.ToInt32(windowSizeParts[1])); FrameRate = new SmoothedData(); FrameTime = new SmoothedDataWithPercentiles(); PrimitiveCount = new int[(int)RenderPrimitiveSequence.Sentinel]; PrimitivePerFrame = new int[(int)RenderPrimitiveSequence.Sentinel]; // Run the game initially at 10FPS fixed-time-step. Do not change this! It affects the loading performance. game.IsFixedTimeStep = true; game.TargetElapsedTime = TimeSpan.FromMilliseconds(100); game.InactiveSleepTime = TimeSpan.FromMilliseconds(100); // Set up the rest of the graphics according to the settings. GraphicsDeviceManager.SynchronizeWithVerticalRetrace = game.Settings.VerticalSync; GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color; GraphicsDeviceManager.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; GraphicsDeviceManager.IsFullScreen = true; GraphicsDeviceManager.PreferMultiSampling = game.Settings.MultisamplingCount > 0; GraphicsDeviceManager.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(GDM_PreparingDeviceSettings); currentScreen = Screen.PrimaryScreen; gameWindowOrigin = new System.Drawing.Point((currentScreen.WorkingArea.Right - gameWindowSize.Width) / 2, (currentScreen.WorkingArea.Bottom - gameWindowSize.Height) / 2); System.Drawing.Point tempGameWindowOrigin = gameWindowOrigin; SynchronizeGraphicsDeviceManager(game.Settings.FullScreen ? game.Settings.NativeFullscreenResolution ? ScreenMode.FullscreenNativeResolution : ScreenMode.FullscreenPresetResolution : ScreenMode.WindowedPresetResolution); //restore gameWindowOrigin which will be overriden when game started in Fullscreen () gameWindowOrigin = tempGameWindowOrigin; RenderPrimitive.SetGraphicsDevice(game.GraphicsDevice); UserInput.Initialize(game); gameForm.LocationChanged += GameForm_LocationChanged; }
public UnityEngine.Texture GetTexture(RenderPrimitive renderPrimitive) { int mID = GetMaterialIDByAlias(MaterialName); switch (mID) { case 1: case 2: case 3: case 4: { return((Renderer.GetTexture(Image) as Unity_Texture).Native); } } return(Texture); }
public UnityEngine.Material GetMaterial(RenderPrimitive renderPrimitive) { UnityEngine.Texture texture = (GradientTexture as Unity_Texture).Native; UnityEngine.Material material; if (renderPrimitive.IsAATextured) { material = Material_AA; material.mainTexture = texture; } else { material = Material_Solid; material.mainTexture = texture; } return(material); }
protected override void Render(BrushMaterial brushMaterial, RenderPrimitive renderPrimitive) { Render(brushMaterial, renderPrimitive as Unity_RenderPrimitive); }