public SphereCut(IContentLoader contentLoader, float size) { _sphereCutProgram = contentLoader.Load <IShaderProgram>("imageOnGeometry.*"); var sphere = Meshes.CreateSphere(size, 5).SwitchHandedness(); _sphereGeometry = VAOLoader.FromMesh(sphere, _sphereCutProgram); }
public View(IContentLoader contentLoader, IRenderState renderState, string spriteSheetName) { renderState.Set(BlendStates.AlphaBlend); GL.Enable(EnableCap.Texture2D); texTileSet = contentLoader.Load <ITexture2D>(spriteSheetName); texTileSet.Filter = TextureFilterMode.Nearest; texTileSet.WrapFunction = TextureWrapFunction.ClampToEdge; }
public VisualPlane(IRenderState renderState, IContentLoader contentLoader) { shdPlane = contentLoader.Load <IShaderProgram>("plane.*"); var mesh = Meshes.CreatePlane(2, 2, 1, 1); plane = VAOLoader.FromMesh(mesh, shdPlane); this.renderState = renderState; }
public MyVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(new ClearColorState(0, 0, 0, 1)); //background clear color renderState.Set(BlendStates.AlphaBlend); //for transparency in textures we use blending GL.Enable(EnableCap.Texture2D); //TODO: only for non shader pipeline relevant -> remove at some point texGreen = contentLoader.Load <ITexture2D>("planet"); }
public SATGpuFilter(IContentLoader contentLoader, IRenderState renderState, int amountBlocksX, int amountBlocksY, int resX, int resY, int kernelSizeY, int kernelSizeX) { this.contentLoader = contentLoader; this.renderState = renderState; shaderSumHorizontal = contentLoader.LoadPixelShader("SATSumHorizontal"); shaderSumVertical = contentLoader.LoadPixelShader("SATSumVertical"); shaderAssemblyVertical = contentLoader.LoadPixelShader("SATAssemblyPassVertical"); shaderAssemblyHorizontal = contentLoader.LoadPixelShader("SATAssemblyPassHorizontal"); shaderSATFilter = contentLoader.LoadPixelShader("SATFiltering"); fullScreenQuad = contentLoader.Load <IShaderProgram>("FullQuad.*"); testTexture = contentLoader.Load <ITexture2D>("testTexture.*"); this.kernelSizeX = kernelSizeX; this.kernelSizeY = kernelSizeY; SetUpBlocksAndTextures(amountBlocksX, amountBlocksY, testTexture.Width, testTexture.Height); }
public override void LoadContent(IContentLoader provider) { var controlFont = provider.Load <SpriteFont>("Graphics/Fonts/ControlFont"); ControlManager = new ControlManager(controlFont); base.LoadContent(provider); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { InitParticles(); renderState.Set(BlendStates.AlphaBlend); renderState.Set(new ShaderPointSize(true)); renderState.Set(new PointSprite(true)); shaderProgram = contentLoader.Load <IShaderProgram>("particle.*"); }
public DeferredRenderer(IContentLoader contentLoader, IRenderState renderState) { renderState.Set <DepthTest>(new DepthTest(true)); GL.Enable(EnableCap.CullFace); GL.Enable(EnableCap.Blend); GL.CullFace(CullFaceMode.Back); this.renderState = renderState; this.contentLoader = contentLoader; deferredParticleShader = contentLoader.Load <IShaderProgram>("deferred_particle.*"); shadowMapShaderParticle = contentLoader.Load <IShaderProgram>("shadowMapParticle.*"); shadowLightViewShaderParticle = contentLoader.Load <IShaderProgram>("shadowLightViewParticle.*"); deferredGeometryShader = contentLoader.Load <IShaderProgram>("deferred_geometry.*"); deferredPost = contentLoader.LoadPixelShader("deferred_post"); pointLightShader = contentLoader.Load <IShaderProgram>("def_pointLight.*"); shadowMapShader = contentLoader.Load <IShaderProgram>("shadowMap.*"); shadowLightViewShader = contentLoader.Load <IShaderProgram>("shadowLightView.*"); var lmesh = Meshes.CreateSphere(1, 2); pointLightSphere = VAOLoader.FromMesh(lmesh, pointLightShader); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(BlendStates.Additive); renderState.Set(BoolState <IShaderPointSizeState> .Enabled); renderState.Set(BoolState <IPointSpriteState> .Enabled); shaderProgram = contentLoader.Load <IShaderProgram>("shader.*"); UpdateGeometry(shaderProgram); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(BlendStates.Additive); renderState.Set(new ShaderPointSize(true)); renderState.Set(new PointSprite(true)); shaderProgram = contentLoader.Load <IShaderProgram>("shader.*"); UpdateGeometry(shaderProgram); }
public override void Load(IContentLoader loader) { _loader = loader; var defaultFont = loader.Load <SpriteFont>(ContentPaths.FONT_UI_GENERAL); varShowLootTip = new GameVariable <bool>(); varShowLootTip.Load(loader); GameObjects.Add(varShowLootTip); // Player player = new Player(eventBus, varShowLootTip); player.Load(loader); GameObjects.Add(player); // Bot bot = new Bot(eventBus, Camera); bot.Load(loader); GameObjects.Add(bot); // Message manager textPopupManager = new TextPopupManager(ContentPaths.FONT_UI_GENERAL, StackingMethod.Parallel); textPopupManager.Load(loader); GameObjects.Add(textPopupManager); // Physics phys = new MapPhysics(chunkMap, physSettings); GameObjects.Add(chunkMap); // Camera GameObjects.Add(Camera); // Services setupKeyListeners(); // Event listeners eventBusSubscriptionIds.AddRange(new[] { eventBus.Subscribe(Events.PlayerPickedUpCoin, (p) => Debug.WriteLine("picked up coin!")), eventBus.Subscribe(Events.PlayerDied, (p) => playerDied()), eventBus.Subscribe(Events.CreateProjectile, (p) => playerCreatedProjectile(p as Projectile)), }); // Game variables var tipLootBoxOpen = "Press <E> to open loot box"; txtDisplayTipLootBoxOpen = new TextElement <string>(tipLootBoxOpen, defaultFont, new TextElementSettings()) { Position = new Vector2(10, 10), IsAttachedToCamera = true, IsHidden = true, }; txtDisplayTipLootBoxOpen.Load(loader); GameObjects.Add(txtDisplayTipLootBoxOpen); // Map loadMap(); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(new DepthTest(true)); shader = contentLoader.Load <IShaderProgram>("TerrainTessellation.*"); shader.Activate(); GL.PatchParameter(PatchParameterInt.PatchVertices, 4); }
public FontGL(IContentLoader contentLoader) { //shdFont = context.CreateShader(); //shdFont.FromStrings(Tools.ToString(Resourcen.texColorVert), Tools.ToString(Resourcen.texColorFrag)); //locCamera = shdFont.GetResourceLocation(ShaderResourceType.Uniform, "camera"); GL.Enable(EnableCap.Texture2D); //TODO: only for non shader pipeline relevant -> remove at some point font = new TextureFont(contentLoader.Load <ITexture2D>("Video Phreak"), 10, 32, 1, 1, .7f); }
public TessellationExample([Import] IContentLoader contentLoader, [Import] ITime time) { shader = contentLoader.Load <IShaderProgram>("Tessellation.*"); shader.Activate(); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); GL.PatchParameter(PatchParameterInt.PatchVertices, 4); this.time = time; }
public MainVisual(IRenderContext renderContext, IContentLoader contentLoader) { renderContext.RenderState.Set(new DepthTest(true)); renderContext.RenderState.Set(new FaceCullingModeState(FaceCullingMode.BACK_SIDE)); var mesh = Meshes.CreatePlane(2, 2, 1024, 1024); var texHeightfield = contentLoader.Load <ITexture2D>("mountain_height"); var bindings = new TextureBinding[] { new TextureBinding("texHeightfield", texHeightfield), new TextureBinding("texColor", contentLoader.Load <ITexture2D>("mountain_color")), new TextureBinding("texStone", contentLoader.Load <ITexture2D>("stone")), }; var shaderProgram = contentLoader.Load <IShaderProgram>("shader.*"); mountain = new MeshVisual(mesh, shaderProgram, bindings); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(new DepthTest(true)); fboShadowMap.Texture.Filter = TextureFilterMode.Nearest; shaderProgram = contentLoader.Load <IShaderProgram>("shadowMap.*"); var mesh = Meshes.CreatePlane(10, 10, 10, 10); var sphere = Meshes.CreateSphere(0.5f, 2); sphere.SetConstantUV(new Vector2(0.5f, 0.5f)); mesh.Add(sphere.Transform(Transformation.Translation(0, 2, -2))); mesh.Add(sphere.Transform(Transformation.Translation(0, 2, 0))); mesh.Add(sphere.Transform(Transformation.Translation(2, 2, -1))); geometry = VAOLoader.FromMesh(mesh, shaderProgram); shaderProgramDepth = contentLoader.Load <IShaderProgram>("depth.*"); //todo: radeon cards created errors with geometry bound to one shader and used in other shaders because of binding id changes }
public Terrain(IContentLoader contentLoader, string heightMapPath, float scale, float sizeX, float sizeY) { this.scale = scale; this.sizeX = sizeX; this.sizeY = sizeY; Texture2dGL htext = contentLoader.Load <Texture2dGL>(heightMapPath); heightMap = htext.SaveToBitmap(); CalculatePixelSizes(); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { InitParticles(); //for transparency in textures we use blending renderState.Set(BlendStates.Additive); renderState.Set(new ShaderPointSize(true)); renderState.Set(new PointSprite(true)); shaderProgram = contentLoader.Load <IShaderProgram>("particle.*"); }
public DirectionalShadowMapping(IContentLoader contentLoader, Dictionary <Enums.EntityType, DefaultMesh> meshes) { _depthShader = contentLoader.Load <IShaderProgram>("depth.*"); _shadowShader = contentLoader.LoadPixelShader("shadow.glsl"); foreach (var meshContainer in meshes) { _geometriesDepth.Add(meshContainer.Key, VAOLoader.FromMesh(meshContainer.Value, _depthShader)); } }
public void Load(RelatedItem relatedItem) { _contentLoader.Load(relatedItem); if (RelatedItemBelongsToApplication(relatedItem)) { LoadOwnContent(relatedItem); } else if (RelatedItemCanBeLaunchedBySisterApplication(relatedItem)) { LoadContentInSisterApplication(relatedItem); } else { DumpContentToUserDefinedLocation(relatedItem); } }
public Skybox(IContentLoader contentLoader, float size, string textureName) { _skyboxProgram = contentLoader.Load <IShaderProgram>("sky.*"); ITexture2D[] textures = new ITexture2D[6]; for (int i = 0; i < 6; i++) { textures[i] = contentLoader.Load <ITexture2D>(textureName + Endings[i]); } _cubeFbo = new CubeMapFBO(textures[0].Width); CreateMap(textures); var sphere = Meshes.CreateSphere(size).SwitchHandedness(); _sphereGeometry = VAOLoader.FromMesh(sphere, _skyboxProgram); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(new DepthTest(true)); shader = contentLoader.Load <IShaderProgram>("TerrainTessellation.*"); shader.Activate(); //GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); GL.PatchParameter(PatchParameterInt.PatchVertices, 4); }
public PBRRenderer(IRenderState renderState, IContentLoader contentLoader) { iblMapList = new List <IBLSetup>(); GL.Enable(EnableCap.DebugOutput); GL.Enable(EnableCap.TextureCubeMapSeamless); this.renderState = renderState; GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.TextureCubeMap); renderState.Set(new DepthTest(true)); //pbrShader = contentLoader.Load<IShaderProgram>("PBRLightingBasic.*"); pbrShader = contentLoader.Load <IShaderProgram>("PBRLighting.*"); //pbrShader = contentLoader.Load<IShaderProgram>("PBRReference.*"); skyboxShader = contentLoader.Load <IShaderProgram>("Skybox.*"); cubeProjectionShader = contentLoader.Load <IShaderProgram>("CubeMapProjection.*"); textureTest = contentLoader.Load <IShaderProgram>("DisplayTexture2D.*"); irradianceMapShader = contentLoader.Load <IShaderProgram>("IrradianceMap.*"); prefilterMapShader = contentLoader.Load <IShaderProgram>("PrefilterIBLMap.*"); integrationMapShader = contentLoader.Load <IShaderProgram>("BRDFIntegration.*"); dLight = new DirectionalLight(); dLight.direction = new Vector3(0, 1, -1); dLight.color = new Vector3(10); dLight.position = new Vector3(0, 1, -1); Vector3 startPos = new Vector3(0, 0, 0.5f); pointLights = new PointLight[4]; for (int i = 0; i < 4; i++) { pointLights[i] = new PointLight(); pointLights[i].color = new Vector3(1); pointLights[i].radius = 1; pointLights[i].position = startPos; } pointLights[0].position = new Vector3(-1, 1, 0.5f); pointLights[1].position = new Vector3(-1, -1, 0.5f); pointLights[2].position = new Vector3(1, -1, 0.5f); pointLights[3].position = new Vector3(1, 1, 0.5f); int size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(PointLight)) * pointLights.Length; //Generate buffer and allocate memory ubo = GL.GenBuffer(); GL.BindBuffer(BufferTarget.UniformBuffer, ubo); GL.BufferData(BufferTarget.UniformBuffer, size, pointLights, BufferUsageHint.DynamicDraw); //Assign Buffer Block to ubo int uniformID = GL.GetUniformBlockIndex(pbrShader.ProgramID, "BufferPointLights"); GL.UniformBlockBinding(pbrShader.ProgramID, uniformID, 0); GL.BindBufferBase(BufferRangeTarget.UniformBuffer, 0, ubo); DefaultMesh cubeMesh = Meshes.CreateCubeWithNormals(); unitCube = VAOLoader.FromMesh(cubeMesh, cubeProjectionShader); renderState.Set(new FaceCullingModeState(FaceCullingMode.BACK_SIDE)); }
public void Load(IContentLoader loader) { Props.Texture = loader.Load <Texture2D>(ContentPaths.SPRITESHEET_MARIO); bulletTexture = loader.Load <Texture2D>(ContentPaths.SPRITE_BULLET); sfxDie = loader.Load <SoundEffect>(ContentPaths.SFX_DEATH); sfxFire = loader.Load <SoundEffect>(ContentPaths.SFX_FIRE); animStanding = new AnimationOverlay( name: "standing", animType: SpriteAnimationType.SingleFrame, origin: SpriteOriginType.TopLeft, width: Props.PhysicalRect.Width, height: Props.PhysicalRect.Height, frames: 1, framerateMillisec: 1, yOffset: 0); animWalking = new AnimationOverlay( name: "walking", animType: SpriteAnimationType.LoopingAnimation, origin: SpriteOriginType.TopLeft, width: Props.PhysicalRect.Width, height: Props.PhysicalRect.Height, frames: 2, framerateMillisec: 100, yOffset: 20); animJetting = new AnimationOverlay( name: "jetting", animType: SpriteAnimationType.SingleFrame, origin: SpriteOriginType.TopLeft, width: Props.PhysicalRect.Width, height: Props.PhysicalRect.Height, frames: 1, framerateMillisec: 1, yOffset: 40); // Default anim animCurrent = animWalking; }
/// <summary> /// /// </summary> /// <param name="contentLoader"></param> /// <param name="name"></param> /// <returns></returns> public static IShaderProgram LoadPixelShader(this IContentLoader contentLoader, string name) { if (contentLoader == null) { throw new ArgumentNullException(nameof(contentLoader)); } var names = new string[] { "screenQuad.vert", name }; var fullNames = contentLoader.Names.GetFullNames(names); return(contentLoader.Load <IShaderProgram>(fullNames)); }
public DeferedVisual(IRenderState renderState, IContentLoader contentLoader) { this.renderState = renderState; deferedDataProgram = contentLoader.Load <IShaderProgram>(new string[] { "lambert.vert", "deferedData.frag" }); deferedProgram = contentLoader.LoadPixelShader("defered.frag"); //deferedProgram = contentLoader.Load<IShaderProgram>("lambert.*"); var mesh = Meshes.CreateCornellBox(); //TODO: ATI seams to do VAO vertex attribute ordering different for each shader would need to create own VAO geometry = VAOLoader.FromMesh(mesh, deferedDataProgram); }
public override void LoadContent(IContentLoader loader) { // Music if (MediaPlayer.State != MediaState.Playing) { MediaPlayer.Volume = Config.MusicVolume / 100f; MediaPlayer.IsRepeating = true; MediaPlayer.Play(loader.Load <Song>("Audio/Musics/menu")); } _logo = loader.Load <Texture2D>("Graphics/Pictures/logo"); _backgroundImage = loader.Load <Texture2D>("Graphics/Pictures/background"); if (_passSound == null) { _passSound = loader.Load <SoundEffect>(@"Audio/SE/pass"); } base.LoadContent(loader); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(new DepthTest(true)); renderState.Set(new FaceCullingModeState(FaceCullingMode.BACK_SIDE)); shaderProgram = contentLoader.Load <IShaderProgram>("shader.*"); var mesh = Meshes.CreateCornellBox(); geometry = VAOLoader.FromMesh(mesh, shaderProgram); bufferMaterials.Set(Meshes.CreateCornellBoxMaterial(), BufferUsageHint.StaticDraw); }
public Water(IContentLoader contentLoader) { waterMapShader = contentLoader.Load <IShaderProgram>("WaterMap.*"); mapFBO = new FBO(Texture2dGL.Create(256, 256, 4, true)); mapFBO.Attach(Texture2dGL.Create(256, 256, 4, true)); mapFBO.Textures[0].WrapFunction = TextureWrapFunction.MirroredRepeat; waveLayers = GetWaveLayer(); List <Wave> waveList = GetWaves(); numberOfWaves = waveList.Count; waveBuffer.Set(waveList.ToArray(), BufferUsageHint.StaticCopy); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { this.renderState = renderState; var shaderMaterial = contentLoader.Load <IShaderProgram>("material.*"); var plane = Meshes.CreatePlane(4, 4, 1, 1); meshVisuals.Add(new MeshVisual(plane, shaderMaterial)); var instanceMesh = contentLoader.Load <DefaultMesh>("suzanne").Transform(Transformation.Scale(0.03f)); var instanceData = CreateInstancePositionMaterial(20, 20); var suzanneInstances = VAOLoader.FromMesh(instanceMesh, shaderMaterial); suzanneInstances.SetAttribute(shaderMaterial.GetResourceLocation(ShaderResourceType.Attribute, nameof(instanceData)), instanceData, true); meshVisuals.Add(new MeshVisual(suzanneInstances, shaderMaterial)); var shaderLighting = contentLoader.Load <IShaderProgram>("lighting.*"); var lightMesh = Meshes.CreateSphere(1f, 2); // either make it bigger or you need good subdivision to avoid border artifacts var lightGeometry = VAOLoader.FromMesh(lightMesh, shaderLighting); lightGeometry.SetAttribute(shaderLighting.GetResourceLocation(ShaderResourceType.Attribute, "lightData"), instanceData, true); lightsVisual = new MeshVisual(lightGeometry, shaderLighting); }