public bool LoadCSI(byte[] csi_data, uint csi_width, uint csi_height) { var surface = new RenderSurface(); // RenderDevice.CreateSurface surface.Create(csi_width, csi_height, SurfacePixelFormat.PFID_X8R8G8B8, true); ImageData = surface; var tempBuffer = GetTempBuffer(csi_width, csi_height, SurfacePixelFormat.PFID_X8R8G8B8); //var data = tempBuffer.GetData(); tempBuffer.CSI2TGA(csi_data, csi_width, csi_height, ImageData.Data, csi_width, csi_height, tempBuffer.Pitch); Load(ImageData.Data, csi_width, tempBuffer); // loads onto gpu? return(true); }
public ImgTex(SurfaceTexture surfaceTexture) { _surfaceTexture = surfaceTexture; if (surfaceTexture.Textures == null || surfaceTexture.Textures.Count < 1) { Console.WriteLine($"ImgTex({surfaceTexture.Id:X8}): no textures"); return; } ID = _surfaceTexture.Id; var textureID = TextureCode = surfaceTexture.Textures[0]; // use texturecode here? //Console.WriteLine($"Loading texture {textureID:X8}"); var renderSurface = DatManager.PortalDat.ReadFromDat <Texture>(textureID); ImageData = new RenderSurface(renderSurface); }