91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 378KB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-24
  • 語(yǔ)言: 其他
  • 標(biāo)簽: SOIL.h??SOIL.c??libSOIL.a??

資源簡(jiǎn)介

libSOIL.a SOIL.h SOIL.c SOIL是簡(jiǎn)易OpenGL圖像庫(kù)(Simple OpenGL Image Library)的縮寫(xiě),它支持大多數(shù)流行的圖像格式,并且使用簡(jiǎn)單。

資源截圖

代碼片段和文件信息

/*
Jonathan?Dummer
2007-07-31-10.32

simple?DXT?compression?/?decompression?code

public?domain
*/

#include?“image_DXT.h“
#include?
#include?
#include?
#include?

/* set?this?=1?if?you?want?to?use?the?covarince?matrix?method...
which?is?better?than?my?method?of?using?standard?deviations
overall?except?on?the?infintesimal?chance?that?the?power
method?fails?for?finding?the?largest?eigenvector */
#define?USE_COV_MAT 1

/*********?Function?Prototypes?*********/
/*
Takes?a?4x4?block?of?pixels?and?compresses?it?into?8?bytes
in?DXT1?format?(color?only?no?alpha).??Speed?is?valued
over?prettyness?at?least?for?now.
*/
void?compress_DDS_color_block(
int?channels
const?unsigned?char?*const?uncompressed
unsigned?char?compressed[8]?);
/*
Takes?a?4x4?block?of?pixels?and?compresses?the?alpha
component?it?into?8?bytes?for?use?in?DXT5?DDS?files.
Speed?is?valued?over?prettyness?at?least?for?now.
*/
void?compress_DDS_alpha_block(
const?unsigned?char?*const?uncompressed
unsigned?char?compressed[8]?);

/*********?Actual?Exposed?Functions?*********/
int
save_image_as_DDS

const?char?*filename
int?width?int?height?int?channels
const?unsigned?char?*const?data

{
/* variables */
FILE?*fout;
unsigned?char?*DDS_data;
DDS_header?header;
int?DDS_size;
/* error?check */
if(?(NULL?==?filename)?||
(width? (channels??4)?||
(data?==?NULL?)?)
{
return?0;
}
/* Convert?the?image */
if(?(channels?&?1)?==?1?)
{
/* no?alpha?just?use?DXT1 */
DDS_data?=?convert_image_to_DXT1(?data?width?height?channels?&DDS_size?);
}?else
{
/* has?alpha?so?use?DXT5 */
DDS_data?=?convert_image_to_DXT5(?data?width?height?channels?&DDS_size?);
}
/* save?it */
memset(?&header?0?sizeof(?DDS_header?)?);
header.dwMagic?=?(‘D‘?< header.dwSize?=?124;
header.dwFlags?=?DDSD_CAPS?|?DDSD_HEIGHT?|?DDSD_WIDTH?|?DDSD_PIXELFORMAT?|?DDSD_LINEARSIZE;
header.dwWidth?=?width;
header.dwHeight?=?height;
header.dwPitchOrLinearSize?=?DDS_size;
header.sPixelFormat.dwSize?=?32;
header.sPixelFormat.dwFlags?=?DDPF_FOURCC;
if(?(channels?&?1)?==?1?)
{
header.sPixelFormat.dwFourCC?=?(‘D‘?< }?else
{
header.sPixelFormat.dwFourCC?=?(‘D‘?< }
header.sCaps.dwCaps1?=?DDSCAPS_TEXTURE;
/* write?it?out */
fout?=?fopen(?filename?“wb“);
fwrite(?&header?sizeof(?DDS_header?)?1?fout?);
fwrite(?DDS_data?1?DDS_size?fout?);
fclose(?fout?);
/* done */
free(?DDS_data?);
return?1;
}

unsigned?char*?convert_image_to_DXT1(
const?unsigned?char?*const?uncompressed
int?width?int?height?int?channels
int?*out_size?)
{
unsigned?char?*compressed;
int?i?j?x?y;
unsigned?char?ublock[16*3];
unsigned?cha

評(píng)論

共有 條評(píng)論

相關(guān)資源