/// <summary> /// lataa skybox (ei cubemap). skyName on nimen alkuosa eli esim plainsky_ jos tiedostot on plainsky_front.jpg, plainsky_back.jpg jne /// ext on tiedoston pääte eli esim jpg, dds /// </summary> public static Sky Load(string skyName, string ext) { Sky sky = new Sky(); string[] sideStr = { "top", "bottom", "left", "right", "front", "back" }; Node skyNode = new Node(); DotScene ds = DotScene.Load("sky/sky.scene", skyNode); int side = 0; TextureLoaderParameters.WrapModeS = TextureWrapMode.ClampToEdge; TextureLoaderParameters.WrapModeT = TextureWrapMode.ClampToEdge; TextureLoaderParameters.FlipImages = false; skyNode.GetList(true); for (int q = 0; q < ObjList.Count; q++) { OgreMesh m = ObjList[q] as OgreMesh; if (m != null) { sky.skyboxSides[side] = m; m.Boundings = null; m.CastShadow = false; string fileName = skyName + sideStr[side] + "." + ext; m.MaterialName = fileName; m.Material = Material.GetMaterial(fileName + "_material"); m.Material.Textures[Settings.COLOR_TEXUNIT].Tex = Texture.Load(m.MaterialName); side++; } } TextureLoaderParameters.FlipImages = true; TextureLoaderParameters.WrapModeS = TextureWrapMode.Repeat; TextureLoaderParameters.WrapModeT = TextureWrapMode.Repeat; return sky; }
public virtual void Dispose() { if (font != null) font.Dispose(); if (colorFBO != null) colorFBO.Dispose(); if (depthFBO != null) depthFBO.Dispose(); if (skybox != null) skybox.Dispose(); skybox = null; colorFBO = null; depthFBO = null; font = null; world = null; Node.ObjectCount = 0; GLSLShader.UnBindShader(); GLSLShader.SetShader("default.shader", ""); }