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 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
8 changes: 6 additions & 2 deletions packages/client-core/i18n/en/editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@
"lbl-unload": "Unload",
"lbl-reload": "Reload"
},
"vps-wayspot": {
"name": "VPS Wayspot",
"description": "Assign a VPS Wayspot",
"lbl-name": "Wayspot Name"
},
"media": {
"name": "Media",
"description": "Audio and video playback",
Expand Down Expand Up @@ -609,8 +614,7 @@
"lbl-fogDensity": "Fog Density"
},
"xr": {
"name": "XR Settings",
"lbl-vpsWaypointName": "VPS Waypoint Name"
"name": "XR Settings"
},
"mountPoint": {
"name": "Mount point",
Expand Down
30 changes: 30 additions & 0 deletions packages/editor/src/components/properties/VPSWayspotNodeEditor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import { useTranslation } from 'react-i18next'

import { useComponent } from '@xrengine/engine/src/ecs/functions/ComponentFunctions'
import { VPSWayspotComponent } from '@xrengine/engine/src/xr/VPSComponents'

import InputGroup from '../inputs/InputGroup'
import StringInput from '../inputs/StringInput'
import NodeEditor from './NodeEditor'
import { EditorComponentType, updateProperty } from './Util'

export const VPSWayspotNodeEditor: EditorComponentType = (props) => {
const { t } = useTranslation()

const wayspot = useComponent(props.node.entity, VPSWayspotComponent)

return (
<NodeEditor
{...props}
name={t('editor:properties.vps-wayspot.name')}
description={t('editor:properties.vps-wayspot.description')}
>
<InputGroup name="Volume" label={t('editor:properties.vps-wayspot.lbl-name')}>
<StringInput value={wayspot.name.value} onChange={updateProperty(VPSWayspotComponent, 'name')} />
</InputGroup>
</NodeEditor>
)
}

export default VPSWayspotNodeEditor
11 changes: 1 addition & 10 deletions packages/editor/src/components/properties/XRSettingsEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,5 @@ import PropertyGroup from './PropertyGroup'
export const XRSettingsEditor = () => {
const { t } = useTranslation()
const sceneMetadata = useHookstate(Engine.instance.currentWorld.sceneMetadata.xr)
return (
<PropertyGroup name={t('editor:properties.xr.name')}>
<InputGroup name="VPS Waypoint Name" label={t('editor:properties.xr.lbl-vpsWaypointName')}>
<StringInput
value={sceneMetadata.vpsWayspotName.value}
onChange={(val) => sceneMetadata.vpsWayspotName.set(val)}
/>
</InputGroup>
</PropertyGroup>
)
return <PropertyGroup name={t('editor:properties.xr.name')}></PropertyGroup>
}
3 changes: 3 additions & 0 deletions packages/editor/src/functions/PrefabEditors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { WaterComponent } from '@xrengine/engine/src/scene/components/WaterCompo
import { LightPrefabs } from '@xrengine/engine/src/scene/systems/LightSystem'
import { ScenePrefabs } from '@xrengine/engine/src/scene/systems/SceneObjectUpdateSystem'
import { TransformComponent } from '@xrengine/engine/src/transform/components/TransformComponent'
import { VPSWayspotComponent } from '@xrengine/engine/src/xr/VPSComponents'

import ChairIcon from '@mui/icons-material/Chair'

Expand Down Expand Up @@ -72,6 +73,7 @@ import TransformPropertyGroup from '../components/properties/TransformPropertyGr
import { EditorComponentType } from '../components/properties/Util'
import VideoNodeEditor from '../components/properties/VideoNodeEditor'
import VolumetricNodeEditor from '../components/properties/VolumetricNodeEditor'
import VPSWayspotNodeEditor from '../components/properties/VPSWayspotNodeEditor'
import WaterNodeEditor from '../components/properties/WaterNodeEditor'

export const EntityNodeEditor = new Map<Component, EditorComponentType>()
Expand Down Expand Up @@ -108,6 +110,7 @@ EntityNodeEditor.set(SplineComponent, SplineNodeEditor)
EntityNodeEditor.set(EnvmapComponent, EnvMapEditor)
EntityNodeEditor.set(EnvMapBakeComponent, EnvMapBakeNodeEditor)
EntityNodeEditor.set(InstancingComponent, InstancingNodeEditor)
EntityNodeEditor.set(VPSWayspotComponent, VPSWayspotNodeEditor)

export const prefabIcons = {
[LightPrefabs.ambientLight]: AmbientLightNodeEditor.iconComponent,
Expand Down
3 changes: 1 addition & 2 deletions packages/engine/src/ecs/classes/World.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ export class World {
height: 0.05
},
xr: {
dollhouse: 'auto' as boolean | 'auto',
vpsWayspotName: ''
dollhouse: 'auto' as boolean | 'auto'
}
})

Expand Down
3 changes: 2 additions & 1 deletion packages/engine/src/ecs/utils/threejsPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as THREE from 'three'
import { BufferGeometry, Euler, Mesh, Object3D, Quaternion, Scene, Vector2, Vector3 } from 'three'
import { acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from 'three-mesh-bvh'

import { GLTFLoader } from '../../assets/loaders/gltf/GLTFLoader'
import { Object3DUtils } from '../../common/functions/Object3DUtils'

//@ts-ignore
Expand Down Expand Up @@ -57,4 +58,4 @@ Object3D.prototype.getWorldDirection = function (target) {
return target.set(e[8], e[9], e[10]).normalize()
}

globalThis.THREE = THREE
globalThis.THREE = { ...THREE, GLTFLoader } as any
17 changes: 0 additions & 17 deletions packages/engine/src/scene/components/VPSComponent.ts

This file was deleted.

23 changes: 15 additions & 8 deletions packages/engine/src/scene/systems/SceneObjectSystem.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Not } from 'bitecs'
import { useEffect } from 'react'
import { Color, Mesh, MeshBasicMaterial, MeshPhongMaterial, MeshStandardMaterial } from 'three'
import { Color, Mesh, MeshBasicMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial } from 'three'

