Merge branch 'main' into AudioImplementation

This commit is contained in:
mushgunAX 2023-02-04 00:31:23 +08:00
commit c7b99df2f6
31 changed files with 3211 additions and 210 deletions

View File

@ -1,16 +1,16 @@
0 1 3 0 1 0000000000000000
1 2 65535 1 2 0000000000000000
2 3 65534 2 3 0000000000000000
3 4 65534 3 4 0000000000000000
4 5 65534 4 5 0000000000000000
5 6 65534 5 6 0000000000000000
6 7 65534 6 7 0000000000000000
7 8 65534 7 8 0000000000000000
8 9 65534 8 9 0000000000000000
9 10 65534 9 10 0000000000000000
10 11 65534 10 11 0000000000000000
11 12 65534 11 12 0000000000000000
12 13 65534 12 13 0000000000000000
13 14 65534 13 14 0000000000000000
14 15 65534 14 15 0000000000000000
15 16 65534 15 16 0000000000000000

View File

@ -132,23 +132,23 @@ Size=165,120
Collapsed=0 Collapsed=0
[Table][0x9D40AE32,17] [Table][0x9D40AE32,17]
Column 0 Weight=0.9945 Column 0 Weight=1.0696
Column 1 Weight=0.9945 Column 1 Weight=0.9194
Column 2 Weight=0.9945 Column 2 Weight=0.9945
Column 3 Weight=0.9945 Column 3 Weight=1.0320
Column 4 Weight=0.9945 Column 4 Weight=0.9570
Column 5 Weight=0.9945 Column 5 Weight=0.9945
Column 6 Weight=0.9945 Column 6 Weight=0.9945
Column 7 Weight=0.9945 Column 7 Weight=0.9945
Column 8 Weight=0.9945 Column 8 Weight=0.9945
Column 9 Weight=0.9945 Column 9 Weight=1.0320
Column 10 Weight=0.9945 Column 10 Weight=0.9570
Column 11 Weight=0.9945 Column 11 Weight=1.0133
Column 12 Weight=1.0132 Column 12 Weight=0.9945
Column 13 Weight=0.8444 Column 13 Weight=0.8444
Column 14 Weight=0.9945 Column 14 Weight=0.9945
Column 15 Weight=1.2009 Column 15 Weight=0.8632
Column 16 Weight=1.0132 Column 16 Weight=1.3510
[Docking][Data] [Docking][Data]
DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=1920,941 Split=X DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=1920,941 Split=X
@ -159,7 +159,7 @@ DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=1920,941 Split
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1130,1036 Split=Y Selected=0xB41284E7 DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1130,1036 Split=Y Selected=0xB41284E7
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=1501,672 Split=Y Selected=0xB41284E7 DockNode ID=0x00000007 Parent=0x00000002 SizeRef=1501,672 Split=Y Selected=0xB41284E7
DockNode ID=0x00000009 Parent=0x00000007 SizeRef=1501,700 Split=Y Selected=0xB41284E7 DockNode ID=0x00000009 Parent=0x00000007 SizeRef=1501,700 Split=Y Selected=0xB41284E7
DockNode ID=0x0000000B Parent=0x00000009 SizeRef=1501,705 CentralNode=1 Selected=0xB41284E7 DockNode ID=0x0000000B Parent=0x00000009 SizeRef=1501,705 CentralNode=1 Selected=0x69428B24
DockNode ID=0x0000000C Parent=0x00000009 SizeRef=1501,234 Selected=0xB128252A DockNode ID=0x0000000C Parent=0x00000009 SizeRef=1501,234 Selected=0xB128252A
DockNode ID=0x0000000A Parent=0x00000007 SizeRef=1501,310 Selected=0xD446F7B6 DockNode ID=0x0000000A Parent=0x00000007 SizeRef=1501,310 Selected=0xD446F7B6
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=1501,338 Selected=0xD9F31532 DockNode ID=0x00000008 Parent=0x00000002 SizeRef=1501,338 Selected=0xD9F31532

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest01_SkinningTest
ID: 72178939
Type: 4
Sub Assets:
Name: Cube
ID: 141097368
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest02_HierachyTest1
ID: 80500944
Type: 4
Sub Assets:
Name: Cube.001
ID: 135102560
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest03_HierachyTest2
ID: 72063399
Type: 4
Sub Assets:
Name: Cube.001
ID: 140361184
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest04_BakedIKLegTest
ID: 80728853
Type: 4
Sub Assets:
Name: Cube
ID: 149723808
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest05_MeshDeformTest
ID: 82124728
Type: 4
Sub Assets:
Name: Sphere
ID: 138773466
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest06_Piston
ID: 76715962
Type: 4
Sub Assets:
Name: Cube
ID: 134911040
Type: 8

