Skip to content

Commit

Permalink
Merge branch '2024.2.1' of https://github.com/vircadia/vircadia-web i…
Browse files Browse the repository at this point in the history
…nto 2024.2.1
  • Loading branch information
Aitolda committed Oct 9, 2024
2 parents 4045343 + a9363ff commit a807a32
Show file tree
Hide file tree
Showing 4 changed files with 363 additions and 335 deletions.
207 changes: 105 additions & 102 deletions src/modules/entity/EntityInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,102 +1,105 @@
//
// IEntity.ts
//
// Created by Nolan Huang on 3 Aug 2022.
// Copyright 2022 Vircadia contributors.
// Copyright 2022 DigiSomni LLC.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
import { IEntityProperties, ISpatialProperties, IBehaviorProperties,
IModelEProperties, IShapeProperties, ILightProperties,
IZoneProperties, IImageProperties, IMaterialProperties, IWebProperties } from "./EntityProperties";
import { Observable } from "@babylonjs/core";

export interface IEntity extends
IEntityProperties,
ISpatialProperties,
IBehaviorProperties {

onCommonPropertiesChanged?: Observable<IEntity>;
onParentChanged?: Observable<IEntity>;
onPositionAndRotationChanged?: Observable<IEntity>;
onDimensionChanged?: Observable<IEntity>;
onRenderModeChanged?: Observable<IEntity>;
onScriptChanged?: Observable<IEntity>;
onUserDataChanged?: Observable<IEntity>;
onCollisionPropertiesChanged?: Observable<IEntity>;
onPhysicsPropertiesChanged?: Observable<IEntity>;
}

export interface IModelEntity extends
IEntity,
IModelEProperties {

onModelURLChanged?: Observable<IEntity>;
onAnimationChanged?: Observable<IEntity>
}

export type JitsiSettings = {
roomID: string;
roomName: string;
};

export type WebExtensions = {
jitsi: JitsiSettings | undefined
};

export interface IWebEntity extends
IEntity,
IWebProperties {

onColorChanged: Observable<IEntity>;
onSourceURLChanged: Observable<IEntity>;
onWebPropertiesChanged: Observable<IEntity>;
}

export interface IShapeEntity extends
IEntity,
IShapeProperties {

onShapeChanged?: Observable<IEntity>;
onColorChanged?: Observable<IEntity>;
}

export interface ILightEntity extends
IEntity,
ILightProperties {

onLightPropertiesChanged?: Observable<IEntity>;
onLightTypeChanged?: Observable<IEntity>;
}

export interface IZoneEntity extends
IEntity,
IZoneProperties {

onShapeTypeChanged: Observable<IEntity>;
onAmbientLightPropertiesChanged: Observable<IEntity>;
onKeyLightPropertiesChanged: Observable<IEntity>;
onSkyboxPropertiesChanged: Observable<IEntity>;
onHazePropertiesChanged: Observable<IEntity>;
onBloomPropertiesChanged: Observable<IEntity>;
}

export interface IImageEntity extends
IEntity,
IImageProperties {

onColorChanged: Observable<IEntity>;
onImageURLChanged: Observable<IEntity>
}

export interface IMaterialEntity extends
IEntity,
IMaterialProperties {

onMaterialDataChanged?: Observable<IEntity>;
onMaterialMappingModeChanged?: Observable<IEntity>;
onMaterialPriorityChanged?: Observable<IEntity>;
onParentMaterialNameChanged?: Observable<IEntity>;
}
//
// IEntity.ts
//
// Created by Nolan Huang on 3 Aug 2022.
// Copyright 2022 Vircadia contributors.
// Copyright 2022 DigiSomni LLC.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
import {
IEntityProperties, ISpatialProperties, IBehaviorProperties,
IModelEProperties, IShapeProperties, ILightProperties,
IZoneProperties, IImageProperties, IMaterialProperties, IWebProperties
} from "./EntityProperties";
import { Observable } from "@babylonjs/core";

