public CreateProxy ( |
||
aabb | ||
userData | object | |
Результат | ushort |
internal void CreateProxy(BroadPhase broadPhase, XForm transform) { Box2DXDebug.Assert(this._proxyId == PairManager.NullProxy); AABB aabb; this.ComputeAABB(out aabb, transform); bool flag = broadPhase.InRange(aabb); Box2DXDebug.Assert(flag); if (flag) { this._proxyId = broadPhase.CreateProxy(aabb, this); } else { this._proxyId = PairManager.NullProxy; } }
internal void RefilterProxy(BroadPhase broadPhase, XForm transform) { if (this._proxyId != PairManager.NullProxy) { broadPhase.DestroyProxy((int)this._proxyId); AABB aabb; this.ComputeAABB(out aabb, transform); bool flag = broadPhase.InRange(aabb); if (flag) { this._proxyId = broadPhase.CreateProxy(aabb, this); } else { this._proxyId = PairManager.NullProxy; } } }
internal void CreateProxy(BroadPhase broadPhase, XForm transform) { Box2DXDebug.Assert(_proxyId == PairManager.NullProxy); AABB aabb; ComputeAABB(out aabb, transform); bool inRange = broadPhase.InRange(aabb); // You are creating a shape outside the world box. Box2DXDebug.Assert(inRange); if (inRange) { _proxyId = broadPhase.CreateProxy(aabb, this); } else { _proxyId = PairManager.NullProxy; } }
internal void RefilterProxy(BroadPhase broadPhase, XForm transform) { if (_proxyId == PairManager.NullProxy) { return; } broadPhase.DestroyProxy(_proxyId); AABB aabb; ComputeAABB(out aabb, transform); bool inRange = broadPhase.InRange(aabb); if (inRange) { _proxyId = broadPhase.CreateProxy(aabb, this); } else { _proxyId = PairManager.NullProxy; } }
internal void RefilterProxy(BroadPhase broadPhase, XForm transform) { if (this._proxyId != PairManager.NullProxy) { broadPhase.DestroyProxy((int)this._proxyId); AABB aabb; this.ComputeAABB(out aabb, transform); bool flag = broadPhase.InRange(aabb); if (flag) { this._proxyId = broadPhase.CreateProxy(aabb, this); } else { this._proxyId = PairManager.NullProxy; } } }
internal void CreateProxy(BroadPhase broadPhase, XForm transform) { Box2DXDebug.Assert(this._proxyId == PairManager.NullProxy); AABB aabb; this.ComputeAABB(out aabb, transform); bool flag = broadPhase.InRange(aabb); Box2DXDebug.Assert(flag); if (flag) { this._proxyId = broadPhase.CreateProxy(aabb, this); } else { this._proxyId = PairManager.NullProxy; } }
public BroadPhaseTest() { BroadPhase.IsValidate = true; //srand(888); AABB worldAABB = new AABB(); worldAABB.LowerBound.Set(-5.0f * k_extent, -5.0f * k_extent); worldAABB.UpperBound.Set(5.0f * k_extent, 5.0f * k_extent); _overlapCount = 0; _overlapCountExact = 0; _callback._test = this; _broadPhase = new BroadPhase(worldAABB, _callback); for (int i = 0; i < k_actorCount; i++) _overlaps[i] = new bool[k_actorCount]; for (int i = 0; i < k_actorCount; i++) for (int j = 0; j < k_actorCount; j++) _overlaps[i][j] = false; for (int i = 0; i < k_actorCount; i++) _actors[i] = new Actor(); for (int i = 0; i < k_actorCount; ++i) { bool s = false; if (i == 91) s = true; Actor actor = _actors[i]; GetRandomAABB(ref actor.aabb); //actor->aabb.minVertex.Set(0.0f, 0.0f); //actor->aabb.maxVertex.Set(k_width, k_width); actor.proxyId = _broadPhase.CreateProxy(actor.aabb, actor); actor.overlapCount = 0; _broadPhase.Validate(); } _automated = true; _stepCount = 0; }
// We need separation create/destroy functions from the constructor/destructor because // the destructor cannot access the allocator or broad-phase (no destructor arguments allowed by C++). public void Create(BroadPhase broadPhase, Body body, Transform xf, FixtureDef def) { UserData = def.UserData; Friction = def.Friction; Restitution = def.Restitution; Body = body; _next = null; Filter = def.Filter; IsSensor = def.IsSensor; Shape = def.Shape.Clone(); Shape.ComputeMass(out _massData, def.Density); // Create proxy in the broad-phase. Shape.ComputeAABB(out Aabb, ref xf); ProxyId = broadPhase.CreateProxy(Aabb, this); }
internal void RefilterProxy(BroadPhase broadPhase, XForm transform) { if (_proxyId == PairManager.NullProxy) { return; } broadPhase.DestroyProxy(_proxyId); AABB aabb; _shape.ComputeAABB(out aabb, transform); bool inRange = broadPhase.InRange(aabb); if (inRange) { _proxyId = broadPhase.CreateProxy(aabb, this); } else { _proxyId = PairManager.NullProxy; } }
public void Create(BroadPhase broadPhase, Body body, XForm xf, FixtureDef def) { UserData = def.UserData; Friction = def.Friction; Restitution = def.Restitution; Density = def.Density; _body = body; _next = null; Filter = def.Filter; _isSensor = def.IsSensor; _type = def.Type; // Allocate and initialize the child shape. switch (_type) { case ShapeType.CircleShape: { CircleShape circle = new CircleShape(); CircleDef circleDef = (CircleDef)def; circle._position = circleDef.LocalPosition; circle._radius = circleDef.Radius; _shape = circle; } break; case ShapeType.PolygonShape: { PolygonShape polygon = new PolygonShape(); PolygonDef polygonDef = (PolygonDef)def; polygon.Set(polygonDef.Vertices, polygonDef.VertexCount); _shape = polygon; } break; case ShapeType.EdgeShape: { EdgeShape edge = new EdgeShape(); EdgeDef edgeDef = (EdgeDef)def; edge.Set(edgeDef.Vertex1, edgeDef.Vertex2); _shape = edge; } break; default: Box2DXDebug.Assert(false); break; } // Create proxy in the broad-phase. AABB aabb; _shape.ComputeAABB(out aabb, xf); bool inRange = broadPhase.InRange(aabb); // You are creating a shape outside the world box. Box2DXDebug.Assert(inRange); if (inRange) { _proxyId = broadPhase.CreateProxy(aabb, this); } else { _proxyId = PairManager.NullProxy; } }
internal void CreateProxy(BroadPhase broadPhase, XForm transform) { Box2DXDebug.Assert(_proxyId == PairManager.NullProxy); AABB aabb; ComputeAABB(out aabb, transform); bool inRange = broadPhase.InRange(aabb); // You are creating a shape outside the world box. Box2DXDebug.Assert(inRange); if (inRange) { _proxyId = broadPhase.CreateProxy(aabb, this); } else { _proxyId = PairManager.NullProxy; } }