| 393 | } |
| 394 | } |
| 395 | void TextureUnitState::setLayerArrayNames(TextureType type, const std::vector<String>& names) |
| 396 | { |
| 397 | OgreAssert(!names.empty(), "array layers empty"); |
| 398 | |
| 399 | const char* typeName; |
| 400 | switch(type) |
| 401 | { |
| 402 | case TEX_TYPE_CUBE_MAP: |
| 403 | typeName = "Cube"; |
| 404 | break; |
| 405 | case TEX_TYPE_2D_ARRAY: |
| 406 | typeName = "Array"; |
| 407 | break; |
| 408 | case TEX_TYPE_3D: |
| 409 | typeName = "Volume"; |
| 410 | break; |
| 411 | default: |
| 412 | OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "arrays not possible for this texture type"); |
| 413 | return; |
| 414 | } |
| 415 | |
| 416 | // use hash to auto-name the texture |
| 417 | uint32 hash = 0; |
| 418 | for(const String& name : names) |
| 419 | hash = FastHash(name.data(), name.size(), hash); |
| 420 | |
| 421 | auto tex = retrieveTexture(StringUtil::format("%sTex_%x", typeName, hash)); |
| 422 | tex->setTextureType(type); |
| 423 | tex->setLayerNames(names); |
| 424 | setTexture(tex); |
| 425 | } |
| 426 | |
| 427 | //----------------------------------------------------------------------- |
| 428 | std::pair<uint32, uint32> TextureUnitState::getTextureDimensions(unsigned int frame) const |