//喷泉 private void btn_Spring_Click(object sender, EventArgs e) { if (_glbControl.Globe.Ocean.Visible) { btn_Ocean.PerformClick(); } //喷泉粒子要素对象 GSOGeoParticle geoParticle = new GSOGeoParticle(); //添加到当前相机位置 geoParticle.SetPosition(_glbControl.Globe.CameraState.Longitude, _glbControl.Globe.CameraState.Latitude, 0); GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); //设置喷泉纹理 emitter.TexturePath = _waterDropPath; //设置粒子大小 emitter.SetSizeFix(0.5f, 2); emitter.VelFix = 10; emitter.VelRnd = 2; emitter.GravityAcc = 9.8f; emitter.AngleXYFix = 0; emitter.AngleXYRnd = 180; emitter.AngleXZFix = 88; emitter.AngleXZRnd = 2; emitter.LifeFix = 5.0f; emitter.LifeRnd = 1.0f; emitter.RotFix = 0; emitter.RotRnd = 0; emitter.RotVelFix = 0; emitter.RotVelRnd = 0; //每秒钟1000个粒子 emitter.EmitPerSec = 1000; //白色,33不透明度 emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); //白色,11不透明度 emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); emitter.IsLumAdded = false; //将发射器添加到粒子对象中 geoParticle.AddEmitter(emitter); geoParticle.Play(); geoParticle.AltitudeMode = EnumAltitudeMode.Absolute; GSOFeature feature = new GSOFeature(); feature.Geometry = geoParticle; _glbControl.Globe.MemoryLayer.AddFeature(feature); _glbControl.Globe.JumpToFeature(feature, 100); }
private void CtrlParticleParamPage_Load(object sender, EventArgs e) { if (mGeometry != null) { if (mGeometry.Type == EnumGeometryType.GeoParticle) { particle = (GSOGeoParticle)mGeometry; if (particle.GetEmitterCount() > 0) { emitter = particle.GetEmitterAt(0) as GSORingParticleEmitter; emitter2 = particle.GetEmitterAt(1) as GSORingParticleEmitter; if (emitter2 != null) { emitter = emitter2; } if (emitter == null) { emitterPoint = particle.GetEmitterAt(0) as GSOPointParticleEmitter; if (emitterPoint != null) { textBoxSetSizeFixX.Text = emitterPoint.SizeFix.X.ToString(); textBoxSetSizeFixY.Text = emitterPoint.SizeFix.Y.ToString(); textBoxVelFix.Text = emitterPoint.VelFix.ToString(); textBoxVelRnd.Text = emitterPoint.VelRnd.ToString(); textBoxAccFix.Text = emitterPoint.AccFix.ToString(); textBoxAccRnd.Text = emitterPoint.AccRnd.ToString(); textBoxAngleXYFix.Text = emitterPoint.AngleXYFix.ToString(); textBoxAngleXYRnd.Text = emitterPoint.AngleXYRnd.ToString(); textBoxAngleXZFix.Text = emitterPoint.AngleXZFix.ToString(); textBoxAngleXZRnd.Text = emitterPoint.AngleXZRnd.ToString(); textBoxLifeFix.Text = emitterPoint.LifeFix.ToString(); textBoxLifeRnd.Text = emitterPoint.LifeRnd.ToString(); textBoxRotFix.Text = emitterPoint.RotFix.ToString(); textBoxRotRnd.Text = emitterPoint.RotRnd.ToString(); textBoxRotVelFix.Text = emitterPoint.RotVelFix.ToString(); textBoxRotVelRnd.Text = emitterPoint.RotVelRnd.ToString(); textBoxEmitPerSec.Text = emitterPoint.EmitPerSec.ToString(); textBoxColorRndStart.Enabled = false; textBoxColorRndEnd.Enabled = false; if (emitterPoint.GetEffectorCount() > 0) { effector = emitterPoint.GetEffectorAt(0); textBoxStartTime.Text = effector.StartTime.ToString(); textBoxEndTime.Text = effector.EndTime.ToString(); } textBoxSetSizeFixX.TextChanged += new EventHandler(textBoxSetSizeFixX_TextChanged); textBoxSetSizeFixY.TextChanged += new EventHandler(textBoxSetSizeFixY_TextChanged); } } else { textBoxSetSizeFixX.Text = emitter.SizeFix.X.ToString(); textBoxSetSizeFixY.Text = emitter.SizeFix.Y.ToString(); textBoxVelFix.Text = emitter.VelFix.ToString(); textBoxVelRnd.Text = emitter.VelRnd.ToString(); textBoxAccFix.Text = emitter.AccFix.ToString(); textBoxAccRnd.Text = emitter.AccRnd.ToString(); textBoxAngleXYFix.Text = emitter.AngleXYFix.ToString(); textBoxAngleXYRnd.Text = emitter.AngleXYRnd.ToString(); textBoxAngleXZFix.Text = emitter.AngleXZFix.ToString(); textBoxAngleXZRnd.Text = emitter.AngleXZRnd.ToString(); textBoxLifeFix.Text = emitter.LifeFix.ToString(); textBoxLifeRnd.Text = emitter.LifeRnd.ToString(); textBoxRotFix.Text = emitter.RotFix.ToString(); textBoxRotRnd.Text = emitter.RotRnd.ToString(); textBoxRotVelFix.Text = emitter.RotVelFix.ToString(); textBoxRotVelRnd.Text = emitter.RotVelRnd.ToString(); textBoxEmitPerSec.Text = emitter.EmitPerSec.ToString(); textBoxColorRndStart.BackColor = emitter.ColorRndStart; textBoxColorRndEnd.BackColor = emitter.ColorRndEnd; if (emitter.GetEffectorCount() > 0) { effector = emitter.GetEffectorAt(0); textBoxStartTime.Text = effector.StartTime.ToString(); textBoxEndTime.Text = effector.EndTime.ToString(); } textBoxSetSizeFixX.TextChanged += new EventHandler(textBoxSetSizeFixX_TextChanged); textBoxSetSizeFixY.TextChanged += new EventHandler(textBoxSetSizeFixY_TextChanged); } } } } }
// 添加水柱 private GSOFeature AddWaterLine() { string strResPath = Path.GetDirectoryName(Application.ExecutablePath) + "/Resource"; GSOGeoParticle geoParticle = new GSOGeoParticle(); geoParticle.SetPosition(116.308, 39.84, 0); // 添加到这个经纬度位置 GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); emitter.TexturePath = strResPath + "/ParticleImage/drop3.png"; geoParticle.TimerInterval = 1; emitter.SetSizeFix(2.0f, 2.0f); emitter.VelFix = 50; emitter.VelRnd = 2; emitter.GravityAcc = 9.8f; emitter.AngleXYFix = 0; emitter.AngleXYRnd = 2; emitter.AngleXZFix = 60; emitter.AngleXZRnd = 2; emitter.LifeFix = 5.0f; emitter.LifeRnd = 1.0f; emitter.RotFix = 0; emitter.RotRnd = 0; emitter.RotVelFix = 0; emitter.RotVelRnd = 0; emitter.EmitPerSec = 1500; emitter.ColorRndStart = Color.FromArgb(100, 222, 222, 222); emitter.ColorRndEnd = Color.FromArgb(50, 222, 222, 222); // 将三个发射器添加到粒子对象中 geoParticle.AddEmitter(emitter); geoParticle.Play(); GSOFeature feature = new GSOFeature(); feature.Geometry = geoParticle; globeControl1.Globe.FlyToFeature(feature); return feature; }
// 添加喷泉 private GSOFeature AddFountain() { string strResPath = Path.GetDirectoryName(Application.ExecutablePath) + "/Resource"; GSOGeoParticle geoParticle = new GSOGeoParticle(); geoParticle.SetPosition(116.314, 39.84, 0); // 添加到这个经纬度位置 GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); emitter.TexturePath = strResPath + "/ParticleImage/test.png"; emitter.SetSizeFix(0.5f, 2); emitter.VelFix = 10; emitter.VelRnd = 2; emitter.GravityAcc = 9.8f; emitter.AngleXYFix = 0; emitter.AngleXYRnd = 180; emitter.AngleXZFix = 88; emitter.AngleXZRnd = 2; emitter.LifeFix = 5.0f; emitter.LifeRnd = 1.0f; emitter.RotFix = 0; emitter.RotRnd = 0; emitter.RotVelFix = 0; emitter.RotVelRnd = 0; emitter.EmitPerSec = 1000; emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); emitter.IsLumAdded = false; // 将三个发射器添加到粒子对象中 geoParticle.AddEmitter(emitter); geoParticle.Play(); GSOFeature feature = new GSOFeature(); feature.Geometry = geoParticle; globeControl1.Globe.FlyToFeature(feature); return feature; }