2
0
Эх сурвалжийг харах

Merge sub-world types into world_types.h

Daniele Bartolini 10 жил өмнө
parent
commit
16bb774398

+ 14 - 12
src/device.cpp

@@ -3,31 +3,33 @@
  * License: https://github.com/taylor001/crown/blob/master/LICENSE
  */
 
-#include "device.h"
 #include "array.h"
+#include "audio.h"
 #include "config.h"
+#include "console_server.h"
+#include "device.h"
+#include "disk_filesystem.h"
+#include "filesystem.h"
+#include "input_device.h"
 #include "input_manager.h"
 #include "log.h"
 #include "lua_environment.h"
+#include "map.h"
 #include "material_manager.h"
 #include "memory.h"
 #include "os.h"
-#include "resource_loader.h"
-#include "resource_manager.h"
-#include "resource_package.h"
-#include "types.h"
-#include "world.h"
-#include "filesystem.h"
 #include "path.h"
-#include "disk_filesystem.h"
 #include "physics.h"
-#include "audio.h"
 #include "profiler.h"
-#include "console_server.h"
-#include "input_device.h"
+#include "resource_loader.h"
+#include "resource_manager.h"
+#include "resource_package.h"
+#include "shader_manager.h"
 #include "sjson.h"
-#include "map.h"
+#include "types.h"
+#include "unit_manager.h"
 #include "vector3.h"
+#include "world.h"
 
 #if CROWN_PLATFORM_ANDROID
 	#include "apk_filesystem.h"

+ 11 - 14
src/device.h

@@ -5,27 +5,24 @@
 
 #pragma once
 
-#include "types.h"
+#include "allocator.h"
 #include "config.h"
-#include "linear_allocator.h"
-#include "world_types.h"
-#include "resource_types.h"
-#include "lua_types.h"
-#include "filesystem_types.h"
 #include "container_types.h"
-#include "input_types.h"
 #include "device_options.h"
-#include "os_event_queue.h"
-#include "string_id.h"
-#include "allocator.h"
+#include "filesystem_types.h"
+#include "input_types.h"
+#include "linear_allocator.h"
 #include "log.h"
+#include "lua_types.h"
+#include "os_event_queue.h"
 #include "proxy_allocator.h"
+#include "resource_types.h"
+#include "string_id.h"
 #include "string_utils.h"
-#include "shader_manager.h"
-#include "material_manager.h"
-#include "unit_manager.h"
-#include <bx/allocator.h>
+#include "types.h"
+#include "world_types.h"
 #include <bgfx/bgfx.h>
