Package com.ngt.jopenmetaverse.shared.types.EnumsPrimitive

Examples of com.ngt.jopenmetaverse.shared.types.EnumsPrimitive.SculptType


    {
      ShapeBlock shape = new ShapeBlock();
      ProfileShape profileShape = ProfileShape.Circle;
      HoleType holeType = HoleType.Circle;
      UUID sculptTexture = UUID.Zero;
      SculptType sculptType = SculptType.None;
        boolean hasFlexi = false;
        boolean hasLight = false;
     
        PrimObject.FlexibleBlock flexible = new PrimObject.FlexibleBlock();
        PrimObject.LightBlock light = new PrimObject.LightBlock();
     
      NodeList inodeList = root.getChildNodes();
      for(int j = 0; j < inodeList.getLength(); j++)
      {
        Node node = inodeList.item(j);
        if(node.getNodeType() == Node.ELEMENT_NODE)
        {
          String nodeName = node.getNodeName();
          if(nodeName.equalsIgnoreCase("ProfileCurve"))
          {
            shape.ProfileCurve = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("TextureEntry"))
          {
            byte[] teData = Utils.decodeBase64String(node.getFirstChild().getNodeValue().trim());
            try {
            prim.Textures =  new TextureEntry(teData, 0, teData.length);
          } catch (Exception e) {
            throw new AssetPrimitiveParsingException(e);
          }
          }
          else if(nodeName.equalsIgnoreCase("PathBegin"))
          {
            shape.PathBegin = Primitive.UnpackBeginCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathCurve"))
          {
            shape.PathCurve = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("PathEnd"))
          {
            shape.PathEnd = Primitive.UnpackEndCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathRadiusOffset"))
          {
            shape.PathRadiusOffset = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }  
          else if(nodeName.equalsIgnoreCase("PathRevolutions"))
          {
            shape.PathRevolutions = Primitive.UnpackPathRevolutions((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathScaleX"))
          {
            shape.PathScaleX = Primitive.UnpackPathScale((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathScaleY"))
          {
            shape.PathScaleY = Primitive.UnpackPathScale((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathShearX"))
          {
            shape.PathShearX = Primitive.UnpackPathShear((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathShearY"))
          {
            shape.PathShearY = Primitive.UnpackPathShear((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathSkew"))
          {
            shape.PathSkew = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTaperX"))
          {
            shape.PathTaperX = Primitive.UnpackPathTaper((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTaperY"))
          {
            shape.PathTaperY = Primitive.UnpackPathShear((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTwist"))
          {
            shape.PathTwist = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTwistBegin"))
          {
            shape.PathTwistBegin = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PCode"))
          {
            prim.PCode = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("ProfileBegin"))
          {
            shape.ProfileBegin = Primitive.UnpackBeginCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("ProfileEnd"))
          {
            shape.ProfileEnd = Primitive.UnpackEndCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("ProfileHollow"))
          {
            shape.ProfileHollow = Primitive.UnpackProfileHollow(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("Scale"))
          {
            prim.Scale = ReadVector(node);
          }
          else if(nodeName.equalsIgnoreCase("State"))
          {
            prim.State = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("ProfileShape"))
          {
            profileShape = ProfileShape.valueOf(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("HollowShape"))
          {
            holeType = HoleType.valueOf(node.getFirstChild().getNodeValue().trim());
          }
            else if(nodeName.equalsIgnoreCase("SculptTexture"))
          {
              sculptTexture = ReadUUID(node);
          }
          else if(nodeName.equalsIgnoreCase("SculptType"))
          {
            sculptType = SculptType.get((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("FlexiSoftness"))
          {
            flexible.Softness = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiTension"))
          {
            flexible.Tension = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiDrag"))
          {
            flexible.Drag = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiGravity"))
          {
            flexible.Gravity = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiWind"))
          {
            flexible.Wind = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiForceX"))
          {
            flexible.Force.X = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiForceY"))
          {
            flexible.Force.Y = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiForceZ"))
          {
            flexible.Force.Z = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightColorR"))
          {
            light.Color.setR(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightColorG"))
          {
            light.Color.setG(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightColorB"))
          {
            light.Color.setB(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightColorA"))
          {
            light.Color.setA(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightRadius"))
          {
            light.Radius = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightCutoff"))
          {
            light.Cutoff = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightFalloff"))
          {
            light.Falloff = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightIntensity"))
          {
            light.Intensity = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiEntry"))
          {
            hasFlexi = Boolean.parseBoolean(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightEntry"))
          {
            hasLight = Boolean.parseBoolean(node.getFirstChild().getNodeValue().trim());
          }
          else
          {
            JLogger.warn("Not handled parsing of node " + root.getNodeName() + ":" + nodeName);
          }

        }
      }
     
        shape.ProfileCurve = Utils.ubyteToInt(profileShape.getIndex()) | Utils.ubyteToInt(holeType.getIndex());
        if (!sculptTexture.equals(UUID.Zero))
        {
            prim.Sculpt = new PrimObject.SculptBlock();
            prim.Sculpt.Texture = sculptTexture;
            prim.Sculpt.Type = Utils.ubyteToInt(sculptType.getIndex());
        }
     
        if (hasFlexi)
            prim.Flexible = flexible;
        if (hasLight)
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.types.EnumsPrimitive.SculptType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.