Java 类com.badlogic.gdx.graphics.g3d.particles.ParticleEffectLoader 实例源码

项目:libgdxcn    文件:FlameMain.java   
public FlameMain () {
    super("Flame");
    MathUtils.random = new RandomXS128();
    particleSystem = ParticleSystem.get();
    effect = new ParticleEffect();
    particleSystem.add(effect);
    assetManager = new AssetManager();
    assetManager.setErrorListener(this);
    assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(new InternalFileHandleResolver()));
    controllersData = new Array<ControllerData>();

    lwjglCanvas = new LwjglCanvas(renderer = new AppRenderer());
    addWindowListener(new WindowAdapter() {
        public void windowClosed (WindowEvent event) {
            //System.exit(0);
            Gdx.app.exit();
        }
    });

    initializeComponents();

    setSize(1280, 950);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setVisible(true);
}
项目:libgdxcn    文件:FlameMain.java   
public ParticleEffect openEffect (File file, boolean replaceCurrentWorkspace) {
    try {
        ParticleEffect loadedEffect = load(file.getAbsolutePath(), ParticleEffect.class, null, 
            new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches()));
        loadedEffect = loadedEffect.copy();
        loadedEffect.init();
        if(replaceCurrentWorkspace){
            effect = loadedEffect;
            controllersData.clear();
            particleSystem.removeAll();
            particleSystem.add(effect);
            for(ParticleController controller : effect.getControllers())
                controllersData.add(new ControllerData(controller));
            rebuildActiveControllers();
        }
        reloadRows();
        return loadedEffect;
    } catch (Exception ex) {
        System.out.println("Error loading effect: " + file.getAbsolutePath());
        ex.printStackTrace();
        JOptionPane.showMessageDialog(this, "Error opening effect.");
    }
    return null;
}
项目:nhglib    文件:SceneManager.java   
private void processAssets(Array<Asset> assets) {
    for (Asset asset : assets) {
        if (asset.isType(ParticleEffect.class)) {
            ParticleRenderingSystem particleRenderingSystem = entities.getEntitySystem(ParticleRenderingSystem.class);
            asset.parameters = new ParticleEffectLoader.ParticleEffectLoadParameter(particleRenderingSystem.getParticleSystem().getBatches());
        }
    }
}
项目:Skyland    文件:ParticleUtils.java   
private void initManager() {
    particleManager = new AssetManager();
    ParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches());
    ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
    particleManager.setLoader(ParticleEffect.class, loader);
    particleManager.load(Particles.PARTICLE_CLOUD_PUFF, ParticleEffect.class, loadParam);
    particleManager.load(Particles.PARTICLE_CAVE_DUST, ParticleEffect.class, loadParam);
    particleManager.finishLoading();
}
项目:GdxDemo3D    文件:GameScene.java   
public GameScene(ModelLoader.ModelParameters modelParameters,
                 TextureLoader.TextureParameter textureParameter,
                 ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter,
                 String pfxPath, String modelPath, String modelExt, ObjectMap<String, GameObjectBlueprint> sharedBlueprints) {
    this.sharedBlueprints = sharedBlueprints;
    this.assets = new BlenderAssetManager(modelParameters, textureParameter, pfxParameter,
            pfxPath, modelPath, modelExt);
}
项目:GdxDemo3D    文件:GameSceneManager.java   
public GameSceneManager(ModelLoader.ModelParameters modelParameters,
                        TextureLoader.TextureParameter textureParameter,
                        ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter,
                        String pfxPath, String modelPath, String modelExt) {
    this.modelPath = modelPath;
    this.modelExt = modelExt;
    this.pfxPath = pfxPath;

    this.modelParameters = modelParameters;
    this.textureParameter = textureParameter;
    this.pfxParameter = pfxParameter;
}
项目:GdxDemo3D    文件:BlenderAssetManager.java   
public BlenderAssetManager(
        ModelLoader.ModelParameters modelParameters,
        TextureLoader.TextureParameter textureParameter,
        ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter,
        String pfxPath, String modelPath, String modelExt) {
    this.modelExt = modelExt;
    this.modelPath = modelPath;
    this.pfxPath = pfxPath;

    this.modelParameters = modelParameters;
    this.textureParameter = textureParameter;
    this.pfxParameter = pfxParameter;
}
项目:libgdxcn    文件:FlameMain.java   
public void saveEffect (File file) {
    Writer fileWriter = null;
    try {
        ParticleEffectLoader loader = (ParticleEffectLoader)assetManager.getLoader(ParticleEffect.class);
        loader.save(effect, new ParticleEffectSaveParameter(new FileHandle(file.getAbsolutePath()), assetManager, particleSystem.getBatches()));
    } catch (Exception ex) {
        System.out.println("Error saving effect: " + file.getAbsolutePath());
        ex.printStackTrace();
        JOptionPane.showMessageDialog(this, "Error saving effect.");
    } finally {
        StreamUtils.closeQuietly(fileWriter);
    }
}
项目:gdx-proto    文件:Assets.java   
public static void loadParticleEffects(ParticleSystem particleSystem) {
    ParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches());
    ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
    manager.setLoader(ParticleEffect.class, loader);
    manager.load("particle/bullet-hit.pfx", ParticleEffect.class, loadParam);
    manager.load("particle/blue-explosion.pfx", ParticleEffect.class, loadParam);
    manager.finishLoading();
}
项目:Alien-Ark    文件:PlanetScreen.java   
private void initParticles() {
    // particles
    particleSystem = ParticleSystem.get();
    particleSpriteBatch = new BillboardParticleBatch();

    particleSpriteBatch.setCamera(camera);
    particleSystem.add(particleSpriteBatch);

    assetManager = new AssetManager();
    ParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches());
    ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
    assetManager.setLoader(ParticleEffect.class, loader);
    assetManager.load("particles/3D/rocket_thruster.pfx", ParticleEffect.class, loadParam);
    assetManager.load("particles/3D/rocket_explosion.pfx", ParticleEffect.class, loadParam);
    assetManager.load("particles/3D/planet_portal.pfx", ParticleEffect.class, loadParam);
    assetManager.finishLoading();

    effectThrust = new ParticleEffect[3];
    effectThrust[0] =       ((ParticleEffect) assetManager.get("particles/3D/rocket_thruster.pfx")).copy();
    effectThrust[1] =       ((ParticleEffect) assetManager.get("particles/3D/rocket_thruster.pfx")).copy();
    effectThrust[2] =       ((ParticleEffect) assetManager.get("particles/3D/rocket_thruster.pfx")).copy();

    effectExplosion =   ((ParticleEffect) assetManager.get("particles/3D/rocket_explosion.pfx")).copy();
    effectPortal =      ((ParticleEffect) assetManager.get("particles/3D/planet_portal.pfx")).copy();
    effectExplosion.init();

    for (ParticleEffect e : effectThrust) {
        e.init();
        e.start();


        particleSystem.add(e);

    }

    effectPortal.init();
    effectPortal.start();
    effectPortal.translate(new Vector3(-30, 0, 135));
    effectPortal.rotate(Vector3.Z, 90);
    effectPortal.rotate(Vector3.X, 30);
    effectPortal.scale(2f, 2f, 2f);


    particleSystem.add(effectPortal);
}