示例#1
0
        private SiliconStudio.Paradox.Graphics.PixelFormat RetrieveFormatFromNativeData(PVRTextureHeader header)
        {
            SiliconStudio.Paradox.Graphics.PixelFormat format = header.GetFormat();
            if (format == SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_Float)
            {
                switch (header.GetChannelType())
                {
                    case EPVRTVariableType.ePVRTVarTypeFloat:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_Float;
                    case EPVRTVariableType.ePVRTVarTypeUnsignedInteger:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_UInt;
                    case EPVRTVariableType.ePVRTVarTypeSignedInteger:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_SInt;
                }
            }
            else if(format == SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UNorm)
            {
                switch (header.GetChannelType())
                {
                    case EPVRTVariableType.ePVRTVarTypeUnsignedShortNorm:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UNorm;
                    case EPVRTVariableType.ePVRTVarTypeUnsignedShort:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UInt;
                    case EPVRTVariableType.ePVRTVarTypeSignedShortNorm:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SNorm;
                    case EPVRTVariableType.ePVRTVarTypeSignedShort:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SInt;
                }
            }
            else if(format == SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm)
            {
                switch (header.GetChannelType())
                {
                    case EPVRTVariableType.ePVRTVarTypeUnsignedByteNorm:
                        {
                            if (header.GetColourSpace() == EPVRTColourSpace.ePVRTCSpacelRGB)
                                return SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm;
                            else
                                return SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb;
                        }
                    case EPVRTVariableType.ePVRTVarTypeUnsignedByte:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UInt;
                    case EPVRTVariableType.ePVRTVarTypeSignedByteNorm:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SNorm;
                    case EPVRTVariableType.ePVRTVarTypeSignedByte:
                        return SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SInt;
                }
            }

            return format;
        }