Esempio 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);
}
Esempio n. 2
0
void PlayerEntity::init(AnyTableReader& propertyTable) {
    Vector3 v;
    propertyTable.getIfPresent("velocity", v);
    Sphere s(1.0f);
    propertyTable.getIfPresent("collisionSphere", s);

    init(v, s);
}
Esempio n. 3
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);
}
Esempio n. 4
0
void MarkerEntity::init(AnyTableReader& propertyTable) {
    Array<Box> boxArray;
    propertyTable.getIfPresent("osBoxArray", boxArray);

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

    init(boxArray, color);
}
Esempio n. 5
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;
    }
}
Esempio n. 6
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);
}
Esempio n. 7
0
void PlayerEntity::init(AnyTableReader& propertyTable) {
    Vector3 v;
    propertyTable.getIfPresent("velocity", v);
    init(v);
}