Files
RobustToolbox/Robust.Shared/Physics/IBroadPhase.cs
metalgearsloth c17c8d7a11 Physics (#1605)
* Physics worlds

* Paul's a good boy

* Build working

* Ingame and not lagging to hell

* Why didn't you commit ahhhhh

* Hard collisions working

* Solver parity

* Decent broadphase work done

* BroadPhase outline done

* BroadPhase working

* waiting for pvs

* Fix static PVS AABB

* Stop static bodies from awakening

* Optimise a bunch of stuff

* Even more broadphase stuff

* I'm fucking stupid

* Optimise fixture updates

* Collision solver start

* Building

* A is for Argumentative

* Fix contact caching island flags

* Circle shapes actually workeded

* Damping

* DS2 consumables only

* Slightly more stable

* Even slightlier more stablier

* VV your heart out

* Initial joint support

* 90% of joints I just wanted to push as I'd scream if I lost progress

* JOINT PURGATORY

* Joints barely functional lmao

* Okay these joints slightly more functional

* Remove station FrictionJoint

* Also that

* Some Box2D ports

* Cleanup mass

* Edge shape

* Active contacts

* Fix active contacts

* Optimise active contacts even more

* Boxes be stacking

* I would die for smug oh my fucking god

* In which everything is fixed

* Distance joints working LETS GO

* Remove frequency on distancejoint

* Fix some stuff and break joints

* Crashing fixed mehbeh

* ICollideSpecial and more resilience

* auto-clear

* showbb vera

* Slap that TODO in there

* Fix restartround crash

* Random fixes

* Fix fixture networking

* Add intersection method for broadphase

* Fix contacts

* Licenses done

* Optimisations

* Fix wall clips

* Config caching for island

* allocations optimisations

* Optimise casts

* Optimise events queue for physics

* Contact manager optimisations

* Optimise controllers

* Sloth joint or something idk

* Controller graph

* Remove content cvar

* Random cleanup

* Finally remove VirtualController

* Manifold structs again

* Optimise this absolute retardation

* Optimise

* fix license

* Cleanup physics interface

* AHHHHHHHHHHHHH

* Fix collisions again

* snivybus

* Fix potential nasty manifold bug

* Tests go snivy

* Disable prediction for now

* Spans

* Fix ShapeTypes

* fixes

* ch ch changeesss

* Kinematic idea

* Prevent static bodies from waking

* Pass WorldAABB to MoveEvent

* Fix collisions

* manifold structs fucking WOOORRKKKINNGGG

* Better pushing

* Fix merge ickies

* Optimise MoveEvents

* Use event for collisions performance

* Fix content tests

* Do not research tests

* Fix most conflicts

* Paul's trying to kill me

* Maybe collisions work idk

* Make us whole again

* Smug is also trying to kill me

* nani

* shitty collisions

* Settling

* Do not research collisions

* SHIP IT

* Fix joints

* PVS moment

* Fix other assert

* Fix locker collisions

* serializable sleeptime

* Aether2D contacts

* Physics is no longer crashing (and burning)

* Add to the TODO list

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2021-03-08 03:19:01 +11:00

120 lines
3.5 KiB
C#

using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Robust.Shared.Maths;
using Robust.Shared.Physics.Dynamics;
namespace Robust.Shared.Physics {
public interface IBroadPhase
{
void UpdatePairs(BroadPhaseDelegate callback);
bool TestOverlap(DynamicTree.Proxy proxyA, DynamicTree.Proxy proxyB);
DynamicTree.Proxy AddProxy(ref FixtureProxy proxy);
void MoveProxy(DynamicTree.Proxy proxyId, in Box2 aabb, Vector2 displacement);
void RemoveProxy(DynamicTree.Proxy proxy);
void TouchProxy(DynamicTree.Proxy proxy);
void QueryAABB(DynamicTree<FixtureProxy>.QueryCallbackDelegate callback,
Box2 aabb,
bool approx = false);
void QueryAabb<TState>(
ref TState state,
DynamicTree<FixtureProxy>.QueryCallbackDelegate<TState> callback,
Box2 aabb,
bool approx = false);
IEnumerable<FixtureProxy> QueryAabb(Box2 aabb, bool approx = false);
void QueryPoint(DynamicTree<FixtureProxy>.QueryCallbackDelegate callback,
Vector2 point,
bool approx = false);
void QueryPoint<TState>(
ref TState state,
DynamicTree<FixtureProxy>.QueryCallbackDelegate<TState> callback,
Vector2 point,
bool approx = false);
IEnumerable<FixtureProxy> QueryPoint(Vector2 point, bool approx = false);
void QueryRay(
DynamicTree<FixtureProxy>.RayQueryCallbackDelegate callback,
in Ray ray,
bool approx = false);
void QueryRay<TState>(
ref TState state,
DynamicTree<FixtureProxy>.RayQueryCallbackDelegate<TState> callback,
in Ray ray,
bool approx = false);
}
public interface IBroadPhase<T> : ICollection<T> where T : notnull {
int Capacity { get; }
int Height {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}
int MaxBalance {
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
get;
}
float AreaRatio {
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
get;
}
bool Add(in T item, Box2? newAABB = null);
bool Remove(in T item);
bool Update(in T item, Box2? newAABB = null);
void QueryAabb(
DynamicTree<T>.QueryCallbackDelegate callback,
Box2 aabb,
bool approx = false);
void QueryAabb<TState>(
ref TState state,
DynamicTree<T>.QueryCallbackDelegate<TState> callback,
Box2 aabb,
bool approx = false);
IEnumerable<T> QueryAabb(Box2 aabb, bool approx = false);
void QueryPoint(DynamicTree<T>.QueryCallbackDelegate callback,
Vector2 point,
bool approx = false);
void QueryPoint<TState>(
ref TState state,
DynamicTree<T>.QueryCallbackDelegate<TState> callback,
Vector2 point,
bool approx = false);
IEnumerable<T> QueryPoint(Vector2 point, bool approx = false);
void QueryRay(
DynamicTree<T>.RayQueryCallbackDelegate callback,
in Ray ray,
bool approx = false);
void QueryRay<TState>(
ref TState state,
DynamicTree<T>.RayQueryCallbackDelegate<TState> callback,
in Ray ray,
bool approx = false);
}
}