public MainView(IRenderState renderState, IContentLoader contentLoader) { _renderState = renderState; _renderState.Set(new BackFaceCulling(true)); var sphere = contentLoader.Load <DefaultMesh>("maze.obj"); sphere = sphere.SwitchTriangleMeshWinding(); _meshes.Add(Enums.EntityType.Maze, sphere); _meshes.Add(Enums.EntityType.Plane, new TBNMesh(Meshes.CreatePlane(1, 1, 1, 1))); _meshes.Add(Enums.EntityType.Mercury, contentLoader.Load <DefaultMesh>("icosphere.obj")); _meshes.Add(Enums.EntityType.Mars, contentLoader.Load <DefaultMesh>("icosphere.obj")); _disableBackFaceCulling.Add(Enums.EntityType.Mercury); _disableBackFaceCulling.Add(Enums.EntityType.Mars); _textures.Add(Enums.EntityType.Mercury, contentLoader.Load <ITexture2D>("mercury8.jpg")); _textures.Add(Enums.EntityType.Mars, contentLoader.Load <ITexture2D>("mars8.jpg")); _textures.Add(Enums.EntityType.Plane, contentLoader.Load <ITexture2D>("haumea.jpg")); _deferred = _renderInstanceGroup.AddShader <Deferred>(new Deferred(contentLoader, _meshes)); _directShadowMap = _renderInstanceGroup.AddShader <DirectionalShadowMapping>(new DirectionalShadowMapping(contentLoader, _meshes)); _ssaoWithBlur = _renderInstanceGroup.AddShader <SSAOWithBlur>(new SSAOWithBlur(contentLoader, 15)); _environmentMap = _renderInstanceGroup.AddShader <EnvironmentMap>(new EnvironmentMap(1024, contentLoader, _meshes)); _addEnvMap = _renderInstanceGroup.AddShader <Add>(new Add(contentLoader)); _lighting = _renderInstanceGroup.AddShader <Lighting>(new Lighting(contentLoader)); _sphereCut = _renderInstanceGroup.AddShader <SphereCut>(new SphereCut(contentLoader, 100)); _skybox = _renderInstanceGroup.AddShader <Skybox>(new Skybox(contentLoader, 100, "space")); _addSkybox = _renderInstanceGroup.AddShader <Add>(new Add(contentLoader)); _bloom = _renderInstanceGroup.AddShader <Bloom>(new Bloom(contentLoader)); _lights.Add(new LightSource(Vector3.Zero, Vector3.Normalize(new Vector3(-1f, -1f, 0.6f)), new Vector3(1.0f, 0.77f, 0.56f))); Bloom = true; }
public MainView(IRenderState renderState, IContentLoader contentLoader, Dictionary <Enums.EntityType, Tuple <DefaultMesh, Vector4> > additionalMeshes) { _renderState = renderState; _renderState.Set(new BackFaceCulling(true)); _meshes.Add(Enums.EntityType.Sphere, new TBNMesh(contentLoader.Load <DefaultMesh>("icosphere.obj"))); _meshes.Add(Enums.EntityType.Nvidia, contentLoader.Load <DefaultMesh>("Nvidia.obj")); _meshes.Add(Enums.EntityType.Radeon, contentLoader.Load <DefaultMesh>("Radeon.obj")); _meshes.Add(Enums.EntityType.NvidiaParticle, CustomMeshes.CreateIcosaeder()); _meshes.Add(Enums.EntityType.RadeonParticle, CustomMeshes.CreateIcosaeder()); _meshes.Add(Enums.EntityType.Crystal1, contentLoader.Load <DefaultMesh>("Crystal1.obj")); _meshes.Add(Enums.EntityType.Crystal2, contentLoader.Load <DefaultMesh>("Crystal2.obj")); _normalMaps.Add(Enums.EntityType.Sphere, contentLoader.Load <ITexture2D>("icosphere_normal.png")); _disableBackFaceCulling.Add(Enums.EntityType.Nvidia); _disableBackFaceCulling.Add(Enums.EntityType.Radeon); _textures.Add(Enums.EntityType.Nvidia, contentLoader.Load <ITexture2D>("Nvidia.png")); _textures.Add(Enums.EntityType.Radeon, contentLoader.Load <ITexture2D>("Radeon.png")); _intensities.Add(Enums.EntityType.NvidiaParticle, new Vector4(1, 0, 0, 0)); _intensities.Add(Enums.EntityType.RadeonParticle, new Vector4(1, 0, 0, 0)); _intensities.Add(Enums.EntityType.Nvidia, new Vector4(.1f, 0, 1, 1)); _intensities.Add(Enums.EntityType.Radeon, new Vector4(.0f, 0, 1, 1)); _intensities.Add(Enums.EntityType.Sphere, new Vector4(.1f, 1, 1, 0)); _intensities.Add(Enums.EntityType.Crystal1, new Vector4(1, 0, 0, 0)); _intensities.Add(Enums.EntityType.Crystal2, new Vector4(1, 0, 0, 0)); foreach (var type in additionalMeshes.Keys) { if (_meshes.ContainsKey(type)) { _meshes[type] = additionalMeshes[type].Item1; } else { _meshes[type] = additionalMeshes[type].Item1; } if (_intensities.ContainsKey(type)) { _intensities[type] = additionalMeshes[type].Item2; } else { _intensities[type] = additionalMeshes[type].Item2; } } _deferred = _renderInstanceGroup.AddShader <Deferred>(new Deferred(contentLoader, _meshes)); _directShadowMap = _renderInstanceGroup.AddShader <DirectionalShadowMapping>(new DirectionalShadowMapping(contentLoader, _meshes)); _blurredShadowMap = _renderInstanceGroup.AddShader <ShadowBlur>(new ShadowBlur(contentLoader, 5)); _ssaoWithBlur = _renderInstanceGroup.AddShader <SSAOWithBlur>(new SSAOWithBlur(contentLoader, 15)); _environmentMap = _renderInstanceGroup.AddShader <EnvironmentMap>(new EnvironmentMap(1024, contentLoader, _meshes)); _addEnvMap = _renderInstanceGroup.AddShader <Add>(new Add(contentLoader)); _lighting = _renderInstanceGroup.AddShader <Lighting>(new Lighting(contentLoader)); _addProjectileColor = _renderInstanceGroup.AddShader <AddWithDepthTest>(new AddWithDepthTest(contentLoader)); _sphereCut = _renderInstanceGroup.AddShader <SphereCut>(new SphereCut(contentLoader, 100)); _skybox = _renderInstanceGroup.AddShader <Skybox>(new Skybox(contentLoader, 100, "blue")); _addSkybox = _renderInstanceGroup.AddShader <Add>(new Add(contentLoader)); _bloom = _renderInstanceGroup.AddShader <Bloom>(new Bloom(contentLoader)); _lights.Add(new LightSource(Vector3.Zero, Vector3.Normalize(new Vector3(-1f, -1f, 0.6f)), new Vector3(0.8f, 0.8f, 0.9f))); Bloom = true; }