|
1 | 1 | package com.jme3.vulkan.material; |
2 | 2 |
|
| 3 | +import com.jme3.asset.AssetKey; |
| 4 | +import com.jme3.asset.CloneableSmartAsset; |
3 | 5 | import com.jme3.dev.NotFullyImplemented; |
4 | 6 | import com.jme3.export.JmeExporter; |
5 | 7 | import com.jme3.export.JmeImporter; |
|
22 | 24 | /** |
23 | 25 | * Relates shader uniform values to shader descriptor sets and bindings. |
24 | 26 | */ |
25 | | -public class NewMaterial implements VulkanMaterial { |
| 27 | +public class NewMaterial implements VulkanMaterial, CloneableSmartAsset { |
26 | 28 |
|
27 | 29 | private final Map<String, VulkanUniform<?>> uniforms = new HashMap<>(); |
28 | 30 | private final Map<String, VulkanTechnique> techniques = new HashMap<>(); |
29 | 31 | private final Map<DescriptorSetLayout, CachedDescriptorSet> setCache = new HashMap<>(); |
30 | 32 |
|
| 33 | + @Override |
| 34 | + public CloneableSmartAsset clone() { |
| 35 | + return null; |
| 36 | + } |
| 37 | + |
| 38 | + @Override |
| 39 | + public void setKey(AssetKey key) { |
| 40 | + |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public AssetKey getKey() { |
| 45 | + return null; |
| 46 | + } |
| 47 | + |
31 | 48 | @Override |
32 | 49 | public void bind(CommandBuffer cmd, Pipeline pipeline, DescriptorPool pool) { |
33 | 50 | List<DescriptorSetLayout> layouts = pipeline.getLayout().getSetLayouts(); |
@@ -69,14 +86,14 @@ public void bind(CommandBuffer cmd, Pipeline pipeline, DescriptorPool pool) { |
69 | 86 | } |
70 | 87 |
|
71 | 88 | @Override |
72 | | - public void setUniform(String name, GpuBuffer buffer) { |
| 89 | + public void setUniformBuffer(String name, GpuBuffer buffer) { |
73 | 90 | BufferUniform u = getUniform(name); |
74 | 91 | u.set(buffer); |
75 | 92 | } |
76 | 93 |
|
77 | 94 | @Override |
78 | | - public void setTexture(String name, Texture texture) { |
79 | | - Uniform<Texture> u = getUniform(name); |
| 95 | + public void setTexture(String name, Texture<?, ?> texture) { |
| 96 | + Uniform<Texture<?, ?>> u = getUniform(name); |
80 | 97 | u.set(texture); |
81 | 98 | } |
82 | 99 |
|
@@ -120,15 +137,17 @@ public void read(JmeImporter im) throws IOException { |
120 | 137 | throw new UnsupportedOperationException("Importing not yet supported."); |
121 | 138 | } |
122 | 139 |
|
123 | | - public void addUniform(String name, Uniform<?> uniform) { |
| 140 | + @Override |
| 141 | + public void setUniform(String name, Uniform<?> uniform) { |
124 | 142 | if (!(uniform instanceof VulkanUniform)) { |
125 | 143 | throw new ClassCastException("Uniform must implement VulkanUniform to be used in a Vulkan context."); |
126 | 144 | } |
127 | 145 | uniforms.put(name, (VulkanUniform<?>)uniform); |
128 | 146 | } |
129 | 147 |
|
| 148 | + @SuppressWarnings("unchecked") |
130 | 149 | @Override |
131 | | - public <T extends Uniform> T getUniform(String name) { |
| 150 | + public <T extends Uniform<?>> T getUniform(String name) { |
132 | 151 | return (T)uniforms.get(name); |
133 | 152 | } |
134 | 153 |
|
|
0 commit comments