本文整理汇总了C++中ogre::HardwarePixelBufferSharedPtr::blitFromMemory方法的典型用法代码示例。如果您正苦于以下问题:C++ HardwarePixelBufferSharedPtr::blitFromMemory方法的具体用法?C++ HardwarePixelBufferSharedPtr::blitFromMemory怎么用?C++ HardwarePixelBufferSharedPtr::blitFromMemory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::HardwarePixelBufferSharedPtr
的用法示例。
在下文中一共展示了HardwarePixelBufferSharedPtr::blitFromMemory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateColorDepthTexture
bool KinectDevice::UpdateColorDepthTexture()
{
bool updated = false;
if (!mColorTexture.isNull() && mColorTextureAvailable)
{
Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mColorTexture->getBuffer();
pixelBuffer->blitFromMemory(mColorPixelBox);
mColorTextureAvailable = false;
updated = true;
}
if (!mDepthTexture.isNull() && mDepthTextureAvailable)
{
Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mDepthTexture->getBuffer();
pixelBuffer->blitFromMemory(mDepthPixelBox);
mDepthTextureAvailable = false;
updated = true;
}
if (!mColoredDepthTexture.isNull()&& mColoredDepthTextureAvailable)
{
Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mColoredDepthTexture->getBuffer();
pixelBuffer->blitFromMemory(mColoredDepthPixelBox);
mColoredDepthTextureAvailable = false;
updated = true;
}
return updated;
}
示例2: 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);
}
示例3: 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);
}
}
示例4: Paint
void HTML::Paint(Ogre::HardwarePixelBufferSharedPtr pixelBuffer, const unsigned char*srcBuffer, const Berkelium::Rect& srcRect, size_t num_copy_rects, const Berkelium::Rect *copy_rects)
{
/**/
const Ogre::PixelBox srcBox = Ogre::PixelBox(ToBox(srcRect), Ogre::PF_BYTE_BGRA, const_cast<unsigned char*>(srcBuffer));
for(unsigned int i = 0; i < num_copy_rects; i++)
{
const Ogre::Box destBox = ToBox(copy_rects[i]);
pixelBuffer->blitFromMemory(srcBox.getSubVolume(destBox), destBox);
}
}
示例5: 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;
}
示例6: assert
void
Terrain::loadResource(Ogre::Resource* resource)
{
const Ogre::String& name = resource->getName();
if (name.find("<Lightmap>") !=Ogre::String::npos)
{
Ogre::String::size_type left_parentheses = name.find_first_of('(');
Ogre::String::size_type right_parentheses = name.find_last_of(')');
if (left_parentheses ==Ogre::String::npos ||
right_parentheses ==Ogre::String::npos)
{
OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR,
"Unorganised lightmap texture name '" + name + "'",
"Terrain::loadResource");
}
Ogre::StringVector vec = Ogre::StringUtil::split(
name.substr(left_parentheses + 1, right_parentheses - left_parentheses - 1), ",", 2);
if (vec.size() != 2)
{
OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR,
"Unorganised lightmap texture name '" + name + "'",
"Terrain::loadResource");
}
int nPosX = Ogre::StringConverter::parseInt(vec[0]);
int nPosZ = Ogre::StringConverter::parseInt(vec[1]);
if (nPosX < 0 || nPosX >= mData->mNumTilePerX ||
nPosZ < 0 || nPosZ >= mData->mNumTilePerZ)
{
OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR,
"Unorganised lightmap texture name '" + name + "'",
"Terrain::loadResource");
}
Ogre::uint uWidth, uHeight;
if (getLightmapQuality() == LMQ_LOW)
{
uWidth = mData->mTileSize * 2;
uHeight = mData->mTileSize * 2;
}
else
{
uWidth = mData->mTileSize * 8;
uHeight = mData->mTileSize * 8;
}
Ogre::Texture* pTexture = static_cast<Ogre::Texture*>(resource);
if (pTexture->getWidth() != uWidth || pTexture->getHeight() != uHeight)
{
pTexture->freeInternalResources();
pTexture->setWidth(uWidth);
pTexture->setHeight(uHeight);
}
pTexture->createInternalResources();
Ogre::HardwarePixelBufferSharedPtr bufferPtr = pTexture->getBuffer();
size_t l = nPosX * mData->mTileSize * 8;
size_t t = nPosZ * mData->mTileSize * 8;
size_t r = l + mData->mTileSize * 8;
size_t b = t + mData->mTileSize * 8;
if (r > mData->mLightmapImage->getWidth())
r = mData->mLightmapImage->getWidth();
if (b > mData->mLightmapImage->getHeight())
b = mData->mLightmapImage->getHeight();
bufferPtr->blitFromMemory(
mData->mLightmapImage->getPixelBox().getSubVolume(Ogre::Box(l, t, r, b)));
}
else
{
for (AtlasArray::const_iterator it = mAtlases.begin(); it != mAtlases.end(); ++it)
{
if (it->texture.get() == resource)
{
assert(!it->image.isNull());
it->texture->loadImage(*it->image);
break;
}
}
}
}
示例7: setupContent
void TextureBlitTest::setupContent()
{
static const Ogre::String ColorTextureName = "VTests_TextureBlit_color_texture";
static const Ogre::String DepthTextureName = "VTests_TextureBlit_depth_texture";
static const int TextureSize = 8;
mViewport->setBackgroundColour(ColourValue(0.8,0.8,0.8));
/// TEST COLOUR
m_colorTexture = Ogre::TextureManager::getSingleton().createManual(
ColorTextureName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
TextureSize, TextureSize,
0,
Ogre::PF_BYTE_RGB,
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
Ogre::PixelBox pb(ColorImage.width, ColorImage.height, 1, Ogre::PF_BYTE_RGB, (void *)ColorImage.pixel_data);
Ogre::HardwarePixelBufferSharedPtr buffer = m_colorTexture->getBuffer();
buffer->blitFromMemory(pb);
// Get the material
Ogre::MaterialPtr matColourPtr = Ogre::MaterialManager::getSingleton().getByName("Examples/OgreDance");
ReplaceTexture(matColourPtr, ColorTextureName);
// create a standard plane entity
Entity* ent = mSceneMgr->createEntity("Plane_color", SceneManager::PT_PLANE);
// attach it to a node, scale it, and position appropriately
SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
node->setPosition(-30.0, 0.0, 0.0);
node->setScale(0.25, 0.25, 0.25);
node->attachObject(ent);
ent->setMaterial(matColourPtr); // give it the material we prepared
/// TEST DEPTH
m_depthTexture = Ogre::TextureManager::getSingleton().createManual(
DepthTextureName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
TextureSize, TextureSize,
0,
Ogre::PF_DEPTH,
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
Ogre::PixelBox dpb(DepthImage.width, DepthImage.height, 1, Ogre::PF_DEPTH, (void *)DepthImage.pixel_data);
Ogre::HardwarePixelBufferSharedPtr dbuffer = m_depthTexture->getBuffer();
dbuffer->blitFromMemory(dpb);
// Get the material
Ogre::MaterialPtr matDepthPtr = Ogre::MaterialManager::getSingleton().getByName("Examples/OgreParade");
ReplaceTexture(matDepthPtr, DepthTextureName);
// create a standard plane entity
Entity* depthEnt = mSceneMgr->createEntity("Plane_depth", SceneManager::PT_PLANE);
// attach it to a node, scale it, and position appropriately
SceneNode* depthNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
depthNode->setPosition(30.0, 0.0, 0.0);
depthNode->setScale(0.25, 0.25, 0.25);
depthNode->attachObject(depthEnt);
depthEnt->setMaterial(matDepthPtr); // give it the material we prepared
mCamera->setPosition(0,0,125);
mCamera->setDirection(0,0,-1);
}