本文整理汇总了C++中texture::get_largest_dimension方法的典型用法代码示例。如果您正苦于以下问题:C++ texture::get_largest_dimension方法的具体用法?C++ texture::get_largest_dimension怎么用?C++ texture::get_largest_dimension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类texture
的用法示例。
在下文中一共展示了texture::get_largest_dimension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gen_miplevel
void gen_miplevel(texture &tex, texture &gen) ///call from main mem_alloc func?
{
int size=tex.get_largest_dimension();
int newsize=size >> 1;
gen.c_image.create(newsize, newsize);
for(int i=0; i<newsize; i++)
{
for(int j=0; j<newsize; j++)
{
sf::Color p4[4];
p4[0]=tex.c_image.getPixel(i*2, j*2);
p4[1]=tex.c_image.getPixel(i*2+1, j*2);
p4[2]=tex.c_image.getPixel(i*2, j*2+1);
p4[3]=tex.c_image.getPixel(i*2+1, j*2+1);
sf::Color m=pixel4(p4[0], p4[1], p4[2], p4[3]);
gen.c_image.setPixel(i, j, m);
}
}
}
示例2: add_texture
void add_texture(texture &tex, int &newid)
{
int size=tex.get_largest_dimension();
int num=0;
cl_uchar4 *firstfree=return_first_free(size, num);
sf::Image *T=&tex.c_image;
texture_array_descriptor *Td=&obj_mem_manager::tdescrip;
int which = Td->texture_nums[num];
int blockalongy = which / (max_tex_size/size);
int blockalongx = which % (max_tex_size/size);
int ti=0, tj=0;
for(int i=blockalongx*size; i<(blockalongx+1)*size; i++)
{
for(int j=blockalongy*size; j<(blockalongy+1)*size; j++)
{
sf::Color c=T->getPixel(ti, tj);
setpixel(firstfree, c, i, j, max_tex_size, max_tex_size);
tj++;
}
ti++;
tj=0;
}
///so, num represents which slice its in
///Td->texture_nums[i] represents which position it is in within the slice;
int mod=(num << 16) | Td->texture_nums[num];
newid=mod;
///so, now the upper half represents which slice its in, and the lower half, the number within the slice
obj_mem_manager::tdescrip.texture_nums[num]++;
}