示例#1
0
        public bool Filter(RigidBody body)
        {
            bool first = First != null?First.Filter(body) : true;

            bool second = Second != null?Second.Filter(body) : true;

            return(first || second);
        }
        public void Evaluate(int SpreadMax)
        {
            if (this.FWorld[0] != null)
            {
                List <RigidBody> allBodies = this.FWorld[0].RigidBodies;
                List <RigidBody> filteredBodyList;

                IRigidBodyFilter filter = this.FFilter[0];

                if (this.FFilter[0] != null)
                {
                    this.bodies.Clear();

                    for (int i = 0; i < allBodies.Count; i++)
                    {
                        if (filter.Filter(allBodies[i]))
                        {
                            this.bodies.Add(allBodies[i]);
                        }
                    }
                    filteredBodyList = this.bodies;
                }
                else
                {
                    filteredBodyList = allBodies;
                }

                this.FRigidBodies.SliceCount = filteredBodyList.Count;

                var outputBuffer = this.FRigidBodies.Stream.Buffer;
                for (int i = 0; i < filteredBodyList.Count; i++)
                {
                    outputBuffer[i] = filteredBodyList[i];
                }
                this.FRigidBodies.Flush(true);
            }
            else
            {
                this.FRigidBodies.SliceCount = 0;
            }
        }
示例#3
0
 public bool Filter(RigidBody body)
 {
     return(filter != null ? !filter.Filter(body) : true);
 }