protected OgexMaterial toMaterial( DataStructure ds, Map<BaseStructure, Object> index ) {
        OgexMaterial result = (OgexMaterial)index.get(ds);
        if( result != null ) {
            return result;
        }
        result = new OgexMaterial();
        index.put(ds, result);
 
        if( "true".equals(ds.getProperty("two_sided")) ) {
            result.setTwoSided(true);
        }
 
        for( BaseStructure child : ds ) {
            String type = child.getType();
            if( StructTypes.NAME.equals(type) ) {
                result.setName((String)child.getValue());
            } else if( StructTypes.COLOR.equals(type) ) {
                String name = ((DataStructure)child).getProperty("attrib");
                result.setColor(name, new OgexColor((float[])child.getValue()));
            } else if( StructTypes.TEXTURE.equals(type) ) {
                String name = ((DataStructure)child).getProperty("attrib");
                result.setTexture(name, toTexture((DataStructure)child, index));
            } else if( StructTypes.PARAM.equals(type) ) {
                String name = ((DataStructure)child).getProperty("attrib");
                result.setParam(name, (Float)child.getValue());
            } else {
                log.warn("Unhandled structure type:" + child.getType() + ", from:" + child.location());            
            }
        }
        
        return result;
    }