本文整理汇总了C++中TexturePtr::getTextureType方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::getTextureType方法的具体用法?C++ TexturePtr::getTextureType怎么用?C++ TexturePtr::getTextureType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::getTextureType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTexture
//-----------------------------------------------------------------------
void TextureUnitState::setTexture( const TexturePtr& texPtr)
{
if (!texPtr)
{
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
"Texture Pointer is empty.",
"TextureUnitState::setTexture");
}
setContentType(CONTENT_NAMED);
mTextureLoadFailed = false;
if (texPtr->getTextureType() == TEX_TYPE_CUBE_MAP)
{
// delegate to cubic texture implementation
setCubicTexture(&texPtr, true);
return;
}
if (texPtr->getTextureType() == TEX_TYPE_EXTERNAL_OES || texPtr->getTextureType() == TEX_TYPE_2D_RECT)
{
setTextureAddressingMode( TAM_CLAMP );
}
mFramePtrs.resize(1);
mFramePtrs[0] = texPtr;
mCurrentFrame = 0;
mCubic = false;
// Load immediately ?
if (isLoaded())
{
_load(); // reload
}
// Tell parent to recalculate hash
if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) )
{
mParent->_dirtyHash();
}
}
示例2: setTexture
//-----------------------------------------------------------------------
void TextureUnitState::setTexture( const TexturePtr& texPtr)
{
if (texPtr.isNull())
{
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
"Texture Pointer is empty.",
"TextureUnitState::setTexture");
}
setContentType(CONTENT_NAMED);
mTextureLoadFailed = false;
if (texPtr->getTextureType() == TEX_TYPE_CUBE_MAP)
{
// delegate to cubic texture implementation
setCubicTexture(&texPtr, true);
}
else
{
mFrames.resize(1);
mFramePtrs.resize(1);
mFrames[0] = texPtr->getName();
mFramePtrs[0] = texPtr;
// defer load until used, so don't grab pointer yet
mCurrentFrame = 0;
mCubic = false;
mTextureType = texPtr->getTextureType();
// Load immediately ?
if (isLoaded())
{
_load(); // reload
}
// Tell parent to recalculate hash
if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) )
{
mParent->_dirtyHash();
}
}
}
示例3: createProceduralParticleSystem
ProceduralManualObject* createProceduralParticleSystem()
{
particleSystem = static_cast<ProceduralManualObject*>
(mSceneMgr->createMovableObject("ParticleGSEntity", ProceduralManualObjectFactory::FACTORY_TYPE_NAME));
particleSystem->setMaterial("Ogre/ParticleGS/Display");
//Generate the geometry that will seed the particle system
ManualObject* particleSystemSeed = mSceneMgr->createManualObject("ParticleSeed");
//This needs to be the initial launcher particle
particleSystemSeed->begin("Ogre/ParticleGS/Display", RenderOperation::OT_POINT_LIST);
particleSystemSeed->position(0,0,0); //Position
particleSystemSeed->textureCoord(1); //Timer
particleSystemSeed->textureCoord(0); //Type
particleSystemSeed->textureCoord(0,0,0); //Velocity
particleSystemSeed->end();
//Generate the RenderToBufferObject
RenderToVertexBufferSharedPtr r2vbObject =
HardwareBufferManager::getSingleton().createRenderToVertexBuffer();
r2vbObject->setRenderToBufferMaterialName("Ogre/ParticleGS/Generate");
//Apply the random texture
TexturePtr randomTexture = RandomTools::generateRandomVelocityTexture();
r2vbObject->getRenderToBufferMaterial()->getTechnique(0)->getPass(0)->
getTextureUnitState("RandomTexture")->setTextureName(
randomTexture->getName(), randomTexture->getTextureType());
r2vbObject->setOperationType(RenderOperation::OT_POINT_LIST);
r2vbObject->setMaxVertexCount(16000);
r2vbObject->setResetsEveryUpdate(false);
VertexDeclaration* vertexDecl = r2vbObject->getVertexDeclaration();
size_t offset = 0;
offset += vertexDecl->addElement(0, offset, VET_FLOAT3, VES_POSITION).getSize(); //Position
offset += vertexDecl->addElement(0, offset, VET_FLOAT1, VES_TEXTURE_COORDINATES, 0).getSize(); //Timer
offset += vertexDecl->addElement(0, offset, VET_FLOAT1, VES_TEXTURE_COORDINATES, 1).getSize(); //Type
offset += vertexDecl->addElement(0, offset, VET_FLOAT3, VES_TEXTURE_COORDINATES, 2).getSize(); //Velocity
//Bind the two together
particleSystem->setRenderToVertexBuffer(r2vbObject);
particleSystem->setManualObject(particleSystemSeed);
//Set bounds
AxisAlignedBox aabb;
aabb.setMinimum(-100,-100,-100);
aabb.setMaximum(100,100,100);
particleSystem->setBoundingBox(aabb);
return particleSystem;
}
示例4: calculateRenderTarget
//-----------------------------------------------------------------------------------
RenderTarget* CompositorPass::calculateRenderTarget( size_t rtIndex,
const CompositorChannel &source )
{
RenderTarget *retVal;
if( !source.isMrt() && !source.textures.empty() &&
source.textures[0]->getTextureType() > TEX_TYPE_2D )
{
//Who had the bright idea of handling Cubemaps differently
//than 3D textures is a mystery. Anyway, deal with it.
TexturePtr texturePtr = source.textures[0];
if( rtIndex >= texturePtr->getDepth() && rtIndex >= texturePtr->getNumFaces() )
{
size_t maxRTs = std::max<size_t>( source.textures[0]->getDepth(),
source.textures[0]->getNumFaces() );
OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
"Compositor pass is asking for a 3D/Cubemap/2D_array texture with "
"more faces/depth/slices than what's been supplied (Asked for slice '" +
StringConverter::toString( rtIndex ) + "', RT has '" +
StringConverter::toString( maxRTs ) + "')",
"CompositorPass::calculateRenderTarget" );
}
/*//If goes out bounds, will reference the last slice/face
rtIndex = std::min( rtIndex, std::max( source.textures[0]->getDepth(),
source.textures[0]->getNumFaces() ) - 1 );*/
TextureType textureType = texturePtr->getTextureType();
size_t face = textureType == TEX_TYPE_CUBE_MAP ? rtIndex : 0;
size_t slice= textureType != TEX_TYPE_CUBE_MAP ? rtIndex : 0;
retVal = texturePtr->getBuffer( face )->getRenderTarget( slice );
}
else
{
retVal = source.target;
}
return retVal;
}
示例5: updateControls
void TextureToolWindow::updateControls(String texName)
{
try
{
bool exists = TextureManager::getSingleton().resourceExists(texName);
if (!exists)
{
mTxt->setCaption(convertToMyGUIString("Texture not found:\n" + texName));
mBtnSavePNG->setEnabled(false);
return;
}
TexturePtr tex = TextureManager::getSingleton().getByName(texName);
if (tex.isNull())
{
mTxt->setCaption(convertToMyGUIString("Error loading texture:\n" + texName));
mBtnSavePNG->setEnabled(false);
return;
}
String str = "#aa0000" + texName + "#000000\n";
str += "#00aa00res: #000000" + TOSTRING(tex->getWidth()) + " x " + TOSTRING(tex->getHeight()) + " pixels\n";
str += "#00aa00size: #000000" + formatBytes(tex->getSize()) + "\n";
str += "#00aa00format: #000000" + PixelUtil::getFormatName(tex->getFormat()) + "\n";
if (tex->getNumFaces() > 1)
str += "#00aa00faces: #000000" + TOSTRING(tex->getNumFaces()) + "\n";
if (tex->getFSAA() > 0)
str += "#00aa00FSAA: #000000" + TOSTRING(tex->getFSAA()) + "\n";
if (tex->getNumMipmaps() > 0)
str += "#00aa00mipmaps: #000000" + TOSTRING(tex->getNumMipmaps()) + "\n";
String typeStr = "";
switch (tex->getTextureType())
{
case TEX_TYPE_1D: typeStr = "1D";
break;
case TEX_TYPE_2D: typeStr = "2D";
break;
case TEX_TYPE_3D: typeStr = "3D";
break;
case TEX_TYPE_CUBE_MAP: typeStr = "Cube Map";
break;
}
str += "#00aa00type: #000000" + typeStr + "\n";
String usageStr = "";
if (tex->getUsage() & TU_STATIC)
usageStr += "static,\n";
if (tex->getUsage() & TU_DYNAMIC)
usageStr += "dynamic,\n";
if (tex->getUsage() & TU_WRITE_ONLY)
usageStr += "write only,\n";
if (tex->getUsage() & TU_STATIC_WRITE_ONLY)
usageStr += "static write only,\n";
if (tex->getUsage() & TU_DYNAMIC_WRITE_ONLY)
usageStr += "dynamic write only,\n";
if (tex->getUsage() & TU_DYNAMIC_WRITE_ONLY_DISCARDABLE)
usageStr += "dynamic write only discardable,\n";
if (tex->getUsage() & TU_AUTOMIPMAP)
usageStr += "automipmap,\n";
if (tex->getUsage() & TU_RENDERTARGET)
usageStr += "rendertarget,\n";
if (tex->getUsage() & TU_DEFAULT)
usageStr += "default\n";
str += "#00aa00usage: #000000" + usageStr + "\n";
if (tex->getDepth() > 1)
str += "#00aa00depth: #000000" + TOSTRING(tex->getDepth()) + "\n";
mTxt->setCaption(convertToMyGUIString(str));
mImage->setImageTexture(texName);
mBtnSavePNG->setEnabled(true);
}
catch (Exception& e)
{
UTFString str = "Exception while opening texture:" + e.getFullDescription();
RoR::App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_MSGTYPE_INFO, str, "error.png");
}
}