Example #1
0
        public ParticleSystem(ParticleEmitter particleEmitter, ParticleFactory particleFactory, Camera activeCamera, bool endlessLife, float emitterLife, int maxParticles)
        {
            this.particleEmitter = particleEmitter;
            this.particleFactory = particleFactory;

            this.endlessLife = endlessLife;
            this.emitterLife = defaultEmitterLife = emitterLife;
            this.maxParticles = maxParticles;
            listParticles = new List<Particle>(maxParticles);
            listCollisionSurfaces = new List<CollisionSurface>();
            listManipulators = new List<Manipulator>();
            this.activeCamera = activeCamera;

            boundingSphere = new Sphere(particleEmitter.getPosition(), particleFactory.getRange());
        }
Example #2
0
        public bool inFrustum(Sphere sphere)
        {
            if (left.distanceTo(sphere.position) < -sphere.radius)
                return false;
            if (right.distanceTo(sphere.position) < -sphere.radius)
                return false;
            if (top.distanceTo(sphere.position) < -sphere.radius)
                return false;
            if (bottom.distanceTo(sphere.position) < -sphere.radius)
                return false;
            if (far.distanceTo(sphere.position) < -sphere.radius)
                return false;
            if (near.distanceTo(sphere.position) < -sphere.radius)
                return false;

            return true;
        }