Skip to content

Commit

Permalink
Merge branch 'dev' into point-click-placement
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Apr 5, 2024
2 parents 611c31a + d387b60 commit 25a5da9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
7 changes: 7 additions & 0 deletions packages/client-core/src/components/MediaIconsBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export const MediaIconsBox = () => {
const audioEnabled = currentLocation?.locationSetting?.value
? currentLocation?.locationSetting?.audioEnabled?.value
: false
const screenshareEnabled = currentLocation?.locationSetting?.value
? currentLocation?.locationSetting?.screenSharingEnabled?.value
: false

const mediaStreamState = useHookstate(getMutableState(MediaStreamState))
const isMotionCaptureEnabled = mediaStreamState.faceTracking.value
Expand Down Expand Up @@ -194,6 +197,10 @@ export const MediaIconsBox = () => {
onPointerEnter={() => AudioEffectPlayer.instance.play(AudioEffectPlayer.SOUNDS.ui)}
icon={<Icon type={'Accessibility'} />}
/>
</>
) : null}
{screenshareEnabled && mediaNetworkReady && mediaNetworkState?.ready.value ? (
<>
<IconButtonWithTooltip
id="UserScreenSharing"
title={t('user:menu.shareScreen')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '@etherealengine/ecs/src/ComponentFunctions'
import { createEntity, removeEntity, useEntityContext } from '@etherealengine/ecs/src/EntityFunctions'

import { UndefinedEntity } from '@etherealengine/ecs'
import { Engine, UndefinedEntity } from '@etherealengine/ecs'
import { TransformPivot } from '@etherealengine/engine/src/scene/constants/transformConstants'
import { getMutableState } from '@etherealengine/hyperflux'
import { TransformComponent } from '@etherealengine/spatial'
Expand Down Expand Up @@ -72,7 +72,7 @@ export const TransformGizmoControlledComponent = defineComponent({
setComponent(pivotEntity, NameComponent, 'gizmoPivotEntity')
setComponent(pivotEntity, TransformComponent)
setComponent(pivotEntity, VisibleComponent)
setComponent(pivotEntity, EntityTreeComponent)
setComponent(pivotEntity, EntityTreeComponent, { parentEntity: Engine.instance.originEntity })
setComponent(pivotEntity, TransformGizmoTagComponent)

/*addObjectToGroup(
Expand All @@ -87,6 +87,9 @@ export const TransformGizmoControlledComponent = defineComponent({
const gizmoControlEntity = createEntity()
const gizmoVisualEntity = createEntity()
const gizmoPlaneEntity = createEntity()
setComponent(gizmoControlEntity, EntityTreeComponent, { parentEntity: Engine.instance.originEntity })
setComponent(gizmoVisualEntity, EntityTreeComponent, { parentEntity: Engine.instance.originEntity })
setComponent(gizmoPlaneEntity, EntityTreeComponent, { parentEntity: Engine.instance.originEntity })

const controlledEntities = [entity]
setComponent(gizmoControlEntity, NameComponent, 'gizmoControllerEntity')
Expand Down
5 changes: 5 additions & 0 deletions packages/editor/src/classes/TransformGizmoVisualComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Ethereal Engine. All Rights Reserved.
*/

import {
Engine,
UndefinedEntity,
createEntity,
defineComponent,
Expand All @@ -38,6 +39,7 @@ import { InputComponent } from '@etherealengine/spatial/src/input/components/Inp
import { addObjectToGroup, removeObjectFromGroup } from '@etherealengine/spatial/src/renderer/components/GroupComponent'
import { VisibleComponent } from '@etherealengine/spatial/src/renderer/components/VisibleComponent'
import { ObjectLayers } from '@etherealengine/spatial/src/renderer/constants/ObjectLayers'
import { EntityTreeComponent } from '@etherealengine/spatial/src/transform/components/EntityTree'
import { TransformGizmoTagComponent } from '@etherealengine/spatial/src/transform/components/TransformComponent'
import { useEffect } from 'react'
import {
Expand Down Expand Up @@ -396,13 +398,15 @@ export const TransformGizmoVisualComponent = defineComponent({
addObjectToGroup(gizmo[mode], gizmoObject[mode])
setComponent(gizmo[mode], TransformGizmoTagComponent)
setComponent(gizmo[mode], VisibleComponent)
setComponent(gizmo[mode], EntityTreeComponent, { parentEntity: Engine.instance.originEntity })

visualComponent.gizmo[mode].set(gizmo[mode])

setComponent(helper[mode], NameComponent, `gizmoHelper${mode}Entity`)
addObjectToGroup(helper[mode], helperObject[mode])
setComponent(helper[mode], TransformGizmoTagComponent)
setComponent(helper[mode], VisibleComponent)
setComponent(helper[mode], EntityTreeComponent, { parentEntity: Engine.instance.originEntity })

visualComponent.helper[mode].set(helper[mode])

Expand All @@ -411,6 +415,7 @@ export const TransformGizmoVisualComponent = defineComponent({
addObjectToGroup(picker[mode], pickerObject[mode])
setComponent(picker[mode], TransformGizmoTagComponent)
setComponent(picker[mode], VisibleComponent)
setComponent(picker[mode], EntityTreeComponent, { parentEntity: Engine.instance.originEntity })

visualComponent.picker[mode].set(picker[mode])

Expand Down
2 changes: 1 addition & 1 deletion packages/engine/tests/util/loadEmptyScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { EntityUUID } from '@etherealengine/ecs'
import { SceneState } from '../../src/scene/SceneState'

export const loadEmptyScene = () => {
SceneState.loadScene('test' as SceneID, {
return SceneState.loadScene('test' as SceneID, {
name: '',
thumbnailUrl: '',
project: '',
Expand Down
2 changes: 1 addition & 1 deletion packages/spatial/src/input/systems/ClientInputSystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function updateGamepadInput(eid: Entity) {

const pointers = defineQuery([InputPointerComponent, InputSourceComponent, Not(XRSpaceComponent)])
const xrSpaces = defineQuery([XRSpaceComponent, TransformComponent])
const inputSources = defineQuery([InputSourceComponent])
const inputSources = defineQuery([InputSourceComponent, TransformComponent])
const inputs = defineQuery([InputComponent])

const inputXRUIs = defineQuery([InputComponent, VisibleComponent, XRUIComponent])
Expand Down
10 changes: 7 additions & 3 deletions packages/spatial/src/renderer/WebGLRendererSystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
defineQuery,
defineSystem,
getComponent,
getOptionalComponent,
hasComponent,
useComponent,
useEntityContext
Expand Down Expand Up @@ -100,6 +101,7 @@ const _scene = new Scene()
_scene.matrixAutoUpdate = false
_scene.matrixWorldAutoUpdate = false
_scene.layers.set(ObjectLayers.Scene)
globalThis._scene = _scene

export class EngineRenderer {
/** @deprecated will be removed once threejs objects are not proxified. Should only be used in loadGLTFModel.ts */
Expand Down Expand Up @@ -320,8 +322,7 @@ export const PostProcessingSettingsState = defineState({

const rendererQuery = defineQuery([RendererComponent, CameraComponent, SceneComponent])

export const filterVisible = (entity: Entity) =>
hasComponent(entity, VisibleComponent) && hasComponent(entity, GroupComponent)
export const filterVisible = (entity: Entity) => hasComponent(entity, VisibleComponent)
export const getNestedVisibleChildren = (entity: Entity) => getNestedChildren(entity, filterVisible)

const execute = () => {
Expand All @@ -348,7 +349,10 @@ const execute = () => {
fog = getComponent(entity, FogComponent)
}
}
const objects = entitiesToRender.map((entity) => getComponent(entity, GroupComponent)).flat()
const objects = entitiesToRender
.map((entity) => getOptionalComponent(entity, GroupComponent)!)
.flat()
.filter(Boolean)

_scene.children = objects

Expand Down
2 changes: 1 addition & 1 deletion packages/spatial/src/xr/XRSessionFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const setupXRSession = async (requestedMode?: 'inline' | 'immersive-ar' |

export const getReferenceSpaces = (xrSession: XRSession) => {
const worldOriginTransform = getComponent(Engine.instance.localFloorEntity, TransformComponent)
const cameraAttachedEntity = getState(PhysicsState).cameraAttachedRigidbodyEntity ?? Engine.instance.cameraEntity
const cameraAttachedEntity = getState(PhysicsState).cameraAttachedRigidbodyEntity || Engine.instance.cameraEntity
const transform = getComponent(cameraAttachedEntity, TransformComponent)

/** since the world origin is based on gamepad movement, we need to transform it by the pose of the avatar */
Expand Down

0 comments on commit 25a5da9

Please sign in to comment.