示例#1
0
        public void UpdateBonds(CompleteOutputDescription latestCoDesc, IBond[] bonds)
        {
            if (scheme.HandlesBonds)
            {
                scheme.SetOutputDescription(coDesc);

                DataFields[][]         allStreams = new DataFields[1][];
                IGeometryCreator[]     schStreams = scheme.GetBondStreams();
                GeomDataBufferStream[] geomStream = new GeomDataBufferStream[schStreams.Length];

                for (int i = 0; i < geomStream.Length; i++)
                {
                    allStreams[0] = schStreams[i].Fields;
                    GeomDataTransformer.CreateBufferStream(allStreams, out geomStream[i]);
                }
                // fill buffer stream
                scheme.SetBondData(bonds, geomStream);
            }
        }
示例#2
0
        public void UpdateAtoms(CompleteOutputDescription coDesc, IAtom[] atoms)
        {
            if (scheme.HandlesAtoms)
            {
                scheme.SetOutputDescription(coDesc);

                // pass throught scheme & effects
                IGeometryCreator[] schStreams = scheme.GetAtomStreams();
                DataFields[][]     allStreams = new DataFields[1][];

                GeomDataBufferStream[] geomStream = new GeomDataBufferStream[schStreams.Length];
                for (int i = 0; i < geomStream.Length; i++)
                {
                    allStreams[0] = schStreams[i].Fields;
                    GeomDataTransformer.CreateBufferStream(allStreams, out geomStream[i]);
                }
                // fill buffer stream
                scheme.SetAtomData(atoms, geomStream);
            }
        }
示例#3
0
        public void OnNewDataSource(IAtom[] atoms, IBond[] bonds, Vector3 origin, Bounds3D bounds)
        {
            sceneGraph = new OcTree <ChemEntity>((int)bounds.radius * 2, -bounds.min);

            /*screenEntities.Add(new BondAngle(device, atoms[0], atoms[1], atoms[2]));
             * screenEntities[0].Init(device);
             *
             * postSceneWorldEntities.Add(new BoundingBoxEntity(new BoundingBox(bounds.min, bounds.max), false, Color.LightGray.ToArgb()));
             * postSceneWorldEntities[0].Init(device);
             * postSceneWorldEntities.Add(new SphereAxis3D());
             * postSceneWorldEntities[1].Init(device);*/

            sceneGraphEntities = sceneGraph.SceneItems;

            // create molecule entities
            foreach (IAtom atom in atoms)
            {
                AtomEntity aentity = AtomEntity.BuildEntity(atom);
                sceneGraph.Insert(aentity);

                /*ScreenLabelVSpaceEntity entity = new ScreenLabelVSpaceEntity(atom.ID + ":" + aentity.UId.ToString(), (Vector3)aentity.Position3D);
                 * entity.Init(device);
                 * screenEntities.Add(entity);*/
                /*AtomSymbolEntity entity = new AtomSymbolEntity(aentity);
                 * entity.Init(device);
                 * postSceneViewEntities.Add(entity);*/
            }

            //foreach (IBond bond in bonds)
            //{
            //sceneGraph.Insert(new BondE);
            //}

            scheme.SetOutputDescription(coDesc);
            scheme.SetupScene(origin, bounds.radius);

            // pass throught scheme & effects
            IGeometryCreator[] schStreams = scheme.GetAtomStreams();
            DataFields[]       efxFields  = null;
            //effect.DesiredData(out efxFields, false);

            DataFields[][] allStreams = new DataFields[1 + (efxFields != null ? 1 : 0)][];
            //if (efxFields != null)
            //    allStreams[1] = efxFields;
            if (scheme.HandlesAtoms && atoms != null)
            {
                GeomDataBufferStream[] geomStream = new GeomDataBufferStream[schStreams.Length];
                for (int i = 0; i < geomStream.Length; i++)
                {
                    allStreams[0] = schStreams[i].Fields;
                    GeomDataTransformer.CreateBufferStream(allStreams, out geomStream[i]);
                }
                // fill buffer stream
                scheme.SetAtomData(atoms, geomStream);
            }

            schStreams = scheme.GetBondStreams();
            if (scheme.HandlesBonds && bonds != null)
            {
                GeomDataBufferStream[] geomStream = new GeomDataBufferStream[schStreams.Length];
                for (int i = 0; i < geomStream.Length; i++)
                {
                    allStreams[0] = schStreams[i].Fields;
                    GeomDataTransformer.CreateBufferStream(allStreams, out geomStream[i]);
                }
                // fill buffer stream
                scheme.SetBondData(bonds, geomStream);
            }
        }