View File

@ -2583,16 +2583,14 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: -1.48352981, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 150924328 Mesh: 150924328
Material: 132690168 Material: 132690168
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: FixRotation
Enabled: true
- EID: 2 - EID: 2
Name: DoorFrame Name: DoorFrame
IsActive: true IsActive: true
@ -4280,7 +4278,7 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 1 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Use Gravity: false Use Gravity: false
Interpolate: true Interpolate: true
@ -4304,29 +4302,7 @@
Position Offset: {x: 0, y: 0.25, z: 0} Position Offset: {x: 0, y: 0.25, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: PlayerController
Enabled: true
respawnPoint: 239
currentState: 0
maxMoveVel: 3
moveForce: 50
sprintMultiplier: 1.5
rotationFactorPerFrame: 5
maxJumpHeight: 2
maxJumpTime: 0.75
fallMultipler: 3
lightMultiper: 0.75
mediumMultiper: 0.5
heavyMultiper: 0.25
- Type: PickAndThrow
Enabled: true
throwForce: [8, 10, 8]
cameraArmOffSet: [0, 0.25, 0]
delayTimer: 1
aimingLength: 0.5
throwItem: false
rayDistance: 0.5
- EID: 196 - EID: 196
Name: HoldingPoint Name: HoldingPoint
IsActive: true IsActive: true
@ -4367,15 +4343,7 @@
Target Offset: {x: 0, y: 0, z: 0} Target Offset: {x: 0, y: 0, z: 0}
Camera Collision: true Camera Collision: true
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: SHADE_Scripting.ThirdPersonCamera
Enabled: true
armLength: 1
turnSpeedPitch: 0.300000012
turnSpeedYaw: 0.5
pitchClamp: 45
inverseXControls: true
inverseYControls: true
- EID: 194 - EID: 194
Name: PlayerBag Name: PlayerBag
IsActive: true IsActive: true
@ -4458,21 +4426,7 @@
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: ~ Components: ~
Scripts: Scripts: ~
- Type: GameManager
Enabled: true
winScene: 86098106
loseScene: 91685359
currGameState: 0
totalItemCount: 0
Score: 0
timer: 200
scoreText: 237
timeText: 206
multiplierText: 238
maxMultiplierDuration: 10
maxMultiplierCombo: 10
multiplierFont: 60
- EID: 235 - EID: 235
Name: ====AI===== Name: ====AI=====
IsActive: true IsActive: true
@ -4490,9 +4444,9 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
@ -4513,18 +4467,7 @@
Position Offset: {x: 0, y: 0.899999976, z: 0} Position Offset: {x: 0, y: 0.899999976, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: Homeowner1
Enabled: true
waypointsPool: 234
patrolSpeed: 1
chaseSpeed: 2
turningSpeed: 5
sightDistance: 8
eyeOffset: [0, 1.64999998, 0]
distanceToCapture: 0.5
captureTime: 0.5
footstepSFXIntervalMultiplier: 0.5
- EID: 234 - EID: 234
Name: ====WaypointPool==== Name: ====WaypointPool====
IsActive: true IsActive: true
@ -4598,7 +4541,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4621,13 +4564,7 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: Item
Enabled: true
Score: 50
currCategory: 1
density: 1
dontReturn: false
- EID: 227 - EID: 227
Name: Mesh_Cheese Name: Mesh_Cheese
IsActive: true IsActive: true
@ -4645,7 +4582,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4668,13 +4605,7 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: Item
Enabled: true
Score: 500
currCategory: 2
density: 1
dontReturn: false
- EID: 65778 - EID: 65778
Name: Mesh_Apple Name: Mesh_Apple
IsActive: true IsActive: true
@ -4692,7 +4623,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4715,13 +4646,7 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: Item
Enabled: true
Score: 10
currCategory: 0
density: 1
dontReturn: false
- EID: 229 - EID: 229
Name: ====ScoreZonePool==== Name: ====ScoreZonePool====
IsActive: true IsActive: true
@ -4739,9 +4664,9 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4764,9 +4689,7 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: ScoringZone
Enabled: true
- EID: 225 - EID: 225
Name: ScoreZone Name: ScoreZone
IsActive: true IsActive: true
@ -4778,9 +4701,9 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4803,9 +4726,7 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: ScoringZone
Enabled: true
- EID: 224 - EID: 224
Name: ScoreZone Name: ScoreZone
IsActive: true IsActive: true
@ -4817,9 +4738,9 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4842,9 +4763,7 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: ScoringZone
Enabled: true
- EID: 223 - EID: 223
Name: ScoreZone Name: ScoreZone
IsActive: true IsActive: true
@ -4856,9 +4775,9 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4881,9 +4800,7 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: ScoringZone
Enabled: true
- EID: 222 - EID: 222
Name: ScoreZone Name: ScoreZone
IsActive: true IsActive: true
@ -4895,9 +4812,9 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -4920,6 +4837,86 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts: ~
- Type: ScoringZone - EID: 217
Enabled: true Name: ===Anims===
IsActive: true
NumberOfChildren: 4
Components: ~
Scripts: ~
- EID: 221
Name: Obj1
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.301929057, y: 0.912136197, z: -9.20810795}
Rotate: {x: 0, y: 1.57079637, z: 0}
Scale: {x: 0.100000024, y: 0.100000024, z: 0.100000024}
IsActive: true
Renderable Component:
Mesh: 141097368
Material: 117923942
IsActive: true
Animator Component:
Rig: 72178939
Clip: 72178939
IsActive: true
Scripts: ~
- EID: 219
Name: Obj3
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.48987007, y: 0.868837833, z: -9.20810795}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 0.113750041, y: 0.113750041, z: 0.113750041}
IsActive: true
Renderable Component:
Mesh: 149723808
Material: 117923942
IsActive: true
Animator Component:
Rig: 80728853
Clip: 80728853
IsActive: true
Scripts: ~
- EID: 218
Name: Obj2
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1.47563028, y: 0.454107046, z: -9.20810795}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 0.0350000113, y: 0.0350000113, z: 0.0350000113}
IsActive: true
Renderable Component:
Mesh: 135102560
Material: 117923942
IsActive: true
Animator Component:
Rig: 80500944
Clip: 80500944
IsActive: true
Scripts: ~
- EID: 220
Name: Obj4
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -0.050871402, y: -0.0112784812, z: -8.23628521}
Rotate: {x: 0, y: -1.57079601, z: 0}
Scale: {x: 0.318530291, y: 0.318552583, z: 0.318530291}
IsActive: true
Renderable Component:
Mesh: 134911040
Material: 117923942
IsActive: true
Animator Component:
Rig: 76715962
Clip: 76715962
IsActive: true
Scripts: ~

