public override object Load(LoadedAsset asset) { string text = ""; StreamReader reader = new StreamReader(asset.Data); text = reader.ReadToEnd(); reader.Close(); return text; }
public override object Load(LoadedAsset asset) { string text = ""; StreamReader reader = new StreamReader(asset.Data); text = reader.ReadToEnd(); reader.Close(); return(text); }
public override object Load(LoadedAsset asset) { string shaderText = ""; StreamReader reader = new StreamReader(asset.Data); string res = ApexEngine.Rendering.Util.ShaderUtil.FormatShaderIncludes(asset.FilePath, reader.ReadToEnd()); reader.Close(); return(res); }
public static object Load(string filePath, AssetLoader loader) { // object alreadyLoaded = null; // if (loadedAssets.TryGetValue(filePath, out alreadyLoaded)) // { // return alreadyLoaded; // } if (!System.IO.File.Exists(filePath)) throw new System.IO.FileNotFoundException("The file \"" + filePath + "\" does not exist!"); loader.ResetLoader(); Stream stream = new FileStream(filePath, FileMode.Open); LoadedAsset asset = new LoadedAsset(stream, filePath); object loaded = loader.Load(asset); stream.Close(); // loadedAssets.Add(filePath, loaded); return loaded; }
public override object Load(LoadedAsset asset) { return(RenderManager.Renderer.LoadAudio(asset)); }
public override Texture2D LoadTexture2D(LoadedAsset asset) { Bitmap bmp = null; if (asset.FilePath.EndsWith(".tga")) { bmp = ApexEngine.Assets.Util.TargaImage.LoadTargaImage(asset.Data); } else bmp = new Bitmap(asset.Data); BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Texture2D tex = new Texture2D(Texture.GenTextureID()); tex.TexturePath = asset.FilePath; tex.Use(); tex.SetWrap(Convert.ToInt32(TextureWrapMode.Repeat), Convert.ToInt32(TextureWrapMode.Repeat)); tex.SetFilter((int)TextureMinFilter.LinearMipmapLinear, (int)TextureMagFilter.Linear); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, bmp_data.Width, bmp_data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0); tex.GenerateMipmap(); tex.Width = bmp.Width; tex.Height = bmp.Height; bmp.UnlockBits(bmp_data); Texture2D.Clear(); return tex; }
public override Sound LoadAudio(LoadedAsset asset) { Sound sound = new Sound(); if (openALSupported) { int buffer = AL.GenBuffer(); int source = AL.GenSource(); int state; if (asset.FilePath.EndsWith("wav")) { // Load wav int channels, bits_per_sample, sample_rate; byte[] wavData = LoadWave(asset.Data, out channels, out bits_per_sample, out sample_rate); AL.BufferData(buffer, GetSoundFormat(channels, bits_per_sample), wavData, wavData.Length, sample_rate); AL.Source(source, ALSourcei.Buffer, buffer); sound.Source = source; sound.Buffer = buffer; } } return sound; }
public override object Load(LoadedAsset asset) { return(Rendering.Texture.LoadTexture(asset)); }
public abstract object Load(LoadedAsset asset);
public static Texture LoadTexture(LoadedAsset asset) { return RenderManager.Renderer.LoadTexture2D(asset); }
/// <summary> /// Load a 2D texture /// </summary> /// <param name="n"></param> /// <param name="textures"></param> public abstract Texture2D LoadTexture2D(LoadedAsset asset);
public abstract Sound LoadAudio(LoadedAsset asset);
public override object Load(LoadedAsset asset) { return Rendering.Texture.LoadTexture(asset); }
public override object Load(LoadedAsset asset) { return RenderManager.Renderer.LoadAudio(asset); }