Exemplo n.º 1
0
        public static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destoryFcn,
                                   ShapeType type1, ShapeType type2)
        {
            Box2DXDebug.Assert(ShapeType.UnknownShape < type1 && type1 < ShapeType.ShapeTypeCount);
            Box2DXDebug.Assert(ShapeType.UnknownShape < type2 && type2 < ShapeType.ShapeTypeCount);

            if (s_registers[(int)type1] == null)
            {
                s_registers[(int)type1] = new ContactRegister[(int)ShapeType.ShapeTypeCount];
            }

            s_registers[(int)type1][(int)type2].CreateFcn  = createFcn;
            s_registers[(int)type1][(int)type2].DestroyFcn = destoryFcn;
            s_registers[(int)type1][(int)type2].Primary    = true;

            if (type1 != type2)
            {
                //if (_registers[(int)type2] == null)
                //	_registers[(int)type2] = new ContactRegister[(int)ShapeType.ShapeTypeCount];

                s_registers[(int)type2][(int)type1].CreateFcn  = createFcn;
                s_registers[(int)type2][(int)type1].DestroyFcn = destoryFcn;
                s_registers[(int)type2][(int)type1].Primary    = false;
            }
        }
Exemplo n.º 2
0
        protected static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destroyFcn, ShapeType type1, ShapeType type2)
        {
            Utilities.Assert(0 <= (int)type1 && type1 < ShapeType.Count);
            Utilities.Assert(0 <= (int)type2 && type2 < ShapeType.Count);

            s_registers[(int)type1, (int)type2].createFcn  = createFcn;
            s_registers[(int)type1, (int)type2].destroyFcn = destroyFcn;
            s_registers[(int)type1, (int)type2].primary    = true;

            if (type1 != type2)
            {
                s_registers[(int)type2, (int)type1].createFcn  = createFcn;
                s_registers[(int)type2, (int)type1].destroyFcn = destroyFcn;
                s_registers[(int)type2, (int)type1].primary    = false;
            }
        }
Exemplo n.º 3
0
        public static void Destroy(ref Contact contact)
        {
            if (contact._manifold.PointCount > 0)
            {
                contact.FixtureA.Body.WakeUp();
                contact.FixtureB.Body.WakeUp();
            }

            ShapeType typeA = contact.FixtureA.ShapeType;
            ShapeType typeB = contact.FixtureB.ShapeType;


            ContactDestroyFcn destroyFcn = s_registers[(int)typeA][(int)typeB].DestroyFcn;

            destroyFcn(ref contact);
        }
Exemplo n.º 4
0
        public static void Destroy(Contact contact)
        {
            Box2DXDebug.Assert(Contact.s_initialized);
            if (contact.GetManifoldCount() > 0)
            {
                contact.GetShape1().GetBody().WakeUp();
                contact.GetShape2().GetBody().WakeUp();
            }
            ShapeType type  = contact.GetShape1().GetType();
            ShapeType type2 = contact.GetShape2().GetType();

            Box2DXDebug.Assert(ShapeType.UnknownShape < type && type < ShapeType.ShapeTypeCount);
            Box2DXDebug.Assert(ShapeType.UnknownShape < type2 && type2 < ShapeType.ShapeTypeCount);
            ContactDestroyFcn destroyFcn = Contact.s_registers[(int)type][(int)type2].DestroyFcn;

            destroyFcn(contact);
        }
Exemplo n.º 5
0
        public static void Destroy(Contact contact, ShapeType typeA, ShapeType typeB)
        {
            Box2DXDebug.Assert(Initialized == true);

            if (contact.Manifold.PointCount > 0)
            {
                contact.GetFixtureA().GetBody().WakeUp();
                contact.GetFixtureB().GetBody().WakeUp();
            }

            Box2DXDebug.Assert(ShapeType.UnknownShape < typeA && typeB < ShapeType.ShapeTypeCount);
            Box2DXDebug.Assert(ShapeType.UnknownShape < typeA && typeB < ShapeType.ShapeTypeCount);

            ContactDestroyFcn destroyFcn = Registers[(int)typeA][(int)typeB].DestroyFcn;

            destroyFcn(contact);
        }
Exemplo n.º 6
0
        public static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destroyFcn,
                                   ShapeType typeA, ShapeType typeB)
        {
            Box2DXDebug.Assert(ShapeType.UnknownShape < typeA && typeA < ShapeType.ShapeTypeCount);
            Box2DXDebug.Assert(ShapeType.UnknownShape < typeB && typeB < ShapeType.ShapeTypeCount);

            Registers[(int)typeA][(int)typeB].CreateFcn  = createFcn;
            Registers[(int)typeA][(int)typeB].DestroyFcn = destroyFcn;
            Registers[(int)typeA][(int)typeB].Primary    = true;

            if (typeA != typeB)
            {
                Registers[(int)typeB][(int)typeA].CreateFcn  = createFcn;
                Registers[(int)typeB][(int)typeA].DestroyFcn = destroyFcn;
                Registers[(int)typeB][(int)typeA].Primary    = false;
            }
        }