+#include <bx/allocator.h>
 
 namespace crown
 {

+ 0 - 3
src/lua/lua_stack.h

@@ -5,9 +5,6 @@
 
 #pragma once
 
-#include "audio_types.h"
-#include "graphics_types.h"
-#include "physics_types.h"
 #include "resource_types.h"
 #include "string_id.h"
 #include "types.h"

+ 8 - 8
src/resource/physics_resource.cpp

@@ -3,18 +3,18 @@
  * License: https://github.com/taylor001/crown/blob/master/LICENSE
  */
 
-#include "physics_resource.h"
-#include "physics_types.h"
-#include "filesystem.h"
-#include "string_utils.h"
+#include "aabb.h"
+#include "compile_options.h"
 #include "dynamic_string.h"
+#include "filesystem.h"
+#include "map.h"
 #include "map.h"
+#include "physics_resource.h"
 #include "quaternion.h"
-#include "compile_options.h"
-#include "aabb.h"
-#include "sphere.h"
 #include "sjson.h"
-#include "map.h"
+#include "sphere.h"
+#include "string_utils.h"
+#include "world_types.h"
 
 namespace crown
 {

+ 6 - 7
src/resource/unit_compiler.cpp

@@ -3,18 +3,17 @@
  * License: https://github.com/taylor001/crown/blob/master/LICENSE
  */
 
-#include "unit_compiler.h"
-#include "unit_resource.h"
 #include "array.h"
-#include "sort_map.h"
 #include "compile_options.h"
+#include "map.h"
 #include "math_utils.h"
-#include "world_types.h"
-#include "graphics_types.h"
 #include "physics_resource.h"
-#include "temp_allocator.h"
 #include "sjson.h"
-#include "map.h"
+#include "sort_map.h"
+#include "temp_allocator.h"
+#include "unit_compiler.h"
+#include "unit_resource.h"
+#include "world_types.h"
 
 namespace crown
 {

+ 0 - 16
src/world/audio_types.h

@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2012-2016 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include "types.h"
-
-namespace crown
-{
-
-class SoundWorld;
-typedef uint32_t SoundInstanceId;
-
-} // namespace crown

+ 1 - 0
src/world/debug_line.cpp

@@ -8,6 +8,7 @@
 #include "device.h"
 #include "math_utils.h"
 #include "matrix4x4.h"
+#include "shader_manager.h"
 #include "vector3.h"
 #include <string.h> // memcpy
 

+ 0 - 79
src/world/graphics_types.h

@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2012-2016 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include "types.h"
-#include "string_id.h"
-#include "math_types.h"
-
-namespace crown
-{
-
-class ShaderManager;
-class MaterialManager;
-class RenderWorld;
-struct DebugLine;
-struct Gui;
-struct Material;
-
-struct MeshInstance
-{
-	uint32_t i;
-};
-
-struct SpriteInstance
-{
-	uint32_t i;
-};
-
-struct LightInstance
-{
-	uint32_t i;
-};
-
-/// Enumerates light types.
-///
-/// @ingroup Graphics
-struct LightType
-{
-	enum Enum
-	{
-		DIRECTIONAL,
-		OMNI,
-		SPOT,
-
-		COUNT
-	};
-};
-
-struct MeshRendererDesc
-{
-	StringId64 mesh_resource;
-	StringId32 mesh_name;
-	StringId64 material_resource; // FIXME
-	bool visible;
-	char _pad[3];
-};
-
-struct SpriteRendererDesc
-{
-	StringId64 sprite_resource;
-	StringId64 material_resource; // FIXME
-	bool visible;
-	char _pad[3];
-	char _pad1[4];
-};
-
-struct LightDesc
-{
-	uint32_t type;    // LightType::Enum
-	float range;      // In meters
-	float intensity;
-	float spot_angle; // In radians
-	Vector3 color;
-};
-
-} // namespace crown

+ 2 - 2
src/world/gui.cpp

@@ -6,11 +6,11 @@
 #include "color4.h"
 #include "font_resource.h"
 #include "gui.h"
-#include "material_resource.h"
 #include "material_manager.h"
+#include "material_resource.h"
+#include "matrix4x4.h"
 #include "vector2.h"
 #include "vector3.h"
-#include "matrix4x4.h"
 #include <bgfx/bgfx.h>
 
 namespace crown

+ 2 - 2
src/world/gui.h

@@ -5,10 +5,10 @@
 
 #pragma once
 
-#include "math_types.h"
 #include "color4.h"
-#include "graphics_types.h"
 #include "material.h"
+#include "math_types.h"
+#include "world_types.h"
 #include <bgfx/bgfx.h>
 
 namespace crown

+ 5 - 4
src/world/material.cpp

@@ -3,16 +3,17 @@
  * License: https://github.com/taylor001/crown/blob/master/LICENSE
  */
 
+#include "device.h"
 #include "material.h"
+#include "material_manager.h"
 #include "material_resource.h"
 #include "memory.h"
-#include "device.h"
 #include "resource_manager.h"
-#include "texture_resource.h"
-#include "material_manager.h"
 #include "shader.h"
-#include <string.h> // memcpy
+#include "shader_manager.h"
+#include "texture_resource.h"
 #include <bgfx/bgfx.h>
+#include <string.h> // memcpy
 
 namespace crown
 {

+ 1 - 1
src/world/material.h

@@ -5,9 +5,9 @@
 
 #pragma once
 
-#include "graphics_types.h"
 #include "math_types.h"
 #include "resource_types.h"
+#include "world_types.h"
 #include <bgfx/bgfx.h>
 
 namespace crown

+ 0 - 248
src/world/physics_types.h

@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 2012-2016 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include "math_types.h"
-#include "string_id.h"
-#include "world_types.h"
-
-namespace crown
-{
-
-struct ColliderInstance
-{
-	uint32_t i;
-};
-
-struct ActorInstance
-{
-	uint32_t i;
-};
-
-struct ControllerInstance
-{
-	uint32_t i;
-};
-
-struct JointInstance
-{
-	uint32_t i;
-};
-
-class PhysicsWorld;
-
-struct ActorType
-{
-	enum Enum
-	{
-		STATIC,
-		DYNAMIC_PHYSICAL,
-		DYNAMIC_KINEMATIC
-	};
-};
-
-struct ShapeType
-{
-	enum Enum
-	{
-		SPHERE,
-		CAPSULE,
-		BOX,
-		CONVEX_HULL,
-		MESH,
-		HEIGHTFIELD,
-
-		COUNT
-	};
-};
-
-struct JointType
-{
-	enum Enum
-	{
-		FIXED,
-		HINGE,
-		SPRING,
-
-		COUNT
-	};
-};
-
-struct ControllerDesc
-{
-	float height;                // Height of the capsule
-	float radius;                // Radius of the capsule
-	float slope_limit;           // The maximum slope which the character can walk up in radians.
-	float step_offset;           // Maximum height of an obstacle which the character can climb.
-	float contact_offset;        // Skin around the object within which contacts will be generated. Use it to avoid numerical precision issues.
-	StringId32 collision_filter; // Collision filter from global.physics_config
-};
-
-struct ActorFlags
-{
-	enum Enum
-	{
-		LOCK_TRANSLATION_X = (1 << 0),
-		LOCK_TRANSLATION_Y = (1 << 1),
-		LOCK_TRANSLATION_Z = (1 << 2),
-		LOCK_ROTATION_X    = (1 << 3),
-		LOCK_ROTATION_Y    = (1 << 4),
-		LOCK_ROTATION_Z    = (1 << 5)
-	};
-};
-
-struct ActorResource
-{
-	StringId32 actor_class;      // Actor from global.physics
-	float mass;                  // Mass of the actor
-	uint32_t flags;              // ActorFlags
-	StringId32 collision_filter; // Collision filter from global.physics_config
-};
-
-struct SphereShape
-{
-	float radius;
-};
-
-struct CapsuleShape
-{
-	float radius;
-	float height;
-};
-
-struct BoxShape
-{
-	Vector3 half_size;
-};
-
-struct HeightfieldShape
-{
-	uint32_t width;
-	uint32_t length;
-	float height_scale;
-	float min_height;
-	float max_height;
-};
-
-struct ShapeDesc
-{
-	StringId32 shape_class;       // Shape class from global.physics_config
-	uint32_t type;                // ShapeType
-	StringId32 material;          // Material from global.physics_config
-	Matrix4x4 local_tm;           // In actor-space
-	SphereShape sphere;
-	CapsuleShape capsule;
-	BoxShape box;
-	HeightfieldShape heightfield;
-	// dynamic data               // Mesh, Heightfield
-};
-
-struct HingeJoint
-{
-	Vector3 axis;
-
-	bool use_motor;
-	float target_velocity;
-	float max_motor_impulse;
-
-	bool use_limits;
-	float lower_limit;
-	float upper_limit;
-	float bounciness;
-};
-
-struct JointDesc
-{
-	uint32_t type;    // JointType::Enum
-	Vector3 anchor_0;
-	Vector3 anchor_1;
-
-	bool breakable;
-	char _pad[3];
-	float break_force;
-
-	HingeJoint hinge;
-};
-
-struct CollisionGroup
-{
-	enum Enum
-	{
-		GROUP_0  = (1<<0), // Reserved
-		GROUP_1  = (1<<1),
-		GROUP_2  = (1<<2),
-		GROUP_3  = (1<<3),
-		GROUP_4  = (1<<4),
-		GROUP_5  = (1<<5),
-		GROUP_6  = (1<<6),
-		GROUP_7  = (1<<7),
-		GROUP_8  = (1<<8),
-		GROUP_9  = (1<<9),
-		GROUP_10 = (1<<10),
-		GROUP_11 = (1<<11),
-		GROUP_12 = (1<<12),
-		GROUP_13 = (1<<13),
-		GROUP_14 = (1<<14),
-		GROUP_15 = (1<<15),
-		GROUP_16 = (1<<16),
-		GROUP_17 = (1<<17),
-		GROUP_18 = (1<<18),
-		GROUP_19 = (1<<19),
-		GROUP_20 = (1<<20),
-		GROUP_21 = (1<<21),
-		GROUP_22 = (1<<22),
-		GROUP_23 = (1<<23),
-		GROUP_24 = (1<<24),
-		GROUP_25 = (1<<25),
-		GROUP_26 = (1<<26),
-		GROUP_27 = (1<<27),
-		GROUP_28 = (1<<28),
-		GROUP_29 = (1<<29),
-		GROUP_30 = (1<<30),
-		GROUP_31 = (1<<31)
-	};
-};
-
-struct RaycastMode
-{
-	enum Enum
-	{
-		CLOSEST,
-		ALL,
-
-		COUNT
-	};
-};
-
-struct RaycastHit
-{
-	ActorInstance actor;
-	Vector3 position;    // In world-space
-	Vector3 normal;      // In world-space
-};
-
-struct PhysicsCollisionEvent
-{
-	enum Type { BEGIN_TOUCH, END_TOUCH } type;
-	ActorInstance actors[2];
-	Vector3 where;
-	Vector3 normal;
-};
-
-struct PhysicsTriggerEvent
-{
-	enum Type { BEGIN_TOUCH, END_TOUCH } type;
-	ActorInstance trigger;
-	ActorInstance other;
-};
-
-struct PhysicsTransformEvent
-{
-	UnitId unit_id;
-	Matrix4x4 world_tm;
-};
-
-} // namespace crown

+ 0 - 2
src/world/physics_world.h

@@ -6,9 +6,7 @@
 #pragma once
 
 #include "event_stream.h"
-#include "graphics_types.h"
 #include "math_types.h"
-#include "physics_types.h"
 #include "resource_types.h"
 #include "world_types.h"
 

+ 1 - 2
src/world/render_world.h

@@ -8,9 +8,8 @@
 #include "container_types.h"
 #include "math_types.h"
 #include "resource_types.h"
-#include "graphics_types.h"
-#include "world_types.h"
 #include "string_id.h"
+#include "world_types.h"
 #include <bgfx/bgfx.h>
 
 namespace crown

+ 6 - 6
src/world/scene_graph.cpp

@@ -3,16 +3,16 @@
  * License: https://github.com/taylor001/crown/blob/master/LICENSE
  */
 
-#include "scene_graph.h"
-#include "quaternion.h"
-#include "vector3.h"
-#include "matrix3x3.h"
-#include "matrix4x4.h"
 #include "allocator.h"
 #include "array.h"
 #include "hash.h"
-#include <string.h> // memcpy
+#include "matrix3x3.h"
+#include "matrix4x4.h"
+#include "quaternion.h"
+#include "scene_graph.h"
+#include "vector3.h"
 #include <stdint.h> // UINT_MAX
+#include <string.h> // memcpy
 
 namespace crown
 {

+ 4 - 4
src/world/shader_manager.cpp

@@ -3,13 +3,13 @@
  * License: https://github.com/taylor001/crown/blob/master/LICENSE
  */
 
-#include "shader_manager.h"
-#include "sort_map.h"
-#include "resource_manager.h"
+#include "array.h"
 #include "reader_writer.h"
+#include "resource_manager.h"
 #include "shader.h"
+#include "shader_manager.h"
+#include "sort_map.h"
 #include "string_utils.h"
-#include "array.h"
 
 namespace crown
 {

+ 1 - 1
src/world/sound_world.h

@@ -5,11 +5,11 @@
 
 #pragma once
 
-#include "audio_types.h"
 #include "math_types.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "types.h"
+#include "world_types.h"
 
 namespace crown
 {

+ 0 - 3
src/world/world.h

@@ -5,12 +5,9 @@
 
 #pragma once
 
-#include "audio_types.h"
 #include "event_stream.h"
-#include "graphics_types.h"
 #include "lua_types.h"
 #include "math_types.h"
-#include "physics_types.h"
 #include "resource_types.h"
 #include "string_id.h"
 #include "types.h"

+ 326 - 19
src/world/world_types.h

@@ -5,17 +5,179 @@
 
 #pragma once
 
-#include "types.h"
 #include "math_types.h"
+#include "string_id.h"
+#include "types.h"
 
 namespace crown
 {
 
 class Level;
+class MaterialManager;
+class PhysicsWorld;
+class RenderWorld;
+class ShaderManager;
+class SoundWorld;
 class UnitManager;
 class World;
+struct DebugLine;
+struct Gui;
+struct Material;
 struct SceneGraph;
 
+typedef uint32_t SoundInstanceId;
+
+/// Enumerates camera projection types.
+///
+/// @ingroup Graphics
+struct ProjectionType
+{
+	enum Enum
+	{
+		ORTHOGRAPHIC,
+		PERSPECTIVE,
+
+		COUNT
+	};
+};
+
+/// Enumerates light types.
+///
+/// @ingroup Graphics
+struct LightType
+{
+	enum Enum
+	{
+		DIRECTIONAL,
+		OMNI,
+		SPOT,
+
+		COUNT
+	};
+};
+
+struct ActorType
+{
+	enum Enum
+	{
+		STATIC,
+		DYNAMIC_PHYSICAL,
+		DYNAMIC_KINEMATIC,
+
+		COUNT
+	};
+};
+
+struct ActorFlags
+{
+	enum Enum
+	{
+		LOCK_TRANSLATION_X = (1 << 0),
+		LOCK_TRANSLATION_Y = (1 << 1),
+		LOCK_TRANSLATION_Z = (1 << 2),
+		LOCK_ROTATION_X    = (1 << 3),
+		LOCK_ROTATION_Y    = (1 << 4),
+		LOCK_ROTATION_Z    = (1 << 5)
+	};
+};
+
+struct ShapeType
+{
+	enum Enum
+	{
+		SPHERE,
+		CAPSULE,
+		BOX,
+		CONVEX_HULL,
+		MESH,
+		HEIGHTFIELD,
+
+		COUNT
+	};
+};
+
+struct JointType
+{
+	enum Enum
+	{
+		FIXED,
+		HINGE,
+		SPRING,
+
+		COUNT
+	};
+};
+
+struct CollisionGroup
+{
+	enum Enum
+	{
+		GROUP_0  = (1<<0), // Reserved
+		GROUP_1  = (1<<1),
+		GROUP_2  = (1<<2),
+		GROUP_3  = (1<<3),
+		GROUP_4  = (1<<4),
+		GROUP_5  = (1<<5),
+		GROUP_6  = (1<<6),
+		GROUP_7  = (1<<7),
+		GROUP_8  = (1<<8),
+		GROUP_9  = (1<<9),
+		GROUP_10 = (1<<10),
+		GROUP_11 = (1<<11),
+		GROUP_12 = (1<<12),
+		GROUP_13 = (1<<13),
+		GROUP_14 = (1<<14),
+		GROUP_15 = (1<<15),
+		GROUP_16 = (1<<16),
+		GROUP_17 = (1<<17),
+		GROUP_18 = (1<<18),
+		GROUP_19 = (1<<19),
+		GROUP_20 = (1<<20),
+		GROUP_21 = (1<<21),
+		GROUP_22 = (1<<22),
+		GROUP_23 = (1<<23),
+		GROUP_24 = (1<<24),
+		GROUP_25 = (1<<25),
+		GROUP_26 = (1<<26),
+		GROUP_27 = (1<<27),
+		GROUP_28 = (1<<28),
+		GROUP_29 = (1<<29),
+		GROUP_30 = (1<<30),
+		GROUP_31 = (1<<31)
+	};
+};
+
+struct RaycastMode
+{
+	enum Enum
+	{
+		CLOSEST,
+		ALL,
+
+		COUNT
+	};
+};
+
+/// Enumerates world event types.
+///
+/// @ingroup World
+struct EventType
+{
+	enum Enum
+	{
+		UNIT_SPAWNED,
+		UNIT_DESTROYED,
+
+		LEVEL_LOADED,
+
+		PHYSICS_COLLISION,
+		PHYSICS_TRIGGER,
+		PHYSICS_TRANSFORM,
+
+		COUNT
+	};
+};
+
 #define UNIT_INDEX_BITS 22
 #define UNIT_INDEX_MASK 0x003fffff
 #define UNIT_ID_BITS    8
@@ -63,15 +225,66 @@ struct CameraInstance
 	uint32_t i;
 };
 
-struct ProjectionType
+struct MeshInstance
 {
-	enum Enum
-	{
-		ORTHOGRAPHIC,
-		PERSPECTIVE,
+	uint32_t i;
+};
 
-		COUNT
-	};
+struct SpriteInstance
+{
+	uint32_t i;
+};
+
+struct LightInstance
+{
+	uint32_t i;
+};
+
+struct ColliderInstance
+{
+	uint32_t i;
+};
+
+struct ActorInstance
+{
+	uint32_t i;
+};
+
+struct ControllerInstance
+{
+	uint32_t i;
+};
+
+struct JointInstance
+{
+	uint32_t i;
+};
+
+struct MeshRendererDesc
+{
+	StringId64 mesh_resource;
+	StringId32 mesh_name;
+	StringId64 material_resource; // FIXME
+	bool visible;
+	char _pad[3];
+};
+
+struct SpriteRendererDesc
+{
+	StringId64 sprite_resource;
+	StringId64 material_resource; // FIXME
+	bool visible;
+	char _pad[3];
+	char _pad1[4];
+};
+
+struct LightDesc
+{
+	uint32_t type;    // LightType::Enum
+	float range;      // In meters
+	float intensity;
+	float spot_angle; // In radians
+	Vector3 color;
 };
 
 struct TransformDesc
@@ -89,21 +302,94 @@ struct CameraDesc
 	float far_range;
 };
 
-struct EventType
+struct ControllerDesc
 {
-	enum Enum
-	{
-		UNIT_SPAWNED,
-		UNIT_DESTROYED,
+	float height;                // Height of the capsule
+	float radius;                // Radius of the capsule
+	float slope_limit;           // The maximum slope which the character can walk up in radians.
+	float step_offset;           // Maximum height of an obstacle which the character can climb.
+	float contact_offset;        // Skin around the object within which contacts will be generated. Use it to avoid numerical precision issues.
+	StringId32 collision_filter; // Collision filter from global.physics_config
+};
 
-		LEVEL_LOADED,
+struct ActorResource
+{
+	StringId32 actor_class;      // Actor from global.physics
+	float mass;                  // Mass of the actor
+	uint32_t flags;              // ActorFlags
+	StringId32 collision_filter; // Collision filter from global.physics_config
+};
 
-		PHYSICS_COLLISION,
-		PHYSICS_TRIGGER,
-		PHYSICS_TRANSFORM,
+struct SphereShape
+{
+	float radius;
+};
 
-		COUNT
-	};
+struct CapsuleShape
+{
+	float radius;
+	float height;
+};
+
+struct BoxShape
+{
+	Vector3 half_size;
+};
+
+struct HeightfieldShape
+{
+	uint32_t width;
+	uint32_t length;
+	float height_scale;
+	float min_height;
+	float max_height;
+};
+
+struct ShapeDesc
+{
+	StringId32 shape_class;       // Shape class from global.physics_config
+	uint32_t type;                // ShapeType
+	StringId32 material;          // Material from global.physics_config
+	Matrix4x4 local_tm;           // In actor-space
+	SphereShape sphere;
+	CapsuleShape capsule;
+	BoxShape box;
+	HeightfieldShape heightfield;
+	// dynamic data               // Mesh, Heightfield
+};
+
+struct HingeJoint
+{
+	Vector3 axis;
+
+	bool use_motor;
+	float target_velocity;
+	float max_motor_impulse;
+
+	bool use_limits;
+	float lower_limit;
+	float upper_limit;
+	float bounciness;
+};
+
+struct JointDesc
+{
+	uint32_t type;    // JointType::Enum
+	Vector3 anchor_0;
+	Vector3 anchor_1;
+
+	bool breakable;
+	char _pad[3];
+	float break_force;
+
+	HingeJoint hinge;
+};
+
+struct RaycastHit
+{
+	ActorInstance actor;
+	Vector3 position;    // In world-space
+	Vector3 normal;      // In world-space
 };
 
 struct UnitSpawnedEvent
@@ -122,4 +408,25 @@ struct LevelLoadedEvent
 {
 };
 
+struct PhysicsCollisionEvent
+{
+	enum Type { BEGIN_TOUCH, END_TOUCH } type;
+	ActorInstance actors[2];
+	Vector3 where;
+	Vector3 normal;
+};
+
+struct PhysicsTriggerEvent
+{
+	enum Type { BEGIN_TOUCH, END_TOUCH } type;
+	ActorInstance trigger;
+	ActorInstance other;
+};
+
+struct PhysicsTransformEvent
+{
+	UnitId unit_id;
+	Matrix4x4 world_tm;
+};
+
 } // namespace crown