Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/engine/benchmarks/AvatarBenchmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { UserID } from '@ir-engine/common/src/schema.type.module'
import {
Engine,
Entity,
EntityTreeComponent,
EntityUUID,
UUIDComponent,
createEntity,
getComponent,
removeEntityNodeRecursively,
setComponent,
useComponent,
useOptionalComponent
Expand All @@ -25,10 +27,6 @@ import { TransformComponent } from '@ir-engine/spatial'
import { RigidBodyComponent } from '@ir-engine/spatial/src/physics/components/RigidBodyComponent'
import { ObjectComponent } from '@ir-engine/spatial/src/renderer/components/ObjectComponent'
import { VisibleComponent, setVisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import {
EntityTreeComponent,
removeEntityNodeRecursively
} from '@ir-engine/spatial/src/transform/components/EntityTree'
import React, { useEffect } from 'react'
import { Group, MathUtils, Quaternion, Vector3 } from 'three'
import {
Expand Down
2 changes: 1 addition & 1 deletion src/examples/GLTFs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { State, getMutableState, useImmediateEffect } from '@ir-engine/hyperflux
import { Entity, EntityUUID, UUIDComponent, createEntity, removeEntity } from '@ir-engine/ecs'

import config from '@ir-engine/common/src/config'
import { EntityTreeComponent } from '@ir-engine/ecs'
import { AnimationComponent } from '@ir-engine/engine/src/avatar/components/AnimationComponent'
import { GLTFComponent } from '@ir-engine/engine/src/gltf/GLTFComponent'
import { ModelComponent } from '@ir-engine/engine/src/scene/components/ModelComponent'
import { AmbientLightComponent, DirectionalLightComponent, TransformComponent } from '@ir-engine/spatial'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { RendererState } from '@ir-engine/spatial/src/renderer/RendererState'
import { VisibleComponent, setVisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { AnimationClip, Color, Euler, Quaternion } from 'three'
import { RouteData } from '../sceneRoute'
import { useExampleEntity } from './utils/common/entityUtils'
Expand Down
6 changes: 2 additions & 4 deletions src/examples/MultipleCanvasCameras.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import config from '@ir-engine/common/src/config'
import {
EntityTreeComponent,
EntityUUID,
UUIDComponent,
UndefinedEntity,
createEntity,
generateEntityUUID,
getMutableComponent,
hasComponent,
removeEntityNodeRecursively,
setComponent
} from '@ir-engine/ecs'
import { GLTFComponent } from '@ir-engine/engine/src/gltf/GLTFComponent'
Expand All @@ -21,10 +23,6 @@ import { InputComponent } from '@ir-engine/spatial/src/input/components/InputCom
import { RendererComponent } from '@ir-engine/spatial/src/renderer/WebGLRendererSystem'
import { SceneComponent } from '@ir-engine/spatial/src/renderer/components/SceneComponents'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import {
EntityTreeComponent,
removeEntityNodeRecursively
} from '@ir-engine/spatial/src/transform/components/EntityTree'
import React, { useEffect, useRef } from 'react'

let count = 0
Expand Down
6 changes: 2 additions & 4 deletions src/examples/MultipleCanvasScenes.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import config from '@ir-engine/common/src/config'
import {
EntityTreeComponent,
EntityUUID,
UUIDComponent,
UndefinedEntity,
createEntity,
generateEntityUUID,
hasComponent,
removeEntityNodeRecursively,
setComponent
} from '@ir-engine/ecs'
import { GLTFComponent } from '@ir-engine/engine/src/gltf/GLTFComponent'
Expand All @@ -20,10 +22,6 @@ import { InputComponent } from '@ir-engine/spatial/src/input/components/InputCom
import { RendererComponent } from '@ir-engine/spatial/src/renderer/WebGLRendererSystem'
import { SceneComponent } from '@ir-engine/spatial/src/renderer/components/SceneComponents'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import {
EntityTreeComponent,
removeEntityNodeRecursively
} from '@ir-engine/spatial/src/transform/components/EntityTree'
import React, { useEffect, useRef } from 'react'

const useScene = (canvas: React.MutableRefObject<HTMLCanvasElement>) => {
Expand Down
4 changes: 2 additions & 2 deletions src/examples/PhysicsDynamicObjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Entity, removeEntity, useOptionalComponent } from '@ir-engine/ecs'
import { GLTFComponent } from '@ir-engine/engine/src/gltf/GLTFComponent'
import { getMutableState, useImmediateEffect, useMutableState } from '@ir-engine/hyperflux'
import '@ir-engine/ir-bot/src/functions/BotHookSystem'
import { EngineState } from '@ir-engine/spatial/src/EngineState'
import { ReferenceSpaceState } from '@ir-engine/spatial'
import { RendererState } from '@ir-engine/spatial/src/renderer/RendererState'
import React, { useEffect } from 'react'
import { useRouteScene } from '../sceneRoute'
Expand All @@ -12,7 +12,7 @@ import { createPhysicsEntity } from './multipleScenes'
export default function PhysicsDynamicObjects() {
const sceneEntity = useRouteScene('ir-engine/default-project', 'public/scenes/default.gltf')!
useNetwork({ online: false })
const viewerEntity = useMutableState(EngineState).viewerEntity.value
const viewerEntity = useMutableState(ReferenceSpaceState).viewerEntity.value

useImmediateEffect(() => {
if (!viewerEntity) return
Expand Down
3 changes: 1 addition & 2 deletions src/examples/Retargeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import createGLTFExporter from '@ir-engine/engine/src/assets/functions/createGLT
import { GLTF } from '@ir-engine/engine/src/assets/loaders/gltf/GLTFLoader'
import { NO_PROXY, defineState, getMutableState, getState, none, useHookstate } from '@ir-engine/hyperflux'

import { Engine, getComponent, setComponent } from '@ir-engine/ecs'
import { Engine, EntityTreeComponent, getComponent, setComponent } from '@ir-engine/ecs'
import { getGLTFAsync } from '@ir-engine/engine/src/assets/functions/resourceLoaderHooks'
import { MixamoBoneNames } from '@ir-engine/engine/src/avatar/AvatarBoneMatching'
import { TransformComponent } from '@ir-engine/spatial'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { GroupComponent, addObjectToGroup } from '@ir-engine/spatial/src/renderer/components/ObjectComponent'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { VRMHumanBoneName } from '@pixiv/three-vrm'
import { Template } from './utils/template'

Expand Down
4 changes: 2 additions & 2 deletions src/examples/ShadowExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { getMutableState, none, useHookstate, useMutableState } from '@ir-engine
import {
DirectionalLightComponent,
PointLightComponent,
ReferenceSpaceState,
SpotLightComponent,
TransformComponent
} from '@ir-engine/spatial'
import { EngineState } from '@ir-engine/spatial/src/EngineState'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { RendererComponent } from '@ir-engine/spatial/src/renderer/WebGLRendererSystem'
import { MeshComponent } from '@ir-engine/spatial/src/renderer/components/MeshComponent'
Expand Down Expand Up @@ -115,7 +115,7 @@ const SceneReactor = (props: { sceneEntity: Entity }) => {

export default function ShadowExampleEntry() {
const entity = useHookstate(UndefinedEntity)
const engine = useMutableState(EngineState)
const engine = useMutableState(ReferenceSpaceState)
const renderer = useOptionalComponent(engine.viewerEntity.value, RendererComponent)

useEffect(() => {
Expand Down
3 changes: 1 addition & 2 deletions src/examples/Splines.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, { useEffect } from 'react'

import { Engine, EntityUUID, UUIDComponent } from '@ir-engine/ecs'
import { Engine, EntityTreeComponent, EntityUUID, UUIDComponent } from '@ir-engine/ecs'
import { setComponent } from '@ir-engine/ecs/src/ComponentFunctions'
import { createEntity } from '@ir-engine/ecs/src/EntityFunctions'
import { SplineComponent } from '@ir-engine/engine/src/scene/components/SplineComponent'
import { SplineTrackComponent } from '@ir-engine/engine/src/scene/components/SplineTrackComponent'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { addObjectToGroup } from '@ir-engine/spatial/src/renderer/components/ObjectComponent'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { TransformComponent } from '@ir-engine/spatial/src/transform/components/TransformComponent'
import { BoxGeometry, Mesh, MeshBasicMaterial, Quaternion, SphereGeometry, Vector3 } from 'three'
import { Template } from './utils/template'
Expand Down
3 changes: 1 addition & 2 deletions src/examples/WebXR.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { MediaIconsBox } from '@ir-engine/client-core/src/components/MediaIconsBox'
import { Shelves } from '@ir-engine/client-core/src/components/Shelves'
import { XRLoading } from '@ir-engine/client-core/src/components/XRLoading'
import { Engine, setComponent } from '@ir-engine/ecs'
import { Engine, EntityTreeComponent, setComponent } from '@ir-engine/ecs'
import { loadEmptyScene } from '@ir-engine/engine/tests/util/loadEmptyScene'
import { getMutableState } from '@ir-engine/hyperflux'
import { CameraOrbitComponent } from '@ir-engine/spatial/src/camera/components/CameraOrbitComponent'
import { RendererState } from '@ir-engine/spatial/src/renderer/RendererState'
import { BackgroundComponent } from '@ir-engine/spatial/src/renderer/components/SceneComponents'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import React, { useEffect } from 'react'
import { Color } from 'three'

Expand Down
2 changes: 1 addition & 1 deletion src/examples/XRMeshes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { setComponent, useComponent } from '@ir-engine/ecs/src/ComponentFunction
import { createEntity, removeEntity, useEntityContext } from '@ir-engine/ecs/src/EntityFunctions'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'

import { EntityTreeComponent } from '@ir-engine/ecs'
import { QueryReactor } from '@ir-engine/ecs/src/QueryFunctions'
import { TransformComponent } from '@ir-engine/spatial'
import { ColliderComponent } from '@ir-engine/spatial/src/physics/components/ColliderComponent'
Expand All @@ -13,7 +14,6 @@ import { CollisionGroups, DefaultCollisionMask } from '@ir-engine/spatial/src/ph
import { BodyTypes, Shapes } from '@ir-engine/spatial/src/physics/types/PhysicsTypes'
import { MeshComponent } from '@ir-engine/spatial/src/renderer/components/MeshComponent'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { XRDetectedMeshComponent } from '@ir-engine/spatial/src/xr/XRDetectedMeshComponent'
import { XRDetectedPlaneComponent } from '@ir-engine/spatial/src/xr/XRDetectedPlaneComponent'
import { Template } from './utils/template'
Expand Down
3 changes: 1 addition & 2 deletions src/examples/avatarMocap.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { useWorldNetwork } from '@ir-engine/client-core/src/common/services/LocationInstanceConnectionService'
import { Entity, UUIDComponent, generateEntityUUID } from '@ir-engine/ecs'
import { Entity, UUIDComponent, generateEntityUUID, removeEntityNodeRecursively } from '@ir-engine/ecs'
import { setComponent, useComponent, useOptionalComponent } from '@ir-engine/ecs/src/ComponentFunctions'
import { AvatarRigComponent } from '@ir-engine/engine/src/avatar/components/AvatarAnimationComponent'
import { MotionCaptureResults, mocapDataChannelType } from '@ir-engine/engine/src/mocap/MotionCaptureSystem'
import { NO_PROXY, State, UserID, getMutableState, getState, useHookstate } from '@ir-engine/hyperflux'
import { DataChannelRegistryState, NetworkState } from '@ir-engine/network'
import { RendererState } from '@ir-engine/spatial/src/renderer/RendererState'
import { VisibleComponent, setVisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { removeEntityNodeRecursively } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { encode } from 'msgpackr'
import React, { useEffect } from 'react'
import { Quaternion, Vector3 } from 'three'
Expand Down
14 changes: 9 additions & 5 deletions src/examples/avatarSimple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useFind } from '@ir-engine/common'
import { AvatarID, avatarPath } from '@ir-engine/common/src/schema.type.module'
import {
Engine,
EntityTreeComponent,
EntityUUID,
UUIDComponent,
UndefinedEntity,
Expand All @@ -19,13 +20,16 @@ import {
import { AvatarNetworkAction } from '@ir-engine/engine/src/avatar/state/AvatarNetworkActions'
import { GLTFComponent } from '@ir-engine/engine/src/gltf/GLTFComponent'
import { GLTFAssetState, GLTFSourceState } from '@ir-engine/engine/src/gltf/GLTFState'
import { AmbientLightComponent, DirectionalLightComponent, TransformComponent } from '@ir-engine/spatial'
import { EngineState } from '@ir-engine/spatial/src/EngineState'
import {
AmbientLightComponent,
DirectionalLightComponent,
ReferenceSpaceState,
TransformComponent
} from '@ir-engine/spatial'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { RendererComponent } from '@ir-engine/spatial/src/renderer/WebGLRendererSystem'
import { SceneComponent } from '@ir-engine/spatial/src/renderer/components/SceneComponents'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'

// create scene with a rigidbody loaded offset from the origin
const createSceneGLTF = (id: string): GLTF.IGLTF => ({
Expand All @@ -52,7 +56,7 @@ export default function AvatarSimpleEntry() {
const entity = useHookstate(UndefinedEntity)
const gltfComponent = useOptionalComponent(entity.value, GLTFComponent)
const avatars = useFind(avatarPath)
const engine = useMutableState(EngineState)
const engine = useMutableState(ReferenceSpaceState)
const renderer = useOptionalComponent(engine.viewerEntity.value, RendererComponent)

useEffect(() => {
Expand All @@ -62,7 +66,7 @@ export default function AvatarSimpleEntry() {
setComponent(lightEntity, UUIDComponent, 'directional light' as EntityUUID)
setComponent(lightEntity, NameComponent, 'Directional Light')
setComponent(lightEntity, TransformComponent, { rotation: new Quaternion().setFromEuler(new Euler(2, 5, 3)) })
setComponent(lightEntity, EntityTreeComponent, { parentEntity: getState(EngineState).originEntity })
setComponent(lightEntity, EntityTreeComponent, { parentEntity: getState(ReferenceSpaceState).originEntity })
setComponent(lightEntity, VisibleComponent, true)
setComponent(lightEntity, DirectionalLightComponent, { color: new Color('white'), intensity: 0.5 })
setComponent(lightEntity, AmbientLightComponent, { color: new Color('white'), intensity: 0.5 })
Expand Down
3 changes: 1 addition & 2 deletions src/examples/componentExamples/ComponentNamesUI.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// @ts-ignore
import styles from './ComponentNamesUI.css?inline'

import ECS, { Entity, getOptionalComponent } from '@ir-engine/ecs'
import ECS, { Entity, EntityTreeComponent, getOptionalComponent } from '@ir-engine/ecs'
import { useXRUIState } from '@ir-engine/engine/src/xrui/useXRUIState'
import { useHookstate } from '@ir-engine/hyperflux'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import React, { useEffect } from 'react'

const ComponentNamesUI: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/examples/componentExamples/componentExamples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import config from '@ir-engine/common/src/config'
import {
Easing,
Entity,
EntityTreeComponent,
UUIDComponent,
UndefinedEntity,
createEntity,
Expand Down Expand Up @@ -39,7 +40,6 @@ import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { Q_IDENTITY, Q_Y_180 } from '@ir-engine/spatial/src/common/constants/MathConstants'
import { setVisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { ObjectLayerMasks } from '@ir-engine/spatial/src/renderer/constants/ObjectLayers'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import React, { useEffect } from 'react'
import { MathUtils } from 'three'
import { useAvatars } from '../../engine/TestUtils'
Expand Down
11 changes: 5 additions & 6 deletions src/examples/gltfViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ import { getMutableState, getState, useHookstate, useMutableState } from '@ir-en
import { Entity, EntityUUID, UUIDComponent, createEntity, removeEntity } from '@ir-engine/ecs'

import config from '@ir-engine/common/src/config'
import { EntityTreeComponent } from '@ir-engine/ecs'
import { SupportedFileTypes } from '@ir-engine/editor/src/constants/AssetTypes'
import { GLTFAssetState } from '@ir-engine/engine/src/gltf/GLTFState'
import { ModelComponent } from '@ir-engine/engine/src/scene/components/ModelComponent'
import { SourceComponent } from '@ir-engine/engine/src/scene/components/SourceComponent'
import { DirectionalLightComponent, TransformComponent } from '@ir-engine/spatial'
import { EngineState } from '@ir-engine/spatial/src/EngineState'
import { DirectionalLightComponent, ReferenceSpaceState, TransformComponent } from '@ir-engine/spatial'
import { CameraComponent } from '@ir-engine/spatial/src/camera/components/CameraComponent'
import { CameraOrbitComponent } from '@ir-engine/spatial/src/camera/components/CameraOrbitComponent'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { InputComponent } from '@ir-engine/spatial/src/input/components/InputComponent'
import { RendererState } from '@ir-engine/spatial/src/renderer/RendererState'
import { SceneComponent } from '@ir-engine/spatial/src/renderer/components/SceneComponents'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { Color, Euler, Quaternion, Vector3 } from 'three'
export const metadata = {
title: 'GLTF',
Expand Down Expand Up @@ -51,7 +50,7 @@ const GLTF = () => {
setComponent(modelEntity, NameComponent, '3D Preview Entity')
setComponent(modelEntity, TransformComponent, { position: new Vector3(3, 0, 0) })
setComponent(modelEntity, SourceComponent, 'gltf viewer-' + source.value)
setComponent(modelEntity, EntityTreeComponent, { parentEntity: getState(EngineState).originEntity })
setComponent(modelEntity, EntityTreeComponent, { parentEntity: getState(ReferenceSpaceState).originEntity })
setComponent(modelEntity, VisibleComponent, true)
setComponent(modelEntity, ModelComponent, { src: source.value })
setComponent(modelEntity, SceneComponent)
Expand All @@ -61,7 +60,7 @@ const GLTF = () => {
setComponent(entity, UUIDComponent, 'directional light' as EntityUUID)
setComponent(entity, NameComponent, 'Directional Light')
setComponent(entity, TransformComponent, { rotation: new Quaternion().setFromEuler(new Euler(2, 5, 3)) })
setComponent(entity, EntityTreeComponent, { parentEntity: getState(EngineState).originEntity })
setComponent(entity, EntityTreeComponent, { parentEntity: getState(ReferenceSpaceState).originEntity })
setComponent(entity, VisibleComponent, true)
setComponent(entity, DirectionalLightComponent, { color: new Color('white'), intensity: 1 })

Expand Down Expand Up @@ -124,7 +123,7 @@ const GLTF = () => {
}

export default function GLTFViewer() {
const viewerEntity = useMutableState(EngineState).viewerEntity.value
const viewerEntity = useMutableState(ReferenceSpaceState).viewerEntity.value

useEffect(() => {
const bgColor = document.body.style.backgroundColor
Expand Down
Loading
Loading