Пример #1
0
        public void TraceFrustumInScene(Matrix viewProjection)
        {
            Frustum frustum = new Frustum(viewProjection);

            ChemEntity[] entities = sceneGraph.GetAllInsideFrustum(frustum);
            if (entities != null)
            {
                foreach (ChemEntity entity in entities)
                {
                    AtomSelectionEntity selEntity = new AtomSelectionEntity((AtomEntity)entity);
                    selEntity.Init(device);
                    postSceneViewEntities.Add(selEntity);
                }
            }
        }
Пример #2
0
 public void UpdateSelectedItems(List <ChemEntity> selected)
 {
     // ensure selection entities exist in scene for the selected objects
     if (selected == null || selected.Count == 0)
     {
         // remove any entities from scene
         sceneManager.RemoveFromPostSceneView(selectedAtoms);
         selectedAtoms.Clear();
     }
     else
     {
         bool[] inUse = new bool[selectedAtoms.Count];
         List <AtomSelectionEntity> newSelectedAtoms = new List <AtomSelectionEntity>();
         foreach (ChemEntity obj in selected)
         {
             if (obj is AtomEntity)
             {
                 // see if already in list
                 int  idx   = 0;
                 bool found = false;
                 foreach (AtomSelectionEntity entity in selectedAtoms)
                 {
                     if (entity.Atom.Atom == obj.CdkObject)
                     {
                         inUse[idx] = true;
                         newSelectedAtoms.Add(entity);
                         found = true;
                         break;
                     }
                     idx++;
                 }
                 if (!found)
                 {
                     AtomSelectionEntity entity = new AtomSelectionEntity((AtomEntity)obj);
                     entity.Init(device);
                     newSelectedAtoms.Add(entity);
                     sceneManager.AddToPostSceneView(entity);
                 }
             }
         }
         sceneManager.RemoveFromPostSceneView(selectedAtoms, inUse);
         selectedAtoms.Clear();
         selectedAtoms = newSelectedAtoms;
     }
 }