Example #1
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);
}
	void CutsceneControlState::run(Real elapsedTime)
	{
	    CameraPosition pos = getBestCameraPosition();
	    switch (pos.type)
	    {
	    case CPT_FIXED:
	        setCameraPosition(pos.position);
	        setCameraOrientation(pos.orientation1);
	        break;
	    case CPT_ROTATING:
	        setCameraPosition(pos.position);
	        lookAt(mTarget->getPosition());
	        break;
	    }
	}