import { getState, useHookstate } from '@xrengine/hyperflux'

Expand All @@ -21,12 +21,12 @@ import {
useOptionalComponent
} from '../../ecs/functions/ComponentFunctions'
import { startQueryReactor } from '../../ecs/functions/SystemFunctions'
import MeshPhysicalMaterial from '../../renderer/materials/constants/material-prototypes/MeshPhysicalMaterial.mat'
import { EngineRenderer } from '../../renderer/WebGLRendererSystem'
import { XRState } from '../../xr/XRState'
import { CallbackComponent } from '../components/CallbackComponent'
import { GroupComponent, Object3DWithEntity } from '../components/GroupComponent'
import { SceneTagComponent } from '../components/SceneTagComponent'
import { ShadowComponent } from '../components/ShadowComponent'
import { UpdatableCallback, UpdatableComponent } from '../components/UpdatableComponent'
import { VisibleComponent } from '../components/VisibleComponent'
import FogSystem from './FogSystem'
Expand Down Expand Up @@ -57,16 +57,12 @@ export default async function SceneObjectSystem(world: World) {
const groupQuery = defineQuery([GroupComponent])
const updatableQuery = defineQuery([GroupComponent, UpdatableComponent, CallbackComponent])

const xrState = getState(XRState)

const reactorSystem = startQueryReactor([GroupComponent, Not(SceneTagComponent), VisibleComponent], function (props) {
const entity = props.root.entity

const is8thWallActive = useHookstate(xrState.is8thWallActive)

useEffect(() => {
/** ensure that hmd has no heavy materials */
if (isHMD || is8thWallActive.value) {
if (isHMD) {
// this code seems to have a race condition where a small percentage of the time, materials end up being fully transparent
for (const object of getOptionalComponent(entity, GroupComponent) ?? [])
object.traverse((obj: Mesh<any, any>) => {
Expand All @@ -84,7 +80,7 @@ export default async function SceneObjectSystem(world: World) {
}
})
}
}, [is8thWallActive])
}, [])

return null
})
Expand All @@ -107,6 +103,7 @@ export default async function SceneObjectSystem(world: World) {

const groupComponent = useOptionalComponent(entity, GroupComponent)
const visibleComponent = useOptionalComponent(entity, VisibleComponent)
const shadowComponent = useOptionalComponent(entity, ShadowComponent)
const _groups = useHookstate([] as Object3DWithEntity[])

useEffect(() => {
Expand Down Expand Up @@ -149,6 +146,16 @@ export default async function SceneObjectSystem(world: World) {
if (groupComponent?.value) for (const obj of groupComponent.value) obj.visible = !!visibleComponent?.value
}, [visibleComponent, groupComponent])

useEffect(() => {
if (groupComponent?.value) {
if (shadowComponent?.value)
for (const obj of groupComponent.value) {
obj.castShadow = shadowComponent.cast.value
obj.receiveShadow = shadowComponent.receive.value
}
}
}, [shadowComponent, groupComponent])

return null
})

Expand Down
4 changes: 0 additions & 4 deletions packages/engine/src/scene/systems/SceneObjectUpdateSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ export default async function SceneObjectUpdateSystem(world: World) {
})

const cameraQuery = defineQuery([CameraComponent])
const shadowQuery = defineQuery([GroupComponent, ShadowComponent])
const envmapQuery = defineQuery([GroupComponent, EnvmapComponent])
const imageQuery = defineQuery([ImageComponent])
const sceneEnvmapQuery = defineQuery([SceneTagComponent, EnvmapComponent])
Expand All @@ -418,7 +417,6 @@ export default async function SceneObjectUpdateSystem(world: World) {
const execute = () => {
for (const action of modifyPropertyActionQueue()) {
for (const entity of action.entities) {
if (hasComponent(entity, ShadowComponent) && hasComponent(entity, GroupComponent)) updateShadow(entity)
if (hasComponent(entity, EnvmapComponent) && hasComponent(entity, GroupComponent)) updateEnvMap(entity)
if (hasComponent(entity, SkyboxComponent)) updateSkybox(entity)
if (hasComponent(entity, PortalComponent)) updatePortal(entity)
Expand All @@ -432,7 +430,6 @@ export default async function SceneObjectUpdateSystem(world: World) {
}

for (const entity of cameraQuery.enter()) addObjectToGroup(entity, getComponent(entity, CameraComponent).camera)
for (const entity of shadowQuery.enter()) updateShadow(entity)
for (const entity of envmapQuery.enter()) updateEnvMap(entity)
for (const entity of loopableAnimationQuery.enter()) updateLoopAnimation(entity)
for (const entity of skyboxQuery.enter()) updateSkybox(entity)
Expand Down Expand Up @@ -569,7 +566,6 @@ export default async function SceneObjectUpdateSystem(world: World) {
world.sceneLoadingRegistry.delete(SCENE_COMPONENT_SPLINE)

removeQuery(world, cameraQuery)
removeQuery(world, shadowQuery)
removeQuery(world, envmapQuery)
removeQuery(world, imageQuery)
removeQuery(world, sceneEnvmapQuery)
Expand Down
43 changes: 0 additions & 43 deletions packages/engine/src/xr/8thwall/WebXR8thwallProxy.ts

This file was deleted.

Loading