public static CompleteOutputDescription LoadDescription(string filename)
        {
            FileStream file = new FileStream(filename, FileMode.Open);
            CompleteOutputDescription desc = LoadDescription(file);

            file.Close();
            return(desc);
        }
 public CompleteOutputDescription(CompleteOutputDescription toClone)
 {
     generalShadingDesc  = new GeneralShadingDesc(toClone.GeneralShadingDesc);
     generalLightingDesc = new GeneralLightingDesc(toClone.GeneralLightingDesc);
     atomShadingDesc     = new AtomShadingDesc(toClone.AtomShadingDesc);
     bondShadingDesc     = new BondShadingDesc(toClone.BondShadingDesc);
     //structuresShadingDesc = new GeneralStructuresShadingDesc(toClone.GeneralStructuresShadingDesc);
     schemeSettings = (MoleculeSchemeSettings)toClone.schemeSettings.Clone();
 }
 public CompleteOutputDescription(CompleteOutputDescription toClone)
 {
     generalShadingDesc = new GeneralShadingDesc(toClone.GeneralShadingDesc);
     generalLightingDesc = new GeneralLightingDesc(toClone.GeneralLightingDesc);
     atomShadingDesc = new AtomShadingDesc(toClone.AtomShadingDesc);
     bondShadingDesc = new BondShadingDesc(toClone.BondShadingDesc);
     //structuresShadingDesc = new GeneralStructuresShadingDesc(toClone.GeneralStructuresShadingDesc);
     schemeSettings = (MoleculeSchemeSettings)toClone.schemeSettings.Clone();
 }
 public static CompleteOutputDescription New()
 {
     CompleteOutputDescription coDesc = new CompleteOutputDescription();
     coDesc.generalShadingDesc = new GeneralShadingDesc();
     coDesc.generalLightingDesc = new GeneralLightingDesc();
     coDesc.atomShadingDesc = new AtomShadingDesc();
     coDesc.bondShadingDesc = new BondShadingDesc();
     coDesc.structuresShadingDesc = new GeneralStructuresShadingDesc();
     return coDesc;
 }
        public static CompleteOutputDescription New()
        {
            CompleteOutputDescription coDesc = new CompleteOutputDescription();

            coDesc.generalShadingDesc    = new GeneralShadingDesc();
            coDesc.generalLightingDesc   = new GeneralLightingDesc();
            coDesc.atomShadingDesc       = new AtomShadingDesc();
            coDesc.bondShadingDesc       = new BondShadingDesc();
            coDesc.structuresShadingDesc = new GeneralStructuresShadingDesc();
            return(coDesc);
        }
        private void CreatePreviewData()
        {
            atoms = new IAtom[] { new Atom("O", new Point3d(0, 0, 0)) };

            ElementPTFactory elements = ElementPTFactory.Instance;
            foreach (IAtom atom in atoms)
            {
                PeriodicTableElement pe = elements.getElement(atom.Symbol);
                if (pe != null)
                {
                    atom.AtomicNumber = pe.AtomicNumber;
                    atom.Properties["PeriodicTableElement"] = pe;
                    atom.Properties["Period"] = int.Parse(pe.Period);
                }
            }

            projMat = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, Width / Height, 0.1f, 20);
            viewMat = Matrix.LookAtLH(new Vector3(2, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 1, 0));

            latestCoDesc = CompleteOutputDescription.New();
            latestCoDesc.SchemeSettings = new BallAndStickSchemeSettings();
            latestCoDesc.SchemeSettings.AtomLOD = 3;
        }
        public void SetScheme(MoleculeRenderingScheme scheme, CompleteOutputDescription coDesc)
        {
            latestCoDesc = new CompleteOutputDescription(coDesc);
            sceneManger.SetScheme(scheme);
            sceneManger.SetOutputDesc(coDesc);

            scheme.device = device;
            // build preview via thread
            if (generatorThread.ThreadState == ThreadState.Running)
            {
                // abort thread
                generatorThread.Abort();
                generatorThread.Join();
            }
            generatorThread = new Thread(GeneratePreviewProcess);
            generatorThread.Start();

            wantPreview = true;
        }
示例#8
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);
            }
        }
示例#9
0
 public void SetOutputDesc(CompleteOutputDescription desc)
 {
     this.coDesc = new CompleteOutputDescription(desc);
     scheme.SetOutputDescription(desc);
 }
示例#10
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);
            }
        }
        public MoleculeSchemeDlg(HashTableSettings settings, OutputCaps outCaps, Device device, CompleteOutputDescription coDesc)
        {
            InitializeComponent();

            currentEffects = new List<Effect>();

            this.settings = settings;

            LoadLocalResources();

            this.refDevice = device;
            this.outCaps = outCaps;
            this.refcoDesc = coDesc;
            this.coDesc = new CompleteOutputDescription(coDesc);

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.LightingPresets.config"))
            {
                LoadLightingPresets(stream);
            }
            
            SetupLightingPreview();
            SetupEffectPreview();

            schemePreviewControl.OnNewPreview += new EventHandler(schemePreviewControl_OnNewPreview);
            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.MoleculeSchemes.config"))
            {
                if (stream != null)
                {
                    XmlDocument xml = new XmlDocument();
                    xml.Load(stream);

                    LoadSchemes(xml);
                    LoadEffects(xml);
                    LoadMaterials(xml);
                }
            }

            previewReady = true;

            updateThread = new Thread(this.UpdatePreviewsProcess);
            updateThread.Start();
        }