/** * Creates a new shader, {@link #initialize() } must be called * after this constructor for the shader to be usable. */ public Shader(){ super(); shaderSourceList = new ArrayList<>(); uniforms = new ListMap<>(); bufferBlocks = new ListMap<>(); attribs = new IntMap<>(); boundUniforms = new ArrayList<>(); }
@Override public ListMap<K, V> clone(){ ListMap<K, V> clone = new ListMap<K, V>(size()); clone.putAll(this); return clone; }
/** * Clones this material. The result is returned. */ @Override public Material clone() { try { Material mat = (Material) super.clone(); if (additionalState != null) { mat.additionalState = additionalState.clone(); } mat.technique = null; mat.techniques = new HashMap<String, Technique>(); mat.paramValues = new ListMap<String, MatParam>(); for (int i = 0; i < paramValues.size(); i++) { Map.Entry<String, MatParam> entry = paramValues.getEntry(i); mat.paramValues.put(entry.getKey(), entry.getValue().clone()); } mat.sortingId = -1; return mat; } catch (CloneNotSupportedException ex) { throw new AssertionError(ex); } }
@Test public void testListMap() { ListMap<String, String> listMap = new ListMap<String, String>(); listMap.put("bob", "hello"); assert "hello".equals(listMap.get("bob")); assert "hello".equals(listMap.remove("bob")); assert listMap.size() == 0; assert listMap.isEmpty(); listMap.put("abc", "1"); listMap.put("def", "2"); listMap.put("ghi", "3"); listMap.put("jkl", "4"); listMap.put("mno", "5"); assert "3".equals(listMap.get("ghi")); assert listMap.size() == 5; assert !listMap.isEmpty(); // check iteration order, should be consistent for (int i = 0; i < listMap.size(); i++) { String expectedValue = Integer.toString(i + 1); String key = listMap.getKey(i); String value = listMap.getValue(i); Entry<String, String> entry = listMap.getEntry(i); assert key.equals(entry.getKey()); assert value.equals(entry.getValue()); assert expectedValue.equals(value); } } }
paramValues = new ListMap<String, MatParam>();
/** * Creates a new material definition with the given name. * * @param assetManager The asset manager to use to load shaders * @param name The debug name of the material definition */ public MaterialDef(AssetManager assetManager, String name){ this.assetManager = assetManager; this.name = name; techniques = new HashMap<String, TechniqueDef>(); matParams = new ListMap<String, MatParam>(); defaultTechs = new ArrayList<TechniqueDef>(); logger.log(Level.INFO, "Loaded material definition: {0}", name); }
public static void main(String[] args){ Map<String, String> map = new ListMap<String, String>(); map.put( "bob", "hello"); System.out.println(map.get("bob")); map.remove("bob"); System.out.println(map.size()); map.put("abc", "1"); map.put("def", "2"); map.put("ghi", "3"); map.put("jkl", "4"); map.put("mno", "5"); System.out.println(map.get("ghi")); }
/** * Creates a new shader, {@link #initialize() } must be called * after this constructor for the shader to be usable. */ public Shader(){ super(); shaderSourceList = new ArrayList<ShaderSource>(); uniforms = new ListMap<String, Uniform>(); attribs = new IntMap<Attribute>(); boundUniforms = new ArrayList<Uniform>(); }
/** * Create an empty shader. */ public Shader(String language){ super(Shader.class); this.language = language; shaderList = new ArrayList<ShaderSource>(); // uniforms = new HashMap<String, Uniform>(); uniforms = new ListMap<String, Uniform>(); attribs = new IntMap<Attribute>(); }
@Override public ListMap<K, V> clone(){ ListMap<K, V> clone = new ListMap<K, V>(size()); clone.putAll(this); return clone; }
@Override public ListMap<K, V> clone(){ ListMap<K, V> clone = new ListMap<K, V>(size()); clone.putAll(this); return clone; }
/** * Clones this material. The result is returned. */ @Override public Material clone() { try { Material mat = (Material) super.clone(); if (additionalState != null) { mat.additionalState = additionalState.clone(); } mat.technique = null; mat.techniques = new HashMap<String, Technique>(); mat.paramValues = new ListMap<String, MatParam>(); for (int i = 0; i < paramValues.size(); i++) { Map.Entry<String, MatParam> entry = paramValues.getEntry(i); mat.paramValues.put(entry.getKey(), entry.getValue().clone()); } mat.sortingId = -1; return mat; } catch (CloneNotSupportedException ex) { throw new AssertionError(ex); } }
/** * Clones this material. The result is returned. */ @Override public Material clone() { try { Material mat = (Material) super.clone(); if (additionalState != null) { mat.additionalState = additionalState.clone(); } mat.technique = null; mat.techniques = new HashMap<String, Technique>(); mat.techniqueArray = null; mat.paramValues = new ListMap<String, MatParam>(); for (int i = 0; i < paramValues.size(); i++) { Map.Entry<String, MatParam> entry = paramValues.getEntry(i); mat.paramValues.put(entry.getKey(), entry.getValue().clone()); } return mat; } catch (CloneNotSupportedException ex) { throw new AssertionError(); } }
public void read(JmeImporter im) throws IOException{ InputCapsule ic = im.getCapsule(this); language = ic.readString("language", null); shaderList = ic.readSavableArrayList("shaderList", null); attribs = (IntMap<Attribute>) ic.readIntSavableMap("attribs", null); HashMap<String, Uniform> uniMap = (HashMap<String, Uniform>) ic.readStringSavableMap("uniforms", null); uniforms = new ListMap<String, Uniform>(uniMap); }
paramValues = new ListMap<String, MatParam>();
paramValues = new ListMap<String, MatParam>();