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


C++ ogre::HardwarePixelBufferSharedPtr类代码示例

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


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

示例1: OnPaint

void RenderHandler::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height)
{
    Ogre::HardwarePixelBufferSharedPtr texBuf = m_texture->getBuffer();
    texBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD);
    memcpy(texBuf->getCurrentLock().data, buffer, width*height*4);
    texBuf->unlock();
}
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:7,代码来源:CefWindow.cpp

示例2: init

    void MiniMapMaker::init(void)
    {
        // 创建纹理
        Ogre::TexturePtr pTexture = Ogre::TextureManager::getSingleton().createManual(
            "RttTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D,
            mTexWidth, mTexHeight, 1, 0, mOutPutFormat,
            Ogre::TU_RENDERTARGET, 0);

        Ogre::HardwarePixelBufferSharedPtr pBuffer = pTexture->getBuffer(0, 0);

        mRenderTexture = pBuffer->getRenderTarget(0);
        {
            mCamera = mManipulator->getSceneManager()->createCamera("RttCam");

            // 设置摄像机的基本属性
            mCamera->setAspectRatio(1);
            mCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
            mCamera->setFOVy(Ogre::Degree(90));            

            _setCameraAttribute();

            Ogre::Viewport *v = mRenderTexture->addViewport( mCamera );
            v->setClearEveryFrame( true );
            v->setBackgroundColour( Ogre::ColourValue::Black );   
            v->setOverlaysEnabled(false);
            v->setSkiesEnabled(false);
            v->setShadowsEnabled(true);
        }
    }
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:30,代码来源:WXMiniMapMaker.cpp

示例3: _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

示例4: render

  void VideoVisual::render(const cv::Mat& image) 
  {

    // Fix image size if necessary
    const cv::Mat* image_ptr = &image;
    cv::Mat converted_image;
    if (image_ptr->rows != height_ || image_ptr->cols != width_) 
    {
      cv::resize(*image_ptr, converted_image, cv::Size(width_, height_));
      image_ptr = &converted_image;
    }

    // Get the pixel buffer
    Ogre::HardwarePixelBufferSharedPtr pixelBuffer = 
      this->texture_->getBuffer();

    // Lock the pixel buffer and get a pixel box
    pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
    const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
    uint8_t* pDest = static_cast<uint8_t*>(pixelBox.data);

    memcpy(pDest, image_ptr->data, height_ * width_ * 4);

    // Unlock the pixel buffer
    pixelBuffer->unlock();
  }
开发者ID:Aridane,项目名称:underwater_map_construction,代码行数:26,代码来源:gazebo_ros_video.cpp

示例5: PaintScrollImage

void HTML::PaintScrollImage(Ogre::HardwarePixelBufferSharedPtr pixelBuffer, const Berkelium::Rect& scrollOrigRect, int scroll_dx, int scroll_dy)
{

  Berkelium::Rect scrolledRect = scrollOrigRect.translate(scroll_dx, scroll_dy);

  Berkelium::Rect scrolled_shared_rect = scrollOrigRect.intersect(scrolledRect);
  // Only do scrolling if they have non-zero intersection
  if(scrolled_shared_rect.width() == 0 || scrolled_shared_rect.height() == 0)
    return;
  Berkelium::Rect shared_rect = scrolled_shared_rect.translate(-scroll_dx, -scroll_dy);

  size_t width = shared_rect.width();
  size_t height = shared_rect.height();

  Ogre::TexturePtr shadow = Ogre::TextureManager::getSingleton().createManual("scrollbuf", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, Ogre::Bitwise::firstPO2From(width), Ogre::Bitwise::firstPO2From(height), 1, 1, Ogre::PF_BYTE_BGRA);
  {
    Ogre::HardwarePixelBufferSharedPtr shadowBuffer = shadow->getBuffer();

    Berkelium::Rect borderedScrollRect = GetBorderedRect(shared_rect);
    Berkelium::Rect borderedScrolledRect = GetBorderedRect(scrolled_shared_rect);

    shadowBuffer->blit(pixelBuffer, Ogre::Box(borderedScrollRect.left(), borderedScrollRect.top(), borderedScrollRect.right(), borderedScrollRect.bottom()), Ogre::Box(0, 0, width, height));

    pixelBuffer->blit(shadowBuffer, Ogre::Box(0, 0, width, height), Ogre::Box(borderedScrolledRect.left(), borderedScrolledRect.top(), borderedScrolledRect.right(), borderedScrolledRect.bottom()));
  }

  Ogre::ResourcePtr shadowResource(shadow);
  Ogre::TextureManager::getSingleton().remove(shadowResource);

}
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:30,代码来源:HTML.cpp

示例6: _copyImagePerPixel

