public void Evaluate(int SpreadMax)
        {
            if (this.FPinInSoftProperties.IsChanged ||
                this.FPinInGenBend.IsChanged ||
                this.FPinInBendDist.IsChanged ||
                this.FPinInBendDist.IsChanged ||
                this.FPinInGenBend.IsChanged ||
                this.SubPinsChanged)
            {
                this.FPinOutShapes.SliceCount =
                    ArrayMax.Max(
                        this.FPinInSoftProperties.SliceCount,
                        this.FPinInBendDist.SliceCount,
                        this.FPinInGenBend.SliceCount,
                        this.SubPinSpreadMax
                        );

                for (int i = 0; i < SpreadMax; i++)
                {
                    AbstractSoftShapeDefinition shape = this.GetShapeDefinition(i);

                    shape.GenerateBendingConstraints = this.FPinInGenBend[i];
                    shape.BendingDistance            = this.FPinInBendDist[i];
                    shape.Properties      = this.FPinInSoftProperties.IsConnected ? this.FPinInSoftProperties[i] : SoftBodyProperties.Default;
                    this.FPinOutShapes[i] = shape;
                }
            }
        }
Esempio n. 2
0
        public void Evaluate(int SpreadMax)
        {
            if (this.FPinInMass.IsChanged ||
                this.FPinInDF.IsChanged ||
                this.FPinInDP.IsChanged ||
                this.FPinInPR.IsChanged ||
                this.FPinInAeroModel.IsChanged ||
                this.FPinInBendDist.IsChanged ||
                this.FPinInGenBend.IsChanged ||
                this.FPinInCHR.IsChanged ||
                this.FPinInDG.IsChanged ||
                this.FPinInAHR.IsChanged ||
                this.SubPinsChanged ||
                this.FPinInIsVolumeMass.IsChanged ||
                this.FPinInSHR.IsChanged ||
                this.FPinInVC.IsChanged)
            {
                this.FPinOutShapes.SliceCount =
                    ArrayMax.Max(
                        this.FPinInAeroModel.SliceCount,
                        this.FPinInBendDist.SliceCount,
                        this.FPinInCHR.SliceCount,
                        this.FPinInDF.SliceCount,
                        this.FPinInDP.SliceCount,
                        this.FPinInGenBend.SliceCount,
                        this.FPinInLF.SliceCount,
                        this.FPinInMass.SliceCount,
                        this.FPinInPR.SliceCount,
                        this.FPinInDG.SliceCount,
                        this.FPinInAHR.SliceCount,
                        this.FPinInIsVolumeMass.SliceCount,
                        this.FPinInSHR.SliceCount,
                        this.FPinInVC.SliceCount,
                        this.SubPinSpreadMax
                        );

                for (int i = 0; i < SpreadMax; i++)
                {
                    AbstractSoftShapeDefinition shape = this.GetShapeDefinition(i);
                    shape.Mass = this.FPinInMass[i];
                    shape.DampingCoefficient         = this.FPinInDP[i];
                    shape.DynamicFrictionCoefficient = this.FPinInDF[i];
                    shape.PressureCoefficient        = this.FPinInPR[i];
                    shape.LiftCoefficient            = this.FPinInLF[i];
                    shape.AeroModel = this.FPinInAeroModel[i];
                    shape.GenerateBendingConstraints = this.FPinInGenBend[i];
                    shape.BendingDistance            = this.FPinInBendDist[i];
                    shape.RigidContactHardness       = this.FPinInCHR[i];
                    shape.DragCoefficient            = this.FPinInDG[i];
                    shape.AnchorHardness             = this.FPinInAHR[i];
                    shape.IsVolumeMass        = this.FPinInIsVolumeMass[i];
                    shape.SoftContactHardness = this.FPinInSHR[i];
                    shape.VolumeConservation  = this.FPinInVC[i];
                    this.FPinOutShapes[i]     = shape;
                }
            }
        }
Esempio n. 3
0
        public void Evaluate(int SpreadMax)
        {
            if (this.FWorld.PluginIO.IsConnected && this.FShapes.PluginIO.IsConnected)
            {
                List <SoftBody> bodies = new List <SoftBody>();
                for (int i = 0; i < SpreadMax; i++)
                {
                    if (FDoCreate[i])
                    {
                        AbstractSoftShapeDefinition shapedef = this.FShapes[i];

                        SoftBody body = shapedef.GetSoftBody(this.FWorld[0].WorldInfo);

                        body.Translate(this.FPosition[i].ToBulletVector());
                        body.Scale(this.FScale[i].ToBulletVector());
                        body.Rotate(this.FRotate[i].ToBulletQuaternion());

                        body.Friction    = this.FFriction[i];
                        body.Restitution = this.FRestitution[i];

                        SoftBodyCustomData bd = new SoftBodyCustomData();
                        bd.Id           = this.FWorld[0].GetNewBodyId();
                        bd.Custom       = this.FCustom[i];
                        bd.HasUV        = shapedef.HasUV;
                        bd.UV           = shapedef.GetUV(body);
                        body.UserObject = bd;


                        if (this.FCustomObj.PluginIO.IsConnected)
                        {
                            bd.CustomObject = (ICloneable)this.FCustomObj[i].Clone();
                        }
                        else
                        {
                            bd.CustomObject = null;
                        }



                        this.FWorld[0].Register(body);
                        bodies.Add(body);
                    }
                }

                this.FOutBodies.SliceCount = bodies.Count;
                for (int i = 0; i < bodies.Count; i++)
                {
                    this.FOutBodies[i] = bodies[i];
                }
            }
            else
            {
                this.FOutBodies.SliceCount = 0;
            }
        }
        public void Evaluate(int SpreadMax)
        {
            if (this.FWorld.PluginIO.IsConnected && this.FShapes.PluginIO.IsConnected)
            {
                List <SoftBody> bodies = new List <SoftBody>();
                for (int i = 0; i < SpreadMax; i++)
                {
                    if (FDoCreate[i])
                    {
                        AbstractSoftShapeDefinition shapedef = this.FShapes[i];

                        SoftBody      body = shapedef.GetSoftBody(this.FWorld[0].WorldInfo);
                        RigidBodyPose pose = this.initialPoseInput.IsConnected ? this.initialPoseInput[i] : RigidBodyPose.Default;

                        body.Translate(pose.Position);
                        body.Scale(this.FScale[i].ToBulletVector());
                        body.Rotate(pose.Orientation);
                        body.Friction    = this.FFriction[i];
                        body.Restitution = this.FRestitution[i];

                        SoftBodyCustomData bd = new SoftBodyCustomData(this.FWorld[0].GetNewSoftBodyId());
                        bd.Custom       = this.FCustom[i];
                        bd.HasUV        = shapedef.HasUV;
                        bd.UV           = shapedef.GetUV(body);
                        bd.Definition   = shapedef;
                        body.UserObject = bd;


                        this.FWorld[0].Register(body);
                        bodies.Add(body);

                        //Attach if to all nodes
                        for (int j = 0; j < body.Nodes.Count; j++)
                        {
                            body.Nodes[j].Tag = (IntPtr)j;
                        }
                    }
                }

                this.FOutBodies.SliceCount = bodies.Count;
                for (int i = 0; i < bodies.Count; i++)
                {
                    this.FOutBodies[i] = bodies[i];
                }
            }
            else
            {
                this.FOutBodies.SliceCount = 0;
            }
        }
Esempio n. 5
0
 public SoftShapeCustomData(int id, AbstractSoftShapeDefinition descriptor)
 {
     this.id         = id;
     this.descriptor = descriptor;
 }