本文整理汇总了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));
}
示例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);
}
示例3: LoadTextures
void Game::LoadTextures()
{
TextureManager* texman = TextureManager::Instance();
texman->CreateTexture( "white", 2, 2, TEX_RGB16, Texture::PARAM_NONE, this );
}
示例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;
//.........这里部分代码省略.........