void LoadDefaultTextures() { lightMat = new Material.PBRLight(); if (defaultBlack == null) { FloatBitmap black = new FloatBitmap(128, 128); Nodes.Helpers.Utils.Fill(black, 0, 0, 0f, 0f, 0f, 1); defaultBlack = new GLTextuer2D(PixelInternalFormat.Rgba8); defaultBlack.Bind(); defaultBlack.SetData(black.Image, GLInterfaces.PixelFormat.Rgba, 128, 128); defaultBlack.GenerateMipMaps(); defaultBlack.SetFilter((int)TextureMinFilter.LinearMipmapLinear, (int)TextureMagFilter.Linear); defaultBlack.SetWrap((int)TextureWrapMode.Repeat); GLTextuer2D.Unbind(); Materia.Nodes.Atomic.MeshNode.DefaultBlack = defaultBlack; } if (defaultWhite == null) { FloatBitmap black = new FloatBitmap(128, 128); Nodes.Helpers.Utils.Fill(black, 0, 0, 1f, 1f, 1f, 1); defaultWhite = new GLTextuer2D(PixelInternalFormat.Rgba8); defaultWhite.Bind(); defaultWhite.SetData(black.Image, GLInterfaces.PixelFormat.Rgba, 128, 128); defaultWhite.GenerateMipMaps(); defaultWhite.SetFilter((int)TextureMinFilter.LinearMipmapLinear, (int)TextureMagFilter.Linear); defaultWhite.SetWrap((int)TextureWrapMode.Repeat); GLTextuer2D.Unbind(); Materia.Nodes.Atomic.MeshNode.DefaultWhite = defaultWhite; } if (defaultGray == null) { FloatBitmap black = new FloatBitmap(128, 128); Nodes.Helpers.Utils.Fill(black, 0, 0, 0.5f, 0.5f, 0.5f, 1); defaultGray = new GLTextuer2D(PixelInternalFormat.Rgba8); defaultGray.Bind(); defaultGray.SetData(black.Image, GLInterfaces.PixelFormat.Rgba, 128, 128); defaultGray.GenerateMipMaps(); defaultGray.SetFilter((int)TextureMinFilter.LinearMipmapLinear, (int)TextureMagFilter.Linear); defaultGray.SetWrap((int)TextureWrapMode.Repeat); GLTextuer2D.Unbind(); } if (defaultDarkGray == null) { FloatBitmap black = new FloatBitmap(128, 128); Nodes.Helpers.Utils.Fill(black, 0, 0, 0.25f, 0.25f, 0.25f, 1); defaultDarkGray = new GLTextuer2D(PixelInternalFormat.Rgba8); defaultDarkGray.Bind(); defaultDarkGray.SetData(black.Image, GLInterfaces.PixelFormat.Rgba, 128, 128); defaultDarkGray.GenerateMipMaps(); defaultDarkGray.SetFilter((int)TextureMinFilter.LinearMipmapLinear, (int)TextureMagFilter.Linear); defaultDarkGray.SetWrap((int)TextureWrapMode.Repeat); GLTextuer2D.Unbind(); Materia.Nodes.Atomic.MeshNode.DefaultDarkGray = defaultDarkGray; } }
public void Release() { if (renderStack != null) { renderStack.Release(); renderStack = null; } if (materialSettings != null) { materialSettings.Save(); } if (lightMat != null) { lightMat.Release(); lightMat = null; } if (defaultBlack != null) { defaultBlack.Release(); defaultBlack = null; } if (defaultWhite != null) { defaultWhite.Release(); defaultWhite = null; } if (defaultGray != null) { defaultGray.Release(); defaultGray = null; } if (defaultDarkGray != null) { defaultDarkGray.Release(); defaultDarkGray = null; } HdriManager.Release(); if (tessMat != null) { tessMat.Release(); tessMat = null; } if (mat != null) { mat.Release(); mat = null; } if (sphere != null) { sphere.Release(); sphere = null; } if (cube != null) { cube.Release(); cube = null; } if (cylinder != null) { cylinder.Release(); cylinder = null; } if (cubeRounded != null) { cubeRounded.Release(); cubeRounded = null; } if (plane != null) { plane.Release(); plane = null; } if (custom != null) { custom.Release(); custom = null; } if (lightMesh != null) { lightMesh.Release(); lightMesh = null; } if (glview != null) { FHost.Child = null; glview.Dispose(); glview = null; } }