View File

@ -13,7 +13,7 @@
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Use Gravity: false Use Gravity: false
Interpolate: true Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
@ -25,7 +25,7 @@
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 1 Collision Tag: 2
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006
@ -52,7 +52,7 @@
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 1 Collision Tag: 5
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006
@ -161,7 +161,7 @@
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 1 Collision Tag: 7
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006

View File

@ -82,7 +82,7 @@ public class PhysicsTestObj : Script
{ {
Ray colliderRay = new Ray(); Ray colliderRay = new Ray();
colliderRay.Direction = Vector3.Right; colliderRay.Direction = Vector3.Right;
Physics.ColliderRaycast(collider.Owner, colliderRay, false, 8); Physics.ColliderRaycast(collider.Owner, colliderRay, false, (ushort)64);
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {

View File

@ -16,48 +16,52 @@ namespace SHADE
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::PushID("CollisionTagNames"); ImGui::PushID("CollisionTagNames");
for (int i = SHCollisionTag::NUM_LAYERS; i >= 1; --i) // Draw Layers
// We have 16 layers for each tag
ImGui::TableNextColumn();
for (int i = 1; i <= SHCollisionTag::NUM_LAYERS; ++i)
{ {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if(i == SHCollisionTag::NUM_LAYERS) continue;
std::string const& tagName = SHCollisionTagMatrix::GetTagName(i); std::string const& tagName = SHCollisionTagMatrix::GetTagName(i);
auto tag = SHCollisionTagMatrix::GetTag(i); auto tag = SHCollisionTagMatrix::GetTag(i);
if (!tag) if (!tag)
continue; continue;
//ImGui::Text(tagName.data());
ImGui::PushID(i); // Show the layer number
SHEditorWidgets::InputText("##", [i]{return SHCollisionTagMatrix::GetTagName(i);}, [i](std::string const& value){SHCollisionTagMatrix::GetTag(i)->SetName(value);}, tagName.data(), ImGuiInputTextFlags_EnterReturnsTrue); ImGui::Text(std::to_string(i).c_str());
ImGui::PopID();
} }
ImGui::PopID(); ImGui::PopID();
// Draw the table
// Convenient how we have 16 layers & 16 tags huh?
for (int i = 0; i < SHCollisionTag::NUM_LAYERS - 1; ++i) for (int i = 0; i < SHCollisionTag::NUM_LAYERS - 1; ++i)
{ {
std::string tagName = SHCollisionTagMatrix::GetTagName(i); std::string tagName = SHCollisionTagMatrix::GetTagName(i);
auto tag = SHCollisionTagMatrix::GetTag(i); auto tag = SHCollisionTagMatrix::GetTag(i);
if(!tag) if(!tag)
continue; continue;
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text(tagName.data());
for (int j = (SHCollisionTag::NUM_LAYERS) - 1; j >= i; --j) ImGui::PushID(i);
SHEditorWidgets::InputText("##", [i]{return SHCollisionTagMatrix::GetTagName(i);}, [i](std::string const& value){SHCollisionTagMatrix::GetTag(i)->SetName(value);}, tagName.data(), ImGuiInputTextFlags_EnterReturnsTrue);
ImGui::PopID();
// The checkboxes are just to set the layers of each tag
// Nothing else should be altered.
for (int j = 0; j < SHCollisionTag::NUM_LAYERS; ++j)
{ {
int idx = j;
std::string tagName2 = SHCollisionTagMatrix::GetTagName(idx);
auto tag2 = SHCollisionTagMatrix::GetTag(idx);
if(!tag2)
continue;
if(tagName.empty())
tagName = std::to_string(i);
if(tagName2.empty())
tagName2 = std::to_string(idx);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if(i == idx)
continue; std::string label = std::format("##{}, Layer {}", tagName, j);
std::string label = std::format("##{} vs {}", tagName, tagName2); if (SHEditorWidgets::CheckBox(label, [tag, &j] {return tag->GetLayerState(j); }, [tag, j](bool const& value) {tag->SetLayerState(j, value); }, label.substr(2)))
if (SHEditorWidgets::CheckBox(label, [tag, &idx] {return tag->GetLayerState(idx); }, [tag, i, idx](bool const& value) {tag->SetLayerState(idx, value); SHCollisionTagMatrix::GetTag(idx)->SetLayerState(i, value); }, label.substr(2)))
{ {
isDirty = true; isDirty = true;
} }
@ -77,7 +81,7 @@ namespace SHADE
{ {
std::filesystem::path defaultCollisionTagNameFilePath{ ASSET_ROOT }; std::filesystem::path defaultCollisionTagNameFilePath{ ASSET_ROOT };
defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig"); defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig");
SHCollisionTagMatrix::Exit(defaultCollisionTagNameFilePath); SHCollisionTagMatrix::SaveToFile(defaultCollisionTagNameFilePath);
isDirty = false; isDirty = false;
} }
ImGui::EndDisabled(); ImGui::EndDisabled();

View File

@ -166,7 +166,7 @@ namespace SHADE
/* Public Function Member Definitions */ /* Public Function Member Definitions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void SHCollisionTagMatrix::Init(const std::filesystem::path& tagNameFilePath) noexcept void SHCollisionTagMatrix::LoadFromFile(const std::filesystem::path& tagNameFilePath) noexcept
{ {
/** /**
* I HATE FILE IO * I HATE FILE IO
@ -240,13 +240,17 @@ namespace SHADE
, linesRead + 1 , linesRead + 1
, tagIndex , tagIndex
) )
collisionTags[tagIndex].SetMask(mask);
} }
else else
{ {
mask = static_cast<uint16_t>(std::stoi(maskString)); for (int i = 0; i < SHCollisionTag::NUM_LAYERS; ++i)
{
const bool LAYER_STATE = maskString[i] == '1';
collisionTags[tagIndex].SetLayerState(i, LAYER_STATE);
}
} }
collisionTags[tagIndex].SetMask(mask);
ss.clear(); ss.clear();
} }
@ -254,7 +258,7 @@ namespace SHADE
collisionTagNamesFile.close(); collisionTagNamesFile.close();
} }
void SHCollisionTagMatrix::Exit(const std::filesystem::path& tagNameFilePath) noexcept void SHCollisionTagMatrix::SaveToFile(const std::filesystem::path& tagNameFilePath) noexcept
{ {
std::ofstream collisionTagNamesFile { tagNameFilePath }; std::ofstream collisionTagNamesFile { tagNameFilePath };
@ -266,7 +270,15 @@ namespace SHADE
// Index Name Mask // Index Name Mask
for (int i = 0; i < SHCollisionTag::NUM_LAYERS; ++i) for (int i = 0; i < SHCollisionTag::NUM_LAYERS; ++i)
collisionTagNamesFile << i << " " << collisionTags[i].GetName() << " " << collisionTags[i].GetMask() << std::endl; {
collisionTagNamesFile << i << " " << collisionTags[i].GetName() << " ";
// Write 1 or 0 for each layer for improved clarity
for (int j = 0; j < SHCollisionTag::NUM_LAYERS; ++j)
collisionTagNamesFile << (collisionTags[i].GetMask() & 1U << j ? 1 : 0);
collisionTagNamesFile << std::endl;
}
collisionTagNamesFile.close(); collisionTagNamesFile.close();
} }

View File

@ -55,8 +55,8 @@ namespace SHADE
/* Function Members */ /* Function Members */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
static void Init (const std::filesystem::path& tagNameFilePath) noexcept; static void LoadFromFile (const std::filesystem::path& tagNameFilePath) noexcept;
static void Exit (const std::filesystem::path& tagNameFilePath) noexcept; static void SaveToFile (const std::filesystem::path& tagNameFilePath) noexcept;
/** /**
* @brief * @brief

View File

@ -120,8 +120,11 @@ namespace SHADE
collisionTag = newCollisionTag; collisionTag = newCollisionTag;
if (rp3dCollider) if (rp3dCollider)
{
rp3dCollider->setCollisionCategoryBits(collisionTag->GetMask());
rp3dCollider->setCollideWithMaskBits(collisionTag->GetMask()); rp3dCollider->setCollideWithMaskBits(collisionTag->GetMask());
} }
}
void SHCollisionShape::SetFriction(float friction) noexcept void SHCollisionShape::SetFriction(float friction) noexcept
{ {
@ -144,7 +147,12 @@ namespace SHADE
material.SetDensity(density); material.SetDensity(density);
if (rp3dCollider) if (rp3dCollider)
{
rp3dCollider->getMaterial().setMassDensity(material.GetDensity()); rp3dCollider->getMaterial().setMassDensity(material.GetDensity());
// Recompute the bodies' mass
dynamic_cast<rp3d::RigidBody*>(collider->collisionBody)->updateMassPropertiesFromColliders();
}
} }
void SHCollisionShape::SetMaterial(const SHPhysicsMaterial& newMaterial) noexcept void SHCollisionShape::SetMaterial(const SHPhysicsMaterial& newMaterial) noexcept
@ -157,6 +165,9 @@ namespace SHADE
rp3dMaterial.setFrictionCoefficient(material.GetFriction()); rp3dMaterial.setFrictionCoefficient(material.GetFriction());
rp3dMaterial.setBounciness(material.GetBounciness()); rp3dMaterial.setBounciness(material.GetBounciness());
rp3dMaterial.setMassDensity(material.GetDensity()); rp3dMaterial.setMassDensity(material.GetDensity());
// Recompute the bodies' mass
dynamic_cast<rp3d::RigidBody*>(collider->collisionBody)->updateMassPropertiesFromColliders();
} }
} }
@ -180,7 +191,13 @@ namespace SHADE
isTrigger ? flags |= FLAG_VALUE : flags &= ~FLAG_VALUE; isTrigger ? flags |= FLAG_VALUE : flags &= ~FLAG_VALUE;
if (rp3dCollider) if (rp3dCollider)
{
rp3dCollider->setIsTrigger(isTrigger); rp3dCollider->setIsTrigger(isTrigger);
// Recompute the bodies' mass
dynamic_cast<rp3d::RigidBody*>(collider->collisionBody)->updateMassPropertiesFromColliders();
}
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
@ -189,9 +206,12 @@ namespace SHADE
void SHCollisionShape::UpdateCollisionTags() noexcept void SHCollisionShape::UpdateCollisionTags() noexcept
{ {
if (collisionTag->IsDirty()) if (rp3dCollider && collisionTag->IsDirty())
{
rp3dCollider->setCollisionCategoryBits(collisionTag->GetMask());
rp3dCollider->setCollideWithMaskBits(collisionTag->GetMask()); rp3dCollider->setCollideWithMaskBits(collisionTag->GetMask());
} }
}
void SHCollisionShape::Update() noexcept void SHCollisionShape::Update() noexcept

View File

@ -210,9 +210,6 @@ namespace SHADE
{ {
.entityID = rigidBody->GetEID() .entityID = rigidBody->GetEID()
, .bodyType = rigidBody->type , .bodyType = rigidBody->type
, .interpolate = rigidBody->interpolate
, .drag = rigidBody->drag
, .angularDrag = rigidBody->angularDrag
}; };
rigidBodyQueue.push(RIGID_BODY_DEF); rigidBodyQueue.push(RIGID_BODY_DEF);
@ -232,22 +229,8 @@ namespace SHADE
SHColliderDef::ShapeDef shapeDef SHColliderDef::ShapeDef shapeDef
{ {
.type = shape->GetType() .type = shape->GetType()
, .posOffset = shape->GetPositionOffset()
, .rotOffset = shape->GetRotationOffset()
}; };
switch (shape->GetType())
{
case SHCollisionShape::Type::SPHERE:
shapeDef.size.x = dynamic_cast<const SHSphere*>(shape)->GetWorldRadius();
break;
case SHCollisionShape::Type::BOX:
shapeDef.size = dynamic_cast<const SHBox*>(shape)->GetWorldExtents();
break;
default:
break;
}
colliderDef.shapes.emplace_back(shapeDef); colliderDef.shapes.emplace_back(shapeDef);
} }
@ -311,9 +294,9 @@ namespace SHADE
rigidBodyComponent->SetFreezeRotationY (rigidBodyComponent->GetFreezeRotationY()); rigidBodyComponent->SetFreezeRotationY (rigidBodyComponent->GetFreezeRotationY());
rigidBodyComponent->SetFreezeRotationZ (rigidBodyComponent->GetFreezeRotationZ()); rigidBodyComponent->SetFreezeRotationZ (rigidBodyComponent->GetFreezeRotationZ());
rigidBodyComponent->SetInterpolate (DEF.interpolate); rigidBodyComponent->SetInterpolate (rigidBodyComponent->IsInterpolating());
rigidBodyComponent->SetDrag (DEF.drag); rigidBodyComponent->SetDrag (rigidBodyComponent->GetDrag());
rigidBodyComponent->SetAngularDrag (DEF.angularDrag); rigidBodyComponent->SetAngularDrag (rigidBodyComponent->GetAngularDrag());
rigidBodyQueue.pop(); rigidBodyQueue.pop();
} }

View File

@ -47,9 +47,6 @@ namespace SHADE
{ {
EntityID entityID = MAX_EID; EntityID entityID = MAX_EID;
SHRigidBodyComponent::Type bodyType = SHRigidBodyComponent::Type::STATIC; SHRigidBodyComponent::Type bodyType = SHRigidBodyComponent::Type::STATIC;
bool interpolate = true;
float drag = 0.0f;
float angularDrag = 0.0f;
}; };
struct SHColliderDef struct SHColliderDef
@ -57,9 +54,6 @@ namespace SHADE
struct ShapeDef struct ShapeDef
{ {
SHCollisionShape::Type type = SHCollisionShape::Type::SPHERE; SHCollisionShape::Type type = SHCollisionShape::Type::SPHERE;
SHVec3 posOffset = SHVec3::Zero;
SHVec3 rotOffset = SHVec3::Zero;
SHVec3 size = SHVec3::Zero; // x for sphere radius, all 3 for box extents
}; };
EntityID entityID = MAX_EID; EntityID entityID = MAX_EID;

View File

@ -42,6 +42,7 @@ namespace SHADE
/* Friends */ /* Friends */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
friend class SHCollisionShape;
friend class SHPhysicsSystem; friend class SHPhysicsSystem;
friend class SHPhysicsObjectManager; friend class SHPhysicsObjectManager;

View File

@ -122,7 +122,7 @@ namespace SHADE
// Initialise collision tags // Initialise collision tags
std::filesystem::path defaultCollisionTagNameFilePath { ASSET_ROOT }; std::filesystem::path defaultCollisionTagNameFilePath { ASSET_ROOT };
defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig"); defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig");
SHCollisionTagMatrix::Init(defaultCollisionTagNameFilePath); SHCollisionTagMatrix::LoadFromFile(defaultCollisionTagNameFilePath);
// Register Events // Register Events
for (int i = 0; i < NUM_EVENT_FUNCTIONS; ++i) for (int i = 0; i < NUM_EVENT_FUNCTIONS; ++i)
@ -145,7 +145,7 @@ namespace SHADE
// Write collision tag names to file // Write collision tag names to file
std::filesystem::path defaultCollisionTagNameFilePath { ASSET_ROOT }; std::filesystem::path defaultCollisionTagNameFilePath { ASSET_ROOT };
defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig"); defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig");
SHCollisionTagMatrix::Exit(defaultCollisionTagNameFilePath); SHCollisionTagMatrix::SaveToFile(defaultCollisionTagNameFilePath);
} }
const std::vector<SHPhysicsRaycastResult>& SHPhysicsSystem::Raycast(const SHRaycaster::RaycastInfo& info) noexcept const std::vector<SHPhysicsRaycastResult>& SHPhysicsSystem::Raycast(const SHRaycaster::RaycastInfo& info) noexcept
@ -155,7 +155,7 @@ namespace SHADE
// Load start and end points into the container for debug drawing // Load start and end points into the container for debug drawing
#ifdef SHEDITOR #ifdef SHEDITOR
SHVec3 endPos = info.ray.position + info.ray.direction * std::clamp(info.distance,0.0f, SHRay::MAX_RAYCAST_DIST); SHVec3 endPos = info.ray.position + info.ray.direction * std::clamp(info.distance, 0.0f, SHRay::MAX_RAYCAST_DIST);
if (!results.empty()) if (!results.empty())
endPos = results.back().position; endPos = results.back().position;