//----------------------------------------------------------------------- public void ILUtil.FromAxiom(PixelBox src) { // ilTexImage http://openil.sourceforge.net/docs/il/f00059.htm ILFormat ifmt = OgreFormat2ilFormat(src.format); if (src.isConsecutive() && ifmt.isValid()) { // The easy case, the buffer is laid out in memory just like // we want it to be and is in a format DevIL can understand directly // We could even save the copy if DevIL would let us Il.ilTexImage(src.Width, src.Height, src.Depth, ifmt.numberOfChannels, ifmt.format, ifmt.type, src.data); } else if (ifmt.isValid()) { // The format can be understood directly by DevIL. The only // problem is that ilTexImage expects our image data consecutively // so we cannot use that directly. // Let DevIL allocate the memory for us, and copy the data consecutively // to its memory ilTexImage(static_cast <ILuint>(src.getWidth()), static_cast <ILuint>(src.getHeight()), static_cast <ILuint>(src.getDepth()), ifmt.numberOfChannels, ifmt.format, ifmt.type, 0); PixelBox dst(src.getWidth(), src.getHeight(), src.getDepth(), src.format, ilGetData()); PixelUtil::bulkPixelConversion(src, dst); } else { // Here it gets ugly. We're stuck with a pixel format that DevIL // can't do anything with. We will do a bulk pixel conversion and // then feed it to DevIL anyway. The problem is finding the best // format to convert to. // most general format supported by OGRE and DevIL PixelFormat fmt = PixelUtil::hasAlpha(src.format)?PF_FLOAT32_RGBA:PF_FLOAT32_RGB; // Make up a pixel format // We don't have to consider luminance formats as they have // straight conversions to DevIL, just weird permutations of RGBA an LA int depths[4];