Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
12 changes: 6 additions & 6 deletions packages/client-core/src/components/InstanceChat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { AuthState } from '@etherealengine/client-core/src/user/services/AuthSer
import { AudioEffectPlayer } from '@etherealengine/engine/src/audio/systems/MediaSystem'
import { Engine } from '@etherealengine/engine/src/ecs/classes/Engine'
import { EngineState } from '@etherealengine/engine/src/ecs/classes/EngineState'
import { WorldNetworkAction } from '@etherealengine/engine/src/networking/functions/WorldNetworkAction'
import { WorldState } from '@etherealengine/engine/src/networking/interfaces/WorldState'
import { dispatchAction, getMutableState, useHookstate } from '@etherealengine/hyperflux'
import Avatar from '@etherealengine/ui/src/primitives/mui/Avatar'
Expand All @@ -47,6 +46,7 @@ import { Close as CloseIcon, Message as MessageIcon } from '@mui/icons-material'
import Fab from '@mui/material/Fab'

import { AppAction } from '../../common/services/AppService'
import { AvatarUIActions, AvatarUIState } from '../../systems/state/AvatarUIState'
import { getUserAvatarThumbnail } from '../../user/functions/useUserAvatarThumbnail'
import { useShelfStyles } from '../Shelves/useShelfStyles'
import defaultStyles from './index.module.scss'
Expand Down Expand Up @@ -89,7 +89,7 @@ export const useChatHooks = ({ chatWindowOpen, setUnreadMessages, messageRefInpu
const composingMessage = useHookstate('')
const cursorPosition = useHookstate(0)
const user = useHookstate(getMutableState(AuthState).user)
const usersTyping = useHookstate(getMutableState(EngineState)).usersTyping[user?.id.value].value
const usersTyping = useHookstate(getMutableState(AvatarUIState)).usersTyping[user?.id.value].value
const isMultiline = useHookstate(false)

useEffect(() => {
Expand All @@ -102,7 +102,7 @@ export const useChatHooks = ({ chatWindowOpen, setUnreadMessages, messageRefInpu
if (!composingMessage.value || !usersTyping) return
const delayDebounce = setTimeout(() => {
dispatchAction(
WorldNetworkAction.setUserTyping({
AvatarUIActions.setUserTyping({
typing: false
})
)
Expand Down Expand Up @@ -132,7 +132,7 @@ export const useChatHooks = ({ chatWindowOpen, setUnreadMessages, messageRefInpu
if (message.length > composingMessage.value.length) {
if (!usersTyping) {
dispatchAction(
WorldNetworkAction.setUserTyping({
AvatarUIActions.setUserTyping({
typing: true
})
)
Expand All @@ -141,7 +141,7 @@ export const useChatHooks = ({ chatWindowOpen, setUnreadMessages, messageRefInpu
if (message.length == 0 || message.length < composingMessage.value.length) {
if (usersTyping) {
dispatchAction(
WorldNetworkAction.setUserTyping({
AvatarUIActions.setUserTyping({
typing: false
})
)
Expand All @@ -156,7 +156,7 @@ export const useChatHooks = ({ chatWindowOpen, setUnreadMessages, messageRefInpu
if (composingMessage?.value?.length && instanceId) {
if (usersTyping) {
dispatchAction(
WorldNetworkAction.setUserTyping({
AvatarUIActions.setUserTyping({
typing: false
})
)
Expand Down
1 change: 1 addition & 0 deletions packages/client-core/src/media/webcam/WebcamInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ const execute = () => {
for (const entity of webcamQuery()) setAvatarExpression(entity)
}

/** @todo - this system currently is not used and has been replaced by the /capture route */
export const WebcamInputSystem = defineSystem({
uuid: 'ee.client.WebcamInputSystem',
execute
Expand Down
4 changes: 3 additions & 1 deletion packages/client-core/src/systems/AvatarUISystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { getMutableState, getState, none } from '@etherealengine/hyperflux'

import AvatarContextMenu from '../user/components/UserMenu/menus/AvatarContextMenu'
import { PopupMenuState } from '../user/components/UserMenu/PopupMenuService'
import { AvatarUIStateSystem } from './state/AvatarUIState'
import { createAvatarDetailView } from './ui/AvatarDetailView'
import { AvatarUIContextMenuState } from './ui/UserMenuView'

Expand Down Expand Up @@ -290,5 +291,6 @@ const reactor = () => {
export const AvatarUISystem = defineSystem({
uuid: 'ee.client.AvatarUISystem',
execute,
reactor
reactor,
subSystems: [AvatarUIStateSystem]
})
61 changes: 61 additions & 0 deletions packages/client-core/src/systems/state/AvatarUIState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
CPAL-1.0 License

The contents of this file are subject to the Common Public Attribution License
Version 1.0. (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://github.com/EtherealEngine/etherealengine/blob/dev/LICENSE.
The License is based on the Mozilla Public License Version 1.1, but Sections 14
and 15 have been added to cover use of software over a computer network and
provide for limited attribution for the Original Developer. In addition,
Exhibit A has been modified to be consistent with Exhibit B.

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License.

The Original Code is Ethereal Engine.

The Original Developer is the Initial Developer. The Initial Developer of the
Original Code is the Ethereal Engine team.

All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023
Ethereal Engine. All Rights Reserved.
*/

import { matches } from '@etherealengine/engine/src/common/functions/MatchesUtils'
import { defineSystem } from '@etherealengine/engine/src/ecs/functions/SystemFunctions'
import { NetworkTopics } from '@etherealengine/engine/src/networking/classes/Network'
import { defineAction, defineState, none, receiveActions } from '@etherealengine/hyperflux'

export class AvatarUIActions {
static setUserTyping = defineAction({
type: 'ee.client.avatar.USER_IS_TYPING',
typing: matches.boolean,
$topic: NetworkTopics.world
})
}

export const AvatarUIState = defineState({
name: 'AvatarUIState',

initial: {
usersTyping: {} as { [key: string]: true }
},

receptors: [
[
AvatarUIActions.setUserTyping,
(state, action) => {
state.usersTyping[action.$from].set(action.typing ? true : none)
}
]
]
})

export const AvatarUIStateSystem = defineSystem({
uuid: 'ee.engine.avatar.AvatarUIStateSystem',
execute: () => {
receiveActions(AvatarUIState)
}
})
14 changes: 7 additions & 7 deletions packages/client-core/src/systems/ui/AvatarDetailView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import { createXRUI } from '@etherealengine/engine/src/xrui/functions/createXRUI
import { useXRUIState } from '@etherealengine/engine/src/xrui/functions/useXRUIState'
import { createState, getMutableState, useHookstate } from '@etherealengine/hyperflux'

import { AvatarUIState } from '../../state/AvatarUIState'
import styleString from './index.scss?inline'

/** @deprecated */
export function createAvatarDetailView(id: string) {
const videoPreviewMesh = new Mesh(new CircleGeometry(0.25, 32), new MeshBasicMaterial())
const ui = createXRUI(
Expand All @@ -55,16 +55,16 @@ export function createAvatarDetailView(id: string) {
interface AvatarDetailState {
id: string
}
/** @deprecated */

const AvatarDetailView = () => {
const { t } = useTranslation()
const detailState = useXRUIState<AvatarDetailState>()
const user = Array.from(Engine.instance.worldNetworkState.peers?.get({ noproxy: true }).values()).find(
(peer) => peer.userId === detailState.id.value
)
const user = Engine.instance.worldNetworkState?.peers
? Array.from(Engine.instance.worldNetwork.peers.values()).find((peer) => peer.userId === detailState.id.value)
: undefined
const worldState = useHookstate(getMutableState(WorldState)).get({ noproxy: true })
const engineState = useHookstate(getMutableState(EngineState))
const usersTyping = engineState.usersTyping[detailState.id.value].value
const usersTypingState = useHookstate(getMutableState(AvatarUIState).usersTyping)
const usersTyping = usersTypingState[detailState.id.value]?.value
const username = worldState?.userNames && user ? worldState.userNames[user.userId] : 'A user'

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import Text from '@etherealengine/client-core/src/common/components/Text'
import { AuthService, AuthState } from '@etherealengine/client-core/src/user/services/AuthService'
import { defaultThemeModes, defaultThemeSettings } from '@etherealengine/common/src/constants/DefaultThemeSettings'
import capitalizeFirstLetter from '@etherealengine/common/src/utils/capitalizeFirstLetter'
import InputGroup from '@etherealengine/editor/src/components/inputs/InputGroup'
import SelectInput from '@etherealengine/editor/src/components/inputs/SelectInput'
import { AudioSettingAction, AudioState } from '@etherealengine/engine/src/audio/AudioState'
import {
AvatarAxesControlScheme,
Expand All @@ -58,6 +60,29 @@ import { UserMenus } from '../../../UserUISystem'
import styles from '../index.module.scss'
import { PopupMenuServices } from '../PopupMenuService'

const ShadowMapResolutionOptions = [
{
label: '256px',
value: 256
},
{
label: '512px',
value: 512
},
{
label: '1024px',
value: 1024
},
{
label: '2048px',
value: 2048
},
{
label: '4096px (not recommended)',
value: 4096
}
]

const chromeDesktop = !isMobile && /chrome/i.test(navigator.userAgent)

type Props = {
Expand Down Expand Up @@ -458,6 +483,17 @@ const SettingMenu = ({ isPopover }: Props): JSX.Element => {
onChange={handleQualityLevelChange}
/>

<InputGroup
name="Shadow Map Resolution"
label={t('editor:properties.directionalLight.lbl-shadowmapResolution')}
>
<SelectInput
options={ShadowMapResolutionOptions}
value={rendererState.shadowMapResolution.value}
onChange={(resolution: number) => rendererState.shadowMapResolution.set(resolution)}
/>
</InputGroup>

<Grid container spacing={{ xs: 0, sm: 2 }}>
<Grid item xs={12} sm={4}>
<InputCheck
Expand Down
4 changes: 2 additions & 2 deletions packages/client-core/src/world/startClientSystems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ import { EquippableSystem } from '@etherealengine/engine/src/interaction/systems
import { InteractiveSystem } from '@etherealengine/engine/src/interaction/systems/InteractiveSystem'
import { MediaControlSystem } from '@etherealengine/engine/src/interaction/systems/MediaControlSystem'
import { MotionCaptureSystem } from '@etherealengine/engine/src/mocap/MotionCaptureSystem'
import { EntityNetworkStateSystem } from '@etherealengine/engine/src/networking/state/EntityNetworkState'
import { IncomingNetworkSystem } from '@etherealengine/engine/src/networking/systems/IncomingNetworkSystem'
import { OutgoingNetworkSystem } from '@etherealengine/engine/src/networking/systems/OutgoingNetworkSystem'
import { WorldNetworkActionSystem } from '@etherealengine/engine/src/networking/systems/WorldNetworkActionSystem'
import { PhysicsSystem } from '@etherealengine/engine/src/physics/systems/PhysicsSystem'
import { HighlightSystem } from '@etherealengine/engine/src/renderer/HighlightSystem'
import { WebGLRendererSystem } from '@etherealengine/engine/src/renderer/WebGLRendererSystem'
Expand All @@ -69,7 +69,7 @@ export const startClientSystems = () => {
})

/** Fixed */
startSystems([IncomingNetworkSystem, WorldNetworkActionSystem, EquippableSystem, AvatarSimulationSystemGroup], {
startSystems([IncomingNetworkSystem, EntityNetworkStateSystem, EquippableSystem, AvatarSimulationSystemGroup], {
with: SimulationSystemGroup
})

Expand Down
3 changes: 0 additions & 3 deletions packages/client-core/src/world/useDefaultLocationSystems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { InputSystemGroup, PresentationSystemGroup } from '@etherealengine/engin
import { startSystems } from '@etherealengine/engine/src/ecs/functions/SystemFunctions'
import { TransformSystem } from '@etherealengine/engine/src/transform/systems/TransformSystem'

import { WebcamInputSystem } from '../media/webcam/WebcamInput'
import { ClientNetworkingSystem } from '../networking/ClientNetworkingSystem'
import { AvatarUISystem } from '../systems/AvatarUISystem'
import { LoadingUISystem } from '../systems/LoadingUISystem'
Expand All @@ -40,8 +39,6 @@ import { UserUISystem } from '../user/UserUISystem'

export const useDefaultLocationSystems = (online: boolean) => {
useEffect(() => {
startSystems([WebcamInputSystem], { with: InputSystemGroup })

startSystems([LoadingUISystem, AvatarUISystem, WidgetUISystem], { before: TransformSystem })

const postPresentationSystems = [UserUISystem, FilteredUsersSystem, WarningUISystem]
Expand Down
1 change: 1 addition & 0 deletions packages/client-core/tests/mocha.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Ethereal Engine. All Rights Reserved.


process.env.APP_ENV = 'test'
process.env.NODE_ENV = 'test'
process.env.TS_NODE_FILES = true
process.env.TS_NODE_PROJECT = 'tsconfig.json'
process.env.TS_NODE_COMPILER_OPTIONS = '{\"module\": \"commonjs\" }'
Expand Down
1 change: 1 addition & 0 deletions packages/client/tests/mocha.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Ethereal Engine. All Rights Reserved.


process.env.APP_ENV = 'test'
process.env.NODE_ENV = 'test'
process.env.TS_NODE_FILES = true
process.env.TS_NODE_PROJECT = 'tsconfig.json'
process.env.TS_NODE_COMPILER_OPTIONS = '{\"module\": \"commonjs\" }'
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,9 @@ import { Component, useComponent } from '@etherealengine/engine/src/ecs/function
import BooleanInput from '../inputs/BooleanInput'
import InputGroup from '../inputs/InputGroup'
import NumericInputGroup from '../inputs/NumericInputGroup'
import SelectInput from '../inputs/SelectInput'
import { updateProperties, updateProperty } from './Util'
import { updateProperty } from './Util'

/**
* Array containing options for shadow resolution
*/
const ShadowMapResolutionOptions = [
{
label: '256px',
value: 256
},
{
label: '512px',
value: 512
},
{
label: '1024px',
value: 1024
},
{
label: '2048px',
value: 2048
},
{
label: '4096px (not recommended)',
value: 4096
}
]

//creating properties for LightShadowProperties component
/**creating properties for LightShadowProperties component */
type LightShadowPropertiesProps = {
entity: Entity
comp: Component<any, any>
Expand All @@ -70,31 +43,17 @@ type LightShadowPropertiesProps = {
/**
* OnChangeShadowMapResolution used to customize properties of LightShadowProperties
* Used with LightNodeEditors.
*
* @type {[class component]}
*/
export const LightShadowProperties = (props: LightShadowPropertiesProps) => {
const { t } = useTranslation()

const changeShadowMapResolution = (resolution) => {
updateProperties(props.comp, { shadowMapResolution: resolution })
}

const lightComponent = useComponent(props.entity, props.comp).value as any

return (
<>
<InputGroup name="Cast Shadows" label={t('editor:properties.directionalLight.lbl-castShadows')}>
<BooleanInput value={lightComponent.castShadow} onChange={updateProperty(props.comp, 'castShadow')} />
</InputGroup>
<InputGroup name="Shadow Map Resolution" label={t('editor:properties.directionalLight.lbl-shadowmapResolution')}>
<SelectInput
key={props.entity}
options={ShadowMapResolutionOptions}
value={lightComponent.shadowMapResolution?.x}
onChange={changeShadowMapResolution}
/>
</InputGroup>
<NumericInputGroup
name="Shadow Bias"
label={t('editor:properties.directionalLight.lbl-shadowBias')}
Expand Down
1 change: 1 addition & 0 deletions packages/editor/tests/mocha.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Ethereal Engine. All Rights Reserved.


process.env.APP_ENV = 'test'
process.env.NODE_ENV = 'test'
process.env.TS_NODE_FILES = true
process.env.TS_NODE_PROJECT = 'tsconfig.json'
process.env.TS_NODE_COMPILER_OPTIONS = '{\"module\": \"commonjs\" }'
1 change: 1 addition & 0 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"web-worker": "1.2.0"
},
"devDependencies": {
"@testing-library/react": "^14.0.0",
"@types/mocha": "10.0.1",
"@types/mock-require": "2.0.1",
"@types/offscreencanvas": "2019.7.0",
Expand Down
Loading