Exemple #1
0
shared_ptr<Entity> VisibleEntity::create 
   (const String&                           name,
    Scene*                                  scene,
    AnyTableReader&                         propertyTable,
    const ModelTable&                       modelTable,
    const Scene::LoadOptions&               options) {

        
    bool canChange = false;
    propertyTable.getIfPresent("canChange", canChange);
    // Pretend that we haven't peeked at this value
    propertyTable.setReadStatus("canChange", false);

    if ((canChange && ! options.stripDynamicVisibleEntitys) || 
        (! canChange && ! options.stripStaticVisibleEntitys)) {

        shared_ptr<VisibleEntity> visibleEntity(new VisibleEntity());
        visibleEntity->Entity::init(name, scene, propertyTable);
        visibleEntity->VisibleEntity::init(propertyTable, modelTable);
        propertyTable.verifyDone();

        return visibleEntity;
    } else {
        return nullptr;
    }
}
Exemple #2
0
shared_ptr<Camera> Camera::create
(const std::string& name,
 Scene*             scene,
 AnyTableReader&    reader) {
     shared_ptr<Camera> c(new Camera());

     c->Entity::init(name, scene, reader);
     c->Camera::init(reader);
     reader.verifyDone();

     return c;
}
Exemple #3
0
shared_ptr<Entity> MarkerEntity::create 
   (const String&                      name,
    Scene*                             scene,
    AnyTableReader&                    propertyTable,
    const ModelTable&                  modelTable) {

    shared_ptr<MarkerEntity> m(new MarkerEntity());
    m->Entity::init(name, scene, propertyTable);
    m->MarkerEntity::init(propertyTable);
    propertyTable.verifyDone();
    return m;
}
Exemple #4
0
shared_ptr<Entity> VisibleEntity::create 
   (const String&                           name,
    Scene*                                  scene,
    AnyTableReader&                         propertyTable,
    const ModelTable&                       modelTable) {

    shared_ptr<VisibleEntity> visibleEntity(new VisibleEntity());
    visibleEntity->Entity::init(name, scene, propertyTable);
    visibleEntity->VisibleEntity::init(propertyTable, modelTable);
    propertyTable.verifyDone();

    return visibleEntity;
}
Exemple #5
0
shared_ptr<PlayerEntity> PlayerEntity::create 
    (const std::string& name,
     Scene*             scene,
     AnyTableReader&    propertyTable,
     const ModelTable&  modelTable) {

    // Don't initialize in the constructor, where it is unsafe to throw Any parse exceptions
    shared_ptr<PlayerEntity> playerEntity(new PlayerEntity());

    // Initialize each base class, which parses its own fields
    playerEntity->Entity::init(name, scene, propertyTable);
    playerEntity->VisibleEntity::init(propertyTable, modelTable);
    playerEntity->PlayerEntity::init(propertyTable);

    // Verify that all fields were read by the base classes
    propertyTable.verifyDone();

    return playerEntity;
}