本文整理汇总了C++中TexturePtr::GetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::GetWidth方法的具体用法?C++ TexturePtr::GetWidth怎么用?C++ TexturePtr::GetWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::GetWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMask
void KeepAspectMaskSubSkin::setMask(Sandbox::Graphics& g,const TexturePtr& texture,const MyGUI::FloatRect& uv) {
if (!texture) return;
Sandbox::Transform2d mTr = Sandbox::Transform2d();
int x = mCroppedParent->getAbsoluteLeft();
int y = mCroppedParent->getAbsoluteTop();
int w = mCroppedParent->getWidth();
int h = mCroppedParent->getHeight();
float tw = uv.width() * texture->GetWidth();
float th = uv.height() * texture->GetHeight();
float sx = float(w) / tw;
float sy = float(h) / th;
float s = (sx > sy) ? sx : sy;
float uvdx = (tw - float(w)/s) * 0.5f / texture->GetWidth();
float uvdy = (th - float(h)/s) * 0.5f / texture->GetHeight();
float uvsw = (1.0f/(s * texture->GetWidth() ) );
float uvsh = (1.0f/(s * texture->GetHeight() ) );
mTr.translate(uv.left+uvdx,uv.top+uvdy);
mTr.scale(uvsw, uvsh);
mTr.translate(-x,-y);
g.SetMask(MASK_MODE_ALPHA, texture, mTr);
}
示例2: RenderTargetPtr
RenderTargetPtr D3D9VideoBufferManager::CreateRenderTarget(TexturePtr rtTex)
{
int rWidth = rtTex->GetWidth(), rHeight = rtTex->GetHeight();
if (rWidth == -1 || rHeight == -1)
{
rWidth = Engine::Instance()->GetDeviceProperty()->Width;
rHeight = Engine::Instance()->GetDeviceProperty()->Height;
}
IDirect3DSurface9 * pD3D9RenderTarget = NULL;
D3D9RenderTarget * pTexture = new D3D9RenderTarget(mD3D9Device);
pTexture->mName = rtTex->GetName();
pTexture->mWidth = rWidth;
pTexture->mHeight = rHeight;
pTexture->mFormat = rtTex->GetFormat();
pTexture->mMSAA = MSAA_NONE;
pTexture->mTexture = rtTex;
D3D9Texture * d3dTex = (D3D9Texture *)rtTex.c_ptr();
d3dTex->GetD3DTexture()->GetSurfaceLevel(0, &pTexture->mRenderTarget);
mRenderTargets.Insert(pTexture->GetName(), pTexture);
return RenderTargetPtr(pTexture);
}
示例3:
GfxSystem::GfxViewport::GfxViewport( ResourceSystem::ResourcePtr texture ):
mPosition(Vector2_Zero),
mSize(Vector2_Zero),
mTexture(InvalidTextureHandle),
mRelativeScale(false),
mGridEnabled(true)
{
OC_ASSERT(texture->GetType() == ResourceSystem::RESTYPE_TEXTURE);
TexturePtr textureResource = (TexturePtr)texture;
mTexture = textureResource->GetTexture();
mSize.x = (float32)textureResource->GetWidth();
mSize.y = (float32)textureResource->GetHeight();
}
示例4: update_shader
void MaskImageWidget::update_shader() {
if (m_shader && getImage() && getImage()->GetTexture()) {
TexturePtr texture = getImage()->GetTexture();
ShaderVec2UniformPtr u = m_shader->GetVec2Uniform("texture_size");
if (u) {
u->SetValue(Vector2f(texture->GetWidth(),texture->GetHeight()));
}
u = m_shader->GetVec2Uniform("orig_texture_size");
if (u) {
u->SetValue(Vector2f(texture->GetOriginalWidth(),texture->GetOriginalHeight()));
}
}
}