-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathsensor.h
More file actions
49 lines (36 loc) · 912 Bytes
/
sensor.h
File metadata and controls
49 lines (36 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-FileCopyrightText: 2023 Erin Catto
// SPDX-License-Identifier: MIT
#pragma once
#include "bitset.h"
#include "container.h"
typedef struct b2Shape b2Shape;
typedef struct b2World b2World;
// Used to track shapes that hit sensors using time of impact
typedef struct b2SensorHit
{
int sensorId;
int visitorId;
} b2SensorHit;
b2DeclareArray( b2SensorHit );
typedef struct b2Visitor
{
int shapeId;
uint16_t generation;
} b2Visitor;
b2DeclareArray( b2Visitor );
typedef struct b2Sensor
{
// todo find a way to pool these
b2Array( b2Visitor ) hits;
b2Array( b2Visitor ) overlaps1;
b2Array( b2Visitor ) overlaps2;
int shapeId;
} b2Sensor;
b2DeclareArray( b2Sensor );
typedef struct b2SensorTaskContext
{
b2BitSet eventBits;
} b2SensorTaskContext;
b2DeclareArray( b2SensorTaskContext );
void b2OverlapSensors( b2World* world );
void b2DestroySensor( b2World* world, b2Shape* sensorShape );