Ejemplo n.º 1
0
void Entity::init
   (const std::string& name,
    Scene*             scene,
    AnyTableReader&    propertyTable) {

    // Track may need this to have a name
    m_name = name;

    m_sourceAny = propertyTable.any();

    shared_ptr<Track> track;
    Any c;
    if (propertyTable.getIfPresent("track", c)) {
        track = Track::create(this, scene, c);
    }

    bool canChange = true, shouldBeSaved = true;
    propertyTable.getIfPresent("canChange", canChange);
    propertyTable.getIfPresent("shouldBeSaved", shouldBeSaved);

    CFrame frame;
    propertyTable.getIfPresent("frame", frame);

    init(name, scene, frame, track, canChange, shouldBeSaved);
}
Ejemplo n.º 2
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;
    }
}
Ejemplo n.º 3
0
void PlayerEntity::init(AnyTableReader& propertyTable) {
    Vector3 v;
    propertyTable.getIfPresent("velocity", v);
    Sphere s(1.0f);
    propertyTable.getIfPresent("collisionSphere", s);

    init(v, s);
}
Ejemplo n.º 4
0
void Camera::init
   (AnyTableReader&    reader) {
    
    reader.getIfPresent("projection",           m_projection);
    reader.getIfPresent("depthOfFieldSettings", m_depthOfFieldSettings);
    reader.getIfPresent("motionBlurSettings",   m_motionBlurSettings);
    reader.getIfPresent("filmSettings",         m_filmSettings);
    reader.getIfPresent("visualizationScale",   m_visualizationScale);
}
Ejemplo n.º 5
0
void MarkerEntity::init(AnyTableReader& propertyTable) {
    Array<Box> boxArray;
    propertyTable.getIfPresent("osBoxArray", boxArray);

    Color3 color = Color3::white();
    propertyTable.getIfPresent("color", color);

    init(boxArray, color);
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
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;
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
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;
}
Ejemplo n.º 10
0
void VisibleEntity::init
   (AnyTableReader&    propertyTable,
    const ModelTable&  modelTable) {

    bool visible = true;
    propertyTable.getIfPresent("visible", visible);

    ArticulatedModel::Pose artPose;
    propertyTable.getIfPresent("articulatedModelPose", artPose);

    ArticulatedModel::PoseSpline artPoseSpline;
    propertyTable.getIfPresent("poseSpline", artPoseSpline);

	MD3Model::PoseSequence md3PoseSequence;
	propertyTable.getIfPresent("md3Pose", md3PoseSequence);

    Surface::ExpressiveLightScatteringProperties expressiveLightScatteringProperties;
    propertyTable.getIfPresent("expressiveLightScatteringProperties", expressiveLightScatteringProperties);
    
    if (propertyTable.getIfPresent("castsShadows", expressiveLightScatteringProperties.castsShadows)) {
        debugPrintf("Warning: castsShadows field is deprecated.  Use expressiveLightScatteringProperties");
    }    

    const lazy_ptr<Model>* model = NULL;
    Any modelNameAny;
    if (propertyTable.getIfPresent("model", modelNameAny)) {
        const String& modelName     = modelNameAny.string();
    
        modelNameAny.verify(modelTable.containsKey(modelName), 
                        "Can't instantiate undefined model named " + modelName + ".");
        model = modelTable.getPointer(modelName);
    }

    Any ignore;
    if (propertyTable.getIfPresent("materialTable", ignore)) {
        ignore.verify(false, "'materialTable' is deprecated. Specify materials on the articulatedModelPose field of VisibleEntity.");
    }

    init(notNull(model) ? model->resolve() : shared_ptr<Model>(), visible, expressiveLightScatteringProperties, artPoseSpline, md3PoseSequence, artPose);
}
Ejemplo n.º 11
0
void PlayerEntity::init(AnyTableReader& propertyTable) {
    Vector3 v;
    propertyTable.getIfPresent("velocity", v);
    init(v);
}