auto-git:
[change] src/viewport-three/viewport-focus.ts
This commit is contained in:
@@ -421,7 +421,11 @@ function createTriggerVolumeFocusTarget(position: Vec3, size: Vec3): ViewportFoc
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function includeEntity(bounds: FocusBoundsAccumulator, entity: EntityInstance) {
|
function includeEntity(
|
||||||
|
bounds: FocusBoundsAccumulator,
|
||||||
|
entity: EntityInstance,
|
||||||
|
document: SceneDocument
|
||||||
|
) {
|
||||||
switch (entity.kind) {
|
switch (entity.kind) {
|
||||||
case "pointLight":
|
case "pointLight":
|
||||||
includeSphereEntity(bounds, entity.position, Math.max(0.5, entity.distance));
|
includeSphereEntity(bounds, entity.position, Math.max(0.5, entity.distance));
|
||||||
@@ -429,9 +433,21 @@ function includeEntity(bounds: FocusBoundsAccumulator, entity: EntityInstance) {
|
|||||||
case "spotLight":
|
case "spotLight":
|
||||||
includeSphereEntity(bounds, entity.position, Math.max(0.75, entity.distance));
|
includeSphereEntity(bounds, entity.position, Math.max(0.75, entity.distance));
|
||||||
break;
|
break;
|
||||||
case "cameraRig":
|
case "cameraRig": {
|
||||||
includeTeleportTarget(bounds, entity.position);
|
const position = resolveCameraRigDocumentPosition(
|
||||||
|
entity,
|
||||||
|
document.entities,
|
||||||
|
document.paths,
|
||||||
|
{
|
||||||
|
fallbackToPathStart: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (position !== null) {
|
||||||
|
includeTeleportTarget(bounds, position);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case "playerStart":
|
case "playerStart":
|
||||||
case "sceneEntry":
|
case "sceneEntry":
|
||||||
case "npc":
|
case "npc":
|
||||||
@@ -452,14 +468,27 @@ function includeEntity(bounds: FocusBoundsAccumulator, entity: EntityInstance) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEntityFocusTarget(entity: EntityInstance): ViewportFocusTarget {
|
function createEntityFocusTarget(
|
||||||
|
entity: EntityInstance,
|
||||||
|
document: SceneDocument
|
||||||
|
): ViewportFocusTarget | null {
|
||||||
switch (entity.kind) {
|
switch (entity.kind) {
|
||||||
case "pointLight":
|
case "pointLight":
|
||||||
return createSphereEntityFocusTarget(entity.position, Math.max(0.6, entity.distance), 0.75);
|
return createSphereEntityFocusTarget(entity.position, Math.max(0.6, entity.distance), 0.75);
|
||||||
case "spotLight":
|
case "spotLight":
|
||||||
return createSphereEntityFocusTarget(entity.position, Math.max(0.8, entity.distance), 0.9);
|
return createSphereEntityFocusTarget(entity.position, Math.max(0.8, entity.distance), 0.9);
|
||||||
case "cameraRig":
|
case "cameraRig": {
|
||||||
return createTeleportTargetFocusTarget(entity.position);
|
const position = resolveCameraRigDocumentPosition(
|
||||||
|
entity,
|
||||||
|
document.entities,
|
||||||
|
document.paths,
|
||||||
|
{
|
||||||
|
fallbackToPathStart: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return position === null ? null : createTeleportTargetFocusTarget(position);
|
||||||
|
}
|
||||||
case "playerStart":
|
case "playerStart":
|
||||||
case "sceneEntry":
|
case "sceneEntry":
|
||||||
case "npc":
|
case "npc":
|
||||||
|
|||||||
Reference in New Issue
Block a user