private void loadPrefabs() { EntityPersister persister = _entityManager.getPersister(); for (String prefabURI : AssetManager.list("prefab")) { _logger.info("Loading prefab " + prefabURI); try { if (!prefabURI.endsWith(".prefab")) { continue; } BufferedReader reader = new BufferedReader(new InputStreamReader(AssetManager.assetStream(prefabURI))); EntityData.Prefab prefabData = EntityDataJSONFormat.readPrefab(reader); if (prefabData != null) { persister.deserializePrefab(prefabData); } } catch (IOException e) { _logger.log(Level.WARNING, "Failed to load prefab '" + prefabURI + "'", e); } } }
/** * Shader parameters for the Particle shader program. * * @author Benjamin Glatzel <*****@*****.**> */ public class ShaderParametersParticle implements IShaderParameters { private Texture terrainTex = AssetManager.loadTexture("engine:terrain"); public void applyParameters(ShaderProgram program) { LocalPlayer localPlayer = CoreRegistry.get(LocalPlayer.class); GL13.glActiveTexture(GL13.GL_TEXTURE0); glBindTexture(GL11.GL_TEXTURE_2D, terrainTex.getId()); if (localPlayer != null) program.setInt("carryingTorch", localPlayer.isCarryingTorch() ? 1 : 0); } }