public override void cleanUp() { PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(ReflectionTexture); PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(RefractionTexture); PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(DepthTexture); base.cleanUp(); }
protected override void FreeShader() { PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <StaticEntityShader>, string, StaticEntityShader>(GetShader()); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <SpecialStaticEntityShader>, string, SpecialStaticEntityShader>(m_specialShader); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <WaterReflectionEntityShader>, string, WaterReflectionEntityShader>(m_liteReflectionShader); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <WaterRefractionEntityShader>, string, WaterRefractionEntityShader>(m_liteRefractionShader); }
public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("_normalsSmoothLvl", _normalsSmoothLvl); info.AddValue("_terrainMaterial", _terrainMaterial, typeof(MistComponent)); info.AddValue("_terrainMaterial", _terrainMaterial, typeof(Material)); string pathTexR = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_textureR); string pathTexG = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_textureR); string pathTexB = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_textureR); string pathTexBlack = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_textureR); string pathTexBlendMap = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_textureR); info.AddValue("pathTexR", pathTexR); info.AddValue("pathTexG", pathTexG); info.AddValue("pathTexB", pathTexB); info.AddValue("pathTexBlack", pathTexBlack); info.AddValue("pathTexBlendMap", pathTexBlendMap); info.AddValue("m_heightMapTexPath", m_heightMapTexPath); info.AddValue("MapSize", MapSize); info.AddValue("MaximumHeight", MaximumHeight); // normal map red channel bool bNormalR = _normalMapR != null; info.AddValue("bNormalR", bNormalR); if (bNormalR) { string pathTexNormalMapR = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_normalMapR); info.AddValue("pathTexNormalMapR", pathTexNormalMapR); } // normal map green channel bool bNormalG = _normalMapG != null; info.AddValue("bNormalG", bNormalG); if (bNormalG) { string pathTexNormalMapG = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_normalMapG); info.AddValue("pathTexNormalMapG", pathTexNormalMapG); } // normal map blue channel bool bNormalB = _normalMapB != null; info.AddValue("bNormalB", bNormalB); if (bNormalB) { string pathTexNormalMapB = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_normalMapB); info.AddValue("pathTexNormalMapB", pathTexNormalMapB); } // normal map black channel bool bNormalBlack = _normalMapBlack != null; info.AddValue("bNormalBlack", bNormalBlack); if (bNormalBlack) { string pathTexNormalMapBlack = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(_normalMapBlack); info.AddValue("pathTexNormalMapBlack", pathTexNormalMapBlack); } }
private void PostConstructor() { if (this.m_postConstructor) { float[,] vertices = new float[6, 3] { { -1.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, -1.0f }, { 1.0f, 0.0f, -1.0f }, { -1.0f, 0.0f, -1.0f }, { -1.0f, 0.0f, 1.0f } }; float[,] normals = new float[6, 3] { { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f } }; float[,] texCoords = new float[6, 2] { { 0, 1 }, { 1, 1 }, { 1, 0 }, { 1, 0 }, { 0, 0 }, { 0, 1 } }; VertexBufferObjectTwoDimension <float> verticesVBO = new VertexBufferObjectTwoDimension <float>(vertices, BufferTarget.ArrayBuffer, 0, 3, VertexBufferObjectBase.DataCarryFlag.Store); VertexBufferObjectTwoDimension <float> normalsVBO = new VertexBufferObjectTwoDimension <float>(normals, BufferTarget.ArrayBuffer, 1, 3, VertexBufferObjectBase.DataCarryFlag.Invalidate); VertexBufferObjectTwoDimension <float> texCoordsVBO = new VertexBufferObjectTwoDimension <float>(texCoords, BufferTarget.ArrayBuffer, 2, 2, VertexBufferObjectBase.DataCarryFlag.Invalidate); VertexBufferObjectTwoDimension <float> tangentsVBO = new VertexBufferObjectTwoDimension <float>(VectorMath.AdditionalVertexInfoCreator.CreateTangentVertices(vertices, texCoords), BufferTarget.ArrayBuffer, 3, 3, VertexBufferObjectBase.DataCarryFlag.Invalidate); VertexBufferObjectTwoDimension <float> bitangentsVBO = new VertexBufferObjectTwoDimension <float>(VectorMath.AdditionalVertexInfoCreator.CreateBitangentVertices(vertices, texCoords), BufferTarget.ArrayBuffer, 4, 3, VertexBufferObjectBase.DataCarryFlag.Invalidate); m_buffer = new VertexArrayObject(); m_buffer.AddVBO(verticesVBO, normalsVBO, texCoordsVBO, tangentsVBO, bitangentsVBO); m_buffer.BindBuffersToVao(); m_shader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <WaterShader>, string, WaterShader>(ProjectFolders.ShadersPath + "waterVS.glsl" + "," + ProjectFolders.ShadersPath + "waterFS.glsl"); m_stencilPassShader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <StencilPassShader>, string, StencilPassShader>(ProjectFolders.ShadersPath + "stencilPassVS.glsl" + "," + ProjectFolders.ShadersPath + "stencilPassFS.glsl"); this.m_fbo = new WaterFBO(); this.m_postConstructor = !this.m_postConstructor; } }
public override void cleanUp() { PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(VerticalBlurTexture); PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(HorizontalBlurTexture); PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(DepthOfFieldResultTexture); base.cleanUp(); }
public void cleanUp() { PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_texture1); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_texture2); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <SunShader>, string, SunShader>(this.m_shader); m_buffer.CleanUp(); }
public void cleanUp() { PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <SkyboxShader>, string, SkyboxShader>(m_shader); m_buffer.CleanUp(); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_skyboxDayTexture); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_skyboxNightTexture); }
private void InitResources(string texture1, string texture2) { float[,] vertices = new float[6, 3] { { -(SUN_SIZE / 2), SUN_SIZE / 2, 0.0f }, { -(SUN_SIZE / 2), -(SUN_SIZE / 2), 0.0f }, { SUN_SIZE / 2, -(SUN_SIZE / 2), 0.0f }, { SUN_SIZE / 2, -(SUN_SIZE / 2), 0.0f }, { SUN_SIZE / 2, SUN_SIZE / 2, 0.0f }, { -(SUN_SIZE / 2), SUN_SIZE / 2, 0.0f } }; float[,] normals = new float[6, 3] { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 } }; float[,] texCoords = new float[6, 2] { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 1, 1 }, { 0, 1 }, { 0, 0 } }; VertexBufferObjectTwoDimension <float> verticesVBO = new VertexBufferObjectTwoDimension <float>(vertices, BufferTarget.ArrayBuffer, 0, 3, VertexBufferObjectBase.DataCarryFlag.Invalidate); VertexBufferObjectTwoDimension <float> normalsVBO = new VertexBufferObjectTwoDimension <float>(normals, BufferTarget.ArrayBuffer, 1, 3, VertexBufferObjectBase.DataCarryFlag.Invalidate); VertexBufferObjectTwoDimension <float> texCoordsVBO = new VertexBufferObjectTwoDimension <float>(texCoords, BufferTarget.ArrayBuffer, 2, 2, VertexBufferObjectBase.DataCarryFlag.Invalidate); m_buffer = new VertexArrayObject(); m_buffer.AddVBO(verticesVBO, normalsVBO, texCoordsVBO); m_buffer.BindBuffersToVao(); m_shader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <SunShader>, string, SunShader>(ProjectFolders.ShadersPath + "sunVS.glsl" + "," + ProjectFolders.ShadersPath + "sunFS.glsl"); m_texture1 = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(texture1); m_texture2 = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(texture2); m_quadLBZ = new Vector4((-SUN_SIZE / 2), (-SUN_SIZE / 2), 0.0f, 1.0f); m_quadRTZ = new Vector4((SUN_SIZE / 2), (SUN_SIZE / 2), 0.0f, 1.0f); }
private void PostConstructor() { if (m_bPostConstructor) { m_shader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <SkyboxShader>, string, SkyboxShader>(ProjectFolders.ShadersPath + "skyboxVS.glsl" + "," + ProjectFolders.ShadersPath + "skyboxFS.glsl"); float[,] vertices = new float[6 * 6, 3] { { -SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, SKYBOX_SIZE }, { -SKYBOX_SIZE, SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, -SKYBOX_SIZE }, { -SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE }, { SKYBOX_SIZE, -SKYBOX_SIZE, SKYBOX_SIZE } }; VertexBufferObjectTwoDimension <float> verticesVBO = new VertexBufferObjectTwoDimension <float>(vertices, BufferTarget.ArrayBuffer, 0, 3, VertexBufferObjectBase.DataCarryFlag.Invalidate); m_buffer = new VertexArrayObject(); m_buffer.AddVBO(verticesVBO); m_buffer.BindBuffersToVao(); m_bPostConstructor = !m_bPostConstructor; } }
public static ITexture CopyTexture(ITexture src) { ITexture dst = PoolProxy.GetResource <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(src.GetTextureParameters()); var renderTarget = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, renderTarget); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, src.GetTextureParameters().TexTarget, dst.GetTextureDescriptor(), 0); GL.DrawBuffer(DrawBufferMode.ColorAttachment0); //GL.Disable(EnableCap.DepthTest); GL.Viewport(0, 0, src.GetTextureRezolution().X, src.GetTextureRezolution().Y); // start copy texture to render target copyShader.startProgram(); src.BindTexture(TextureUnit.Texture0); copyShader.SetUniformValues(0); var quadBuffer = ScreenQuad.GetScreenQuadBuffer(); quadBuffer.RenderVAO(PrimitiveType.Triangles); copyShader.stopProgram(); GL.Enable(EnableCap.DepthTest); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); GL.DeleteFramebuffer(renderTarget); return(dst); }
public EnvironmentEntities(string modelPath, string texturePath, string normalMapPath, string specularMapPath, string[] cubemapEnvMap, Vector3 translation = new Vector3(), Vector3 rotation = new Vector3(), Vector3 scale = new Vector3()) : base(modelPath, texturePath, normalMapPath, specularMapPath, translation, rotation, scale) { this.m_envMap = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(cubemapEnvMap[0] + "," + cubemapEnvMap[1] + "," + cubemapEnvMap[2] + "," + cubemapEnvMap[3] + "," + cubemapEnvMap[4] + "," + cubemapEnvMap[5]); }
public WaterPlane(string distortionMap, string normalMap, Vector3 translation, Vector3 rotation, Vector3 scaling, WaterQuality quality, Int32 frustumSquares = 0) { m_waterDistortionMap = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(distortionMap); m_waterNormalMap = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(normalMap); m_frustumSquares = frustumSquares; m_translation = translation; m_rotation = rotation; m_scaling = scaling; /*Nominal water coords*/ m_moveFactor = 0.0f; m_waveSpeed = 0.1f; m_waveStrength = 0.04f; m_transparencyDepth = 10000f; /*First pass post constructor*/ this.m_postConstructor = true; this.Quality = quality; m_collisionCheckPoints = null; m_modelMatrix = Matrix4.Identity; m_modelMatrix *= Matrix4.CreateRotationX(MathHelper.DegreesToRadians(m_rotation.X)); m_modelMatrix *= Matrix4.CreateRotationY(MathHelper.DegreesToRadians(m_rotation.Y)); m_modelMatrix *= Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(m_rotation.Z)); m_modelMatrix *= Matrix4.CreateScale(m_scaling); m_modelMatrix *= Matrix4.CreateTranslation(m_translation); InitPhysics(); }
public void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix) { if (bPostConstructor) { shader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <SkyboxShader>, string, SkyboxShader>(String.Format("{0}{1},{0}{2}", ProjectFolders.ShadersPath, "skyboxVS.glsl", "skyboxFS.glsl")); model = new RawModel(attribs); cubemap = ProxyTextureLoader.LoadCubemap(new string[] { ProjectFolders.SkyboxTexturesPath + "/Day/" + "right.bmp", ProjectFolders.SkyboxTexturesPath + "/Day/" + "left.bmp", ProjectFolders.SkyboxTexturesPath + "/Day/" + "top.bmp", ProjectFolders.SkyboxTexturesPath + "/Day/" + "bottom.bmp", ProjectFolders.SkyboxTexturesPath + "/Day/" + "back.bmp", ProjectFolders.SkyboxTexturesPath + "/Day/" + "front.bmp" }); bPostConstructor = false; } shader.startProgram(); cubemap.BindTexture(OpenTK.Graphics.OpenGL.TextureUnit.Texture0); shader.SetTransformationMatrices(Matrix4.Identity, viewMatrix, projectionMatrix); shader.SetCubemap(0); VAOManager.renderBuffers(model.Buffer, OpenTK.Graphics.OpenGL.PrimitiveType.Triangles); shader.stopProgram(); }
public void cleanUp() { PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <LandscapeShader>, string, LandscapeShader>(_shader); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <WaterReflectionTerrainShader>, string, WaterReflectionTerrainShader>(liteReflectionShader); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <WaterRefractionTerrainShader>, string, WaterRefractionTerrainShader>(liteRefractionShader); _buffer.CleanUp(); if (_normalMapR != null) { PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_normalMapR); } if (_normalMapG != null) { PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_normalMapG); } if (_normalMapB != null) { PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_normalMapB); } if (_normalMapBlack != null) { PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_normalMapBlack); } PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_textureBlack); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_textureR); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_textureG); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_textureB); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(_blendMap); }
public void CleanUp() { m_buffer?.CleanUp(); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_waterDistortionMap); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_waterNormalMap); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <WaterShader>, string, WaterShader>(m_shader); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <StencilPassShader>, string, StencilPassShader>(m_stencilPassShader); }
public override void cleanUp() { PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(verticalBlurTexture); PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(horizontalBlurTexture); PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(frameTextureLowRezolution); PoolProxy.FreeResourceMemory <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(lensFlareResultTexture); base.cleanUp(); }
public virtual void CleanUp() { PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_texture); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_normalMap); PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(m_specularMap); PoolProxy.FreeResourceMemory <ObtainModelPool, ModelAllocationPolicy, string, Skin>(m_skin); FreeShader(); }
public void GetObjectData(SerializationInfo info, StreamingContext context) { string dayTexturesPath = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(m_skyboxDayTexture); string nightTexturesPath = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(m_skyboxNightTexture); info.AddValue("m_skyboxDayTexture", dayTexturesPath); info.AddValue("m_skyboxNightTexture", nightTexturesPath); info.AddValue("FloatSpeed", FloatSpeed); }
private void InitResources(string modelPath, string texturePath, string normalMapPath, string specularMapPath) { m_lightVisibilityMap = new BoolMap(); m_texture = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(texturePath); m_normalMap = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(normalMapPath); m_specularMap = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(specularMapPath); m_skin = PoolProxy.GetResource <ObtainModelPool, ModelAllocationPolicy, string, Skin>(modelPath); InitShader(); }
protected override void setTextures() { RadialBlurAppliedTexture = PoolProxy.GetResource <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(new TextureParameters(TextureTarget.Texture2D, TextureMagFilter.Linear, TextureMinFilter.Linear, 0, PixelInternalFormat.Rgb, EngineStatics.globalSettings.DomainFramebufferRezolution.X / 10, EngineStatics.globalSettings.DomainFramebufferRezolution.Y / 10, PixelFormat.Rgb, PixelType.UnsignedByte, TextureWrapMode.Repeat)); LightShaftsResultTexture = PoolProxy.GetResource <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(new TextureParameters(TextureTarget.Texture2D, TextureMagFilter.Nearest, TextureMinFilter.Nearest, 0, PixelInternalFormat.Rgb, EngineStatics.globalSettings.DomainFramebufferRezolution.X, EngineStatics.globalSettings.DomainFramebufferRezolution.Y, PixelFormat.Rgb, PixelType.UnsignedByte, TextureWrapMode.Repeat)); }
private void Init(string[] dayTextures, string[] nightTextures) { m_moveFactor = 0.0f; m_skyboxDayTexture = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(dayTextures[0] + "," + dayTextures[1] + "," + dayTextures[2] + "," + dayTextures[3] + "," + dayTextures[4] + "," + dayTextures[5]); m_skyboxNightTexture = PoolProxy.GetResource <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(nightTextures[0] + "," + nightTextures[1] + "," + nightTextures[2] + "," + nightTextures[3] + "," + nightTextures[4] + "," + nightTextures[5]); m_bPostConstructor = true; }
private void postConstructor() { if (bPostConstructor) { renderTarget = new LightShaftFramebufferObject(); shader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <LightShaftShader <SubsequenceType> >, string, LightShaftShader <SubsequenceType> >(ProjectFolders.ShadersPath + "lightShaftsVS.glsl" + "," + ProjectFolders.ShadersPath + "lightShaftsFS.glsl"); bPostConstructor = false; } }
private void OnKeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { #region In-game settings case Keys.R: { break; } case Keys.M: { if (EngineStatics.Mode == PrimitiveType.Triangles) { EngineStatics.Mode = PrimitiveType.Lines; } else { EngineStatics.Mode = PrimitiveType.Triangles; } break; } case Keys.Escape: this.Close(); break; //Exit case Keys.Add: { GameWorld.GetWorldInstance().GetLevel().Water.GetData().WaveSpeed += 0.1f; GameWorld.GetWorldInstance().GetLevel().Water.GetData().WaveStrength += 0.1f; break; } case Keys.Subtract: { GameWorld.GetWorldInstance().GetLevel().Water.GetData().WaveSpeed -= 0.1f; GameWorld.GetWorldInstance().GetLevel().Water.GetData().WaveStrength -= 0.1f; break; } case Keys.Insert: { GameWorld.GetWorldInstance().GetUiFrameCreator().PushFrame((new ObtainRenderTargetPool().GetPool() as RenderTargetPool).GetRenderTargetAt(renderTargetIndex)); Int32 count = PoolProxy.GetResourceCountInPool <ObtainRenderTargetPool>(); if (renderTargetIndex + 1 >= count) { renderTargetIndex = 0; } else { ++renderTargetIndex; } break; } #endregion } }
public void cleanUp() { _plants.Clear(); VAOManager.cleanUp(_buffer); PoolProxy.FreeResourceMemory <ObtainShaderPool, ShaderAllocationPolicy <PlantShader>, string, PlantShader>(_shader); foreach (var item in _texture) { PoolProxy.FreeResourceMemory <ObtainTexturePool, TextureAllocationPolicy, string, ITexture>(item); } }
private void PostConstructor() { if (_postConstructor) { _buffer = ScreenQuad.GetScreenQuadBuffer(); _shader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <UiFrameShader>, string, UiFrameShader>(ProjectFolders.ShadersPath + "uiVS.glsl," + ProjectFolders.ShadersPath + "uiFS.glsl"); _postConstructor = false; } }
private void PostConstructor() { if (bPostConstructor) { renderTarget = new DepthOfFieldFramebufferObject(); dofShader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <DepthOfFieldShader <SubsequenceType> >, string, DepthOfFieldShader <SubsequenceType> >(ProjectFolders.ShadersPath + "depthOfFieldVS.glsl" + "," + ProjectFolders.ShadersPath + "depthOfFieldFS.glsl"); bPostConstructor = false; } }
private bool TryLoadAnimation(string modelPath) { if (m_skin as AnimatedSkin == null) { throw new ArgumentException("Mesh that is loaded doesn't support animation."); } m_animations = PoolProxy.GetResource <ObtainAnimationPool, AnimationAllocationPolicy, string, List <AnimationSequence> >(modelPath); return(true); }
private void postConstructor(Landscape terrain = null) { if (this._postConstructor) { if (_shader == null) { _shader = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <PlantShader>, string, PlantShader>(ProjectFolders.ShadersPath + "plantVertexShader.glsl" + "," + ProjectFolders.ShadersPath + "plantFragmentShader.glsl"); } this._postConstructor = false; } }
public void GetObjectData(SerializationInfo info, StreamingContext context) { string pathToTexture1 = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(m_texture1); string pathToTexture2 = PoolProxy.GetResourceKey <ObtainTexturePool, string, ITexture>(m_texture2); info.AddValue("pathToTexture1", pathToTexture1); info.AddValue("pathToTexture2", pathToTexture2); info.AddValue("lensFlareSunSize", LENS_FLARE_SUN_SIZE); info.AddValue("sunSize", SUN_SIZE); info.AddValue("lensFlareSizeToSunSize", LENS_FLARE_SIZE_TO_SUN_SIZE); }
protected override void setTextures() { /*Create 3 textures : * 1 - for reflection * 2 - for refraction * 3 - for depth*/ ReflectionTexture = PoolProxy.GetResource <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(new TextureParameters(TextureTarget.Texture2D, TextureMagFilter.Nearest, TextureMinFilter.Nearest, 0, PixelInternalFormat.Rgb, (Int32)(EngineStatics.globalSettings.DomainFramebufferRezolution.X / 1.5), (Int32)(EngineStatics.globalSettings.DomainFramebufferRezolution.Y / 1.5), PixelFormat.Rgb, PixelType.UnsignedByte, TextureWrapMode.Repeat)); RefractionTexture = PoolProxy.GetResource <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(new TextureParameters(TextureTarget.Texture2D, TextureMagFilter.Nearest, TextureMinFilter.Nearest, 0, PixelInternalFormat.Rgb, (Int32)(EngineStatics.globalSettings.DomainFramebufferRezolution.X / 1.5), (Int32)(EngineStatics.globalSettings.DomainFramebufferRezolution.Y / 1.5), PixelFormat.Rgb, PixelType.UnsignedByte, TextureWrapMode.Repeat)); DepthTexture = PoolProxy.GetResource <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(new TextureParameters(TextureTarget.Texture2D, TextureMagFilter.Nearest, TextureMinFilter.Nearest, 0, PixelInternalFormat.Depth24Stencil8, (Int32)(EngineStatics.globalSettings.DomainFramebufferRezolution.X / 1.5f), (Int32)(EngineStatics.globalSettings.DomainFramebufferRezolution.Y / 1.5f), PixelFormat.DepthComponent, PixelType.Float, TextureWrapMode.Repeat)); }