Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,Id,IsActive,CreDate")] TimeEntity timeEntity)
        {
            if (id != timeEntity.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _timeRepository.UpdateAsync(timeEntity);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TimeEntityExists(timeEntity.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(timeEntity));
        }
Exemplo n.º 2
0
 private void FrmParkingPayDetailReport_Load(object sender, EventArgs e)
 {
     this.UCChargeDateTime.Init();
     this.UCEnterDateTime.Init();
     if (UserSetting.Current.EnableForceShifting && UserSetting.Current.ForceShiftingTime != null)
     {
         TimeEntity te = UserSetting.Current.ForceShiftingTime;
         if ((DateTime.Now.Hour > te.Hour) ||
             (DateTime.Now.Hour == te.Hour && DateTime.Now.Minute >= te.Minute))
         {
             UCChargeDateTime.StartDateTime = DateTime.Today.AddHours(te.Hour).AddMinutes(te.Minute);
             UCChargeDateTime.EndDateTime   = DateTime.Today.AddDays(1).AddHours(te.Hour).AddMinutes(te.Minute).AddSeconds(-1);
         }
         else
         {
             UCChargeDateTime.StartDateTime = DateTime.Today.AddDays(-1).AddHours(te.Hour).AddMinutes(te.Minute);
             UCChargeDateTime.EndDateTime   = DateTime.Today.AddHours(te.Hour).AddMinutes(te.Minute).AddSeconds(-1);
         }
     }
     this.comCardType.Init();
     this.comOperator.Init();
     this.comPaymentMode.Init();
     this.workStationCombobox1.Init();
     this.carTypeComboBox1.Init();
     this.comPaymentCode.Init();
     this.comOperatorDept.Init();
     this.comStationDept.Init();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the projectile.
        /// </summary>
        public bool Update(TimeEntity timeEntity)
        {
            elapsedTime = (float)timeEntity.ElapsedTime.TotalSeconds;

            // Simple projectile physics.
            position   += velocity * elapsedTime;
            velocity.Y -= elapsedTime * gravity;
            age        += elapsedTime;

            // Update the particle emitter, which will create our particle trail.
            trailEmitter.Update(timeEntity, position);

            // If enough time has passed, explode! Note how we pass our velocity
            // in to the AddParticle method: this lets the explosion be influenced
            // by the speed and direction of the projectile which created it.
            if (age > projectileLifespan)
            {
                for (int i = 0; i < numExplosionParticles; i++)
                {
                    explosionParticles.QuerieNewParticle(position, velocity);
                }

                for (int i = 0; i < numExplosionSmokeParticles; i++)
                {
                    explosionSmokeParticles.QuerieNewParticle(position, velocity);
                }

                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
    void OnTriggerEnter(Collider other)
    {
        TimeEntity e = other.gameObject.GetComponent <TimeEntity>();

        if (e == null || TimeManipulator.CurrTimeState != TimeState.Playing)
        {
            return;
        }
        if (_aesthetics.activeSelf)
        {
            if (_collectionTime == -1)
            {
                e.AddCollection(this);
                _collectionTime = TimeManipulator.CurrFrame;
            }
            else if (_collectionTime != TimeManipulator.CurrFrame)
            {
                Debug.Log(TimeManipulator.CurrFrame + " but expected " + _collectionTime);
                Events.g.Raise(new CollectionParadox(e));
                Debug.Log("Collection Paradox!");
            }
            _aesthetics.SetActive(false);
            AudioSource.PlayClipAtPoint(_collectionSound, transform.position);
        }
    }
Exemplo n.º 5
0
        private void FrmReportForm_Load(object sender, EventArgs e)
        {
            this.cmbSort.SelectedItem = "收费时间";
            InitCollectGridView();

            InitDetailGrid();
            // 初始化时间控件
            this.ucDateTimeInterval2.Init();
            if (UserSetting.Current.EnableForceShifting && UserSetting.Current.ForceShiftingTime != null)
            {
                TimeEntity te = UserSetting.Current.ForceShiftingTime;
                if ((DateTime.Now.Hour > te.Hour) ||
                    (DateTime.Now.Hour == te.Hour && DateTime.Now.Minute >= te.Minute))
                {
                    ucDateTimeInterval2.StartDateTime = DateTime.Today.AddHours(te.Hour).AddMinutes(te.Minute);
                    ucDateTimeInterval2.EndDateTime   = DateTime.Today.AddDays(1).AddHours(te.Hour).AddMinutes(te.Minute).AddSeconds(-1);
                }
                else
                {
                    ucDateTimeInterval2.StartDateTime = DateTime.Today.AddDays(-1).AddHours(te.Hour).AddMinutes(te.Minute);
                    ucDateTimeInterval2.EndDateTime   = DateTime.Today.AddHours(te.Hour).AddMinutes(te.Minute).AddSeconds(-1);
                }
            }

            // 初始化ComboBox1下拉框
            this.operatorComboBox2.Init();
            this.workStationCombobox2.Init();
            // add by tom,2012-2-14
            this.ucEntrance2.Init();
            this.cardTypeComboBox1.Init();
            //end
        }
Exemplo n.º 6
0
        public async Task <TimeEntity> Post(TimeEntity user)
        {
            var result = await _repository.InsertAsync(user);

            await _repository.Commit();

            return(result);
        }
Exemplo n.º 7
0
        private void AddActor(TimeEntity entity)
        {
            var box = new TextBox {
                Text = "Name: " + entity.Name + $", current state: resting.", Width = 600, ReadOnly = true
            };

            entity.Action += state => box.Text = "Name: " + entity.Name + $", current state: {state}";
            Panel.Controls.Add(box);
        }
Exemplo n.º 8
0
        public override void Update(TimeEntity timeEntity)
        {
            effect.SetValue("world", Matrix.Identity);
            effect.SetValue("view", camera.ViewMatrix);
            effect.SetValue("projection", camera.ProjectionMatrix);

            effect.SetValue("cameraPosition", camera.Location);
            effect.SetValue("lightPosition", camera.Location);
        }
Exemplo n.º 9
0
 // Update is called once per frame
 public void OnTick(TimeEntity e, int currentTick)
 {
     if (currentTick > totalTicks)
     {
         totalTicks        = currentTick;
         playhead.maxValue = totalTicks;
         playhead.value    = playhead.maxValue;
     }
 }
Exemplo n.º 10
0
        public async Task <IActionResult> Create([Bind("Name,Id")] TimeEntity timeEntity)
        {
            if (ModelState.IsValid)
            {
                await _timeRepository.AddAsync(timeEntity);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(timeEntity));
        }
Exemplo n.º 11
0
 public static TimeModel MapToListModel(TimeEntity entity) =>
 entity == null
         ? null
         : new TimeModel()
 {
     Id         = entity.Id,
     Discipline = entity.Discipline,
     Time       = entity.Time,
     Team       = TeamMapper.MapToDetailModel(entity.Team),
     Person     = PersonMapper.MapToDetailModel(entity.Person)
 };
Exemplo n.º 12
0
        List <TimeEntity> GetDsGioThi()
        {
            List <TimeEntity> kq = new List <TimeEntity>();

            foreach (DataGridViewRow r in dgrDanhSach.Rows)
            {
                TimeEntity gt = new TimeEntity(r.Cells[0].Value.ToString(), r.Cells[1].Value.ToString());
                kq.Add(gt);
            }
            return(kq);
        }
Exemplo n.º 13
0
    // Use this for initialization
    void Start()
    {
        playhead = GetComponent <Slider> ();

        _timeContext = Contexts.sharedInstance.time;

        TimeEntity e = _timeContext.CreateEntity();

        e.AddTickListener(this);
        e.AddPausedListener(this);

        playhead.enabled = false;
    }
Exemplo n.º 14
0
 public void Draw(TimeEntity time)
 {
     foreach (DrawableComponent provider in providers)
     {
         if (provider.IsEnabled)
         {
             provider.Draw(time);
         }
     }
     foreach (DrawableComponent provider in backgroundProviders)
     {
         provider.Draw(time);
     }
 }
        /// <summary>
        /// When implemented in a bot, handles an incoming activity.
        /// </summary>
        /// <param name="turnContext">The context object for this turn.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// A task that represents the work queued to execute.
        /// </returns>
        /// <remarks>
        /// The <paramref name="turnContext" /> provides information about the
        /// incoming activity, and other data needed to process the activity.
        /// </remarks>
        /// <seealso cref="T:Microsoft.Bot.Builder.ITurnContext" />
        /// <seealso cref="T:Microsoft.Bot.Schema.IActivity" />
        public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
        {
            RecognizerResult recognizerResult = await this.recognizer.RecognizeAsync(turnContext, CancellationToken.None).ConfigureAwait(false);

            if (recognizerResult.Intents == null || recognizerResult.Intents["RemindMe"] == null)
            {
                await turnContext.SendActivityAsync("Sorry, I did not get that").ConfigureAwait(false);
            }
            else
            {
                TimeEntity timeEntity  = recognizerResult.Entities["Time"].ToObject <TimeEntity>();
                string     remindAbout = recognizerResult.Entities["Reminder"].ToString();

                this.proactiveMessageManager.QueueWorkItem(turnContext, "Reminding you about " + remindAbout, TimeSpan.FromSeconds(timeEntity.TimeInSeconds));
            }
        }
Exemplo n.º 16
0
 void Start()
 {
     timeEntity = GetComponent <TimeEntity>();
     if (timeEntity == null)
     {
         Debug.LogError("Could not find a TimeEntity in BasicTimeManager");
     }
     anim = GetComponent <Animator>();
     if (anim == null)
     {
         Debug.LogError("Could not find an Animator in BasicTimeManager");
     }
     soundManager = GetComponent <SoundManager>();
     //if (soundManager == null) Debug.LogError("Could not find a SoundManager in BasicTimeManager");
     //SetPitch
 }
Exemplo n.º 17
0
        public async Task <TimeEntity> Put(TimeEntity timeEntity)
        {
            try
            {
                var result = await _timeService.Put(timeEntity);

                await _timeService.Commit();

                return(result);
            }
            catch (Exception)
            {
                _timeService.Dispose();
                throw;
            }
        }
Exemplo n.º 18
0
 public override void Draw(TimeEntity timeEntity)
 {
     if (primitiveCount > 0)
     {
         effect.Technique = new EffectHandle("PerPixelDiffuseAndPhongMetaball");
         device.SetStreamSource(0, vb, 0, MetaballVertex.SizeInBytes);
         device.VertexFormat = MetaballVertex.Format;
         int passes = effect.Begin();
         for (int i = 0; i < passes; i++)
         {
             effect.BeginPass(i);
             device.DrawPrimitives(PrimitiveType.TriangleList, 0, primitiveCount);
             effect.EndPass();
         }
         effect.End();
     }
 }
Exemplo n.º 19
0
 public virtual void ClearAllNormalization()
 {
     foreach (Entity entity in entities)
     {
         if (entity is TimeEntity)
         {
             entity.clearRelation();
             entity.setTimePoint(TimeExtractor.conf.TimeConstants.DEFAULT_TIME_POINT);
             TimeEntity te = new TimeEntity();
             te.duration     = new Dictionary <DurationUnit, double>();
             te.items        = new List <Item>();
             te.mode         = TimeEntityMode.NA;
             te.relation     = TLinkType.OVERLAP;
             te.repeat_times = 0;
         }
     }
 }
Exemplo n.º 20
0
        public static string TimeEntityGetVal(TimeEntity e)
        {
            //TimePoint tp;
            //string s = "";
            //switch (e.type)
            //{
            //    case TimeEntityType.DATE:
            //        tp = e.getFirstTimePoint();
            //        if (tp.getYear() == TimeConstants.DEFAULT_VALUE) return "";
            //        s = Convert.ToString(tp.getYear());
            //        if (tp.getMonth() != TimeConstants.DEFAULT_VALUE) s += "-" + AppendZero(tp.getMonth(), 2);
            //        if (tp.getDay() != TimeConstants.DEFAULT_VALUE) s += "-" + AppendZero(tp.getDay(), 2);
            //        return s;

            //    case TimeEntityType.TIME:
            //        tp = e.getFirstTimePoint();
            //        if (tp.apm == ApmType.PM && tp.getHour() < 12)
            //            tp.setHour(tp.getHour() + 12);
            //        s = "T" + AppendZero(tp.getHour(), 2) + ":" +
            //            AppendZero(((tp.getMinute() == TimeConstants.DEFAULT_VALUE)? 0 : tp.getMinute()), 2);
            //        if (tp.getDay() != TimeConstants.DEFAULT_VALUE)
            //            s = tp.getYear() + "-" +
            //                AppendZero(tp.getMonth(), 2) + "-" +
            //                AppendZero((tp.getDay() == TimeConstants.DEFAULT_VALUE)? 1 : tp.getDay(), 2) + s;
            //        return s;

            //    case TimeEntityType.DURATION:
            //        return GetDurationExpression(e.duration);

            //    case TimeEntityType.FREQUENCY:
            //        s = "R";
            //        if (e.repeat_times > 0) s += e.repeat_times;
            //        if (e.duration == null || e.duration.Count == 0)
            //            return s;
            //        return s + GetDurationExpression(e.duration);

            //    case TimeEntityType.RELATIVE_TP:
            //        s = GetDurationExpression(e.duration);
            //        s += ":" + ((e.relation != TLinkType.BEFORE) ? "+" : "-") + ":" + e.keyev;
            //        return s;

            //}

            return("");
        }
Exemplo n.º 21
0
        public static Entity AnnotateToEntity(string str)
        {
            Regex timeRegex = new Regex(@"``(?<text>[^`]+(?:`[^`]+)*)``(?<normalize>[^\s]*)");
            Match match     = timeRegex.Match(str);

            if (match != null)
            {
                //A time entity
                Entity entity = new TimeEntity();
                entity.text       = match.Groups["text"].Value;
                entity.text       = TimeExtractor.util.StringUtil.strip(entity.text);
                entity.type       = "time";
                entity.timePeriod = AnnotateToTimePeriod(match.Groups["normalize"].Value);
                return(entity);
            }

            return(null);
        }
Exemplo n.º 22
0
        public override void Update(TimeEntity timeEntity)
        {
            currentTime = (float)timeEntity.TotalTime.TotalMilliseconds / 10000.0f;

            //if (particlesList.Count > settings.MaxParticles)
            //    particlesList.Clear();

            int oldCount = particlesList.Count;

            for (int i = 0; i < oldCount; i++)
            {
                Vector3 newPosition = ComputeNewPosition(startPositions[i], particlesList[i].Velocity, (currentTime - times[i]) * (1 + settings.DurationRandomness));
                if (MathHelper.CheckPosition(newPosition, dataSource.DisplayData, dataSource.MissingValue) && (particlesList[i].Time < settings.Duration.TotalSeconds + times[i]))
                {
                    float value = MathHelper.GetValue(newPosition, dataSource.DisplayData, dataSource.MissingValue);
                    particlesList.Add(new ParticleVertex(newPosition, particlesList[i].Velocity, (int)RgbPalette.ColorARGB(RgbPalette.GetColor(value, dataSource.Maximum, dataSource.Minimum, dataSource.MissingValue)), particlesList[i].Time + (float)timeEntity.ElapsedTime.TotalSeconds));
                    startPositions.Add(startPositions[i]);
                    times.Add(times[i]);
                }
            }
            particlesList.RemoveRange(0, oldCount);
            startPositions.RemoveRange(0, oldCount);
            times.RemoveRange(0, oldCount);

            if (particlesList.Count > 0)
            {
                if (vertexBuffer != null)
                {
                    vertexBuffer.Dispose();
                }

                vertexBuffer = new VertexBuffer(device, ParticleVertex.SizeInBytes * Math.Max(10, particlesList.Count), Usage.WriteOnly | Usage.Points, ParticleVertex.Format, Pool.Default);

                using (DataStream ds = vertexBuffer.Lock(0, 0, LockFlags.None))
                {
                    ds.WriteRange(particlesList.ToArray());
                }
                vertexBuffer.Unlock();
            }

            effect.SetValue("View", camera.ViewMatrix);
            effect.SetValue("Projection", camera.ProjectionMatrix);
        }
Exemplo n.º 23
0
        private Mysetting GetSettingFromInput()
        {
            Mysetting ms = Mysetting.Current;

            if (Mysetting.Current == null)
            {
                ms = new Mysetting();
            }
            if (ms.ParkfullCheckTimezones == null)
            {
                ms.ParkfullCheckTimezones = new List <Ralid.Park.BusinessModel.Model.TimeZone>();
            }
            ms.ParkfullCheckTimezones.Clear();
            if (chk1.Checked)
            {
                TimeEntity te1 = new TimeEntity(dtLimitationBegin1.Value.Hour, dtLimitationBegin1.Value.Minute);
                TimeEntity te2 = new TimeEntity(dtLimitationEnd1.Value.Hour, dtLimitationEnd1.Value.Minute);
                Ralid.Park.BusinessModel.Model.TimeZone tz = new Ralid.Park.BusinessModel.Model.TimeZone(te1, te2);
                ms.ParkfullCheckTimezones.Add(tz);
            }
            if (chk2.Checked)
            {
                TimeEntity te1 = new TimeEntity(dtLimitationBegin2.Value.Hour, dtLimitationBegin2.Value.Minute);
                TimeEntity te2 = new TimeEntity(dtLimitationEnd2.Value.Hour, dtLimitationEnd2.Value.Minute);
                Ralid.Park.BusinessModel.Model.TimeZone tz = new Ralid.Park.BusinessModel.Model.TimeZone(te1, te2);
                ms.ParkfullCheckTimezones.Add(tz);
            }
            if (chk3.Checked)
            {
                TimeEntity te1 = new TimeEntity(dtLimitationBegin3.Value.Hour, dtLimitationBegin3.Value.Minute);
                TimeEntity te2 = new TimeEntity(dtLimitationEnd3.Value.Hour, dtLimitationEnd3.Value.Minute);
                Ralid.Park.BusinessModel.Model.TimeZone tz = new Ralid.Park.BusinessModel.Model.TimeZone(te1, te2);
                ms.ParkfullCheckTimezones.Add(tz);
            }
            if (chk4.Checked)
            {
                TimeEntity te1 = new TimeEntity(dtLimitationBegin4.Value.Hour, dtLimitationBegin4.Value.Minute);
                TimeEntity te2 = new TimeEntity(dtLimitationEnd4.Value.Hour, dtLimitationEnd4.Value.Minute);
                Ralid.Park.BusinessModel.Model.TimeZone tz = new Ralid.Park.BusinessModel.Model.TimeZone(te1, te2);
                ms.ParkfullCheckTimezones.Add(tz);
            }
            return(ms);
        }
Exemplo n.º 24
0
    void UpdateTime()
    {
        float timecount = Time.time - starttime;
        float min       = Mathf.Floor((timecount / 60f));
        float sec       = (timecount % 60f);
        float fraction  = ((timecount * 10) % 10);

        time = new TimeEntity {
            min = min, sec = sec, fraction = fraction
        };

        if (timeCounter)
        {
            timeCounter.text = String.Format("{0:00}:{1:00}:{2:00}", time.min, time.sec, time.fraction) + " Collect: " + score.ToString() + " V: " + string.Format("{0:0.##}", visibleTimes);
        }

        if (time.min >= maxMinutes)
        {
            OnEnded?.Invoke();
        }
    }
Exemplo n.º 25
0
        private bool CheckInputOfTariffOfThreeTimeZone()
        {
            TimeEntity time1Begin = new TimeEntity(tThree_dtTime1Begin.Value.Hour, tThree_dtTime1Begin.Value.Minute);
            TimeEntity time1End   = new TimeEntity(tThree_dtTime1End.Value.Hour, tThree_dtTime1End.Value.Minute);

            TimeEntity time2Begin = new TimeEntity(tThree_dtTime2Begin.Value.Hour, tThree_dtTime2Begin.Value.Minute);
            TimeEntity time2End   = new TimeEntity(tThree_dtTime2End.Value.Hour, tThree_dtTime2End.Value.Minute);

            TimeEntity time3Begin = new TimeEntity(tThree_dtTime3Begin.Value.Hour, tThree_dtTime3Begin.Value.Minute);
            TimeEntity time3End   = new TimeEntity(tThree_dtTime3End.Value.Hour, tThree_dtTime3End.Value.Minute);

            if (!(time1Begin.TotalMinutes == time3End.TotalMinutes &&
                  time1End.TotalMinutes == time2Begin.TotalMinutes &&
                  time2End.TotalMinutes == time3Begin.TotalMinutes))
            {
                this.tThree_dtTime1Begin.Focus();
                MessageBox.Show(Resource1.FrmTariffSelection_InvalidThreeTimezone);
                return(false);
            }
            return(true);
        }
Exemplo n.º 26
0
        /// <summary>
        /// Updates the emitter, creating the appropriate number of particles
        /// in the appropriate positions.
        /// </summary>
        public void Update(TimeEntity timeEntity, Vector3 newPosition)
        {
            // Work out how much time has passed since the previous update.
            elapsedTime = (float)timeEntity.ElapsedTime.TotalSeconds;

            if (elapsedTime > 0)
            {
                // Work out how fast we are moving.
                Vector3 velocity = (newPosition - previousPosition) / elapsedTime;

                // If we had any time left over that we didn't use during the
                // previous update, add that to the current elapsed time.
                float timeToSpend = timeLeftOver + elapsedTime;

                // Counter for looping over the time interval.
                float currentTime = -timeLeftOver;

                // Create particles as long as we have a big enough time interval.
                while (timeToSpend > timeBetweenParticles)
                {
                    currentTime += timeBetweenParticles;
                    timeToSpend -= timeBetweenParticles;

                    // Work out the optimal position for this particle. This will produce
                    // evenly spaced particles regardless of the object speed, particle
                    // creation frequency, or game update rate.
                    float mu = currentTime / elapsedTime;

                    Vector3 position = Vector3.Lerp(previousPosition, newPosition, mu);

                    // Create the particle.
                    particleSystem.QuerieNewParticle(position, velocity * 5);
                }

                // Store any time we didn't use, so it can be part of the next update.
                timeLeftOver = timeToSpend;
            }

            previousPosition = newPosition;
        }
        public override void Draw(TimeEntity timeEntity)
        {
            device.SetRenderTarget(0, solidDepthSurface);
            ClearRenderTarget(new Vector4(1000, 0, 0, 0));



            device.SetRenderTarget(0, volumeDepthSurface);
            ClearRenderTarget(new Vector4(camera.NearPlane, 0, 0, 0));
            effect.Technique = new EffectHandle("Depth");
            DrawRayCasting(timeEntity);

            device.SetRenderTarget(0, volumeAccuSurface);
            device.Clear(ClearFlags.Target, new Color4(1.0f, 0, 0, 0), 1.0f, 0);
            effect.Technique = new EffectHandle("EmiAbs_Accu");
            DrawRayCasting(timeEntity);


            device.SetRenderTarget(0, backBufferSurface);
            effect.Technique = new EffectHandle("EmiAbs_Compose");
            DrawRayCasting(timeEntity);
        }
Exemplo n.º 28
0
        public void CanAddMinutes()
        {
            TimeEntity te  = new TimeEntity();
            TimeEntity ret = te.AddMinutes(-30);

            Assert.IsTrue(ret.Hour == 23 && ret.Minute == 30);

            te  = new TimeEntity(23, 30);
            ret = te.AddMinutes(40);  //0:10
            Assert.IsTrue(ret.Hour == 0 && ret.Minute == 10);
            ret = te.AddMinutes(-142535356);
            Assert.IsTrue(ret != null);

            ret = te.AddMinutes(0);
            Assert.IsTrue(ret.Hour == 23 && ret.Minute == 30);
            ret = te.AddMinutes(30);
            Assert.IsTrue(ret.Hour == 0 && ret.Minute == 0);
            ret = te.AddMinutes(24 * 60 + 30);
            Assert.IsTrue(ret.Hour == 0 && ret.Minute == 0);
            ret = te.AddMinutes(-(23 * 60 + 30));
            Assert.IsTrue(ret.Hour == 0 && ret.Minute == 0);
        }
        private void DrawRayCasting(TimeEntity timeEntity)
        {
            effect.SetValue("g_ObjectToClip", world * camera.ViewMatrix * camera.ProjectionMatrix);
            effect.SetValue("g_ObjectToWorld", world);
            effect.SetValue("g_ObjectToView", world * camera.ViewMatrix);

            effect.SetValue("g_ViewToTex", Matrix.Invert(tex * world * camera.ViewMatrix));
            effect.SetValue("g_SamplingParams", new Vector4(intensitiveInterval, intensitiveScale, (float)1.0f / camera.ProjectionMatrix.M11, (float)1.0f / camera.ProjectionMatrix.M22));
            effect.SetValue("g_TextureSize", new Vector4(textureSizeX, textureSizeY, textureSizeZ, 0));
            effect.SetValue("g_TexCoordOffset", new Vector4((float)timeEntity.TotalTime.TotalMilliseconds * 0.002f, (float)timeEntity.TotalTime.TotalMilliseconds * 0.001f, densityMod, 0));
            effect.SetValue("denValueRange", new Vector4((CurrentValue - dataSource.Minimum) / (dataSource.Maximum - dataSource.Minimum), 0, 0, step));
            effect.SetValue("EnableSlicing", EnableSlicing);

            Vector4 pixelOffset = new Vector4(0.5f / resolutionX, -0.5f / resolutionY, 0f, 0f);

            pixelOffset *= (float)volumeShorterring;

            effect.SetValue("g_PixelOffset", pixelOffset);
            effect.SetTexture(new EffectHandle("g_EmiAbsTexture"), texture);
            effect.SetTexture(new EffectHandle("g_DensityModTexture"), denModTex);
            effect.SetTexture(new EffectHandle("g_DepthBufferTexture"), solidDepthRT);
            effect.SetTexture(new EffectHandle("g_EmiAbsAccuBufferTexture"), volumeAccuRT);
            effect.SetTexture(new EffectHandle("g_EmiAbsDepthBufferTexture"), volumeDepthRT);

            device.VertexFormat = VertexFormat.Position;
            int numPasses = effect.Begin();

            for (int i = 0; i < numPasses; i++)
            {
                effect.BeginPass(i);
                device.SetStreamSource(0, cube, 0, Vertex.SizeInBytes);
                device.Indices = cubeIndices;
                device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 12);
                effect.EndPass();
            }
            effect.End();
        }
Exemplo n.º 30
0
        public override void Draw(TimeEntity timeEntity)
        {
            if (particlesList.Count > 0)
            {
                SetupDevice();

                // Set the particle vertex buffer and vertex declaration.
                device.SetStreamSource(0, vertexBuffer, 0, ParticleVertex.SizeInBytes);
                device.VertexFormat = ParticleVertex.Format;


                // Activate the particle effect.
                int numPasses = effect.Begin();

                for (int i = 0; i < numPasses; i++)
                {
                    effect.BeginPass(i);

                    device.DrawPrimitives(PrimitiveType.PointList, 0, particlesList.Count);

                    effect.EndPass();
                }



                effect.End();

                // Reset a couple of the more unusual renderstates that we changed,
                // so as not to mess up any other subsequent drawing.
                device.SetRenderState(RenderState.AlphaFunc, Compare.Always);
                device.SetRenderState(RenderState.PointSpriteEnable, false);
                device.SetRenderState(RenderState.ZWriteEnable, true);
            }

            drawCounter++;
        }