Package com.ardor3d.extension.effect.particle.emitter

Source Code of com.ardor3d.extension.effect.particle.emitter.LineSegmentEmitter

/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/

package com.ardor3d.extension.effect.particle.emitter;

import java.io.IOException;

import com.ardor3d.math.LineSegment3;
import com.ardor3d.math.Vector3;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;

public class LineSegmentEmitter extends SavableParticleEmitter {

    private LineSegment3 _source;

    public LineSegmentEmitter() {
        _source = new LineSegment3();
    }

    /**
     * @param source
     *            the segment to use as our source
     */
    public LineSegmentEmitter(final LineSegment3 source) {
        _source = source;
    }

    public void setSource(final LineSegment3 source) {
        _source = source;
    }

    public LineSegment3 getSource() {
        return _source;
    }

    public Vector3 randomEmissionPoint(final Vector3 store) {
        Vector3 rVal = store;
        if (rVal == null) {
            rVal = new Vector3();
        }

        getSource().random(rVal);
        return rVal;
    }

    // /////////////////
    // Methods for Savable
    // /////////////////

    public void read(final InputCapsule capsule) throws IOException {
        _source = (LineSegment3) capsule.readSavable("source", null);
    }

    public void write(final OutputCapsule capsule) throws IOException {
        capsule.write(_source, "source", null);
    }
}
TOP

Related Classes of com.ardor3d.extension.effect.particle.emitter.LineSegmentEmitter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.