//------------------------------------------------------------------------------
void OgreVideoTexture::_copyImagePerPixel(const IplImage *_image
                                         ,Ogre::HardwarePixelBufferSharedPtr _pixelBuffer)
{
    // Lock the pixel buffer and get a pixel box
    _pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); // for best performance use HBL_DISCARD!
    const Ogre::PixelBox& pixelBox = _pixelBuffer->getCurrentLock();

    Ogre::uint32* pDest = static_cast<Ogre::uint32*>(pixelBox.data);
    
    size_t w, h, widthStep;
    w = _image->width;
    h = _image->height;
    widthStep = _image->widthStep;

    Ogre::uint32 pixelBGRA;
    for(size_t i=0 ; i < h ; i++)
    {
        size_t offset = i*widthStep;
        for (size_t j=0 ; j < w ; j++)
        {
            memcpy(&pixelBGRA, _image->imageData + offset +j*3, sizeof(Ogre::uint32));            
            pDest[i *1024 + j] = pixelBGRA;            
        }
    }
   
    _pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:28,代码来源:OgreVideoTexture.cpp

示例7: _copyImagePerChannel

//------------------------------------------------------------------------------
void OgreVideoTexture::_copyImagePerChannel(const IplImage *_image
                                         ,Ogre::HardwarePixelBufferSharedPtr _pixelBuffer)
{

    // Lock the pixel buffer and get a pixel box
    _pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); // 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 < _image->height; j++)
        for(size_t i = 0; i < _image->width ; i++)
        {
            char pixelR = CV_IMAGE_ELEM(_image, char, j, i*3+2 );
            char pixelG = CV_IMAGE_ELEM(_image, char, j, i*3+1);
            char pixelB = CV_IMAGE_ELEM(_image, char, j, i*3 );

            int w = mVideoTexture->getWidth();

            pDest[j*1024*4 + i*4]   = pixelB;
            pDest[j*1024*4 + i*4+1] = pixelG;
            pDest[j*1024*4 + i*4+2] = pixelR;
            //pDest[j*w*4 + i*4+3] = 255;
        }

    _pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:30,代码来源:OgreVideoTexture.cpp

示例8: 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

示例9: _updateVolTextureData

	void DataManager::_updateVolTextureData(Cell ***c, const VolTextureId& TexId, const int& nx, const int& ny, const int& nz)
	{
		Ogre::HardwarePixelBufferSharedPtr buffer = mVolTextures[TexId]->getBuffer(0,0);
		
		buffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
		const Ogre::PixelBox &pb = buffer->getCurrentLock();

		Ogre::uint32 *pbptr = static_cast<Ogre::uint32*>(pb.data);
		size_t x, y, z;

		for (z=pb.front; z<pb.back; z++) 
        {
            for (y=pb.top; y<pb.bottom; y++)
            {
                for (x=pb.left; x<pb.right; x++)
				{
					Ogre::PixelUtil::packColour(c[x][y][z].dens/* TODO!!!! */, c[x][y][z].light, 0, 0, pb.format, &pbptr[x]);
                } 
                pbptr += pb.rowPitch;
            }
            pbptr += pb.getSliceSkip();
        }

		buffer->unlock();
	}
开发者ID:coldelectrons,项目名称:fortressoverseer,代码行数:25,代码来源:DataManager.cpp

示例10: onPaint

/**
 * @inheritDoc.
 */
void BrowserWindow::onPaint(Berkelium::Window *win, const unsigned char *sourceBuffer, const Berkelium::Rect &sourceBufferRect, size_t numCopyRects, const Berkelium::Rect *copyRects, int dx, int dy, const Berkelium::Rect &scrollRect) {
    const Ogre::HardwarePixelBufferSharedPtr textureBuffer = m_texture->getBuffer();
    const Ogre::PixelBox srcBox = Ogre::PixelBox(rectToBox(sourceBufferRect), Ogre::PF_BYTE_BGRA, const_cast<unsigned char*>(sourceBuffer));

    for(int i = 0; i < numCopyRects; i++) {
        const Ogre::Box destBox = rectToBox(copyRects[i]);
        textureBuffer->blitFromMemory(srcBox.getSubVolume(destBox), destBox);
    }
}
开发者ID:Kissy,项目名称:shoot-em-up-project,代码行数:12,代码来源:BrowserWindow.cpp

