mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Improve presentation
This commit is contained in:
Vendored
+15
-12
@@ -423,12 +423,12 @@ foreign lib {
|
|||||||
|
|
||||||
// Get proxy user data
|
// Get proxy user data
|
||||||
// @return the proxy user data or 0 if the id is invalid
|
// @return the proxy user data or 0 if the id is invalid
|
||||||
DynamicTree_GetUserData :: proc "contextless" (tree: DynamicTree, proxyId: i32) -> i32 {
|
DynamicTree_GetUserData :: #force_inline proc "contextless" (tree: DynamicTree, proxyId: i32) -> i32 {
|
||||||
return tree.nodes[proxyId].userData
|
return tree.nodes[proxyId].userData
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the AABB of a proxy
|
// Get the AABB of a proxy
|
||||||
DynamicTree_GetAABB :: proc "contextless" (tree: DynamicTree, proxyId: i32) -> AABB {
|
DynamicTree_GetAABB :: #force_inline proc "contextless" (tree: DynamicTree, proxyId: i32) -> AABB {
|
||||||
return tree.nodes[proxyId].aabb
|
return tree.nodes[proxyId].aabb
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +436,6 @@ DynamicTree_GetAABB :: proc "contextless" (tree: DynamicTree, proxyId: i32) -> A
|
|||||||
|
|
||||||
@(link_prefix="b2", default_calling_convention="c")
|
@(link_prefix="b2", default_calling_convention="c")
|
||||||
foreign lib {
|
foreign lib {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup world World
|
* @defgroup world World
|
||||||
* These functions allow you to create a simulation world.
|
* These functions allow you to create a simulation world.
|
||||||
@@ -575,7 +574,11 @@ foreign lib {
|
|||||||
|
|
||||||
// Dump memory stats to box2d_memory.txt
|
// Dump memory stats to box2d_memory.txt
|
||||||
World_DumpMemoryStats :: proc(worldId: WorldId) ---
|
World_DumpMemoryStats :: proc(worldId: WorldId) ---
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@(link_prefix="b2", default_calling_convention="c")
|
||||||
|
foreign lib {
|
||||||
/**
|
/**
|
||||||
* @defgroup body Body
|
* @defgroup body Body
|
||||||
* This is the body API.
|
* This is the body API.
|
||||||
@@ -583,9 +586,9 @@ foreign lib {
|
|||||||
|
|
||||||
// Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition
|
// Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition
|
||||||
// on the stack and pass it as a pointer.
|
// on the stack and pass it as a pointer.
|
||||||
// @code{.c}
|
// @code{.odin}
|
||||||
// BodyDef bodyDef = b2DefaultBodyDef();
|
// body_def := b2.DefaultBodyDef()
|
||||||
// BodyId myBodyId = b2CreateBody(myWorldId, &bodyDef);
|
// my_body_id =: b2.CreateBody(my_world_id, body_def)
|
||||||
// @endcode
|
// @endcode
|
||||||
// @warning This function is locked during callbacks.
|
// @warning This function is locked during callbacks.
|
||||||
CreateBody :: proc(worldId: WorldId, #by_ptr def: BodyDef) -> BodyId ---
|
CreateBody :: proc(worldId: WorldId, #by_ptr def: BodyDef) -> BodyId ---
|
||||||
@@ -998,7 +1001,11 @@ foreign lib {
|
|||||||
// Get the maximum capacity required for retrieving all the touching contacts on a shape
|
// Get the maximum capacity required for retrieving all the touching contacts on a shape
|
||||||
Shape_GetContactCapacity :: proc(shapeId: ShapeId) -> c.int ---
|
Shape_GetContactCapacity :: proc(shapeId: ShapeId) -> c.int ---
|
||||||
|
|
||||||
|
// Get the current world AABB
|
||||||
|
Shape_GetAABB :: proc(shapeId: ShapeId) -> AABB ---
|
||||||
|
|
||||||
|
// Get the closest point on a shape to a target point. Target and result are in world space.
|
||||||
|
Shape_GetClosestPoint :: proc(shapeId: ShapeId, target: Vec2) -> Vec2 ---
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB on the contact data.
|
// Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB on the contact data.
|
||||||
@@ -1012,12 +1019,6 @@ Shape_GetContactData :: proc "c" (shapeId: ShapeId, contactData: []ContactData)
|
|||||||
|
|
||||||
@(link_prefix="b2", default_calling_convention="c")
|
@(link_prefix="b2", default_calling_convention="c")
|
||||||
foreign lib {
|
foreign lib {
|
||||||
// Get the current world AABB
|
|
||||||
Shape_GetAABB :: proc(shapeId: ShapeId) -> AABB ---
|
|
||||||
|
|
||||||
// Get the closest point on a shape to a target point. Target and result are in world space.
|
|
||||||
Shape_GetClosestPoint :: proc(shapeId: ShapeId, target: Vec2) -> Vec2 ---
|
|
||||||
|
|
||||||
// Chain Shape
|
// Chain Shape
|
||||||
|
|
||||||
// Create a chain shape
|
// Create a chain shape
|
||||||
@@ -1497,4 +1498,6 @@ IsValid :: proc{
|
|||||||
Shape_IsValid,
|
Shape_IsValid,
|
||||||
Chain_IsValid,
|
Chain_IsValid,
|
||||||
Joint_IsValid,
|
Joint_IsValid,
|
||||||
|
|
||||||
|
IsValidRay,
|
||||||
}
|
}
|
||||||
Vendored
+1
-1
@@ -413,7 +413,7 @@ TreeNode :: struct {
|
|||||||
enlarged: bool, // 1
|
enlarged: bool, // 1
|
||||||
|
|
||||||
// Padding for clarity
|
// Padding for clarity
|
||||||
pad: [9]byte,
|
_: [9]byte,
|
||||||
}
|
}
|
||||||
|
|
||||||
// The dynamic tree structure. This should be considered private data.
|
// The dynamic tree structure. This should be considered private data.
|
||||||
|
|||||||
Vendored
+23
-13
@@ -1,5 +1,7 @@
|
|||||||
package vendor_box2d
|
package vendor_box2d
|
||||||
|
|
||||||
|
import "base:intrinsics"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup id Ids
|
* @defgroup id Ids
|
||||||
* These ids serve as handles to internal Box2D objects.
|
* These ids serve as handles to internal Box2D objects.
|
||||||
@@ -7,19 +9,13 @@ package vendor_box2d
|
|||||||
* Include this header if you need the id types and not the whole Box2D API.
|
* Include this header if you need the id types and not the whole Box2D API.
|
||||||
* All ids are considered null if initialized to zero.
|
* All ids are considered null if initialized to zero.
|
||||||
*
|
*
|
||||||
* For example in C++:
|
* For example in Odin:
|
||||||
*
|
*
|
||||||
* @code{.cxx}
|
* @code{.odin}
|
||||||
* b2WorldId worldId = {};
|
* worldId := b2.WorldId{}
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* Or in C:
|
* This is considered null.
|
||||||
*
|
|
||||||
* @code{.c}
|
|
||||||
* b2WorldId worldId = {0};
|
|
||||||
* @endcode
|
|
||||||
*
|
|
||||||
* These are both considered null.
|
|
||||||
*
|
*
|
||||||
* @warning Do not use the internals of these ids. They are subject to change. Ids should be treated as opaque objects.
|
* @warning Do not use the internals of these ids. They are subject to change. Ids should be treated as opaque objects.
|
||||||
* @warning You should use ids to access objects in Box2D. Do not access files within the src folder. Such usage is unsupported.
|
* @warning You should use ids to access objects in Box2D. Do not access files within the src folder. Such usage is unsupported.
|
||||||
@@ -68,10 +64,24 @@ nullJointId :: JointId{}
|
|||||||
nullChainId :: ChainId{}
|
nullChainId :: ChainId{}
|
||||||
|
|
||||||
/// Macro to determine if any id is null.
|
/// Macro to determine if any id is null.
|
||||||
IS_NULL :: proc "c" (id: $T) -> bool { return id.index1 == 0 }
|
IS_NULL :: #force_inline proc "c" (id: $T) -> bool
|
||||||
|
where intrinsics.type_is_struct(T),
|
||||||
|
intrinsics.type_has_field(T, "index1") {
|
||||||
|
return id.index1 == 0
|
||||||
|
}
|
||||||
|
|
||||||
/// Macro to determine if any id is non-null.
|
/// Macro to determine if any id is non-null.
|
||||||
IS_NON_NULL :: proc "c" (id: $T) -> bool { return id.index1 != 0 }
|
IS_NON_NULL :: #force_inline proc "c" (id: $T) -> bool
|
||||||
|
where intrinsics.type_is_struct(T),
|
||||||
|
intrinsics.type_has_field(T, "index1") {
|
||||||
|
return id.index1 != 0
|
||||||
|
}
|
||||||
|
|
||||||
/// Compare two ids for equality. Doesn't work for b2WorldId.
|
/// Compare two ids for equality. Doesn't work for b2WorldId.
|
||||||
ID_EQUALS :: proc "c" (id1, id2: $T) -> bool { return id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.revision == id2.revision }
|
ID_EQUALS :: #force_inline proc "c" (id1, id2: $T) -> bool
|
||||||
|
where intrinsics.type_is_struct(T),
|
||||||
|
intrinsics.type_has_field(T, "index1"),
|
||||||
|
intrinsics.type_has_field(T, "world0"),
|
||||||
|
intrinsics.type_has_field(T, "revision") {
|
||||||
|
return id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.revision == id2.revision
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+5
-5
@@ -199,9 +199,8 @@ BodyDef :: struct {
|
|||||||
Filter :: struct {
|
Filter :: struct {
|
||||||
// The collision category bits. Normally you would just set one bit. The category bits should
|
// The collision category bits. Normally you would just set one bit. The category bits should
|
||||||
// represent your application object types. For example:
|
// represent your application object types. For example:
|
||||||
// @code{.cpp}
|
// @code{.odin}
|
||||||
// enum MyCategories
|
// My_Categories :: enum u32 {
|
||||||
// {
|
|
||||||
// Static = 0x00000001,
|
// Static = 0x00000001,
|
||||||
// Dynamic = 0x00000002,
|
// Dynamic = 0x00000002,
|
||||||
// Debris = 0x00000004,
|
// Debris = 0x00000004,
|
||||||
@@ -209,14 +208,15 @@ Filter :: struct {
|
|||||||
// // etc
|
// // etc
|
||||||
// };
|
// };
|
||||||
// @endcode
|
// @endcode
|
||||||
|
// Or use a bit_set.
|
||||||
categoryBits: u32,
|
categoryBits: u32,
|
||||||
|
|
||||||
// The collision mask bits. This states the categories that this
|
// The collision mask bits. This states the categories that this
|
||||||
// shape would accept for collision.
|
// shape would accept for collision.
|
||||||
// For example, you may want your player to only collide with static objects
|
// For example, you may want your player to only collide with static objects
|
||||||
// and other players.
|
// and other players.
|
||||||
// @code{.c}
|
// @code{.odin}
|
||||||
// maskBits = Static | Player;
|
// maskBits = u32(My_Categories.Static | My_Categories.Player);
|
||||||
// @endcode
|
// @endcode
|
||||||
maskBits: u32,
|
maskBits: u32,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user