当前位置: 首页>>代码示例>>C++>>正文


C++ TexturePtr::getHeight方法代码示例

本文整理汇总了C++中ogre::TexturePtr::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::getHeight方法的具体用法?C++ TexturePtr::getHeight怎么用?C++ TexturePtr::getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::TexturePtr的用法示例。


在下文中一共展示了TexturePtr::getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: video_display

void video_display(VideoState *is)
{
  VideoPicture *vp;

  vp = &is->pictq[is->pictq_rindex];

  if (is->video_st->codec->width != 0 && is->video_st->codec->height != 0)
  {
    Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton ().getByName("VideoTexture");
    if (texture.isNull () || texture->getWidth() != is->video_st->codec->width || texture->getHeight() != is->video_st->codec->height)
    {
      Ogre::TextureManager::getSingleton ().remove ("VideoTexture");
      texture = Ogre::TextureManager::getSingleton().createManual(
                  "VideoTexture",
                  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                  Ogre::TEX_TYPE_2D,
                  is->video_st->codec->width, is->video_st->codec->height,
                  0,
                  Ogre::PF_BYTE_RGBA,
                  Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
    }
    Ogre::PixelBox pb(is->video_st->codec->width, is->video_st->codec->height, 1, Ogre::PF_BYTE_RGBA, vp->data);
    Ogre::HardwarePixelBufferSharedPtr buffer = texture->getBuffer();
    buffer->blitFromMemory(pb);
  }

  free(vp->data);
}
开发者ID:pdpdds,项目名称:Win32OpenSourceSample,代码行数:28,代码来源:VideoPlayer.cpp

示例2: addTextureDebugOverlay

void GraphicsController::addTextureDebugOverlay(const Ogre::String& texname, size_t i)
{
    using namespace Ogre;
    Overlay* debugOverlay = OverlayManager::getSingleton().getByName("PRJZ/DebugOverlay");

	MaterialPtr debugMat = MaterialManager::getSingleton().getByName("PRJZ/BasicTexture", "PROJECT_ZOMBIE");
	if(debugMat.isNull())
		OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "PRJZ/BasicTexture material was not found.", "GraphicsController::addTextureDebugOverlay");
    debugMat->getTechnique(0)->getPass(0)->setLightingEnabled(false);
    TextureUnitState *t = debugMat->getTechnique(0)->getPass(0)->createTextureUnitState(texname);
    t->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);

    Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().getByName(texname);
    Ogre::Real tWidth = tex->getWidth();
    Ogre::Real tHeight = tex->getHeight();

    //ratio 
    Ogre::Real ratio = tHeight / tWidth;
    OverlayContainer* debugPanel = (OverlayContainer*)
        (OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" + StringConverter::toString(i)));
    debugPanel->_setPosition(0.0, 0.0);
    debugPanel->_setDimensions(0.5f, 0.5f * ratio);
    debugPanel->setMaterialName(debugMat->getName());
    debugOverlay->add2D(debugPanel);
}
开发者ID:beyzend,项目名称:OgrePRJZSample,代码行数:25,代码来源:GraphicsController.cpp

示例3: processOutputImage

//!
//! Processes the node's input data to generate the node's output image.
//!
void BadPrintingNode::processOutputImage ()
{
    // obtain input image
    Ogre::TexturePtr inputTexture = getTextureValue("Input Map");
    if (inputTexture.isNull()) {
        //disable compositor (now that the input texture name was set)
        if (m_compositor)
            m_compositor->setEnabled(false);

        //render and set output
        m_renderTexture->getBuffer()->getRenderTarget()->update();
        setValue("Image", m_defaultTexture);
        Log::warning("No input image connected.", "BadPrintingNode::processOutputImage");
    }
    else if (!m_renderTexture.isNull()) {
        //resize render texture
        size_t width = inputTexture->getWidth();
        size_t height = inputTexture->getHeight();
        resizeRenderTexture(width, height);
        
        //enable compositor (now that the input texture name was set)
        if (m_compositor)
            m_compositor->setEnabled(true);

        m_renderTexture->getBuffer()->getRenderTarget()->update();
        setValue("Image", m_renderTexture);
    }
}
开发者ID:banduladh,项目名称:levelfour,代码行数:31,代码来源:BadPrintingNode.cpp

示例4: _initTexture

