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


C++ TextureManager::CreateTexture方法代码示例

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


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

示例1: BindableTexture

ScaledTexture::ScaledTexture
 (const ContextManager& context_manager,
  TextureManager&       texture_manager,
  const TextureDesc&    original_desc,
  const TextureData*    data,
  unsigned int          scaled_width,
  unsigned int          scaled_height)
    : BindableTexture (context_manager),
      original_width (original_desc.width),
      original_height (original_desc.height)
{
  static const char* METHOD_NAME = "render::low_level::opengl::ScaledTexture::ScaledTexture";

  if (data)
    throw xtl::format_not_supported_exception (METHOD_NAME, "Texture initial data not supported (not implemented)");

  const ContextCaps& caps = GetCaps ();

  if (!scaled_width)
  {
    if (original_desc.width > caps.max_texture_size)
      scaled_width = caps.max_texture_size;
    else
      scaled_width = get_next_higher_power_of_two (original_desc.width);
  }

  if (!scaled_height)
  {
    if (original_desc.height > caps.max_texture_size)
      scaled_height = caps.max_texture_size;
    else
      scaled_height = get_next_higher_power_of_two (original_desc.height);
  }

  TextureDesc temp_desc = original_desc;

  temp_desc.width  = scaled_width;
  temp_desc.height = scaled_height;
  
  horisontal_scale = (float)scaled_width  / (float)original_desc.width;
  vertical_scale   = (float)scaled_height / (float)original_desc.height;  

  ITexture* created_texture = texture_manager.CreateTexture (temp_desc, 0);

  shadow_texture = TexturePtr (dynamic_cast<BindableTexture*> (created_texture), false);

  if (!shadow_texture.get ())
    throw xtl::format_operation_exception (METHOD_NAME, "TextureManager::CreateTexture returned texture with incompatible type");

  LogPrintf ("Warning: scaled texture %ux%ux%u has created for original texture %ux%ux%[email protected]%s", scaled_width, scaled_height, temp_desc.layers,
    original_desc.width, original_desc.height, original_desc.layers, get_name (original_desc.format));
}
开发者ID:untgames,项目名称:funner,代码行数:52,代码来源:gl_texture_scaled.cpp

示例2: int

Map::Map(int w, int h)
{
	usingSectors = false;
	width = w;
	height = h;
	texture = 0;
	GLASSERT(w <= MAX_MAP_SIZE);
	GLASSERT(h <= MAX_MAP_SIZE);
	GLOUTPUT(("Map created. %dK\n", int(sizeof(*this)) / 1024));
	saturation = 1.0f;

	gamui::RenderAtom nullAtom;
	overlayM1.Init(this);
	overlay0.Init(this);
	overlay1.Init(this);

	TextureManager* texman = TextureManager::Instance();
	texman->CreateTexture("miniMap", 512, 512, TEX_RGB16, Texture::PARAM_NONE, this);
}
开发者ID:fordream,项目名称:alteraorbis,代码行数:19,代码来源:map.cpp

示例3: LoadTextures

void Game::LoadTextures()
{
	TextureManager* texman = TextureManager::Instance();
	texman->CreateTexture( "white", 2, 2, TEX_RGB16, Texture::PARAM_NONE, this );
}
开发者ID:csioza,项目名称:alteraorbis,代码行数:5,代码来源:game.cpp

示例4: each

