本文整理汇总了C++中PropertyBag::getBag方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyBag::getBag方法的具体用法?C++ PropertyBag::getBag怎么用?C++ PropertyBag::getBag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyBag
的用法示例。
在下文中一共展示了PropertyBag::getBag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void ActorSet::load(const PropertyBag &objects, World *_world)
{
ASSERT(_world!=0, "world was null");
world = _world;
for(size_t i=0, n=objects.getNumInstances("object"); i<n; ++i)
{
const tuple<OBJECT_ID, ActorPtr> t = create();
const ActorPtr object = t.get<1>();
const PropertyBag decl = objects.getBag("object", i);
const FileName templateFile = decl.getFileName("template");
const vec3 initialPosition = decl.getVec3("position");
const PropertyBag templateData = PropertyBag::fromFile(templateFile);
const PropertyBag base = templateData.getBag("components");
ComponentDataSet s = ComponentDataSet::load(base, decl);
// get actor name
object->actorName = "(no name)";
templateData.get("name", object->actorName);
object->load(s, initialPosition, vec3(0,0,0), world);
object->setParentBlackBoard(this);
}
}
示例2: loadParticleEmitters
void ParticleSystem::loadParticleEmitters(const PropertyBag &data)
{
const size_t nEmitters = data.getNumInstances("emitter");
ASSERT(nEmitters>0, "particle system does not specify any emitters");
for(size_t i=0; i<nEmitters; ++i)
{
const PropertyBag emitterData = data.getBag("emitter", i);
ParticleEmitter *emitter = new ParticleEmitter(emitterData, this);
emitters.push_back(emitter);
}
}
示例3: loadParticleTemplates
void ParticleSystem::loadParticleTemplates(const PropertyBag &data)
{
const size_t n = data.getNumInstances("template");
for(size_t i=0; i<n; ++i)
{
const PropertyBag templateData = data.getBag("template", i);
const string templateName = templateData.getString("name");
const string materialName = templateData.getString("material");
Material *material = getMaterialPtr(materialName);
ParticleElement element(templateData, material);
templatesByName.insert(make_pair(templateName, element));
}
}
示例4: loadParticleMaterials
void ParticleSystem::loadParticleMaterials(const PropertyBag &data,
TextureFactory &textureFactory)
{
const size_t nMaterials = data.getNumInstances("material");
ASSERT(nMaterials>0, "particle system does not specify any materials");
for(size_t i=0; i<nMaterials; ++i)
{
PropertyBag MatBag = data.getBag("material", i);
Material material;
const string name = MatBag.getString("name");
const FileName fileName = MatBag.getString("image");
material.setTexture(textureFactory.load(fileName, false));
material.glow = MatBag.getBool("glow");
materials.insert(make_pair(name, material));
}
ASSERT(!materials.empty(),
"after loading, there are no particle materials in system");
}
示例5: animationSequence
AnimationController*
ModelLoaderSingle::loadFromFile(const FileName &fileName,
TextureFactory &textureFactory) const
{
PropertyBag xml = PropertyBag::fromFile(fileName);
const FileName directory = fileName.getPath();
// Winding of polygons, either "CCW" or "CW"
string polygonWinding = "CW";
xml.get("polygonWinding", polygonWinding);
// Allocate a blank animation controller
AnimationController *controller = new AnimationController();
// Get key frames from the first source
PropertyBag fileBag = xml.getBag("model", 0);
const FileName file = directory.append(fileBag.getFileName("file"));
FileName skinName;
if(fileBag.get("skin", skinName))
{
skinName = directory.append(skinName);
}
vector<KeyFrame> keyFrames = loadKeyFrames(file, skinName, textureFactory);
// Get the rest of the key frames
for(size_t i = 1, numMD3 = xml.getNumInstances("model"); i<numMD3; ++i)
{
PropertyBag fileBag = xml.getBag("model", i);
const FileName file = directory.append(fileBag.getFileName("file"));
FileName skinName;
if(fileBag.get("skin", skinName))
{
skinName = directory.append(skinName);
}
vector<KeyFrame> k = loadKeyFrames(file, skinName, textureFactory);
for(size_t i=0; i<k.size(); ++i)
{
KeyFrame &keyFrame = keyFrames[i];
keyFrame.merge(k[i]);
// set polygon windings according to data file
setPolygonWinding(keyFrame, polygonWinding);
}
}
// Build the animations from these keyframes
for(size_t i = 0, numAnimations = xml.getNumInstances("animation");
i<numAnimations;
++i)
{
PropertyBag animation;
string name;
bool looping=false;
int start=0;
float priority=0;
int length=0;
float fps=0;
xml.get("animation", animation, i);
animation.get("name", name);
animation.get("priority", priority);
animation.get("looping", looping);
animation.get("start", start);
animation.get("length", length);
animation.get("fps", fps);
// Add it to the controller
AnimationSequence animationSequence(keyFrames,
name,
priority,
looping,
start,
length,
fps);
controller->addAnimation(animationSequence);
}
return controller;
}