Beispiel #1
0
            protected void _createRenderObjects()
            {
                var laserParams = this._laser.parameters;

                if (laserParams.doEmissionFlare && _occDiskFlatObj == null)
                {
                    _occDiskFlatObj = new SSObjectOcclusionQueuery(new SSMeshDisk());
                    _occDiskFlatObj.renderState.alphaBlendingOn          = true;
                    _occDiskFlatObj.renderState.lighted                  = false;
                    _occDiskFlatObj.renderState.depthTest                = true;
                    _occDiskFlatObj.renderState.depthWrite               = false;
                    _occDiskFlatObj.renderState.doBillboarding           = false;
                    _occDiskFlatObj.renderState.matchScaleToScreenPixels = true;
                    _occDiskFlatObj.Scale = new Vector3(_laser.parameters.emissionOccDiskRadiusPx);
                    var color = _laser.parameters.backgroundColor; // debugging
                    color.A = _laser.parameters.emissionOccDisksAlpha;
                    _occDiskFlatObj.MainColor = color;
                    _occDiskFlatObj.Name      = "occlusion disk object for laser beam's emission flare";
                    _occDiskScene.AddObject(_occDiskFlatObj);
                }

                if (_beamObj == null)
                {
                    _beamObj = new SLaserBeamMiddleObject(
                        _laser, _beamId, _beamScene,
                        laserParams.middleBackgroundTexture(), laserParams.middleOverlayTexture(),
                        laserParams.middleInterferenceTexture());
                    _beamObj.Name = "laser beam middle section object";
                    _beamScene.AddObject(_beamObj);
                }

                if (laserParams.doEmissionFlare && _emissionFlareUpdater == null)
                {
                    _emissionFlareUpdater = new SLaserEmissionFlareUpdater(
                        _laser, _beamId, _occDiskFlatObj,
                        laserParams.emissionBackgroundRect, laserParams.emissionOverlayRect);
                    _sprite2dRenderer.addUpdater(_emissionFlareUpdater);
                }

                if (laserParams.doScreenHitFlare && _hitFlareUpdater == null)
                {
                    float[] masterScales = { laserParams.hitFlareCoronaOverlayScale, laserParams.hitFlareCoronaOverlayScale,
                                             laserParams.hitFlareRing1Scale,         laserParams.hitFlareRing2Scale };
                    _hitFlareUpdater = new SLaserScreenHitFlareUpdater(_laser, _beamId, _beamScene, null, masterScales);
                    _sprite2dRenderer.addUpdater(_hitFlareUpdater);
                }
            }
Beispiel #2
0
 public void requestDeleteFromScene()
 {
     if (_beamObj != null)
     {
         _beamObj.renderState.toBeDeleted = true;
     }
     if (_occDiskFlatObj != null)
     {
         _occDiskFlatObj.renderState.toBeDeleted = true;
     }
     if (_emissionFlareUpdater != null)
     {
         _sprite2dRenderer.removeUpdater(_emissionFlareUpdater);
         _emissionFlareUpdater = null;
     }
     if (_hitFlareUpdater != null)
     {
         _sprite2dRenderer.removeUpdater(_hitFlareUpdater);
         _hitFlareUpdater = null;
     }
 }
Beispiel #3
0
            protected void _createRenderObjects()
            {
                var laserParams = this._laser.parameters;

                if (laserParams.doEmissionFlare && _occDiskFlatObj == null) {
                    _occDiskFlatObj = new SSObjectOcclusionQueuery (new SSMeshDisk ());
                    _occDiskFlatObj.renderState.alphaBlendingOn = true;
                    _occDiskFlatObj.renderState.lighted = false;
                    _occDiskFlatObj.renderState.depthTest = true;
                    _occDiskFlatObj.renderState.depthWrite = false;
                    _occDiskFlatObj.renderState.doBillboarding = false;
                    _occDiskFlatObj.renderState.matchScaleToScreenPixels = true;
                    _occDiskFlatObj.Scale = new Vector3 (_laser.parameters.emissionOccDiskRadiusPx);
                    var color = _laser.parameters.backgroundColor; // debugging
                    color.A = _laser.parameters.emissionOccDisksAlpha;
                    _occDiskFlatObj.MainColor = color;
                    _occDiskFlatObj.Name = "occlusion disk object for laser beam's emission flare";
                    _occDiskScene.AddObject(_occDiskFlatObj);
                }

                if (_beamObj == null) {
                    _beamObj = new SLaserBeamMiddleObject (
                        _laser, _beamId, _beamScene,
                        laserParams.middleBackgroundTexture(), laserParams.middleOverlayTexture(),
                        laserParams.middleInterferenceTexture());
                    _beamObj.Name = "laser beam middle section object";
                    _beamScene.AddObject(_beamObj);
                }

                if (laserParams.doEmissionFlare && _emissionFlareUpdater == null) {
                    _emissionFlareUpdater = new SLaserEmissionFlareUpdater (
                        _laser, _beamId, _occDiskFlatObj,
                        laserParams.emissionBackgroundRect, laserParams.emissionOverlayRect);
                    _sprite2dRenderer.addUpdater(_emissionFlareUpdater);
                }

                if (laserParams.doScreenHitFlare && _hitFlareUpdater == null) {
                    float[] masterScales = { laserParams.hitFlareCoronaOverlayScale, laserParams.hitFlareCoronaOverlayScale,
                                             laserParams.hitFlareRing1Scale, laserParams.hitFlareRing2Scale };
                    _hitFlareUpdater = new SLaserScreenHitFlareUpdater (_laser, _beamId, _beamScene, null, masterScales);
                    _sprite2dRenderer.addUpdater(_hitFlareUpdater);
                }
            }
Beispiel #4
0
 public void requestDeleteFromScene()
 {
     if (_beamObj != null) {
         _beamObj.renderState.toBeDeleted = true;
     }
     if (_occDiskFlatObj != null) {
         _occDiskFlatObj.renderState.toBeDeleted = true;
     }
     if (_emissionFlareUpdater != null) {
         _sprite2dRenderer.removeUpdater(_emissionFlareUpdater);
         _emissionFlareUpdater = null;
     }
     if (_hitFlareUpdater != null) {
         _sprite2dRenderer.removeUpdater(_hitFlareUpdater);
         _hitFlareUpdater = null;
     }
 }