Package processing.xml

Examples of processing.xml.XMLElement


   */
  protected void initEffect(String filename) {
    initEffectCommon();

    filename = filename.replace('\\', '/');
    XMLElement xml = new XMLElement(parent, filename);

    loadXML(xml);

    initShader(filename, false);
  }
View Full Code Here


    initEffectCommon();

    try {
      String xmlText = PApplet
          .join(PApplet.loadStrings(url.openStream()), "\n");
      XMLElement xml = new XMLElement(xmlText);
      loadXML(xml);
    } catch (IOException e) {
      System.err.println("Error loading effect: " + e.getMessage());
    }
View Full Code Here

  protected void loadXML(XMLElement xml) {
    // Parsing xml configuration.

    int n = xml.getChildCount();
    String name;
    XMLElement child;
    vertexFN = geometryFN = fragmentFN = "";
    for (int i = 0; i < n; i++) {
      child = xml.getChild(i);
      name = child.getName();
      if (name.equals("description")) {
        description = child.getContent();
      } else if (name.equals("vertex")) {
        // vertexFN = fixShaderFilename(child.getContent(), rootPath);
        vertexFN = child.getContent();
      } else if (name.equals("geometry")) {
        // geometryFN = fixShaderFilename(child.getContent(), rootPath);
        geometryFN = child.getContent();
        inGeoPrim = child.getString("input");
        outGeoPrim = child.getString("output");
        maxNumOutVert = child.getInt("vertcount");
      } else if (name.equals("fragment")) {
        // fragmentFN = fixShaderFilename(child.getContent(), rootPath);
        fragmentFN = child.getContent();
      } else if (name.equals("textures")) {
        loadTextures(child);
      } else if (name.equals("vertexattribs")) {
        loadVertAttribs(child);
      } else if (name.equals("parameters")) {
View Full Code Here

    int n = xml.getChildCount();
    numTextures = n;
    texNameArray = new String[numTextures];
    texUnitUniform = new int[numTextures];

    XMLElement child;
    String name, texName, valueStr;
    int texUnit;
    for (int i = 0; i < n; i++) {
      child = xml.getChild(i);
      name = child.getName();
      if (name.equals("texture")) {
        texName = child.getString("name");
        valueStr = child.getContent();
        texUnit = PApplet.parseInt(PApplet.split(valueStr, ' '))[0];
        texHashMap.put(texName, new Integer(texUnit));
        texNameArray[i] = texName;
      }
    }
View Full Code Here

  protected void loadVertAttribs(XMLElement xml) {
    int n = xml.getChildCount();
    numVertAttribs = n;
    vertAttribArray = new GLModelEffectVertexAttrib[numVertAttribs];

    XMLElement child;
    String name;
    String attrName, attrTypeStr, attrValueStr, attrLabelStr;
    int attrType;
    GLModelEffectVertexAttrib attrib;
    for (int i = 0; i < n; i++) {
      child = xml.getChild(i);
      name = child.getName();
      if (name.equals("vertexattrib")) {
        float[] attrValue;
        attrName = child.getString("name");
        attrTypeStr = child.getString("type");
        attrLabelStr = child.getString("label");
        attrValueStr = child.getContent();
        attrType = GLModelEffectVertexAttrib.getType(attrTypeStr);

        attrValue = PApplet.parseFloat(PApplet.split(attrValueStr, ' '));

        if ((-1 < attrType) && !paramsHashMap.containsKey(attrName)) {
View Full Code Here

  protected void loadParams(XMLElement xml) {
    int n = xml.getChildCount();
    numParams = n;
    paramsArray = new GLModelEffectParameter[numParams];

    XMLElement child;
    String name;
    String parName, parTypeStr, parValueStr, parLabelStr;
    int parType;
    GLModelEffectParameter param;
    for (int i = 0; i < n; i++) {
      child = xml.getChild(i);
      name = child.getName();
      if (name.equals("parameter")) {
        float[] parValue;
        parName = child.getString("name");
        parTypeStr = child.getString("type");
        parLabelStr = child.getString("label");
        parValueStr = child.getContent();
        parType = GLModelEffectParameter.getType(parTypeStr);

        parValue = PApplet.parseFloat(PApplet.split(parValueStr, ' '));

        if ((-1 < parType) && !paramsHashMap.containsKey(parName)) {
View Full Code Here

     * menu elements we can find.
     */
    Stack s = new Stack();
    try
    {
      s.push(new XMLElement(in));
      while (!s.isEmpty())
      {
        XMLElement curEl = (XMLElement) s.pop();
        if (curEl.getName().equalsIgnoreCase("menu"))
        {
          // If curEl is a menu, parse it and add it to the ArrayList.
          menus.add(menuElement(null, curEl));
        } else
        {
          // If not, keep going through the XML tree and search for
          // more <menu> elements.
          Enumeration en = curEl.enumerateChildren();
          while (en.hasMoreElements())
          {
            s.push(en.nextElement());
          }
        }
View Full Code Here

     * children and call menuElement() on each one.
     */
    XMLElement[] els = el.getChildren();
    for (int i = 0; i < els.length; i++)
    {
      XMLElement child = els[i];
      menuElement(newItem, child);
    }
    return newItem;
  }
View Full Code Here

TOP

Related Classes of processing.xml.XMLElement

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.