当前位置: 首页>>代码示例>>C++>>正文


C++ Texture::Depth方法代码示例

本文整理汇总了C++中Texture::Depth方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::Depth方法的具体用法?C++ Texture::Depth怎么用?C++ Texture::Depth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Texture的用法示例。


在下文中一共展示了Texture::Depth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: other

	void D3D11Texture3D::CopyToTexture(Texture& target)
	{
		BOOST_ASSERT(type_ == target.Type());

		D3D11Texture3D& other(*checked_cast<D3D11Texture3D*>(&target));

		if ((this->Width(0) == target.Width(0)) && (this->Height(0) == target.Height(0))
			&& (this->Depth(0) == target.Depth(0)) && (this->Format() == target.Format())
			&& (this->NumMipMaps() == target.NumMipMaps()))
		{
			d3d_imm_ctx_->CopyResource(other.D3DTexture().get(), d3dTexture3D_.get());
		}
		else
		{
			uint32_t const array_size = std::min(this->ArraySize(), target.ArraySize());
			uint32_t const num_mips = std::min(this->NumMipMaps(), target.NumMipMaps());
			for (uint32_t index = 0; index < array_size; ++ index)
			{
				for (uint32_t level = 0; level < num_mips; ++ level)
				{
					this->ResizeTexture3D(target, index, level, 0, 0, 0, target.Width(level), target.Height(level), target.Depth(level),
						index, level, 0, 0, 0, this->Width(level), this->Height(level), this->Depth(level), true);
				}
			}
		}
	}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2:

	void OGLESTexture3D::CopyToTexture(Texture& target)
	{
		BOOST_ASSERT(type_ == target.Type());

		for (uint32_t level = 0; level < num_mip_maps_; ++ level)
		{
			this->CopyToSubTexture3D(target,
				0, level, 0, 0, 0, target.Width(level), target.Height(level), target.Depth(level),
				0, level, 0, 0, 0, this->Width(level), this->Height(level), this->Depth(level));
		}
	}
开发者ID:BitYorkie,项目名称:KlayGE,代码行数:11,代码来源:OGLESTexture3D.cpp

示例3:

	void D3D12Texture3D::CopyToTexture(Texture& target)
	{
		BOOST_ASSERT(type_ == target.Type());

		if ((this->Width(0) == target.Width(0)) && (this->Height(0) == target.Height(0))
			&& (this->Depth(0) == target.Depth(0)) && (this->Format() == target.Format())
			&& (this->NumMipMaps() == target.NumMipMaps()))
		{
			this->DoHWCopyToTexture(target);
		}
		else
		{
			uint32_t const array_size = std::min(this->ArraySize(), target.ArraySize());
			uint32_t const num_mips = std::min(this->NumMipMaps(), target.NumMipMaps());
			for (uint32_t index = 0; index < array_size; ++ index)
			{
				for (uint32_t level = 0; level < num_mips; ++ level)
				{
					this->ResizeTexture3D(target, index, level, 0, 0, 0, target.Width(level), target.Height(level), target.Depth(level),
						index, level, 0, 0, 0, this->Width(level), this->Height(level), this->Depth(level), true);
				}
			}
		}
	}
开发者ID:BitYorkie,项目名称:KlayGE,代码行数:24,代码来源:D3D12Texture3D.cpp

示例4: LoadTex

static bool LoadTex(char * FileName, unsigned char scdata [lmwid][lmwid][3]){
using namespace VSFileSystem;

  unsigned char ctemp;
  VSFile f;
  VSError err = f.OpenReadOnly( FileName, TextureFile);
	if (err>Ok)
	{
		return false;
	}
	Texture tex;
	unsigned char * data = tex.ReadImage( &f, texTransform, true);
	int bpp = tex.Depth();
	int format = tex.Format();

	unsigned char *buffer= NULL;
	bpp/=8;	
	// 999 is the code for DDS file, we must decompress them.
	if(format == 999){
		unsigned char *tmpbuffer = data + 2;
		TEXTUREFORMAT internformat;
		bpp = 1;
		// Make sure we are reading a DXT1 file. All backgrounds 
		// should be DXT1
		switch(tex.mode){
			case ::VSImage::_DXT1:
				internformat = DXT1;
				break;
			default:
				return(false);
		}
		// we could hardware decompress, but that involves more
		// pollution of gl in gfx. 
		ddsDecompress(tmpbuffer,buffer,internformat, tex.sizeY,tex.sizeX);
		// We are done with the DDS file data.  Remove it. 
		free(data);
		data = buffer;
		
		// stride and row_pointers are used for the texTransform 
		unsigned long stride = 4 * sizeof(unsigned char);
		unsigned char **row_pointers = (unsigned char**)malloc(sizeof(unsigned char*)*tex.sizeY);
		for(unsigned int i = 0;i < tex.sizeY;++i){
			row_pointers[i] = &data[i*stride*tex.sizeX];
		}
		// texTransform demands that the first argument (bpp) be 8. So we abide
		int tmp = 8;
		int tmp2 = PNG_HAS_COLOR + PNG_HAS_ALPHA;
		buffer = texTransform(tmp,tmp2,tex.sizeX,tex.sizeY,row_pointers);
		// We're done with row_pointers, free it
		free(row_pointers);
		row_pointers = NULL;
		// We're done with the decompressed dds data, free it
		free(data);
		// We set data to the transformed image data 
		data = buffer;
		buffer = NULL;
		// it's 3 because 24/8
		bpp =  4;
	} else if (format&PNG_HAS_ALPHA) {
	  bpp*=4;
	}else {
	  bpp*=3;
	}
	if (data) {
	  int ii;
	  int jj;
	  for (int i=0;i<lmwid;i++) {
	    ii=(i*tex.sizeY)/lmwid;
	    for (int j=0;j<lmwid;j++) {
	      jj= (j*tex.sizeX)/lmwid;
	      scdata[i][j][0]=data[(ii*tex.sizeX+jj)*bpp];
	      scdata[i][j][1]=data[(ii*tex.sizeX+jj)*bpp+1];
	      scdata[i][j][2]=data[(ii*tex.sizeX+jj)*bpp+2];
	    }
	  }
	  free(data);
	}
	else
		return false;

 	f.Close();
	return true;
}
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:83,代码来源:env_map_gent.cpp


注:本文中的Texture::Depth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。