Exemplo n.º 7
0
 public static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destoryFcn, ShapeType type1, ShapeType type2)
 {
     Box2DXDebug.Assert(ShapeType.UnknownShape < type1 && type1 < ShapeType.ShapeTypeCount);
     Box2DXDebug.Assert(ShapeType.UnknownShape < type2 && type2 < ShapeType.ShapeTypeCount);
     if (Contact.s_registers[(int)type1] == null)
     {
         Contact.s_registers[(int)type1] = new ContactRegister[2];
     }
     Contact.s_registers[(int)type1][(int)type2].CreateFcn = createFcn;
     Contact.s_registers[(int)type1][(int)type2].DestroyFcn = destoryFcn;
     Contact.s_registers[(int)type1][(int)type2].Primary = true;
     if (type1 != type2)
     {
         Contact.s_registers[(int)type2][(int)type1].CreateFcn = createFcn;
         Contact.s_registers[(int)type2][(int)type1].DestroyFcn = destoryFcn;
         Contact.s_registers[(int)type2][(int)type1].Primary = false;
     }
 }
Exemplo n.º 8
0
        public static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destoryFcn,
                                   ShapeType type1, ShapeType type2)
        {
            if (s_registers[(int)type1] == null)
            {
                s_registers[(int)type1] = new ContactRegister[(int)ShapeType.ShapeTypeCount];
            }

            s_registers[(int)type1][(int)type2].CreateFcn  = createFcn;
            s_registers[(int)type1][(int)type2].DestroyFcn = destoryFcn;
            s_registers[(int)type1][(int)type2].Primary    = true;

            if (type1 != type2)
            {
                s_registers[(int)type2][(int)type1].CreateFcn  = createFcn;
                s_registers[(int)type2][(int)type1].DestroyFcn = destoryFcn;
                s_registers[(int)type2][(int)type1].Primary    = false;
            }
        }
Exemplo n.º 9
0
        public static void Destroy(ref Contact contact)
        {
            Box2DXDebug.Assert(s_initialized == true);

            if (contact._manifold.PointCount > 0)
            {
                contact.FixtureA.Body.WakeUp();
                contact.FixtureB.Body.WakeUp();
            }

            ShapeType typeA = contact.FixtureA.ShapeType;
            ShapeType typeB = contact.FixtureB.ShapeType;

            Box2DXDebug.Assert(ShapeType.UnknownShape < typeA && typeA < ShapeType.ShapeTypeCount);
            Box2DXDebug.Assert(ShapeType.UnknownShape < typeB && typeB < ShapeType.ShapeTypeCount);

            ContactDestroyFcn destroyFcn = s_registers[(int)typeA][(int)typeB].DestroyFcn;

            destroyFcn(ref contact);
        }
Exemplo n.º 10
0
        public static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destroyFcn,
                            ShapeType typeA, ShapeType typeB)
        {
            Box2DXDebug.Assert(ShapeType.UnknownShape < typeA && typeA < ShapeType.ShapeTypeCount);
            Box2DXDebug.Assert(ShapeType.UnknownShape < typeB && typeB < ShapeType.ShapeTypeCount);

            Registers[(int)typeA][(int)typeB].CreateFcn = createFcn;
            Registers[(int)typeA][(int)typeB].DestroyFcn = destroyFcn;
            Registers[(int)typeA][(int)typeB].Primary = true;

            if (typeA != typeB)
            {
                Registers[(int)typeB][(int)typeA].CreateFcn = createFcn;
                Registers[(int)typeB][(int)typeA].DestroyFcn = destroyFcn;
                Registers[(int)typeB][(int)typeA].Primary = false;
            }
        }
Exemplo n.º 11
0
		protected static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destroyFcn, ShapeType type1, ShapeType type2){
			Utilities.Assert(0 <= (int)type1 && type1 < ShapeType.Count);
			Utilities.Assert(0 <= (int)type2 && type2 < ShapeType.Count);

			s_registers[(int)type1, (int)type2].createFcn = createFcn;
			s_registers[(int)type1, (int)type2].destroyFcn = destroyFcn;
			s_registers[(int)type1, (int)type2].primary = true;

			if (type1 != type2)
			{
				s_registers[(int)type2, (int)type1].createFcn = createFcn;
				s_registers[(int)type2, (int)type1].destroyFcn = destroyFcn;
				s_registers[(int)type2, (int)type1].primary = false;
			}
		}