Esempio n. 1
0
        public override SimElement MakeSimElement(AlignedEditableForm aef, List <SimElement> simElements)
        {
            var p = new Particle(_pos, _damping);

            p.OverrideUID(uid);

            return(p);
        }
Esempio n. 2
0
        /*
         * Methods
         */

        public override SimElement MakeSimElement(AlignedEditableForm aef, List <SimElement> simElements)
        {
            var a = simElements[aef.uid2idxDic[_aUID]] as Particle;

            var pc = new PinConstraint(a, _pos);

            pc.OverrideUID(uid);

            return(pc);
        }
Esempio n. 3
0
        /*
         * Methods
         */

        public override SimElement MakeSimElement(AlignedEditableForm aef, List <SimElement> simElements)
        {
            var a = simElements[aef.uid2idxDic[_aUID]] as Particle;
            var b = simElements[aef.uid2idxDic[_bUID]] as Particle;

            var sc = new SpringConstraint(a, b, _stiffness);

            sc.OverrideUID(uid);

            return(sc);
        }
Esempio n. 4
0
        public override SimElement MakeSimElement(AlignedEditableForm aef, List <SimElement> simElements)
        {
            var a = simElements[aef.uid2idxDic[_aUID]] as Particle;
            var b = simElements[aef.uid2idxDic[_bUID]] as Particle;

            var jc = new JetInteraction(a, b, _power);

            jc.OverrideUID(uid);

            return(jc);
        }
Esempio n. 5
0
        /*
         * Methods
         */

        public override SimElement MakeSimElement(AlignedEditableForm aef, List <SimElement> simElements)
        {
            var a = simElements[aef.uid2idxDic[_aUID]] as Particle;
            var b = simElements[aef.uid2idxDic[_bUID]] as Particle;
            var m = simElements[aef.uid2idxDic[_mUID]] as Particle;

            var ac = new AngleConstraint(a, b, m, _stiffness);

            ac.OverrideUID(uid);

            return(ac);
        }
Esempio n. 6
0
        public AlignedEditableForm ExportAlignedEditableForm()
        {
            List <SimElemInfo> alignedSimElemInfo = new List <SimElemInfo>();

            List <int>            sortedKeys = GetSortedKeyList();
            Dictionary <int, int> uid2idxDic = new Dictionary <int, int>();

            // その他の要素を参照するためのインデックス
            List <int> particleIdxs        = new List <int>();
            List <int> renderedSimElemIdxs = new List <int>();

            bool canRender, isParticle;

            for (int i = 0; i < sortedKeys.Count; ++i)
            {
                var group = _elemGroupDic[sortedKeys[i]];
                isParticle = (group.profile.attr == SimElemDefine.SimElemAttr.Particle);
                canRender  = group.profile.canRender;

                for (var j = 0; j < group.numElems; ++j)
                {
                    if (canRender)
                    {
                        renderedSimElemIdxs.Add(alignedSimElemInfo.Count);
                    }
                    if (isParticle)
                    {
                        particleIdxs.Add(alignedSimElemInfo.Count);
                    }
                    var elemInfo = group.GetAt(j);
                    uid2idxDic.Add(elemInfo.uid, alignedSimElemInfo.Count);
                    alignedSimElemInfo.Add(elemInfo);
                }
            }

            var exportForm = new AlignedEditableForm();

            exportForm.simElemInfos = alignedSimElemInfo;
            exportForm.uid2idxDic   = uid2idxDic;

            exportForm.renderedSimElemIdxs = renderedSimElemIdxs;
            exportForm.particleIdxs        = particleIdxs;

            return(exportForm);
        }
Esempio n. 7
0
        void SwitchToPlay()
        {
            _monoSim.enabled     = true;
            _simRenderer.enabled = true;

            markerManager.Clear();
            _monoSim.updateSim      = true;
            _simRenderer.updateMesh = true;

            // テスト
            var aef = _editableForm.ExportAlignedEditableForm();

            _simulator.ImportFromSimElementList(aef.ExportSimElements());
            integratorRenderer.renderedSimElemIdx = aef.renderedSimElemIdxs;

            _particles = SimpleSimHelper.GetParticlesByIdx(aef.particleIdxs, _simulator);

            _alignedEditableForm = aef;

            _simInteraction.ConnectUID2IDX(aef);
            _simInteraction.SetSimulator(_simulator);

            // _simRelatedForm = _monoSim.sim.ExportRelatedForm();
        }
Esempio n. 8
0
 public abstract SimElement MakeSimElement(AlignedEditableForm aef, List <SimElement> simElements);