本文整理汇总了C++中OGRE_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ OGRE_FREE函数的具体用法?C++ OGRE_FREE怎么用?C++ OGRE_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OGRE_FREE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: OGRE_ALLOC_T
void FileSystemLayer::getConfigPaths()
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
// try to determine the application's path
DWORD bufsize = 256;
char* resolved = 0;
do
{
char* buf = OGRE_ALLOC_T(char, bufsize, Ogre::MEMCATEGORY_GENERAL);
DWORD retval = GetModuleFileName(NULL, buf, bufsize);
if (retval == 0)
{
// failed
OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
break;
}
if (retval < bufsize)
{
// operation was successful.
resolved = buf;
}
else
{
// buffer was too small, grow buffer and try again
OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
bufsize <<= 1;
}
} while (!resolved);
Ogre::String appPath = resolved;
if (resolved)
OGRE_FREE(resolved, Ogre::MEMCATEGORY_GENERAL);
if (!appPath.empty())
{
// need to strip the application filename from the path
Ogre::String::size_type pos = appPath.rfind('\\');
if (pos != Ogre::String::npos)
appPath.erase(pos);
}
else
{
// fall back to current working dir
appPath = ".";
}
#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
Ogre::String appPath;
if(!widePathToOgreString(appPath, Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data()))
{
// fallback to current working dir
appPath = ".";
}
#endif
// use application path as config search path
mConfigPaths.push_back(appPath + '\\');
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:58,代码来源:OgreFileSystemLayer.cpp
示例2: OGRE_ALLOC_T
/*/////////////////////////////////////////////////////////////////*/
bool OgreOggStreamSound::_stream(ALuint buffer)
{
std::vector<char> audioData;
char* data;
int section = 0;
int result = 0;
// Create buffer
data = OGRE_ALLOC_T(char, mBufferSize, Ogre::MEMCATEGORY_GENERAL);
memset(data, 0, mBufferSize);
// Read only what was asked for
while( !mStreamEOF && (static_cast<int>(audioData.size()) < mBufferSize) )
{
int bytes = 0;
// Read up to a buffer's worth of data
bytes = ov_read(&mOggStream, data, static_cast<int>(mBufferSize), 0, 2, 1, §ion);
// EOF check
if (bytes == 0)
{
// If set to loop wrap to start of stream
if ( mLoop && mSeekable )
{
if ( ov_time_seek(&mOggStream, 0 + mLoopOffset)!= 0 )
{
Ogre::LogManager::getSingleton().logMessage("***--- OgreOggStream::_stream() - ERROR looping stream, ogg file NOT seekable!");
break;
}
}
else
{
mStreamEOF=true;
// Don't loop - finish.
break;
}
}
// Append to end of buffer
audioData.insert(audioData.end(), data, data + bytes);
// Keep track of read data
result+=bytes;
}
// EOF
if(result == 0)
{
OGRE_FREE(data, Ogre::MEMCATEGORY_GENERAL);
return false;
}
alGetError();
// Copy buffer data
alBufferData(buffer, mFormat, &audioData[0], static_cast<ALsizei>(audioData.size()), mVorbisInfo->rate);
// Cleanup
OGRE_FREE(data, Ogre::MEMCATEGORY_GENERAL);
return true;
}
开发者ID:Acularius,项目名称:Thrive,代码行数:59,代码来源:ogreoggstreamsound.cpp
示例3: inflateEnd
//---------------------------------------------------------------------
void DeflateStream::destroy()
{
if (getAccessMode() == READ)
inflateEnd(mZStream);
OGRE_FREE(mZStream, MEMCATEGORY_GENERAL);
mZStream = 0;
OGRE_FREE(mTmp, MEMCATEGORY_GENERAL);
mTmp = 0;
}
开发者ID:wjwwood,项目名称:ogre,代码行数:11,代码来源:OgreDeflate.cpp
示例4: OGRE_ALLOC_T
//-----------------------------------------------------------------------
bool ConvexBody::operator == ( const ConvexBody& rhs ) const
{
if ( getPolygonCount() != rhs.getPolygonCount() )
return false;
// Compare the polygons. They may not be in correct order.
// A correct convex body does not have identical polygons in its body.
bool *bChecked = OGRE_ALLOC_T(bool, getPolygonCount(), MEMCATEGORY_SCENE_CONTROL);
for ( size_t i=0; i<getPolygonCount(); ++i )
{
bChecked[ i ] = false;
}
for ( size_t i=0; i<getPolygonCount(); ++i )
{
bool bFound = false;
for ( size_t j=0; j<getPolygonCount(); ++j )
{
const Polygon& pA = getPolygon( i );
const Polygon& pB = rhs.getPolygon( j );
if ( pA == pB )
{
bFound = true;
bChecked[ i ] = true;
break;
}
}
if ( bFound == false )
{
OGRE_FREE(bChecked, MEMCATEGORY_SCENE_CONTROL);
bChecked = 0;
return false;
}
}
for ( size_t i=0; i<getPolygonCount(); ++i )
{
if ( bChecked[ i ] != true )
{
OGRE_FREE(bChecked, MEMCATEGORY_SCENE_CONTROL);
bChecked = 0;
return false;
}
}
OGRE_FREE(bChecked, MEMCATEGORY_SCENE_CONTROL);
bChecked = 0;
return true;
}
开发者ID:carriercomm,项目名称:gamekit,代码行数:53,代码来源:OgreConvexBody.cpp
示例5: OGRE_FREE
//-----------------------------------------------------------------------------
Image & Image::operator = ( const Image &img )
{
if( m_pBuffer && m_bAutoDelete )
{
OGRE_FREE(m_pBuffer, MEMCATEGORY_GENERAL);
m_pBuffer = NULL;
}
m_uWidth = img.m_uWidth;
m_uHeight = img.m_uHeight;
m_uDepth = img.m_uDepth;
m_eFormat = img.m_eFormat;
m_uSize = img.m_uSize;
m_uFlags = img.m_uFlags;
m_ucPixelSize = img.m_ucPixelSize;
m_uNumMipmaps = img.m_uNumMipmaps;
m_bAutoDelete = img.m_bAutoDelete;
//Only create/copy when previous data was not dynamic data
if( m_bAutoDelete )
{
m_pBuffer = OGRE_ALLOC_T(uchar, m_uSize, MEMCATEGORY_GENERAL);
memcpy( m_pBuffer, img.m_pBuffer, m_uSize );
}
else
{
m_pBuffer = img.m_pBuffer;
}
return *this;
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:30,代码来源:OgreImage.cpp
示例6: OGRE_MALLOC
//---------------------------------------------------------------------
void TerrainLayerBlendMap::blit(const PixelBox &src, const Box &dstBox)
{
const PixelBox* srcBox = &src;
if (srcBox->getWidth() != dstBox.getWidth() || srcBox->getHeight() != dstBox.getHeight())
{
// we need to rescale src to dst size first (also confvert format)
void* tmpData = OGRE_MALLOC(dstBox.getWidth() * dstBox.getHeight(), MEMCATEGORY_GENERAL);
srcBox = OGRE_NEW PixelBox(dstBox.getWidth(), dstBox.getHeight(), 1, PF_L8, tmpData);
Image::scale(src, *srcBox);
}
// pixel conversion
PixelBox dstMemBox(dstBox, PF_L8, mData);
PixelUtil::bulkPixelConversion(*srcBox, dstMemBox);
if (srcBox != &src)
{
// free temp
OGRE_FREE(srcBox->data, MEMCATEGORY_GENERAL);
OGRE_DELETE srcBox;
srcBox = 0;
}
Rect dRect(dstBox.left, dstBox.top, dstBox.right, dstBox.bottom);
dirtyRect(dRect);
}
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:30,代码来源:OgreTerrainLayerBlendMap.cpp
示例7: while
//-----------------------------------------------------------------------
void CgProgram::freeCgArgs(void)
{
if (mCgArguments)
{
size_t index = 0;
char* current = mCgArguments[index];
while (current)
{
OGRE_FREE(current, MEMCATEGORY_RESOURCE);
mCgArguments[index] = 0;
current = mCgArguments[++index];
}
OGRE_FREE(mCgArguments, MEMCATEGORY_RESOURCE);
mCgArguments = 0;
}
}
开发者ID:wjwwood,项目名称:ogre,代码行数:17,代码来源:OgreCgProgram.cpp
示例8: OGRE_EXCEPT
//-----------------------------------------------------------------------------
Image & Image::flipAroundX()
{
if( !mBuffer )
{
OGRE_EXCEPT(
Exception::ERR_INTERNAL_ERROR,
"Can not flip an uninitialised texture",
"Image::flipAroundX" );
}
mNumMipmaps = 0; // Image operations lose precomputed mipmaps
size_t rowSpan = mWidth * mPixelSize;
uchar *pTempBuffer = OGRE_ALLOC_T(uchar, rowSpan * mHeight, MEMCATEGORY_GENERAL);
uchar *ptr1 = mBuffer, *ptr2 = pTempBuffer + ( ( mHeight - 1 ) * rowSpan );
for( ushort i = 0; i < mHeight; i++ )
{
memcpy( ptr2, ptr1, rowSpan );
ptr1 += rowSpan; ptr2 -= rowSpan;
}
memcpy( mBuffer, pTempBuffer, rowSpan * mHeight);
OGRE_FREE(pTempBuffer, MEMCATEGORY_GENERAL);
return *this;
}
开发者ID:ballisticwhisper,项目名称:ogre,代码行数:30,代码来源:OgreImage.cpp
示例9: OGRE_FREE
void AndroidArchive::unload()
{
if(mBuffer)
{
OGRE_FREE(mBuffer, MEMCATEGORY_GENERAL);
mBuffer = 0;
}
}
开发者ID:136296634mn,项目名称:ogre-android-demo,代码行数:8,代码来源:AndroidArchive.cpp
示例10: OGRE_FREE
//---------------------------------------------------------------------
void Image::freeMemory()
{
//Only delete if this was not a dynamic image (meaning app holds & destroys buffer)
if( mBuffer && mAutoDelete )
{
OGRE_FREE(mBuffer, MEMCATEGORY_GENERAL);
mBuffer = NULL;
}
}
开发者ID:ballisticwhisper,项目名称:ogre,代码行数:11,代码来源:OgreImage.cpp
示例11: OGRE_FREE
//-----------------------------------------------------------------------
void BspRaySceneQuery::clearTemporaries(void)
{
mObjsThisQuery.clear();
vector<WorldFragment*>::type::iterator i;
for (i = mSingleIntersections.begin(); i != mSingleIntersections.end(); ++i)
{
OGRE_FREE(*i, MEMCATEGORY_SCENE_CONTROL);
}
mSingleIntersections.clear();
}
开发者ID:airgames,项目名称:vuforia-gamekit-integration,代码行数:11,代码来源:OgreBspSceneManager.cpp
示例12: getBufferResources
//-----------------------------------------------------------------------------
void D3D9HardwarePixelBuffer::bind(IDirect3DDevice9 *dev, IDirect3DVolume9 *volume, IDirect3DBaseTexture9 *mipTex)
{
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
BufferResources* bufferResources = getBufferResources(dev);
bool isNewBuffer = false;
if (bufferResources == NULL)
{
bufferResources = createBufferResources();
mMapDeviceToBufferResources[dev] = bufferResources;
isNewBuffer = true;
}
bufferResources->mipTex = mipTex;
bufferResources->volume = volume;
bufferResources->volume->AddRef();
D3DVOLUME_DESC desc;
if(volume->GetDesc(&desc) != D3D_OK)
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Could not get volume information",
"D3D9HardwarePixelBuffer::D3D9HardwarePixelBuffer");
mWidth = desc.Width;
mHeight = desc.Height;
mDepth = desc.Depth;
mFormat = D3D9Mappings::_getPF(desc.Format);
// Default
mRowPitch = mWidth;
mSlicePitch = mHeight*mWidth;
mSizeInBytes = PixelUtil::getMemorySize(mWidth, mHeight, mDepth, mFormat);
if (isNewBuffer && mOwnerTexture->isManuallyLoaded())
{
DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
while (it != mMapDeviceToBufferResources.end())
{
if (it->second != bufferResources &&
it->second->volume != NULL &&
it->first->TestCooperativeLevel() == D3D_OK &&
dev->TestCooperativeLevel() == D3D_OK)
{
Box fullBufferBox(0,0,0,mWidth,mHeight,mDepth);
PixelBox dstBox(fullBufferBox, mFormat);
dstBox.data = OGRE_MALLOC(getSizeInBytes(), MEMCATEGORY_RESOURCE);
blitToMemory(fullBufferBox, dstBox, it->second, it->first);
blitFromMemory(dstBox, fullBufferBox, bufferResources);
OGRE_FREE(dstBox.data, MEMCATEGORY_RESOURCE);
break;
}
++it;
}
}
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:56,代码来源:OgreD3D9HardwarePixelBuffer.cpp
示例13: suggestPixelFormat
//-----------------------------------------------------------------------
void RenderTarget::writeContentsToFile(const String& filename)
{
PixelFormat pf = suggestPixelFormat();
uchar *data = OGRE_ALLOC_T(uchar, mWidth * mHeight * PixelUtil::getNumElemBytes(pf), MEMCATEGORY_RENDERSYS);
PixelBox pb(mWidth, mHeight, 1, pf, data);
copyContentsToMemory(pb);
Image().loadDynamicImage(data, mWidth, mHeight, 1, pf, false, 1, 0).save(filename);
OGRE_FREE(data, MEMCATEGORY_RENDERSYS);
}
开发者ID:mACH1VO,项目名称:MuOnline,代码行数:14,代码来源:OgreRenderTarget.cpp
示例14: OGRE_ALLOC_T
//---------------------------------------------------------------------
void Serializer::readFloats(DataStreamPtr& stream, double* pDest, size_t count)
{
// Read from float, convert to double
float* tmp = OGRE_ALLOC_T(float, count, MEMCATEGORY_GENERAL);
float* ptmp = tmp;
stream->read(tmp, sizeof(float) * count);
flipFromLittleEndian(tmp, sizeof(float), count);
// Convert to doubles (no cast required)
while(count--)
{
*pDest++ = *ptmp++;
}
OGRE_FREE(tmp, MEMCATEGORY_GENERAL);
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:15,代码来源:OgreSerializer.cpp
示例15: publishFrame
// bool publishFrame(Ogre::RenderWindow * render_object, const std::string frame_id)
bool publishFrame(Ogre::RenderTexture * render_object, const std::string frame_id)
{
if (pub_.getTopic() == "")
{
return false;
}
if (frame_id == "")
{
return false;
}
// RenderTarget::writeContentsToFile() used as example
int height = render_object->getHeight();
int width = render_object->getWidth();
// the results of pixel format have to be used to determine
// image.encoding
Ogre::PixelFormat pf = render_object->suggestPixelFormat();
uint pixelsize = Ogre::PixelUtil::getNumElemBytes(pf);
uint datasize = width * height * pixelsize;
// 1.05 multiplier is to avoid crash when the window is resized.
// There should be a better solution.
uchar *data = OGRE_ALLOC_T(uchar, datasize * 1.05, Ogre::MEMCATEGORY_RENDERSYS);
Ogre::PixelBox pb(width, height, 1, pf, data);
render_object->copyContentsToMemory(pb, Ogre::RenderTarget::FB_AUTO);
sensor_msgs::Image image;
image.header.stamp = ros::Time::now();
image.header.seq = image_id_++;
image.header.frame_id = frame_id;
image.height = height;
image.width = width;
image.step = pixelsize * width;
if (pixelsize == 3)
image.encoding = sensor_msgs::image_encodings::RGB8; // would break if pf changes
else if (pixelsize == 4)
image.encoding = sensor_msgs::image_encodings::RGBA8; // would break if pf changes
else
{
ROS_ERROR_STREAM("unknown pixe format " << pixelsize << " " << pf);
}
image.is_bigendian = (OGRE_ENDIAN == OGRE_ENDIAN_BIG);
image.data.resize(datasize);
memcpy(&image.data[0], data, datasize);
pub_.publish(image);
OGRE_FREE(data, Ogre::MEMCATEGORY_RENDERSYS);
}
开发者ID:lucasw,项目名称:rviz_camera_stream,代码行数:48,代码来源:camera_display.cpp
示例16: SAFE_RELEASE
//-----------------------------------------------------------------------------
void D3D9HardwarePixelBuffer::destroyBufferResources(IDirect3DDevice9* d3d9Device)
{
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.find(d3d9Device);
if (it != mMapDeviceToBufferResources.end())
{
SAFE_RELEASE(it->second->surface);
SAFE_RELEASE(it->second->volume);
if (it->second != NULL)
{
OGRE_FREE (it->second, MEMCATEGORY_RENDERSYS);
it->second = NULL;
}
mMapDeviceToBufferResources.erase(it);
}
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:19,代码来源:OgreD3D9HardwarePixelBuffer.cpp
示例17: checkStream
//---------------------------------------------------------------------
void StreamSerialiser::writeData(const void* buf, size_t size, size_t count)
{
checkStream(false, false, true);
size_t totSize = size * count;
if (mFlipEndian)
{
void* pToWrite = OGRE_MALLOC(totSize, MEMCATEGORY_GENERAL);
memcpy(pToWrite, buf, totSize);
Bitwise::bswapChunks(pToWrite, size, count);
mStream->write(pToWrite, totSize);
OGRE_FREE(pToWrite, MEMCATEGORY_GENERAL);
}
else
{
mStream->write(buf, totSize);
}
}
开发者ID:spetz911,项目名称:ogre3d,代码行数:22,代码来源:OgreStreamSerialiser.cpp
示例18: destroyRenderTexture
D3D9HardwarePixelBuffer::~D3D9HardwarePixelBuffer()
{
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
destroyRenderTexture();
DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
while (it != mMapDeviceToBufferResources.end())
{
SAFE_RELEASE(it->second->surface);
SAFE_RELEASE(it->second->volume);
if (it->second != NULL)
{
OGRE_FREE (it->second, MEMCATEGORY_RENDERSYS);
it->second = NULL;
}
DeviceToBufferResourcesIterator deadi = it++;
mMapDeviceToBufferResources.erase(deadi);
}
}
开发者ID:terminus510,项目名称:OgreBulletTest,代码行数:21,代码来源:OgreD3D9HardwarePixelBuffer.cpp
示例19: while
Terrain* SnowTerrain::getTerrain()
{
if(!mTerrainGroup) return NULL;
Terrain *t = mTerrainGroup->getTerrain(0,0);
return t;
TerrainGroup::TerrainIterator ti = mTerrainGroup->getTerrainIterator();
while (ti.hasMoreElements())
{
Ogre::uint32 tkey = ti.peekNextKey();
TerrainGroup::TerrainSlot* ts = ti.getNext();
if (ts->instance && ts->instance->isLoaded())
{
float* heights = ts->instance->getHeightData();
//PixelBox* pBox = ts->instance->calculateNormals());
TexturePtr texturePtr = ts->instance->getTerrainNormalMap();
HardwarePixelBufferSharedPtr buf = texturePtr->getBuffer();
size_t bytes = buf->getSizeInBytes();
size_t h = buf->getHeight();
size_t w = buf->getWidth();
size_t d = buf->getDepth();
PixelFormat f = PF_BYTE_RGB;//buf->getFormat();
uint8* tmpData = (uint8*)OGRE_MALLOC(w * h * 3, MEMCATEGORY_GENERAL);
memset(tmpData,0,w*h*3);
PixelBox pBox(w, h, d, f, tmpData);
buf->blitToMemory(pBox);
OGRE_FREE(tmpData, MEMCATEGORY_GENERAL);
}
}
return NULL;
}
开发者ID:pranavsureshpn,项目名称:gpusphsim,代码行数:38,代码来源:SnowTerrain.cpp
示例20: OGRE_FREE
//-----------------------------------------------------------------------
DefaultHardwareIndexBuffer::~DefaultHardwareIndexBuffer()
{
OGRE_FREE(mData, MEMCATEGORY_GEOMETRY);
}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:5,代码来源:OgreDefaultHardwareBufferManager.cpp
注:本文中的OGRE_FREE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论