示例11: _updateNormalMap

	bool TextureManager::_updateNormalMap(Image &Image)
	{
		if (!mCreated)
		{
			HydraxLOG("Error in TextureManager::_updateNormalMap, create() does not called.");

			return false;
		}

		if (Image.getType() != Image::TYPE_RGB)
		{
			HydraxLOG("Error in TextureManager::_updateNormalMap, Image type isn't correct.");

			return false;
		}

		Ogre::TexturePtr &Texture = getTexture(TEX_NORMAL_ID);

		Size ImageSize = Image.getSize();
		
		if (Texture->getWidth()  != ImageSize.Width ||
			Texture->getHeight() != ImageSize.Height)
		{
			HydraxLOG("Error in TextureManager::update, Update size doesn't correspond to " + getTextureName(TEX_NORMAL_ID) + " texture size");

			return false;
		}

		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = Texture->getBuffer();

        pixelBuffer->lock(Ogre::HardwareBuffer::HBL_NORMAL);
        const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();

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

        int x, y;

        for (x = 0; x < ImageSize.Width; x++)
        {
            for (y = 0; y < ImageSize.Height; y++)
            {
                *pDest++ =   Image.getValue(x,y,2); // B
                *pDest++ =   Image.getValue(x,y,1); // G
                *pDest++ =   Image.getValue(x,y,0); // R
				*pDest++ =   255;                   // A
            }
        }

        pixelBuffer->unlock();

		return true;
	}
开发者ID:DDeimos,项目名称:DeimosSpace,代码行数:52,代码来源:TextureManager.cpp

示例12: update

bool OgreARAppLogic::update(Ogre::Real deltaTime)
{
	if (!pause) {
		if( !userUpdate(this)) return false; // call user-defined funcions

		// update background image
		if (!mTexture.isNull())
		{
			//Pedimos a ogre que actualice la imagen desde el PixelBox
			Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mTexture->getBuffer();
			pixelBuffer->blitFromMemory(mPixelBox);
		}	  	  
	}

	bool result = processInputs(deltaTime);
	return result;
}
开发者ID:Dymanik,项目名称:anarcards,代码行数:17,代码来源:OgreARAppLogic.cpp

示例13: Rectangle

void SourceTexture::Rectangle(int x, int y, int width, int height, unsigned long color)
{
	Ogre::HardwarePixelBufferSharedPtr pixelBuffer = m_spTexture->getBuffer();
	pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
	const Ogre::PixelBox& pixelbox = pixelBuffer->getCurrentLock();
	/*unsigned int dstBpp = Ogre::PixelUtil::getNumElemBytes(pixelbox.format);
	unsigned int dstPitch = pixelbox.rowPitch * dstBpp;*/
	unsigned char *pImage = static_cast<unsigned char*>(pixelbox.data);
	
	int dst_width = pixelbox.getWidth();

	unsigned char *pTmp = pImage + ( ( y*m_nWidth) + x )*4;
	for(int i = 0 ; i < width ; i++, pTmp += 4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	pTmp = pImage + ( ( (y+height-1)*m_nWidth) + x )*4;
	for(int i = 0 ; i < width ; i++, pTmp += 4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	pTmp = pImage + ( ( y*m_nWidth) + x )*4;
	for(int i = 0 ; i < height ; i++, pTmp += m_nWidth*4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	pTmp = pImage + ( ( y*m_nWidth) + x+width-1 )*4;
	for(int i = 0 ; i < height ; i++, pTmp += m_nWidth*4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	//m_spImageData->SetFlag(NxImageData::UPDATE_PIXEL);
}
开发者ID:oksangman,项目名称:Ant,代码行数:45,代码来源:SourceTexture.cpp

示例14: renderIntoTexture

	void UiManager::renderIntoTexture(const Ogre::TexturePtr &aTexture)
	{
		assert(!aTexture.isNull());
		assert(isViewSizeMatching(aTexture));
		
		Ogre::HardwarePixelBufferSharedPtr hwBuffer = aTexture->getBuffer(0, 0);
		hwBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
		
		const Ogre::PixelBox &pb = hwBuffer->getCurrentLock();
		
		// render into texture buffer
		QImage textureImg((uchar *)pb.data, pb.getWidth(), pb.getHeight(), QImage::Format_ARGB32);
		textureImg.fill(0);
		
		QPainter painter(&textureImg);
		mWidgetView->render(&painter, QRect(QPoint(0, 0), mWidgetView->size()), QRect(QPoint(0, 0), mWidgetView->size()));
		
		hwBuffer->unlock();
	}
开发者ID:advancingu,项目名称:Cutexture,代码行数:19,代码来源:UiManager.cpp

示例15: _copyImagePerLine

//------------------------------------------------------------------------------
void OgreVideoTexture::_copyImagePerLine(const IplImage *_image
                                        ,Ogre::HardwarePixelBufferSharedPtr _pixelBuffer)
{

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

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

    for (size_t i = 0 ; i < _image->height ; i++)
    {
    memcpy(pDest + i*1024*4
          , (_image->imageData) +   i*_image->width * 3
          , _image->width * 3);
    }

    _pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:21,代码来源:OgreVideoTexture.cpp


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