Esempio n. 1
0
        public SExplosionRenderer(int particleCapacity         = 500,
                                  SExplosionParameters eParams = null)
            : base(new SExplosionSystem(eParams ?? new SExplosionParameters(), particleCapacity),
                   SSTexturedQuad.DoubleFaceInstance,
                   _defaultUsageHint
                   )
        {
            renderState.castsShadow     = false;
            renderState.receivesShadows = false;
            renderState.doBillboarding  = false;
            renderState.alphaBlendingOn = true;
            //renderState.depthTest = true;
            renderState.depthTest  = true;
            renderState.depthWrite = false;
            renderState.lighted    = false;

            simulateOnUpdate = true;
            Name             = "simple expolsion renderer";

            base.colorMaterial = SSColorMaterial.pureAmbient;

            var texture = particleSystem.parameters.getTexture();

            this.textureMaterial = new SSTextureMaterial(diffuse: texture);
        }
Esempio n. 2
0
        public void showExplosionDelayed(SExplosionParameters eParams, float intensity,
                                         float delay, Vector3 position, Vector3 velocity)
        {
            var di = new DelayedExplosionInfo(
                this, eParams, intensity, position, velocity, delay);

            _delayedExpls.Add(di);
        }
Esempio n. 3
0
 public DelayedExplosionInfo(SExplosionManager em, SExplosionParameters ep,
                             float intensity, Vector3 position, Vector3 velocity, float delay)
 {
     _explParams     = ep;
     _em             = em;
     _position       = position;
     _velocity       = velocity;
     _intensity      = intensity;
     _delayRemaining = delay;
 }
Esempio n. 4
0
            public SExplosionSystem(SExplosionParameters eParams, int particleCapacity)
                : base(particleCapacity)
            {
                _configureParameters(eParams);

                // shared
                _radialOrientator = new RadialBillboardOrientator();
                _radialOrientator.effectorMask
                    = (ushort)ComponentMask.FlyingSparks | (ushort)ComponentMask.SmokeTrails;
                addEffector(_radialOrientator);
            }
Esempio n. 5
0
            protected void _configureParameters(SExplosionParameters eParams)
            {
                _eParams = eParams;

                configureFlameSmoke();
                configureFlash();
                configureFlyingSparks();
                configureSmokeTrails();
                configureRoundSparks();
                configureDebris();
                configureShockwave();
            }
Esempio n. 6
0
        protected void _showExplosionCommon(SSObject attachTo, SExplosionParameters eParams,
                                            Vector3 position, Vector3 velocity, float intensity, float simInterval = float.NaN)
        {
            SExplosionRenderer renderer = null;

            foreach (var existing in _renderers)
            {
                if (existing.particleSystem.numElements == 0)
                {
                    // recycle existing renderers...
                    renderer          = existing;
                    renderer.attachTo = attachTo;
                    if (attachTo == null)
                    {
                        renderer.worldMat = Matrix4.Identity;
                    }
                    else
                    {
                        renderer.worldMat = attachTo.worldMat;
                    }
                    renderer.parameters = eParams;
                    break;
                }
            }
            if (renderer == null)
            {
                // have to allocate a new renderer
                renderer          = new SExplosionRenderer(_particleCapacity, eParams);
                renderer.attachTo = attachTo;
                _renderScene.AddObject(renderer);
                _renderers.Add(renderer);
            }
            if (!float.IsNaN(simInterval))
            {
                renderer.particleSystem.simulationStep = simInterval;
            }
            renderer.showExplosion(position, intensity, velocity);
        }
Esempio n. 7
0
 public void showExplosionAttached(SExplosionParameters eParams, float intensity,
                                   SSObject attachTo, Vector3 localPos, float simInterval = float.NaN)
 {
     _showExplosionCommon(attachTo, eParams, localPos, Vector3.Zero, intensity, simInterval);
 }
Esempio n. 8
0
 public void showExplosion(SExplosionParameters eParams, float intensity,
                           Vector3 position, Vector3 velocity, float simInterval = float.NaN)
 {
     _showExplosionCommon(null, eParams, position, velocity, intensity, simInterval);
 }