Esempio n. 1
0
 private void RenderBeams(IRenderContext context)
 {
     if (context != null)
     {
         for (int i = 0; i < Beams.Count; i++)
         {
             BeamRenderer?.Render(Beams[i], Camera, context, new Rectd(0, 0, 1, 1), (LineType)i);
         }
     }
 }
Esempio n. 2
0
 public DicomPanelModel()
 {
     Camera           = new Camera();
     ImageRenderer    = new ImageRenderer();
     DoseRenderer     = new DoseRenderer();
     ROIRenderer      = new ROIRenderer();
     VectorRenderer   = new VoxelFieldRenderer();
     ROIs             = new List <RegionOfInterest>();
     POIs             = new List <PointOfInterest>();
     ContouredDoses   = new List <IDoseObject>();
     BeamRenderer     = new BeamRenderer();
     Beams            = new List <Beam>();
     OrthogonalModels = new List <DicomPanelModel>();
     Overlays         = new List <IOverlay>();
     ToolBox          = new ToolBox();
     Overlays.Add(new ScaleOverlay());
     SpyGlass         = new Rectd(0, 0, 1, 1);
     AdditionalImages = new List <RenderableImage>();
     VectorFields     = new List <VectorField>();
 }
Esempio n. 3
0
    // Update is called once per frame
    public void UpdateParticles(BeamRenderer br)
    {
        Transform target = br.target.transform;

        float timer = br.timer;

        // update particles - position the at the parent transform
        particles.transform.localPosition = Vector3.zero;
        //point them at the target
        particles.transform.forward = target.transform.position - particles.transform.position;
        float dist = Vector3.Distance(target.transform.position, particles.transform.position);

        switch (scalingType)
        {
        case ScalingType.ScaleLength:
            ParticleSystem.ShapeModule shape = particles.GetComponent <ParticleSystem>().shape;
            shape.length = dist;

            // scale emission rate to increase as the beam lengthens.
            // Use this when we've set the beam, shape to emit from volume, so the particles dont thin out on a long beam
            ParticleSystem.EmissionModule emission = particles.emission;
            ParticleSystem.MinMaxCurve    eCurve   = emission.rateOverTime;
            eCurve.constant       = baseEmissionRate * dist;
            emission.rateOverTime = eCurve;
            break;

        case ScalingType.ScaleLifeTime:
            // use this if we've emitted from base - make the particles last longer for a longer beam
            ParticleSystem.MainModule  main   = particles.main;
            ParticleSystem.MinMaxCurve sCurve = main.startLifetime;
            sCurve.constant    = dist / main.startSpeed.constant;
            main.startLifetime = sCurve;
            break;
        }

        if (timer < 1.01f)
        {
            Stop();
        }
    }