public XvrImageParameters(int width, int height, PsuTextureType texType, bool hasMips = false, PsuTexturePixelFormat format = PsuTexturePixelFormat.Argb8888) { startingOffset = 0x20; this.width = width; this.height = height; pixelFormat = format.ToRawValue(); pixelFlags = (byte)(texType.ToRawValue() | (hasMips ? 1 : 0)); this.width = width; this.height = height; maxV = (int)(Math.Log(width - 1, 2)); maxU = (int)(Math.Log(height - 1, 2)); maximumMips = Math.Min(maxU, maxV); }
public static XvrRasterEncoder GetEncoder(PsuTextureType texType, PsuTexturePixelFormat pixelFormat) { switch (texType) { case PsuTextureType.Raster: return(new XvrSimpleFormatEncoder(pixelFormat)); /* * case PsuTextureType.Dxt1: return new DxtnDecoder(parameters.PixelFormat); * case PsuTextureType.Dxt2: return new Dxt2Decoder(parameters.PixelFormat); * case PsuTextureType.Dxt3: return new Dxt3Decoder(parameters.PixelFormat); * case PsuTextureType.Dxt4: return new Dxt4Decoder(parameters.PixelFormat); * case PsuTextureType.Dxt5: return new Dxt5Decoder(parameters.PixelFormat);*/ default: throw new Exception("Invalid texture format " + texType); } }
public static byte ToRawValue(this PsuTextureType format) { switch (format) { case PsuTextureType.Raster: return(0x70); case PsuTextureType.Dxt1: return(0x73); case PsuTextureType.Dxt2: return(0x75); case PsuTextureType.Dxt3: return(0x77); case PsuTextureType.Dxt4: return(0x79); case PsuTextureType.Dxt5: return(0x7B); } return(0x70); }