//------------------------------------------------------------------------------
void OgreVideoTexture::_initTexture(Ogre::TexturePtr _texture)
{
    // Get the pixel buffer
    Ogre::HardwarePixelBufferSharedPtr pixelBuffer = _texture->getBuffer();

    // Lock the pixel buffer and get a pixel box
    pixelBuffer->lock(Ogre::HardwareBuffer::HBL_NORMAL); // for best performance use HBL_DISCARD!
    const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();

    Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);

    for (size_t j = 0; j < _texture->getHeight(); j++)
        for(size_t i = 0; i < _texture->getWidth() ; i++)
        {

            if (j<480-5 && i<640-5)
            {
                *pDest++ = 255; // B
                *pDest++ = 0; // G
                *pDest++ = 255; // R
            }
            else
            {
                *pDest++ = 255; // B
                *pDest++ = 0;   // G
                *pDest++ = 0; // R
            }
        }
 
        pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:32,代码来源:OgreVideoTexture.cpp

示例5: Refresh

void EC_ChatBubble::Refresh()
{
    if (renderer_.expired() || !billboardSet_ || !billboard_)
        return;

    // If no messages in the log, hide the chat bubble.
    if (messages_.isEmpty())
    {
        billboardSet_->setVisible(false);
        return;
    }
    else
        billboardSet_->setVisible(true);

    // Get image buffer and texture
    QImage buffer = GetChatBubblePixmap().toImage();
    Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().getByName(texture_name_);
    if (buffer.isNull() || texture.isNull())
        return;

    // Check texture size
    if ((int)texture->getWidth() != buffer.width() || (int)texture->getHeight() != buffer.height())
    {
        texture->freeInternalResources();
        texture->setWidth(buffer.width());
        texture->setHeight(buffer.height());
        texture->createInternalResources();
    }

    // Update texture buffer
    Ogre::Box update_box(0,0, buffer.width(), buffer.height());
    Ogre::PixelBox pixel_box(update_box, Ogre::PF_A8R8G8B8, (void*)buffer.bits());
    if (!texture->getBuffer().isNull())
        texture->getBuffer()->blitFromMemory(pixel_box, update_box);
}
开发者ID:A-K,项目名称:naali,代码行数:35,代码来源:EC_ChatBubble.cpp

示例6: setViewSize

	void UiManager::setViewSize(const Ogre::TexturePtr &aTexture)
	{
		// make sure that the view size matches the texture size
		if (!aTexture.isNull() && !isViewSizeMatching(aTexture))
		{
			mWidgetView->setGeometry(QRect(0, 0, aTexture->getWidth(), aTexture->getHeight()));
		}
	}
开发者ID:advancingu,项目名称:Cutexture,代码行数:8,代码来源:UiManager.cpp

示例7: getRequestedSize

 MyGUI::IntSize ImageButton::getRequestedSize()
 {
     Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().getByName(mImageNormal);
     if (texture.isNull())
     {
         std::cerr << "ImageButton: can't find " << mImageNormal << std::endl;
         return MyGUI::IntSize(0,0);
     }
     return MyGUI::IntSize (texture->getWidth(), texture->getHeight());
 }
开发者ID:Adrian-Revk,项目名称:openmw,代码行数:10,代码来源:imagebutton.cpp

示例8: Update

