PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 1ms 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
Possible License(s): LGPL-2.1
  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. #include "linden_common.h"
  27. #include "llvolumexml.h"
  28. //============================================================================
  29. // LLVolumeXml is just a wrapper class; all members are static
  30. //============================================================================
  31. LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params)
  32. {
  33. LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE);
  34. ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
  35. ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
  36. ret->createChild("hollow", FALSE)->setFloatValue(1, &params->getHollow());
  37. return ret;
  38. }
  39. LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params)
  40. {
  41. LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE);
  42. ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
  43. ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
  44. ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV);
  45. ret->createChild("shear", FALSE)->setFloatValue(2, params->getShear().mV);
  46. ret->createChild("twist_interval", FALSE)->setFloatValue(2, &params->getTwistBegin());
  47. ret->createChild("radius_offset", FALSE)->setFloatValue(1, &params->getRadiusOffset());
  48. ret->createChild("taper", FALSE)->setFloatValue(2, params->getTaper().mV);
  49. ret->createChild("revolutions", FALSE)->setFloatValue(1, &params->getRevolutions());
  50. ret->createChild("skew", FALSE)->setFloatValue(1, &params->getSkew());
  51. return ret;
  52. }
  53. LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
  54. {
  55. LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE);
  56. LLPointer<LLXMLNode> node ;
  57. node = exportPathParams(&params->getPathParams()) ;
  58. node->setParent(ret);
  59. node = exportProfileParams(&params->getProfileParams()) ;
  60. node->setParent(ret);
  61. return ret;
  62. }