本文整理汇总了C++中OGRE_NEW_T函数的典型用法代码示例。如果您正苦于以下问题:C++ OGRE_NEW_T函数的具体用法?C++ OGRE_NEW_T怎么用?C++ OGRE_NEW_T使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OGRE_NEW_T函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: concatenate_path
Ogre::DataStreamPtr OMEFileSystemArchive::open(const Ogre::String& filename, bool readOnly) const
{
Ogre::String full_path = concatenate_path(mName, filename);
// Use filesystem to determine size
// (quicker than streaming to the end and back)
struct stat tagStat;
int ret = stat(full_path.c_str(), &tagStat);
assert(ret == 0 && "Problem getting file size" );
(void)ret; // Silence warning
// Always open in binary mode
// Also, always include reading
std::ios::openmode mode = std::ios::in | std::ios::binary;
std::istream* baseStream = 0;
std::ifstream* roStream = 0;
std::fstream* rwStream = 0;
if (!readOnly && isReadOnly())
{
mode |= std::ios::out;
rwStream = OGRE_NEW_T(std::fstream, Ogre::MEMCATEGORY_GENERAL)();
rwStream->open(full_path.c_str(), mode);
baseStream = rwStream;
}
else
{
roStream = OGRE_NEW_T(std::ifstream, Ogre::MEMCATEGORY_GENERAL)();
roStream->open(full_path.c_str(), mode);
baseStream = roStream;
}
// Should check ensure open succeeded, in case fail for some reason.
if (baseStream->fail())
{
OGRE_DELETE_T(roStream, basic_ifstream, Ogre::MEMCATEGORY_GENERAL);
OGRE_DELETE_T(rwStream, basic_fstream, Ogre::MEMCATEGORY_GENERAL);
OGRE_EXCEPT(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Cannot open file: " + filename,
"FileSystemArchive::open");
}
/// Construct return stream, tell it to delete on destroy
Ogre::FileStreamDataStream* stream = 0;
if (rwStream)
{
// use the writeable stream
stream = OGRE_NEW Ogre::FileStreamDataStream(filename,
rwStream, (size_t)tagStat.st_size, true);
}
else
{
// read-only stream
Ogre::String newName = mName + ":" + filename;
stream = OGRE_NEW Ogre::FileStreamDataStream(newName,
roStream, (size_t)tagStat.st_size, true);
}
return Ogre::DataStreamPtr(stream);
}
示例2: OGRE_DELETE_T
//-----------------------------------------------------------------------
void PhysXActorExtern::setPhysicsShape(PhysicsShapeDesc* physicsShapeDesc)
{
if (mPhysicsShapeDesc)
{
OGRE_DELETE_T(mPhysicsShapeDesc, PhysicsShapeDesc, Ogre::MEMCATEGORY_SCENE_OBJECTS);
}
switch (physicsShapeDesc->mPhysicsShapeType)
{
case ST_BOX:
{
PhysicsBoxDesc* physicsBoxDesc = static_cast<PhysicsBoxDesc*>(physicsShapeDesc);
mPhysicsShapeDesc = OGRE_NEW_T(PhysicsBoxDesc, Ogre::MEMCATEGORY_SCENE_OBJECTS)(*physicsBoxDesc);
}
break;
case ST_SPHERE:
{
PhysicsSphereDesc* physicsSphereDesc = static_cast<PhysicsSphereDesc*>(physicsShapeDesc);
mPhysicsShapeDesc = OGRE_NEW_T(PhysicsSphereDesc, Ogre::MEMCATEGORY_SCENE_OBJECTS)(*physicsSphereDesc);
}
break;
case ST_CAPSULE:
{
PhysicsCapsuleDesc* physicsCapsuleDesc = static_cast<PhysicsCapsuleDesc*>(physicsShapeDesc);
mPhysicsShapeDesc = OGRE_NEW_T(PhysicsCapsuleDesc, Ogre::MEMCATEGORY_SCENE_OBJECTS)(*physicsCapsuleDesc);
}
break;
}
}
示例3: clear
//-----------------------------------------------------------------------
void ConfigFile::load(const DataStreamPtr& stream, const String& separators,
bool trimWhitespace)
{
/* Clear current settings map */
clear();
String currentSection = StringUtil::BLANK;
SettingsMultiMap* currentSettings = OGRE_NEW_T(SettingsMultiMap, MEMCATEGORY_GENERAL)();
mSettings[currentSection] = currentSettings;
/* Process the file line for line */
String line, optName, optVal;
while (!stream->eof())
{
line = stream->getLine();
/* Ignore comments & blanks */
if (line.length() > 0 && line.at(0) != '#' && line.at(0) != '@')
{
if (line.at(0) == '[' && line.at(line.length()-1) == ']')
{
// Section
currentSection = line.substr(1, line.length() - 2);
SettingsBySection::const_iterator seci = mSettings.find(currentSection);
if (seci == mSettings.end())
{
currentSettings = OGRE_NEW_T(SettingsMultiMap, MEMCATEGORY_GENERAL)();
mSettings[currentSection] = currentSettings;
}
else
{
currentSettings = seci->second;
}
}
else
{
/* Find the first seperator character and split the string there */
Ogre::String::size_type separator_pos = line.find_first_of(separators, 0);
if (separator_pos != Ogre::String::npos)
{
optName = line.substr(0, separator_pos);
/* Find the first non-seperator character following the name */
Ogre::String::size_type nonseparator_pos = line.find_first_not_of(separators, separator_pos);
/* ... and extract the value */
/* Make sure we don't crash on an empty setting (it might be a valid value) */
optVal = (nonseparator_pos == Ogre::String::npos) ? "" : line.substr(nonseparator_pos);
if (trimWhitespace)
{
StringUtil::trim(optVal);
StringUtil::trim(optName);
}
currentSettings->insert(SettingsMultiMap::value_type(optName, optVal));
}
}
}
}
}
示例4: ParticleAffector
//-----------------------------------------------------------------------
TextureRotator::TextureRotator(void) :
ParticleAffector(),
mUseOwnRotationSpeed(DEFAULT_USE_OWN_SPEED),
mScaledRotationSpeed(Ogre::Radian(0)),
twoPiRad(Ogre::Radian(Ogre::Math::TWO_PI))
{
mDynRotation = OGRE_NEW_T(DynamicAttributeFixed, Ogre::MEMCATEGORY_SCENE_OBJECTS)();
(static_cast<DynamicAttributeFixed*>(mDynRotation))->setValue(DEFAULT_ROTATION);
mDynRotationSpeed = OGRE_NEW_T(DynamicAttributeFixed, Ogre::MEMCATEGORY_SCENE_OBJECTS)();
(static_cast<DynamicAttributeFixed*>(mDynRotationSpeed))->setValue(DEFAULT_ROTATION_SPEED);
}
示例5: OGRE_NEW_T
//---------------------------------------------------------------------
void AnimationState::createBlendMask(size_t blendMaskSizeHint, float initialWeight)
{
if(!mBlendMask)
{
if(initialWeight >= 0)
{
mBlendMask = OGRE_NEW_T(BoneBlendMask, MEMCATEGORY_ANIMATION)(blendMaskSizeHint, initialWeight);
}
else
{
mBlendMask = OGRE_NEW_T(BoneBlendMask, MEMCATEGORY_ANIMATION)(blendMaskSizeHint);
}
}
}
示例6: ParticleAffector
//-----------------------------------------------------------------------
JetAffector::JetAffector (void) :
ParticleAffector(),
mScaled(0.0f)
{
mDynAcceleration = OGRE_NEW_T(DynamicAttributeFixed, Ogre::MEMCATEGORY_SCENE_OBJECTS)();
(static_cast<DynamicAttributeFixed*>(mDynAcceleration))->setValue(DEFAULT_ACCELERATION);
}
示例7:
//---------------------------------------------------------------------
D3D11VideoModeList* D3D11Driver::getVideoModeList()
{
if(mVideoModeList.isNull())
mVideoModeList = SharedPtr<D3D11VideoModeList>(OGRE_NEW_T(D3D11VideoModeList, MEMCATEGORY_GENERAL)(getDeviceAdapter()), SPFM_DELETE_T);
return mVideoModeList.get();
}
示例8: OGRE_NEW_T
void ConfigFile::addSection(const Ogre::String& section, const Ogre::NameValuePairList& settings)
{
// Create new section
mSettings[section] = OGRE_NEW_T(SettingsMultiMap, MEMCATEGORY_GENERAL);
// Insert values from the settings list
mSettings[section]->insert(settings.begin(), settings.end());
}
示例9: setlocale
//-----------------------------------------------------------------------
DataStreamPtr FileSystemArchive::open(const String& filename) const
{
#if (_MSC_VER >= 1400)
// std::locale langLocale("");
// std::locale::global(langLocale);
setlocale( LC_CTYPE, "" );
#endif
String full_path = concatenate_path(mName, filename);
// Use filesystem to determine size
// (quicker than streaming to the end and back)
struct stat tagStat;
int ret = stat(full_path.c_str(), &tagStat);
assert(ret == 0 && "Problem getting file size" );
// Always open in binary mode
std::ifstream *origStream = OGRE_NEW_T(std::ifstream, MEMCATEGORY_GENERAL)();
origStream->open(full_path.c_str(), std::ios::in | std::ios::binary);
// Should check ensure open succeeded, in case fail for some reason.
if (origStream->fail())
{
OGRE_DELETE_T(origStream, basic_ifstream, MEMCATEGORY_GENERAL);
OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
"Cannot open file: " + filename,
"FileSystemArchive::open");
}
/// Construct return stream, tell it to delete on destroy
FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(filename,
origStream, tagStat.st_size, true);
return DataStreamPtr(stream);
}
示例10: OGRE_NEW_T
//-----------------------------------------------------------------------
void QueuedRenderableCollection::merge( const QueuedRenderableCollection& rhs )
{
mSortedDescending.insert( mSortedDescending.end(), rhs.mSortedDescending.begin(), rhs.mSortedDescending.end() );
PassGroupRenderableMap::const_iterator srcGroup;
for( srcGroup = rhs.mGrouped.begin(); srcGroup != rhs.mGrouped.end(); ++srcGroup )
{
PassGroupRenderableMap::iterator dstGroup = mGrouped.find( srcGroup->first );
if (dstGroup == mGrouped.end())
{
std::pair<PassGroupRenderableMap::iterator, bool> retPair;
// Create new pass entry, build a new list
// Note that this pass and list are never destroyed until the
// engine shuts down, or a pass is destroyed or has it's hash
// recalculated, although the lists will be cleared
retPair = mGrouped.insert(
PassGroupRenderableMap::value_type(
srcGroup->first, OGRE_NEW_T(RenderableList, MEMCATEGORY_SCENE_CONTROL)() ));
assert(retPair.second &&
"Error inserting new pass entry into PassGroupRenderableMap");
dstGroup = retPair.first;
}
// Insert renderable
dstGroup->second->insert( dstGroup->second->end(), srcGroup->second->begin(), srcGroup->second->end() );
}
}
示例11: OGRE_NEW_T
//------------------------------------------------------------------------
BackgroundProcessTicket ResourceBackgroundQueue::load(
const String& resType, const String& name,
const String& group, bool isManual,
ManualResourceLoader* loader,
const NameValuePairList* loadParams,
ResourceBackgroundQueue::Listener* listener)
{
#if OGRE_THREAD_SUPPORT
// queue a request
ResourceRequest req;
req.type = RT_LOAD_RESOURCE;
req.resourceType = resType;
req.resourceName = name;
req.groupName = group;
req.isManual = isManual;
req.loader = loader;
// Make instance copy of loadParams for thread independence
req.loadParams = ( loadParams ? OGRE_NEW_T(NameValuePairList, MEMCATEGORY_GENERAL)( *loadParams ) : 0 );
req.listener = listener;
return addRequest(req);
#else
// synchronous
ResourceManager* rm =
ResourceGroupManager::getSingleton()._getResourceManager(resType);
rm->load(name, group, isManual, loader, loadParams);
return 0;
#endif
}
示例12: GOTHOGRE_EXCEPT
//---------------------------------------------------------------------
Ogre::DataStreamPtr UnicodeFileSystemArchive::create(const String& _filename) const
{
if (isReadOnly())
{
GOTHOGRE_EXCEPT(_filename << " - Cannot create a file in"
<< " read-only archive " << getName() << ".");
}
WString wfullpath = getFullPath(_filename);
// Always open in binary mode
// Also, always include reading
std::ios::openmode mode = std::ios::out | std::ios::binary;
std::fstream* rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
rwStream->open(wfullpath.c_str(), mode);
// Should check ensure open succeeded, in case fail for some reason.
if (rwStream->fail())
{
OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
GOTHOGRE_EXCEPT(_filename << " - Cannot create file in"
<< " archive " << getName() << ".");
}
GOTHOGRE_INFO(_filename << " - " << "Saving to"
<< " archive " << getName() << ".");
/// Construct return stream, tell it to delete on destroy
FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(_filename,
rwStream, 0, true);
return DataStreamPtr(stream);
}
示例13: OGRE_NEW_T
//-------------------------------------------------------------------------
void
LGPArchive::load()
{
//OGRE_LOCK_AUTO_MUTEX
std::ifstream *ifs( OGRE_NEW_T( std::ifstream, Ogre::MEMCATEGORY_GENERAL )( mName.c_str(), std::ifstream::binary ) );
load( OGRE_NEW Ogre::FileStreamDataStream( ifs ) );
}
示例14: OGRE_EXCEPT
//---------------------------------------------------------------------
DataStreamPtr FileSystemArchive::create(const String& filename) const
{
if (isReadOnly())
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Cannot create a file in a read-only archive",
"FileSystemArchive::remove");
}
String full_path = concatenate_path(mName, filename);
// Always open in binary mode
// Also, always include reading
std::ios::openmode mode = std::ios::out | std::ios::binary;
std::fstream* rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
rwStream->open(full_path.c_str(), mode);
// Should check ensure open succeeded, in case fail for some reason.
if (rwStream->fail())
{
OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
"Cannot open file: " + filename,
"FileSystemArchive::create");
}
/// Construct return stream, tell it to delete on destroy
FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(filename,
rwStream, 0, true);
return DataStreamPtr(stream);
}
示例15: findResourceFileInfo
FileInfoListPtr findResourceFileInfo (const String& _groupName, const String& _pattern, bool _recursive, bool _dirs)
{
OGRE_LOCK_AUTO_MUTEX
// MEMCATEGORY_GENERAL is the only category supported for SharedPtr
FileInfoListPtr vec(OGRE_NEW_T(FileInfoList, MEMCATEGORY_GENERAL)(), SPFM_DELETE_T);
// Try to find in resource index first
ResourceGroup* grp = getResourceGroup(_groupName);
if (!grp)
{
GOTHOGRE_EXCEPT(
"Cannot locate a resource group called '" << _groupName << "'");
}
OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
// Iterate over the archives
LocationList::iterator i, iend;
iend = grp->locationList.end();
for (i = grp->locationList.begin(); i != iend; ++i)
{
FileInfoListPtr lst = (*i)->archive->findFileInfo(_pattern, _recursive, _dirs);
vec->insert(vec->end(), lst->begin(), lst->end());
}
return vec;
}