コード例 #1
0
        public static CompleteOutputDescription LoadDescription(string filename)
        {
            FileStream file = new FileStream(filename, FileMode.Open);
            CompleteOutputDescription desc = LoadDescription(file);

            file.Close();
            return(desc);
        }
コード例 #2
0
 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();
 }
コード例 #3
0
 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();
 }
コード例 #4
0
 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;
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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);
            }
        }
コード例 #11
0
        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();
        }