Esempio n. 1
0
void Render::loadXML(ofXml &xml) {
    if (xml.exists("[@vsync]")) {
        string str = ofToString( xml.getAttribute("[@vsync]") );
        if (str == "on")    vsync = true;
        else                vsync = false;
    }
    if (xml.exists("[@framerate]"))
        framerate = ofToInt( xml.getAttribute("[@framerate]") );
    setup();
}
Esempio n. 2
0
void Socket::loadXML(ofXml &xml) {
    if (xml.exists("socket[@enabled]")) {
        string str = ofToString(xml.getAttribute("socket[@enabled]"));
        if (str == "on") enabled = true;
        else             enabled = false;
    }
    
    if (xml.exists("socket[@host]"))
        host = ofToString( xml.getAttribute("socket[@host]") );
    if (xml.exists("socket[@send]"))
        send = ofToInt( xml.getAttribute("socket[@send]") );
    if (xml.exists("socket[@receive]"))
        receive = ofToInt( xml.getAttribute("socket[@receive]") );
    
    if (enabled)
        setup();
}
Esempio n. 3
0
void Projector::loadXML(ofXml &xml) {
    string str;
    
    if (xml.exists("[@resolution]")) {
        str = xml.getAttribute("[@resolution]");
        width = ofToFloat(ofSplitString(str, ",")[0]);
        height = ofToFloat(ofSplitString(str, ",")[1]);
    }
}
Esempio n. 4
0
void Projector::loadXML2(ofXml &xml) {
    string str;
    float val;

    // color
    if (xml.exists("[@brightness]")) {
        brightness = ofToFloat( xml.getAttribute("[@brightness]"));
    }
    if (xml.exists("[@contrast]")) {
        contrast = ofToFloat( xml.getAttribute("[@contrast]") );
    }
    if (xml.exists("[@saturation]")) {
        saturation = ofToFloat( xml.getAttribute("[@saturation]") );
    }

    // plane warp
    plane.width = width;
    plane.height = height;
    plane.load(xml, projectorStartingIndex);


    // camera position
    if (xml.exists("[@position]")) {
        str = xml.getAttribute("[@position]");
        float azi  = ofToFloat(ofSplitString(str, ",")[0]);
        float ele  = ofToFloat(ofSplitString(str, ",")[1]);
        float dis  = ofToFloat(ofSplitString(str, ",")[2]);
        setCameraPosition(azi, ele, dis);
    }

    // camera orientation
    if (xml.exists("[@orientation]")) {
        str = xml.getAttribute("[@orientation]");
        float roll = ofToFloat(ofSplitString(str, ",")[0]);
        float tilt = ofToFloat(ofSplitString(str, ",")[1]);
        float pan = ofToFloat(ofSplitString(str, ",")[2]);
        setCameraOrientation(roll, tilt, pan);
    }

    // camera lens fov
    if (xml.exists("[@fov]")) {
        val = ofToFloat( xml.getAttribute("[@fov]") );
        setCameraFov(val);
    }

    //camera lens offset
    if (xml.exists("[@offset]")) {
        str = xml.getAttribute("[@offset]");
        float offX  = ofToFloat(ofSplitString(str, ",")[0]);
        float offY  = ofToFloat(ofSplitString(str, ",")[1]);
        setCameraOffset(offX, offY);
    }

	curves.load(projectorStartingIndex);

    mask.width = width;
    mask.height = height;
    mask.load(projectorStartingIndex);
}
Esempio n. 5
0
void ofxControlPanel::setFromXml(ofXml &xml)
{
    ofxControlWidget::setFromXml(xml);
    if (xml.exists("Sequencer"))
    {
        if (!sequencerMade) {
            createSequencer();
        }
        sequencer->setFromXml(xml);
    }
    else {
        ofLog(OF_LOG_ERROR, "No sequencer found in preset");
    }
}
Esempio n. 6
0
void ofxControlPanel::loadSequencerFromXml(ofXml &xml)
{
    if (xml.exists("Sequencer"))
    {
        xml.setTo("Sequencer");
        if (!sequencerMade) {
            createSequencer();
        }
        sequencer->setFromXml(xml);
        xml.setToParent();
    }
    else {
        ofLog(OF_LOG_ERROR, "No sequencer found in preset");
    }
}
Esempio n. 7
0
bool ofxFadeEffect::settings::deserialize( ofXml X )
{
	ofParameterGroup G;
	G.setName("fxShake_Settings");

	X.deserialize(G);
	bool bSuc = X.exists(G.getName());
	if(bSuc)
	{
		alphaFrom = G.getInt("alphaFrom");
		alphaTo = G.getInt("alphaTo");
		time = G.getFloat("time");
		delay = G.getFloat("delay");
	}

	return bSuc;	
}
Esempio n. 8
0
bool ofxImageThing::settings::deserialize( ofXml X )
{
	ofParameterGroup G;
	G.setName("ofxImageThing_Settings");

	X.deserialize(G);
	bool bSuc = X.exists(G.getName());
	if(bSuc)
	{
		imgPath= G.getString("imgPath");
		imgColor = G.getColor("imgColor");
		width = G.getFloat("width");
		height = G.getFloat("height");
		imgAlpha = G.getFloat("imgAlpha");
	}

	return bSuc;	
}
void KinectV2Classifier::setFromLearnXml(ofXml &xml)
{
    xml.setTo("LearnInfo");
    
    if (xml.exists("Classes")) {
        xml.setTo("Classes");
        if (xml.exists("Class[0]"))
        {
            xml.setTo("Class[0]");
            do {
                addClass(xml.getValue<string>("Name"));
            }
            while(xml.setToSibling());
            xml.setToParent();
        }
        xml.setToParent();
    }
    
    if (xml.exists("Ranges")) {
        xml.setTo("Ranges");
        if (xml.exists("Joint[0]"))
        {
            int idx = 0;
            xml.setTo("Joint[0]");
            do {
                min[idx] = xml.getValue<float>("Min");
                max[idx] = xml.getValue<float>("Max");
                idx++;
            }
            while(xml.setToSibling());
            xml.setToParent();
        }
        xml.setToParent();
    }
    
    if (xml.exists("Training")) {
        xml.setTo("Training");
        if (xml.exists("Entry[0]"))
        {
            xml.setTo("Entry[0]");
            do {
                double label = xml.getValue<double>("Label");
                vector<string> featureVectorS = ofSplitString(xml.getValue<string>("Features"), ",");
                vector<float> entry;
                entry.push_back(label);
                for (auto f : featureVectorS) {
                    entry.push_back(ofToFloat(f));
                }
                data.addEntry(entry);
            }
            while(xml.setToSibling());
            xml.setToParent();
        }
        xml.setToParent();
    }
    
    if (xml.exists("Model")) {
        xml.setTo("Model");
        string path = xml.getValue<string>("Path");
        svm.loadModel(path);
        trained = true;
        xml.setToParent();
    }
    xml.setToParent();
}