本文整理汇总了C++中osgdb::Input::readObjectOfType方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::readObjectOfType方法的具体用法?C++ Input::readObjectOfType怎么用?C++ Input::readObjectOfType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgdb::Input
的用法示例。
在下文中一共展示了Input::readObjectOfType方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VolumeTile_readLocalData
bool VolumeTile_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgVolume::VolumeTile& volumeTile = static_cast<osgVolume::VolumeTile&>(obj);
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Locator>());
if (readObject.valid()) itrAdvanced = true;
osgVolume::Locator* locator = dynamic_cast<osgVolume::Locator*>(readObject.get());
if (locator) volumeTile.setLocator(locator);
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Layer>());
if (readObject.valid()) itrAdvanced = true;
osgVolume::Layer* readLayer = dynamic_cast<osgVolume::Layer*>(readObject.get());
if (readLayer) volumeTile.setLayer(readLayer);
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::VolumeTechnique>());
if (readObject.valid())
{
volumeTile.setVolumeTechnique(dynamic_cast<osgVolume::VolumeTechnique*>(readObject.get()));
itrAdvanced = true;
}
return itrAdvanced;
}
示例2: BumpMapping_readLocalData
bool BumpMapping_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgFX::BumpMapping &myobj = static_cast<osgFX::BumpMapping &>(obj);
bool itAdvanced = false;
if (fr[0].matchWord("lightNumber")) {
int n;
if (fr[1].getInt(n)) {
myobj.setLightNumber(n);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("diffuseUnit")) {
int n;
if (fr[1].getInt(n)) {
myobj.setDiffuseTextureUnit(n);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("normalMapUnit")) {
int n;
if (fr[1].getInt(n)) {
myobj.setNormalMapTextureUnit(n);
fr += 2;
itAdvanced = true;
}
}
osg::ref_ptr<osg::Texture2D> diffuse_tex = static_cast<osg::Texture2D *>(fr.readObjectOfType(osgDB::type_wrapper<osg::Texture2D>()));
if (diffuse_tex.valid()) {
myobj.setOverrideDiffuseTexture(diffuse_tex.get());
itAdvanced = true;
}
osg::ref_ptr<osg::Texture2D> normal_tex = static_cast<osg::Texture2D *>(fr.readObjectOfType(osgDB::type_wrapper<osg::Texture2D>()));
if (normal_tex.valid()) {
myobj.setOverrideNormalMapTexture(normal_tex.get());
itAdvanced = true;
}
return itAdvanced;
}
示例3: Layer_readLocalData
bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgVolume::Layer& layer = static_cast<osgVolume::Layer&>(obj);
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Locator>());
osgVolume::Locator* locator = dynamic_cast<osgVolume::Locator*>(readObject.get());
if (locator) layer.setLocator(locator);
return itrAdvanced;
}
示例4: ModularProgram_readLocalData
bool ModularProgram_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgParticle::ModularProgram &myobj = static_cast<osgParticle::ModularProgram &>(obj);
bool itAdvanced = false;
osgParticle::Operator *op = static_cast<osgParticle::Operator *>(fr.readObjectOfType(osgDB::type_wrapper<osgParticle::Operator>()));
if (op) {
myobj.addOperator(op);
itAdvanced = true;
}
return itAdvanced;
}
示例5: DatabaseBuilder_readLocalData
bool DatabaseBuilder_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
vpb::DatabaseBuilder& db = static_cast<vpb::DatabaseBuilder&>(obj);
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<BuildOptions>());
if (readObject.valid())
{
db.setBuildOptions(dynamic_cast<BuildOptions*>(readObject.get()));
}
return itrAdvanced;
}
示例6: TransferFunctionProperty_readLocalData
bool TransferFunctionProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgVolume::TransferFunctionProperty& tfp = static_cast<osgVolume::TransferFunctionProperty&>(obj);
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::TransferFunction>());
if (readObject.valid()) itrAdvanced = true;
osg::TransferFunction* tf = dynamic_cast<osg::TransferFunction*>(readObject.get());
if (tf) tfp.setTransferFunction(tf);
return itrAdvanced;
}
示例7: AnimationPathCallback_readLocalData
bool AnimationPathCallback_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osg::AnimationPathCallback *apc = dynamic_cast<osg::AnimationPathCallback*>(&obj);
if (!apc) return false;
bool iteratorAdvanced = false;
if (fr.matchSequence("pivotPoint %f %f %f"))
{
osg::Vec3 pivot;
fr[1].getFloat(pivot[0]);
fr[2].getFloat(pivot[1]);
fr[3].getFloat(pivot[2]);
apc->setPivotPoint(pivot);
fr += 4;
iteratorAdvanced = true;
}
if (fr.matchSequence("timeOffset %f"))
{
fr[1].getFloat(apc->_timeOffset);
fr+=2;
iteratorAdvanced = true;
}
else if(fr.matchSequence("timeMultiplier %f"))
{
fr[1].getFloat(apc->_timeMultiplier);
fr+=2;
iteratorAdvanced = true;
}
static osg::ref_ptr<osg::AnimationPath> s_path = new osg::AnimationPath;
ref_ptr<osg::Object> object = fr.readObjectOfType(*s_path);
if (object.valid())
{
osg::AnimationPath* animpath = dynamic_cast<osg::AnimationPath*>(object.get());
if (animpath) apc->setAnimationPath(animpath);
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
示例8: NodeCallback_readLocalData
bool NodeCallback_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
NodeCallback& nc = dynamic_cast<NodeCallback&>(obj);
if (!(&nc)) return false;
bool itrAdvanced = false;
static osg::ref_ptr<NodeCallback> s_nc = new NodeCallback;
osg::ref_ptr<osg::Object> object = fr.readObjectOfType(*s_nc);
if (object.valid())
{
NodeCallback* ncc = dynamic_cast<NodeCallback*>(object.get());
if (ncc) nc.setNestedCallback(ncc);
itrAdvanced = true;
}
return itrAdvanced;
}
示例9: CompositeProperty_readLocalData
bool CompositeProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgVolume::CompositeProperty& cp = static_cast<osgVolume::CompositeProperty&>(obj);
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject;
do
{
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Property>());
if (readObject.valid()) itrAdvanced = true;
osgVolume::Property* property = dynamic_cast<osgVolume::Property*>(readObject.get());
if (property) cp.addProperty(property);
} while (readObject.valid());
return itrAdvanced;
}
示例10: HeightFieldLayer_readLocalData
bool HeightFieldLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgTerrain::HeightFieldLayer& layer = static_cast<osgTerrain::HeightFieldLayer&>(obj);
bool itrAdvanced = false;
if (fr.matchSequence("file %w") || fr.matchSequence("file %s"))
{
std::string setname;
std::string filename;
osgTerrain::extractSetNameAndFileName(fr[1].getStr(),setname, filename);
if (!filename.empty())
{
osg::ref_ptr<osg::HeightField> hf = osgDB::readHeightFieldFile(filename);
if (hf.valid())
{
layer.setName(setname);
layer.setFileName(filename);
layer.setHeightField(hf.get());
}
}
fr += 2;
itrAdvanced = true;
}
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::HeightField>());
if (readObject.valid()) itrAdvanced = true;
osg::HeightField* hf = dynamic_cast<osg::HeightField*>(readObject.get());
if (hf)
{
layer.setHeightField(hf);
}
return itrAdvanced;
}
示例11: 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;
}
示例12: View_readLocalData
//.........这里部分代码省略.........
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))
{
view.setUpViewInWindow(x, y, width, height);
}
osg::ref_ptr<osg::Object> readObject;
while ((readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::Camera>())).valid())
{
view.setCamera(static_cast<osg::Camera*>(readObject.get()));
iteratorAdvanced = true;
}
if (fr.matchSequence("Slaves {"))
{
int entry = fr[0].getNoNestedBrackets();
fr += 2;
while (!fr.eof() && fr[0].getNoNestedBrackets() > entry)
{
readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::Camera>());
if (readObject.valid())
view.addSlave(static_cast<osg::Camera*>(readObject.get()));
else
++fr;
}
// skip trailing '}'
++fr;
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
示例13: ParticleEffect_readLocalData
//.........这里部分代码省略.........
{
float particleDuration;
fr[1].getFloat(particleDuration);
particle.setLifeTime(particleDuration);
particleSet = true;
fr += 2;
itrAdvanced = true;
}
if (fr[0].matchWord("particleSizeRange"))
{
osgParticle::rangef r;
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum))
{
particle.setSizeRange(r);
particleSet = true;
fr += 3;
itrAdvanced = true;
}
}
if (fr[0].matchWord("particleAlphaRange"))
{
osgParticle::rangef r;
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum))
{
particle.setAlphaRange(r);
particleSet = true;
fr += 3;
itrAdvanced = true;
}
}
if (fr[0].matchWord("particleColorRange"))
{
osgParticle::rangev4 r;
if (fr[1].getFloat(r.minimum.x()) && fr[2].getFloat(r.minimum.y()) && fr[3].getFloat(r.minimum.z()) && fr[4].getFloat(r.minimum.w()) &&
fr[5].getFloat(r.maximum.x()) && fr[6].getFloat(r.maximum.y()) && fr[7].getFloat(r.maximum.z()) && fr[8].getFloat(r.maximum.w()))
{
particle.setColorRange(r);
particleSet = true;
fr += 9;
itrAdvanced = true;
}
}
if (particleSet)
{
effect.setDefaultParticleTemplate(particle);
}
if (fr.matchSequence("wind %f %f %f"))
{
osg::Vec3 wind;
fr[1].getFloat(wind[0]);
fr[2].getFloat(wind[1]);
fr[3].getFloat(wind[2]);
effect.setWind(wind);
fr += 4;
itrAdvanced = true;
}
if (fr[0].matchWord("useLocalParticleSystem"))
{
if (fr[1].matchWord("FALSE"))
{
effect.setUseLocalParticleSystem(false);
fr+=2;
itrAdvanced = true;
// now read the particle system that is shared with an node external to this particle effect
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgParticle::ParticleSystem>());
if (readObject.valid())
{
osgParticle::ParticleSystem* ps = static_cast<osgParticle::ParticleSystem*>(readObject.get());
effect.setParticleSystem(ps);
itrAdvanced = true;
}
}
else if (fr[1].matchWord("TRUE"))
{
effect.setUseLocalParticleSystem(true);
fr+=2;
itrAdvanced = true;
}
}
if (!effect.getAutomaticSetup())
{
// since by default the clone of the ParticleEffect is done with automatic setup off to prevent premature loading of
// imagery, we still want to make sure the ParticleEffect is properly built so we'll now manually enable the automatic setup
// run the buildEffect().
effect.setAutomaticSetup(true);
effect.buildEffect();
}
return itrAdvanced;
}
示例14: ParticleProcessor_readLocalData
bool ParticleProcessor_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgParticle::ParticleProcessor &myobj = static_cast<osgParticle::ParticleProcessor &>(obj);
bool itAdvanced = false;
osg::ref_ptr<osgParticle::ParticleSystem> ps_proto = new osgParticle::ParticleSystem;
osgParticle::ParticleSystem *ps = static_cast<osgParticle::ParticleSystem *>(fr.readObjectOfType(*ps_proto));
if (ps) {
myobj.setParticleSystem(ps);
itAdvanced = true;
}
if (fr[0].matchWord("enabled")) {
if (fr[1].matchWord("TRUE")) {
myobj.setEnabled(true);
fr += 2;
itAdvanced = true;
} else if (fr[1].matchWord("FALSE")) {
myobj.setEnabled(false);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("referenceFrame")) {
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
myobj.setReferenceFrame(osgParticle::ParticleProcessor::ABSOLUTE_RF);
fr += 2;
itAdvanced = true;
}
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_RF);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("endless")) {
if (fr[1].matchWord("TRUE")) {
myobj.setEndless(true);
fr += 2;
itAdvanced = true;
} else if (fr[1].matchWord("FALSE")) {
myobj.setEndless(false);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("lifeTime")) {
float lt;
if (fr[1].getFloat(lt)) {
myobj.setLifeTime(lt);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("startTime")) {
float st;
if (fr[1].getFloat(st)) {
myobj.setStartTime(st);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("currentTime")) {
float ct;
if (fr[1].getFloat(ct)) {
myobj.setCurrentTime(ct);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("resetTime")) {
float ct;
if (fr[1].getFloat(ct)) {
myobj.setResetTime(ct);
fr += 2;
itAdvanced = true;
}
}
return itAdvanced;
}