PageRenderTime 342ms CodeModel.GetById 159ms app.highlight 9ms RepoModel.GetById 173ms app.codeStats 0ms

/indra/llprimitive/llvolumexml.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 78 lines | 34 code | 16 blank | 28 comment | 0 complexity | 4b1132417bef874f5d38ac60371e1151 MD5 | raw file
 1/** 
 2 * @file llvolumexml.cpp
 3 * @brief LLVolumeXml base class
 4 *
 5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#include "linden_common.h"
28
29#include "llvolumexml.h"
30
31//============================================================================
32
33// LLVolumeXml is just a wrapper class; all members are static
34
35//============================================================================
36
37LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params)
38{
39	LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE);
40
41	ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
42	ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
43	ret->createChild("hollow", FALSE)->setFloatValue(1, &params->getHollow());
44
45	return ret;
46}
47
48
49LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params)
50{
51	LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE); 
52	ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
53	ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
54	ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV);
55	ret->createChild("shear", FALSE)->setFloatValue(2, params->getShear().mV);
56	ret->createChild("twist_interval", FALSE)->setFloatValue(2, &params->getTwistBegin());
57	ret->createChild("radius_offset", FALSE)->setFloatValue(1, &params->getRadiusOffset());
58	ret->createChild("taper", FALSE)->setFloatValue(2, params->getTaper().mV);
59	ret->createChild("revolutions", FALSE)->setFloatValue(1, &params->getRevolutions());
60	ret->createChild("skew", FALSE)->setFloatValue(1, &params->getSkew());
61
62	return ret;
63}
64
65
66LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
67{
68	LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE);
69	
70	LLPointer<LLXMLNode> node ;
71	node = exportPathParams(&params->getPathParams()) ;
72	node->setParent(ret);
73	node = exportProfileParams(&params->getProfileParams()) ;
74	node->setParent(ret);
75
76	return ret;
77}
78