Пример #1
0
void Warp::writeSettings( const WarpList &warps, const DataTargetRef &target )
{
	// create default <profile> (profiles are not yet supported)
	XmlTree profile;
	profile.setTag( "profile" );
	profile.setAttribute( "name", "default" );

	//
	for( unsigned i = 0; i < warps.size(); ++i ) {
		// create <map>
		XmlTree map;
		map.setTag( "map" );
		map.setAttribute( "id", i + 1 );
		map.setAttribute( "display", 1 ); // not supported yet

		// create <warp>
		map.push_back( warps[i]->toXml() );

		// add map to profile
		profile.push_back( map );
	}

	// create config document and root <warpconfig>
	XmlTree doc;
	doc.setTag( "warpconfig" );
	doc.setAttribute( "version", "1.0" );
	doc.setAttribute( "profile", "default" );

	// add profile to root
	doc.push_back( profile );

	// write file
	doc.write( target );
}
	XmlTree	VDFbo::toXml() const {
		XmlTree		xml;
		xml.setTag("details");
		xml.setAttribute("path", mFilePathOrText);
		xml.setAttribute("width", mVDSettings->mFboWidth);
		xml.setAttribute("height", mVDSettings->mFboHeight);
		xml.setAttribute("shadername", mShaderName);
		xml.setAttribute("inputtextureindex", mInputTextureIndex);
		return xml;
	}
XmlTree	WarpPerspectiveBilinear::toXml() const
{
	XmlTree xml = WarpBilinear::toXml();

	// set corners
	for(unsigned i=0;i<4;++i) {
		Vec2f corner = mWarp->getControlPoint(i);

		XmlTree cp;
		cp.setTag("corner");
		cp.setAttribute("x", corner.x);
		cp.setAttribute("y", corner.y);

		xml.push_back(cp);
	}

	return xml;
}
Пример #4
0
XmlTree Warp::toXml() const
{
	XmlTree xml;
	xml.setTag( "warp" );
	switch( mType ) {
	case BILINEAR:
		xml.setAttribute( "method", "bilinear" );
		break;
	case PERSPECTIVE:
		xml.setAttribute( "method", "perspective" );
		break;
	case PERSPECTIVE_BILINEAR:
		xml.setAttribute( "method", "perspectivebilinear" );
		break;
	default:
		xml.setAttribute( "method", "unknown" );
		break;
	}
	xml.setAttribute( "width", mControlsX );
	xml.setAttribute( "height", mControlsY );
	xml.setAttribute( "brightness", mBrightness );

	// add <controlpoint> tags (column-major)
	std::vector<vec2>::const_iterator itr;
	for( itr = mPoints.begin(); itr != mPoints.end(); ++itr ) {
		XmlTree cp;
		cp.setTag( "controlpoint" );
		cp.setAttribute( "x", ( *itr ).x );
		cp.setAttribute( "y", ( *itr ).y );

		xml.push_back( cp );
	}

	// add <blend> parameters
	XmlTree blend;
	blend.setTag( "blend" );
	blend.setAttribute( "exponent", mExponent );
	{
		XmlTree edges;
		edges.setTag( "edges" );
		edges.setAttribute( "left", mEdges.x );
		edges.setAttribute( "top", mEdges.y );
		edges.setAttribute( "right", mEdges.z );
		edges.setAttribute( "bottom", mEdges.w );
		blend.push_back( edges );

		XmlTree gamma;
		gamma.setTag( "gamma" );
		gamma.setAttribute( "red", mGamma.x );
		gamma.setAttribute( "green", mGamma.y );
		gamma.setAttribute( "blue", mGamma.z );
		blend.push_back( gamma );

		XmlTree luminance;
		luminance.setTag( "luminance" );
		luminance.setAttribute( "red", mLuminance.x );
		luminance.setAttribute( "green", mLuminance.y );
		luminance.setAttribute( "blue", mLuminance.z );
		blend.push_back( luminance );
	}
	xml.push_back( blend );

	return xml;
}