本文整理汇总了C++中osgdb::Input::read方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::read方法的具体用法?C++ Input::read怎么用?C++ Input::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgdb::Input
的用法示例。
在下文中一共展示了Input::read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScalarProperty_readLocalData
bool ScalarProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgVolume::ScalarProperty& sp = static_cast<osgVolume::ScalarProperty&>(obj);
bool itrAdvanced = false;
float value=0;
if (fr.read("value",value))
{
itrAdvanced = true;
sp.setValue(value);
}
return itrAdvanced;
}
示例2: SwitchProperty_readLocalData
bool SwitchProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgVolume::SwitchProperty& sp = static_cast<osgVolume::SwitchProperty&>(obj);
bool itrAdvanced = false;
int value=0;
if (fr.read("activeProperty",value))
{
itrAdvanced = true;
sp.setActiveProperty(value);
}
return itrAdvanced;
}
示例3: SwitchLayer_readLocalData
bool SwitchLayer_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgTerrain::SwitchLayer &layer = static_cast<osgTerrain::SwitchLayer&>(obj);
bool itrAdvanced = false;
int i;
if (fr.read("ActiveLayer", i))
{
layer.setActiveLayer(i);
itrAdvanced = true;
}
;
return itrAdvanced;
}
示例4: CompositeLayer_readLocalData
bool CompositeLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgTerrain::CompositeLayer& layer = static_cast<osgTerrain::CompositeLayer&>(obj);
bool itrAdvanced = false;
osg::ref_ptr<osgTerrain::Locator> locator = 0;
do
{
itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Locator>());
locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
if (readObject.valid()) itrAdvanced = true;
unsigned int minLevel=0;
if (fr.read("MinLevel",minLevel))
{
itrAdvanced = true;
}
unsigned int maxLevel = MAXIMUM_NUMBER_OF_LEVELS;
if (fr.read("MaxLevel",maxLevel))
{
itrAdvanced = true;
}
if (fr.matchSequence("file %s") || fr.matchSequence("file %w") )
{
layer.addLayer(fr[1].getStr());
fr += 2;
itrAdvanced = true;
}
else if (fr.matchSequence("ProxyLayer %s") || fr.matchSequence("ProxyLayer %w"))
{
std::string setname;
std::string filename;
osgTerrain::extractSetNameAndFileName(fr[1].getStr(),setname, filename);
if (!filename.empty())
{
osgTerrain::ProxyLayer* proxyLayer = new osgTerrain::ProxyLayer;
proxyLayer->setFileName(filename);
proxyLayer->setName(setname);
if (locator.valid()) proxyLayer->setLocator(locator.get());
if (minLevel!=0) proxyLayer->setMinLevel(minLevel);
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel);
layer.addLayer(proxyLayer);
}
fr += 2;
itrAdvanced = true;
}
else
{
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Layer>());
osgTerrain::Layer* readLayer = dynamic_cast<osgTerrain::Layer*>(readObject.get());
if (readLayer)
{
if (locator.valid())
{
readLayer->setLocator(locator.get());
locator = 0;
}
if (minLevel!=0) readLayer->setMinLevel(minLevel);
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) readLayer->setMaxLevel(maxLevel);
layer.addLayer(readLayer);
}
if (readObject.valid()) itrAdvanced = true;
}
} while (itrAdvanced);
if (locator.valid()) layer.setLocator(locator.get());
return itrAdvanced;
}
示例5: View_readLocalData
bool View_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgViewer::View &view = dynamic_cast<osgViewer::View&>(obj);
bool iteratorAdvanced = false;
bool matchedFirst = false;
if ((matchedFirst = fr.matchSequence("setUpViewFor3DSphericalDisplay {")) ||
fr.matchSequence("setUpViewForPanoramicSphericalDisplay {"))
{
double radius = 1.0;
double collar = 0.45;
unsigned int screenNum = 0;
unsigned int intensityFormat = 8;
osg::Matrix matrix;
std::string filename;
osg::ref_ptr<osg::Image> intensityMap;
int entry = fr[0].getNoNestedBrackets();
fr += 2;
while (!fr.eof() && fr[0].getNoNestedBrackets() > entry)
{
bool local_itrAdvanced = false;
if (fr.read("radius", radius))
local_itrAdvanced = true;
if (fr.read("collar", collar))
local_itrAdvanced = true;
if (fr.read("screenNum", screenNum))
local_itrAdvanced = true;
if (fr.read("intensityFile", filename))
local_itrAdvanced = true;
if (fr.matchSequence("intensityMap {"))
intensityMap = readIntensityImage(fr, local_itrAdvanced);
if (fr.read("intensityFormat", intensityFormat))
local_itrAdvanced = true;
if (readMatrix(matrix, fr, "projectorMatrix"))
local_itrAdvanced = true;
if (!local_itrAdvanced)
++fr;
}
// skip trailing '}'
++fr;
iteratorAdvanced = true;
if (!filename.empty())
{
intensityMap = osgDB::readRefImageFile(filename);
}
if (intensityMap.valid())
{
if (intensityFormat == 16)
intensityMap->setInternalTextureFormat(GL_LUMINANCE16F_ARB);
else if (intensityFormat == 32)
intensityMap->setInternalTextureFormat(GL_LUMINANCE32F_ARB);
// else intensityMap->setInternalTextureFormat(image->getPixelFormat());
}
if (matchedFirst)
view.setUpViewFor3DSphericalDisplay(radius, collar, screenNum, intensityMap.get(), matrix);
else
view.setUpViewForPanoramicSphericalDisplay(radius, collar, screenNum, intensityMap.get(), matrix);
}
int x = 0;
int y = 0;
int width = 128;
int height = 1024;
unsigned int screenNum = 0;
if (fr.read("setUpViewOnSingleScreen", screenNum))
{
view.setUpViewOnSingleScreen(screenNum);
iteratorAdvanced = true;
}
if (fr.read("setUpViewAcrossAllScreens"))
{
view.setUpViewAcrossAllScreens();
iteratorAdvanced = true;
}
if (fr.read("setUpViewInWindow", x, y, width, height, screenNum))
{
view.setUpViewInWindow(x, y, width, height, screenNum);
}
if (fr.read("setUpViewInWindow", x, y, width, height))
//.........这里部分代码省略.........