MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / getTextureSize

Method getTextureSize

OgreMain/src/OgreAutoParamDataSource.cpp:575–606  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

573 }
574 //-----------------------------------------------------------------------------
575 Vector4 AutoParamDataSource::getTextureSize( size_t index ) const
576 {
577 Vector4 size = Vector4( 1, 1, 1, 1 );
578
579 if( mCurrentJob && index < mCurrentJob->getNumTexUnits() )
580 {
581 const TextureGpu *tex = mCurrentJob->getTexture( static_cast<uint8>( index ) );
582 if( tex )
583 {
584 size.x = static_cast<Real>( tex->getWidth() );
585 size.y = static_cast<Real>( tex->getHeight() );
586 size.z = static_cast<Real>( tex->getDepth() );
587 }
588 }
589 else if( index < mCurrentPass->getNumTextureUnitStates() )
590 {
591 const TextureGpu *tex =
592 mCurrentPass->getTextureUnitState( static_cast<unsigned short>( index ) )
593 ->_getTexturePtr();
594 if( tex )
595 {
596 size.x = static_cast<Real>( tex->getWidth() );
597 size.y = static_cast<Real>( tex->getHeight() );
598 size.z = static_cast<Real>( tex->getDepth() );
599 }
600 }
601
602 size.w = std::max( size.x, size.y );
603 size.w = std::max( size.w, size.z );
604
605 return size;
606 }
607 //-----------------------------------------------------------------------------
608 Vector4 AutoParamDataSource::getInverseTextureSize( size_t index ) const
609 {

Callers 1

_updateAutoParamsMethod · 0.80

Calls 7

_getTexturePtrMethod · 0.80
getTextureUnitStateMethod · 0.80
Vector4Function · 0.50
getTextureMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
getDepthMethod · 0.45

Tested by

no test coverage detected