コード例 #1
0
ファイル: SLaserManager.cs プロジェクト: kniteli/SimpleScene
        public SLaser addLaser(SLaserParameters laserParams, 
		   		     		   SSObject srcObject, SSObject dstObject)
        {
            if (_2dEffectRenderer.textureMaterial == null) {
                _2dEffectRenderer.textureMaterial = new SSTextureMaterial (laserParams.emissionSpritesTexture);
            }

            var newLaser = new SLaser (laserParams);
            //newLaser.intensityEnvelope.sustainDuration = sustainDuration;
            newLaser.sourceObject = srcObject;
            newLaser.targetObject = dstObject;

            var newLaserRuntime = new LaserRuntimeInfo (newLaser, _beamScene3d, _occDiskScene, _2dEffectRenderer);
            _laserRuntimes.Add (newLaserRuntime);

            if (laserParams.doLaserBurn) {
                _laserBurnParticles.particleSystem.addHitSpots(newLaser);
            }

            // debug hacks
            //newLaser.sourceObject = newLaserRuntime.beamRuntimes[0].emissionBillboard;
            //newLaser.sourceTxfm = Matrix4.Identity;

            return newLaser;
        }
コード例 #2
0
ファイル: SLaserManager.cs プロジェクト: wumohai/SimpleScene
        public SLaser addLaser(SLaserParameters laserParams,
                               SSObject srcObject, SSObject dstObject,
                               SLaser.TargetVelFunc targetVelFunc = null)
        {
            if (_2dEffectRenderer.textureMaterial == null)
            {
                _2dEffectRenderer.textureMaterial = new SSTextureMaterial(laserParams.emissionSpritesTexture());
            }

            var newLaser = new SLaser(laserParams, targetVelFunc);

            newLaser.sourceObject = srcObject;
            newLaser.targetObject = dstObject;

            var newLaserRuntime = new LaserRuntimeInfo(newLaser, _beamScene3d, _occDiskScene, _2dEffectRenderer);

            _laserRuntimes.Add(newLaserRuntime);

            if (laserParams.doLaserBurn)
            {
                SLaserBurnParticlesObject burnRenderer;
                bool ok = _laserBurnParticleRenderers.TryGetValue(dstObject, out burnRenderer);
                if (!ok)
                {
                    burnRenderer                 = new SLaserBurnParticlesObject(dstObject, _maxBurnParticlesPerObject, null);
                    burnRenderer.Name            = "laser manager's laser burn particle system renderer";
                    burnRenderer.textureMaterial = new SSTextureMaterial(laserParams.laserBurnParticlesTexture());
                    //_laserBurnParticles.renderMode = SSInstancedMeshRenderer.RenderMode.GpuInstancing;
                    burnRenderer.simulateOnUpdate = false;
                    burnRenderer.simulateOnRender = true;
                    _beamScene3d.AddObject(burnRenderer);
                    _laserBurnParticleRenderers [dstObject] = burnRenderer;
                }
                burnRenderer.particleSystem.addHitSpots(newLaser);
            }


            // debug hacks
            //newLaser.sourceObject = newLaserRuntime.beamRuntimes[0].emissionBillboard;
            //newLaser.sourceTxfm = Matrix4.Identity;

            return(newLaser);
        }
コード例 #3
0
ファイル: SLaserManager.cs プロジェクト: jeske/SimpleScene
        public SLaser addLaser(SLaserParameters laserParams, 
		   		     		   SSObject srcObject, SSObject dstObject,
                               SLaser.TargetVelFunc targetVelFunc = null)
        {
            if (_2dEffectRenderer.textureMaterial == null) {
                _2dEffectRenderer.textureMaterial = new SSTextureMaterial (laserParams.emissionSpritesTexture());
            }

            var newLaser = new SLaser (laserParams, targetVelFunc);
            newLaser.sourceObject = srcObject;
            newLaser.targetObject = dstObject;

            var newLaserRuntime = new LaserRuntimeInfo (newLaser, _beamScene3d, _occDiskScene, _2dEffectRenderer);
            _laserRuntimes.Add (newLaserRuntime);

            if (laserParams.doLaserBurn) {
                SLaserBurnParticlesObject burnRenderer;
                bool ok = _laserBurnParticleRenderers.TryGetValue(dstObject, out burnRenderer);
                if (!ok) {
                    burnRenderer = new SLaserBurnParticlesObject (dstObject, _maxBurnParticlesPerObject, null);
                    burnRenderer.Name = "laser manager's laser burn particle system renderer";
                    burnRenderer.textureMaterial = new SSTextureMaterial(laserParams.laserBurnParticlesTexture());
                    //_laserBurnParticles.renderMode = SSInstancedMeshRenderer.RenderMode.GpuInstancing;
                    burnRenderer.simulateOnUpdate = false;
                    burnRenderer.simulateOnRender = true;
                    _beamScene3d.AddObject(burnRenderer);
                    _laserBurnParticleRenderers [dstObject] = burnRenderer;
                }
                burnRenderer.particleSystem.addHitSpots(newLaser);
            }

            // debug hacks
            //newLaser.sourceObject = newLaserRuntime.beamRuntimes[0].emissionBillboard;
            //newLaser.sourceTxfm = Matrix4.Identity;

            return newLaser;
        }