public bool Init(RenderingScene renderingScene) { scene = renderingScene; _device = Engine.I.Device; try { foreach (var ent in scene.RenderableEntities) { _device.LoadMesh(ent.Value.Mesh); _device.LoadShader(ent.Value.Material.Shader); if (ent.Value.Material.HasDiffuse) { _device.LoadTexture(ent.Value.Material.Diffuse); } if (ent.Value.Material.HasNormal) { _device.LoadTexture(ent.Value.Material.Normal); } } return(true); } catch (Exception e) { #if DEBUG throw; #endif RenderAPI.I.Core.Log.Error("Can't initialize diffuse stage.", e); } return(false); }
public bool Init(RenderingScene renderingScene) { try { var skyboxName = RenderAPI.I.Game.Level.LevelInfo["LevelProperties", "Skybox"]; var skyboxData = RenderAPI.I.Game.Level.LevelInfo[skyboxName]; _skybox = Skybox.Load( skyboxData["right"], skyboxData["left"], skyboxData["top"], skyboxData["bottom"], skyboxData["back"], skyboxData["front"]); initialized = true; scene = renderingScene; } catch (Exception e) { RenderAPI.I.Core.Log.Error("Can't load skybox", e); #if DEBUG throw; #endif initialized = false; } return(initialized); }
/// <summary> /// Initializes render stages. Loads level data. /// </summary> /// <returns><code>true</code>, if no fails.</returns> public virtual bool Init(RenderingScene renderingScene) { RenderingScene = renderingScene; var initResult = Stages .Select(stage => stage.Init(RenderingScene)) .All(stageInit => stageInit); IsInitialized = true; return(initResult); }
public EngineCommandResult Execute(IEngineCommand c) { var ll = (AshyCore.EngineAPI.EngineCommands.LoadLevel)c; var scene = new RenderingScene(ll.LoadingLevel.Entities); var isLoaded = Engine.I.RenderTechnique.Init(scene); if (isLoaded) { Engine.I.Status = EngineStatus.LoadedWorld; } return(isLoaded ? EngineCommandResult.Success : EngineCommandResult.Failed); }
public override bool Init(RenderingScene renderingScene) { GL.Enable(EnableCap.DepthTest); GL.Disable(EnableCap.CullFace); GL.Enable(EnableCap.Texture2D); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Enable(EnableCap.Blend); GL.Enable(IndexedEnableCap.Blend, 0); GL.ClearColor(Color.FromArgb(50, 50, 50)); GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); return(base.Init(renderingScene)); }
public bool Init(RenderingScene renderingScene) { _scene = renderingScene; var _device = Engine.I.Device; try { foreach (var ent in renderingScene.RenderableEntities) { _device.LoadMesh(ent.Value.Mesh); _device.LoadShader(ent.Value.Material.Shader); if (ent.Value.Material.HasDiffuse) { _device.LoadTexture(ent.Value.Material.Diffuse); } if (ent.Value.Material.HasNormal) { _device.LoadTexture(ent.Value.Material.Normal); } } _depthMap = new DepthMap(renderingScene); _directLight = new DirectLightCaster(pos: new Vec3(90, 90, -150), dir: Vec3.Zero, color: new Vec3(234.0f / 255.0f, 215.0f / 255.0f, 213.0f / 255.0f)); _depthMap.FillDepthMap(_directLight.LightSpaceMatrix); _shaderProgram = DepthMap.LoadSpecificShader("shadow&light"); return(true); } catch (Exception e) { #if DEBUG throw; #endif RenderAPI.I.Core.Log.Error("Can't initialize diffuse stage.", e); } return(false); }
public bool Init(RenderingScene renderingScene) { throw new System.NotImplementedException(); }