Model::Model(ID3D11Device* device, TextureManager& texMgr, const std::string& modelFilename, const std::string& texturePath)
{
	//std::vector<M3dMaterial> mats;
	std::vector<MaterialLoader> mats;

	//M3DLoader m3dLoader;
	//m3dLoader.LoadM3d(modelFilename, Vertices, Indices, Subsets, mats);

	ModelLoader loader;
	loader.Load(modelFilename, Vertices, Indices, Subsets, mats, SkinnedData);



	ModelMesh.SetVertices(device, &Vertices[0], Vertices.size());
	ModelMesh.SetIndices(device, &Indices[0], Indices.size());
	ModelMesh.SetSubsetTable(Subsets);

	SubsetCount = mats.size();

	TPM = mats[0].DiffuseMapNames.size();
	for(UINT i = 0; i < SubsetCount; ++i)
	{
		Mat.push_back(mats[i].Mat);

		for (int j = 0; j < mats[i].DiffuseMapNames.size(); ++j)
		{
			if (mats[i].DiffuseMapNames[j] != "")
			{
				ID3D11ShaderResourceView* diffuseMapSRV = texMgr.CreateTexture(texturePath + mats[i].DiffuseMapNames[j]);
				if (diffuseMapSRV)
					DiffuseMapSRV.push_back(diffuseMapSRV);
			}
		}

		for (int j = 0; j < mats[i].NormalMapNames.size(); ++j)
		{
			if (mats[i].NormalMapNames[j] != "")
			{
				ID3D11ShaderResourceView* normalMapSRV = texMgr.CreateTexture(texturePath + mats[i].NormalMapNames[j]);
				if (normalMapSRV)
					NormalMapSRV.push_back(normalMapSRV);
			}
		}
		/*
		if (mats[i].DiffuseMapName != "")
		{
			ID3D11ShaderResourceView* diffuseMapSRV = texMgr.CreateTexture(texturePath + mats[i].DiffuseMapName);
			if (diffuseMapSRV)
				DiffuseMapSRV.push_back(diffuseMapSRV);
		}

		if (mats[i].NormalMapName != "")
		{
			ID3D11ShaderResourceView* normalMapSRV = texMgr.CreateTexture(texturePath + mats[i].NormalMapName);
			if (normalMapSRV)
				NormalMapSRV.push_back(normalMapSRV);
		}*/
	}
	
	m_BoneBoxes = SkinnedData.CreateBoneBoxes(Vertices);

	if (m_BoneBoxes.size() == 0)
	{
		//BoundingSphere::CreateFromPoints(m_BoundingSphere, Vertices.size(), &Vertices[0].Pos, sizeof(Vertex::PosNormalTexTanSkinned));

		BoundingBox AABB;
		BoundingBox::CreateFromPoints(AABB, Vertices.size(), &Vertices[0].Pos, sizeof(Vertex::PosNormalTexTanSkinned));

		BoundingOrientedBox::CreateFromBoundingBox(m_BoundingOrientedBox, AABB);

		XMFLOAT3 Extents = m_BoundingOrientedBox.Extents;
		m_SmallestRadiusInBox =	( Extents.x > Extents.z ) ? Extents.z : Extents.x;

		BoundingSphere::CreateFromBoundingBox(m_BoundingSphere, m_BoundingOrientedBox);
	}

	else
	{
		AnimationClip* AC = SkinnedData.GetAnimation("ALL");

		if (AC)
		{
			UINT numKeyFrames = AC->BoneAnimations[0].Keyframes.size();

			std::vector<XMFLOAT3> bigBoxPoints;
			m_SmallestRadiusInBox = 99999;
			for (int i = 0; i < numKeyFrames; ++i)
			{
				float time = AC->BoneAnimations[0].Keyframes[i].TimePos;

				std::vector<XMFLOAT4X4> FinalTransforms(AC->BoneAnimations.size());
				SkinnedData.GetFinalTransforms("ALL", time, FinalTransforms);

				std::vector<DirectX::BoundingOrientedBox>	tempboxes(m_BoneBoxes.size());
				for (int i = 0; i < m_BoneBoxes.size(); ++i)
				{
					m_BoneBoxes[i].Transform(tempboxes[i], XMLoadFloat4x4(&FinalTransforms[i]));
				}

				std::vector<XMFLOAT3> points;
//.........这里部分代码省略.........
开发者ID:CarlRapp,项目名称:CodenameGamma,代码行数:101,代码来源:Model.cpp


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