export interface IEntity extends
IEntityProperties,
ISpatialProperties,
IBehaviorProperties {

onCommonPropertiesChanged?: Observable<IEntity>;
onParentChanged?: Observable<IEntity>;
onPositionAndRotationChanged?: Observable<IEntity>;
onDimensionChanged?: Observable<IEntity>;
onRenderModeChanged?: Observable<IEntity>;
onScriptChanged?: Observable<IEntity>;
onUserDataChanged?: Observable<IEntity>;
onCollisionPropertiesChanged?: Observable<IEntity>;
onPhysicsPropertiesChanged?: Observable<IEntity>;
}

export interface IModelEntity extends
IEntity,
IModelEProperties {

onModelURLChanged?: Observable<IEntity>;
onAnimationChanged?: Observable<IEntity>
}

export type JitsiSettings = {
roomID: string;
roomName: string;
};

export type WebExtensions = {
jitsi: JitsiSettings | undefined
};

export interface IWebEntity extends
IEntity,
IWebProperties {

onColorChanged: Observable<IEntity>;
onSourceURLChanged: Observable<IEntity>;
onWebPropertiesChanged: Observable<IEntity>;
}

export interface IShapeEntity extends
IEntity,
IShapeProperties {

onShapeChanged?: Observable<IEntity>;
onColorChanged?: Observable<IEntity>;
}

export interface ILightEntity extends
IEntity,
ILightProperties {

onLightPropertiesChanged?: Observable<IEntity>;
onLightTypeChanged?: Observable<IEntity>;
}

export interface IZoneEntity extends
IEntity,
IZoneProperties {

onShapeTypeChanged: Observable<IEntity>;
onCompoundShapeURLChanged: Observable<IEntity>;
onAmbientLightPropertiesChanged: Observable<IEntity>;
onKeyLightPropertiesChanged: Observable<IEntity>;
onSkyboxPropertiesChanged: Observable<IEntity>;
onHazePropertiesChanged: Observable<IEntity>;
onBloomPropertiesChanged: Observable<IEntity>;
}

export interface IImageEntity extends
IEntity,
IImageProperties {

onColorChanged: Observable<IEntity>;
onImageURLChanged: Observable<IEntity>
}

export interface IMaterialEntity extends
IEntity,
IMaterialProperties {

onMaterialDataChanged?: Observable<IEntity>;
onMaterialMappingModeChanged?: Observable<IEntity>;
onMaterialPriorityChanged?: Observable<IEntity>;
onParentMaterialNameChanged?: Observable<IEntity>;
}
13 changes: 10 additions & 3 deletions src/modules/entity/components/controllers/ZoneEntityController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ export class ZoneEntityController extends EntityController {
super.onInitialize();

this._zoneEntity.onShapeTypeChanged?.add(this._handleShapeTypeChanged.bind(this));
this._zoneEntity.onCompoundShapeURLChanged?.add(this._handleCompoundShapeURLChanged.bind(this));
this._zoneEntity.onSkyboxPropertiesChanged?.add(this._updateSkybox.bind(this));
this._zoneEntity.onAmbientLightPropertiesChanged?.add(this.updateAmbientLight.bind(this));
this._zoneEntity.onKeyLightPropertiesChanged?.add(this.updateKeyLight.bind(this));
this._zoneEntity.onHazePropertiesChanged?.add(this.updateHaze.bind(this));
this._zoneEntity.onUserDataChanged?.add(this._updateUserData.bind(this));

this._zoneEntity.onDimensionChanged?.add(this._updateDimensions.bind(this));
this._zoneEntity.onPositionAndRotationChanged?.add(this._updatePositionAndRotation.bind(this));
}

public onStart(): void {
Expand All @@ -130,10 +132,15 @@ export class ZoneEntityController extends EntityController {
}

protected _handleShapeTypeChanged(): void {
// eslint-disable-next-line no-empty
if (this._gameObject) {
console.log(`Zone shape type changed to: ${this._zoneEntity.shapeType}`);
// Here you could implement logic to change the zone's visual representation
// or behavior based on the new shape type, if needed in the future.
}

}
protected _handleCompoundShapeURLChanged(): void {
console.log(`Zone compound shape URL changed to: ${this._zoneEntity.compoundShapeURL}`);
// Here you could implement logic to load and apply the compound shape
// from the URL, if needed in the future.
}

protected _updateDimensions(): void {
Expand Down
Loading

0 comments on commit a807a32

Please sign in to comment.