void EC_WidgetCanvas::Update()
{
    if (framework->IsHeadless())
        return;

    if (!widget_.data() || texture_name_.empty())
        return;
    if (widget_->width() <= 0 || widget_->height() <= 0)
        return;

    try
    {
        Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().getByName(texture_name_);
        if (texture.isNull())
            return;

        if (buffer_.size() != widget_->size())
            buffer_ = QImage(widget_->size(), QImage::Format_ARGB32_Premultiplied);
        if (buffer_.width() <= 0 || buffer_.height() <= 0)
            return;

        QPainter painter(&buffer_);
        widget_->render(&painter);

        // Set texture to material
        if (update_internals_ && !material_name_.empty())
        {
            Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(material_name_);
            if (material.isNull())
                return;
            // Just for good measure, this is done once in the ctor already if everything went well.
            OgreRenderer::SetTextureUnitOnMaterial(material, texture_name_);
            UpdateSubmeshes();
            update_internals_ = false;
        }

        if ((int)texture->getWidth() != buffer_.width() || (int)texture->getHeight() != buffer_.height())
        {
            texture->freeInternalResources();
            texture->setWidth(buffer_.width());
            texture->setHeight(buffer_.height());
            texture->createInternalResources();
        }

        Blit(buffer_, texture);
    }
    catch (Ogre::Exception &e) // inherits std::exception
    {
        LogError("Exception occurred while blitting texture data from memory: " + std::string(e.what()));
    }
    catch (...)
    {
        LogError("Unknown exception occurred while blitting texture data from memory.");
    }
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:55,代码来源:EC_WidgetCanvas.cpp

示例9: mMainLight

SimpleRenderContext::SimpleRenderContext(const std::string& prefix, Ogre::TexturePtr texture) :
    mMainLight(0), mSceneManager(0), mWidth(texture->getWidth()), mHeight(texture->getHeight()), mRenderTexture(0), mCameraNode(0), mCameraPitchNode(0), mEntityNode(0), mRootNode(0), mCamera(0), mViewPort(0), mResourceLoader(*this), mBackgroundColour(Ogre::ColourValue::Black), mCameraPositionMode(CPM_OBJECTCENTER), mTextureOwned(false)
{

    setupScene(prefix);
    setTexture(texture);

    Ogre::Real aspectRatio = static_cast<float>(texture->getWidth()) / static_cast<float>(texture->getHeight());

    S_LOG_VERBOSE("Setting aspect ratio of camera to " << aspectRatio);
    mCamera->setAspectRatio(aspectRatio);

}
开发者ID:bregma,项目名称:ember,代码行数:13,代码来源:SimpleRenderContext.cpp

示例10: getTextureHeight

int GUIHelper::getTextureHeight(const Ogre::String &materialName)
{
	Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(materialName);
	if(mat.isNull() || /*!mat->getTechnique(0) ||
			!mat->getTechnique(0)->getPass(0) ||*/
			!mat->getTechnique(0)->getPass(0)->getTextureUnitState(0))
		return -1;

	Ogre::TexturePtr text = Ogre::TextureManager::getSingleton().getByName(
			mat->getTechnique(0)->getPass(0)->getTextureUnitState(
					0)->getTextureName());
	if(text.isNull()) return -1;
	return text->getHeight();
}
开发者ID:agudpp,项目名称:CordobaZombie,代码行数:14,代码来源:GUIHelper.cpp

示例11: string

        skin::skin(const string &n):
            _name(n),
            _prefix("gui/skins/" + _name + "/" + _name)
        {
            txml::document doc;
            doc.LoadFile((engine::DATA_DIR + _prefix + ".xml").c_str());
            if (doc.Error())
            {
                engine::log("failed to load GUI skin " + _name);
                return;
            }

            txml::element *rootElem = doc.RootElement();

            for (txml::node *i = rootElem->FirstChild(); i; i = i->NextSibling())
            {
                pieceList &pl = _elements[i->Value()];

                for (txml::node *j = i->FirstChild(); j; j = j->NextSibling())
                {
                    txml::element *element = j->ToElement();
                    if (element)
                    {
                        piece &p = pl[element->Value()];
                        string tex = element->attrib<string>("image", string());

                        if (!tex.empty())
                        {
                            p.tex = "gui/skins/" + _name + "/" + tex;

                            Ogre::TexturePtr tex = gfx::getTexture(p.tex);
                            if (tex.get())
                                p.size = vec2(tex->getWidth(), tex->getHeight());
                            else
                                p.size = vec2(0, 0);
                        }
                        else
                        {
                            p.tex.clear();
                            p.size = vec2(0, 0);
                        }
                    }
                }
            }
        }
开发者ID:Joooo,项目名称:pseudoform,代码行数:45,代码来源:skin.cpp

示例12: ResizePreviewImage

void CLASS::ResizePreviewImage()
{
	MyGUI::IntSize imgSize(0, 0);
	Ogre::TexturePtr t = Ogre::TextureManager::getSingleton().load(m_preview_image_texture, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
	if (!t.isNull())
	{
		imgSize.width = (int)t->getWidth() * 10;
		imgSize.height = (int)t->getHeight() * 10;
	}

	if (imgSize.width != 0 && imgSize.height != 0)
	{
		MyGUI::IntSize maxSize = m_PreviewBox->getSize();

		float imgRatio = imgSize.width / (float)imgSize.height;
		float maxRatio = maxSize.width / (float)maxSize.height;

		MyGUI::IntSize newSize(0, 0);
		MyGUI::IntPoint newPosition(0, 0);

		// scale with aspect ratio
		if (imgRatio > maxRatio)
		{
			newSize.width = maxSize.width;
			newSize.height = maxSize.width / imgRatio;
			newPosition.left = 0;
			newPosition.top = maxSize.height - newSize.height;
		}
		else
		{
			newSize.width = maxSize.height * imgRatio;
			newSize.height = maxSize.height;
			newPosition.left = maxSize.width - newSize.width;
			newPosition.top = 0;
		}

		m_Preview->setSize(newSize);
		m_Preview->setPosition(newPosition);
	}
}
开发者ID:derbymutt,项目名称:rigs-of-rods,代码行数:40,代码来源:GUI_MainSelector.cpp

示例13: exploreCell

    void GlobalMap::exploreCell(int cellX, int cellY)
    {
        float originX = static_cast<float>((cellX - mMinX) * mCellSize);
        // NB y + 1, because we want the top left corner, not bottom left where the origin of the cell is
        float originY = static_cast<float>(mHeight - (cellY + 1 - mMinY) * mCellSize);

        if (cellX > mMaxX || cellX < mMinX || cellY > mMaxY || cellY < mMinY)
            return;

        Ogre::TexturePtr localMapTexture = Ogre::TextureManager::getSingleton().getByName("Cell_"
            + boost::lexical_cast<std::string>(cellX) + "_" + boost::lexical_cast<std::string>(cellY));

        if (!localMapTexture.isNull())
        {
            int mapWidth = localMapTexture->getWidth();
            int mapHeight = localMapTexture->getHeight();
            mOverlayTexture->load();
            mOverlayTexture->getBuffer()->blit(localMapTexture->getBuffer(), Ogre::Image::Box(0,0,mapWidth,mapHeight),
                         Ogre::Image::Box(static_cast<Ogre::uint32>(originX), static_cast<Ogre::uint32>(originY),
                         static_cast<Ogre::uint32>(originX + mCellSize), static_cast<Ogre::uint32>(originY + mCellSize)));

            Ogre::Image backup;
            std::vector<Ogre::uchar> data;
            data.resize(mCellSize*mCellSize*4, 0);
            backup.loadDynamicImage(&data[0], mCellSize, mCellSize, Ogre::PF_A8B8G8R8);

            localMapTexture->getBuffer()->blitToMemory(Ogre::Image::Box(0,0,mapWidth,mapHeight), backup.getPixelBox());

            for (int x=0; x<mCellSize; ++x)
                for (int y=0; y<mCellSize; ++y)
                {
                    assert (originX+x < mOverlayImage.getWidth());
                    assert (originY+y < mOverlayImage.getHeight());
                    assert (x < int(backup.getWidth()));
                    assert (y < int(backup.getHeight()));
                    mOverlayImage.setColourAt(backup.getColourAt(x, y, 0), static_cast<size_t>(originX + x), static_cast<size_t>(originY + y), 0);
                }
        }
    }
开发者ID:AAlderman,项目名称:openmw,代码行数:39,代码来源:globalmap.cpp

示例14: LoadTexture

bool RocketInterface::LoadTexture(Rocket::Core::TextureHandle& textureHandle,
                                  Rocket::Core::Vector2i& textureDimensions,
                                  const Rocket::Core::String& source)
{
    Ogre::TextureManager* tm = Ogre::TextureManager::getSingletonPtr();
    Ogre::TexturePtr texture = tm->getByName(Ogre::String(source.CString()));

    if (texture.isNull())
    {
        texture = tm->load(
            Ogre::String(source.CString()), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D, 0, 1.0f, false, Ogre::PF_UNKNOWN, true);
    }

    if (texture.isNull())
        return false;

    textureDimensions.x = texture->getWidth();
    textureDimensions.y = texture->getHeight();

    textureHandle = reinterpret_cast<Rocket::Core::TextureHandle>(new RocketOgreTexture(texture));
    return true;
}
开发者ID:JamesLinus,项目名称:dawnengine,代码行数:23,代码来源:RocketInterface.cpp

示例15: isViewSizeMatching

	bool UiManager::isViewSizeMatching(const Ogre::TexturePtr &aTexture) const
	{
		assert(!aTexture.isNull());
		
		return (aTexture->getWidth() == mWidgetView->width() && aTexture->getHeight() == mWidgetView->height());
	}
开发者ID:advancingu,项目名称:Cutexture,代码行数:6,代码来源:UiManager.cpp


注:本文中的ogre::TexturePtr::getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。