-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5536 from mozilla/bitecs-experiment
New Entity Framework
- Loading branch information
Showing
88 changed files
with
3,721 additions
and
2,550 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { addComponent, removeComponent } from "bitecs"; | ||
import { | ||
RemoteRight, | ||
RemoteLeft, | ||
HandRight, | ||
HandLeft, | ||
RemoteHoverTarget, | ||
NotRemoteHoverTarget, | ||
RemoveNetworkedEntityButton, | ||
DestroyAtExtremeDistance | ||
} from "./bit-components"; | ||
|
||
[ | ||
["remote-right", RemoteRight], | ||
["remote-left", RemoteLeft], | ||
["hand-right", HandRight], | ||
["hand-left", HandLeft], | ||
["is-remote-hover-target", RemoteHoverTarget], | ||
["is-not-remote-hover-target", NotRemoteHoverTarget], | ||
["remove-networked-object-button", RemoveNetworkedEntityButton], | ||
["destroy-at-extreme-distances", DestroyAtExtremeDistance] | ||
].forEach(([aframeComponentName, bitecsComponent]) => { | ||
AFRAME.registerComponent(aframeComponentName, { | ||
init: function() { | ||
addComponent(APP.world, bitecsComponent, this.el.object3D.eid); | ||
}, | ||
remove: function() { | ||
removeComponent(APP.world, bitecsComponent, this.el.object3D.eid); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { defineComponent, setDefaultSize, Types } from "bitecs"; | ||
|
||
// TODO this has to happen before all components are defined. Is there a better spot to be doing this? | ||
setDefaultSize(10000); | ||
|
||
export const $isStringType = Symbol("isStringType"); | ||
|
||
export const Networked = defineComponent({ | ||
id: Types.ui32, | ||
creator: Types.ui32, | ||
owner: Types.ui32, | ||
|
||
lastOwnerTime: Types.ui32 | ||
}); | ||
Networked.id[$isStringType] = true; | ||
Networked.creator[$isStringType] = true; | ||
Networked.owner[$isStringType] = true; | ||
|
||
export const Owned = defineComponent(); | ||
export const NetworkedMediaFrame = defineComponent({ | ||
capturedNid: Types.ui32, | ||
scale: [Types.f32, 3] | ||
}); | ||
NetworkedMediaFrame.capturedNid[$isStringType] = true; | ||
|
||
export const MediaFrame = defineComponent({ | ||
capturedNid: Types.ui32, | ||
scale: [Types.f32, 3], | ||
mediaType: Types.ui8, | ||
bounds: [Types.f32, 3], | ||
preview: Types.eid, | ||
previewingNid: Types.eid | ||
}); | ||
export const Text = defineComponent(); | ||
export const Slice9 = defineComponent({ | ||
insets: [Types.ui32, 4], | ||
size: [Types.f32, 2] | ||
}); | ||
|
||
export const NetworkedTransform = defineComponent({ | ||
position: [Types.f32, 3], | ||
rotation: [Types.f32, 4], | ||
scale: [Types.f32, 3] | ||
}); | ||
|
||
export const AEntity = defineComponent(); | ||
export const Object3DTag = defineComponent(); | ||
export const GLTFModel = defineComponent(); | ||
export const CursorRaycastable = defineComponent(); | ||
export const RemoteHoverTarget = defineComponent(); | ||
export const NotRemoteHoverTarget = defineComponent(); | ||
export const Holdable = defineComponent(); | ||
export const RemoveNetworkedEntityButton = defineComponent(); | ||
export const Interacted = defineComponent(); | ||
|
||
export const HandRight = defineComponent(); | ||
export const HandLeft = defineComponent(); | ||
export const RemoteRight = defineComponent(); | ||
export const RemoteLeft = defineComponent(); | ||
export const HoveredHandRight = defineComponent(); | ||
export const HoveredHandLeft = defineComponent(); | ||
export const HoveredRemoteRight = defineComponent(); | ||
export const HoveredRemoteLeft = defineComponent(); | ||
export const HeldHandRight = defineComponent(); | ||
export const HeldHandLeft = defineComponent(); | ||
export const HeldRemoteRight = defineComponent(); | ||
export const HeldRemoteLeft = defineComponent(); | ||
export const Held = defineComponent(); | ||
export const OffersRemoteConstraint = defineComponent(); | ||
export const HandCollisionTarget = defineComponent(); | ||
export const OffersHandConstraint = defineComponent(); | ||
export const TogglesHoveredActionSet = defineComponent(); | ||
|
||
export const HoverButton = defineComponent({ type: Types.ui8 }); | ||
export const TextButton = defineComponent({ labelRef: Types.eid }); | ||
export const HoldableButton = defineComponent(); | ||
export const SingleActionButton = defineComponent(); | ||
|
||
export const Pen = defineComponent(); | ||
export const HoverMenuChild = defineComponent(); | ||
export const Static = defineComponent(); | ||
export const Inspectable = defineComponent(); | ||
export const PreventAudioBoost = defineComponent(); | ||
export const IgnoreSpaceBubble = defineComponent(); | ||
export const Rigidbody = defineComponent({ | ||
bodyId: Types.ui16, | ||
collisionGroup: Types.ui32, | ||
collisionMask: Types.ui32, | ||
flags: Types.ui8, | ||
gravity: Types.f32 | ||
}); | ||
export const PhysicsShape = defineComponent({ bodyId: Types.ui16, shapeId: Types.ui16, halfExtents: [Types.f32, 3] }); | ||
export const Pinnable = defineComponent(); | ||
export const Pinned = defineComponent(); | ||
export const DestroyAtExtremeDistance = defineComponent(); | ||
|
||
export const MediaLoading = defineComponent(); | ||
|
||
export const FloatyObject = defineComponent({ flags: Types.ui8, releaseGravity: Types.f32 }); | ||
export const MakeKinematicOnRelease = defineComponent(); | ||
|
||
export const CameraTool = defineComponent({ | ||
snapTime: Types.f32, | ||
state: Types.ui8, | ||
captureDurIdx: Types.ui8, | ||
trackTarget: Types.eid, | ||
|
||
snapMenuRef: Types.eid, | ||
button_next: Types.eid, | ||
button_prev: Types.eid, | ||
snapRef: Types.eid, | ||
cancelRef: Types.eid, | ||
recVideoRef: Types.eid, | ||
screenRef: Types.eid, | ||
selfieScreenRef: Types.eid, | ||
cameraRef: Types.eid, | ||
countdownLblRef: Types.eid, | ||
captureDurLblRef: Types.eid, | ||
sndToggleRef: Types.eid | ||
}); | ||
export const MyCameraTool = defineComponent(); |
Oops, something went wrong.