查看: 1364|回复: 2

void DatabasePager::requestNodeFile疑问?

[复制链接]

该用户从未签到

发表于 2011-1-12 11:58:45 | 显示全部楼层 |阅读模式
void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* group,
float priority, const osg::FrameStamp* framestamp,
osg::ref_ptr& databaseRequestRef,
ReaderWriter::Options* loadOptions)
{

if (previousFrame!=frameNumber)
{
// osg::notify(osg::NOTICE)<<"requestNodeFiles for "<
RequestQueue* requestQueue = databaseRequest->_requestQueue;
if (requestQueue)
{

// 这儿判断等于1是什么意思
if (databaseRequestRef->referenceCount()==1)
{
osg::notify(osg::INFO)<<"DatabasePager::fileRquest("<
databaseRequest->_frameNumberFirstRequest = frameNumber;
databaseRequest->_timestampFirstRequest = timestamp;
databaseRequest->_priorityFirstRequest = priority;
databaseRequest->_frameNumberLastRequest = frameNumber;
databaseRequest->_timestampLastRequest = timestamp;
databaseRequest->_priorityLastRequest = priority;
databaseRequest->_groupForAddingLoadedSubgraph = group;
databaseRequest->_loadOptions = loadOptions;
databaseRequest->_requestQueue = _fileRequestQueue.get();

_fileRequestQueue->add(databaseRequest);
}

}
}

// 这儿判断什么意思
if (!foundEntry)
{
osg::notify(osg::INFO)<<"In DatabasePager::fileRquest("<
OpenThreads::ScopedLock lock(_fileRequestQueue->_requestMutex);

if (!databaseRequestRef.valid() || databaseRequestRef->referenceCount()==1)
{
osg::ref_ptr databaseRequest = new DatabaseRequest;

databaseRequestRef = databaseRequest.get();

databaseRequest->_fileName = fileName;
databaseRequest->_frameNumberFirstRequest = frameNumber;
databaseRequest->_timestampFirstRequest = timestamp;
databaseRequest->_priorityFirstRequest = priority;
databaseRequest->_frameNumberLastRequest = frameNumber;
databaseRequest->_timestampLastRequest = timestamp;
databaseRequest->_priorityLastRequest = priority;
databaseRequest->_groupForAddingLoadedSubgraph = group;
databaseRequest->_loadOptions = loadOptions;
databaseRequest->_requestQueue = _fileRequestQueue.get();

_fileRequestQueue->_requestList.push_back(databaseRequest.get());

_fileRequestQueue->updateBlock();
}

}

// 这儿判断什么意思
if (!_startThreadCalled)
{
OpenThreads::ScopedLock lock(_run_mutex);

if (!_startThreadCalled)
{
_startThreadCalled = true;
_done = false;
osg::notify(osg:EBUG_INFO)<<"DatabasePager::startThread()"<
if (_databaseThreads.empty())
{
setUpThreads(
osg::DisplaySettings::instance()->getNumOfDatabaseThreadsHint(),
osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint());
}

for(DatabaseThreadList::const_iterator dt_itr = _databaseThreads.begin();
dt_itr != _databaseThreads.end();
++dt_itr)
{
(*dt_itr)->startThread();
}
}
}

totalTime += osg::Timer::instance()->delta_m(start_tick, osg::Timer::instance()->tick());
}


请高手多指点!

该用户从未签到

发表于 2011-1-13 08:40:15 | 显示全部楼层
既然您打算自己研读osg的源代码,那么针对这几个点进行分析,给出您的看法,然后大家共同讨论——这样岂不更好~~

该用户从未签到

 楼主| 发表于 2011-1-13 08:44:15 | 显示全部楼层
好的,遇到的问题暂时解决了
有时间把代码搞明白,再回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表