mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
Merge pull request #10856 from zfox23/spectatorCamera_positionSpeedup
Spectator Camera position/orientation update speedup
This commit is contained in:
commit
fcc131187d
4 changed files with 103 additions and 78 deletions
|
@ -1957,7 +1957,7 @@ void Application::initializeGL() {
|
||||||
render::CullFunctor cullFunctor = LODManager::shouldRender;
|
render::CullFunctor cullFunctor = LODManager::shouldRender;
|
||||||
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
||||||
bool isDeferred = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD);
|
bool isDeferred = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD);
|
||||||
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraFrame", cullFunctor);
|
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor);
|
||||||
_renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, isDeferred);
|
_renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, isDeferred);
|
||||||
_renderEngine->load();
|
_renderEngine->load();
|
||||||
_renderEngine->registerScene(_main3DScene);
|
_renderEngine->registerScene(_main3DScene);
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "SecondaryCamera.h"
|
#include "SecondaryCamera.h"
|
||||||
#include <TextureCache.h>
|
#include <TextureCache.h>
|
||||||
#include <gpu/Context.h>
|
#include <gpu/Context.h>
|
||||||
|
#include <EntityScriptingInterface.h>
|
||||||
|
|
||||||
using RenderArgsPointer = std::shared_ptr<RenderArgs>;
|
using RenderArgsPointer = std::shared_ptr<RenderArgs>;
|
||||||
|
|
||||||
|
@ -27,40 +29,33 @@ void MainRenderTask::build(JobModel& task, const render::Varying& inputs, render
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SecondaryCameraRenderTaskConfig::resetSize(int width, int height) { // FIXME: Add an arg here for "destinationFramebuffer"
|
class SecondaryCameraJob { // Changes renderContext for our framebuffer and view.
|
||||||
bool wasEnabled = isEnabled();
|
QUuid _attachedEntityId{};
|
||||||
setEnabled(false);
|
|
||||||
auto textureCache = DependencyManager::get<TextureCache>();
|
|
||||||
textureCache->resetSpectatorCameraFramebuffer(width, height); // FIXME: Call the correct reset function based on the "destinationFramebuffer" arg
|
|
||||||
setEnabled(wasEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SecondaryCameraRenderTaskConfig::resetSizeSpectatorCamera(int width, int height) { // Carefully adjust the framebuffer / texture.
|
|
||||||
resetSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
class BeginSecondaryCameraFrame { // Changes renderContext for our framebuffer and view.
|
|
||||||
glm::vec3 _position{};
|
glm::vec3 _position{};
|
||||||
glm::quat _orientation{};
|
glm::quat _orientation{};
|
||||||
float _vFoV{};
|
float _vFoV{};
|
||||||
float _nearClipPlaneDistance{};
|
float _nearClipPlaneDistance{};
|
||||||
float _farClipPlaneDistance{};
|
float _farClipPlaneDistance{};
|
||||||
|
EntityPropertyFlags _attachedEntityPropertyFlags;
|
||||||
|
QSharedPointer<EntityScriptingInterface> _entityScriptingInterface;
|
||||||
public:
|
public:
|
||||||
using Config = BeginSecondaryCameraFrameConfig;
|
using Config = SecondaryCameraJobConfig;
|
||||||
using JobModel = render::Job::ModelO<BeginSecondaryCameraFrame, RenderArgsPointer, Config>;
|
using JobModel = render::Job::ModelO<SecondaryCameraJob, RenderArgsPointer, Config>;
|
||||||
BeginSecondaryCameraFrame() {
|
SecondaryCameraJob() {
|
||||||
_cachedArgsPointer = std::make_shared<RenderArgs>(_cachedArgs);
|
_cachedArgsPointer = std::make_shared<RenderArgs>(_cachedArgs);
|
||||||
|
_entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||||
|
_attachedEntityPropertyFlags += PROP_POSITION;
|
||||||
|
_attachedEntityPropertyFlags += PROP_ROTATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void configure(const Config& config) {
|
void configure(const Config& config) {
|
||||||
if (config.enabled || config.alwaysEnabled) {
|
_attachedEntityId = config.attachedEntityId;
|
||||||
_position = config.position;
|
_position = config.position;
|
||||||
_orientation = config.orientation;
|
_orientation = config.orientation;
|
||||||
_vFoV = config.vFoV;
|
_vFoV = config.vFoV;
|
||||||
_nearClipPlaneDistance = config.nearClipPlaneDistance;
|
_nearClipPlaneDistance = config.nearClipPlaneDistance;
|
||||||
_farClipPlaneDistance = config.farClipPlaneDistance;
|
_farClipPlaneDistance = config.farClipPlaneDistance;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void run(const render::RenderContextPointer& renderContext, RenderArgsPointer& cachedArgs) {
|
void run(const render::RenderContextPointer& renderContext, RenderArgsPointer& cachedArgs) {
|
||||||
auto args = renderContext->args;
|
auto args = renderContext->args;
|
||||||
|
@ -83,8 +78,14 @@ public:
|
||||||
});
|
});
|
||||||
|
|
||||||
auto srcViewFrustum = args->getViewFrustum();
|
auto srcViewFrustum = args->getViewFrustum();
|
||||||
|
if (!_attachedEntityId.isNull()) {
|
||||||
|
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(_attachedEntityId, _attachedEntityPropertyFlags);
|
||||||
|
srcViewFrustum.setPosition(entityProperties.getPosition());
|
||||||
|
srcViewFrustum.setOrientation(entityProperties.getRotation());
|
||||||
|
} else {
|
||||||
srcViewFrustum.setPosition(_position);
|
srcViewFrustum.setPosition(_position);
|
||||||
srcViewFrustum.setOrientation(_orientation);
|
srcViewFrustum.setOrientation(_orientation);
|
||||||
|
}
|
||||||
srcViewFrustum.setProjection(glm::perspective(glm::radians(_vFoV), ((float)args->_viewport.z / (float)args->_viewport.w), _nearClipPlaneDistance, _farClipPlaneDistance));
|
srcViewFrustum.setProjection(glm::perspective(glm::radians(_vFoV), ((float)args->_viewport.z / (float)args->_viewport.w), _nearClipPlaneDistance, _farClipPlaneDistance));
|
||||||
// Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera,
|
// Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera,
|
||||||
// which is not what we want here.
|
// which is not what we want here.
|
||||||
|
@ -99,6 +100,41 @@ protected:
|
||||||
RenderArgsPointer _cachedArgsPointer;
|
RenderArgsPointer _cachedArgsPointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void SecondaryCameraJobConfig::setPosition(glm::vec3 pos) {
|
||||||
|
if (attachedEntityId.isNull()) {
|
||||||
|
position = pos;
|
||||||
|
emit dirty();
|
||||||
|
} else {
|
||||||
|
qDebug() << "ERROR: Cannot set position of SecondaryCamera while attachedEntityId is set.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecondaryCameraJobConfig::setOrientation(glm::quat orient) {
|
||||||
|
if (attachedEntityId.isNull()) {
|
||||||
|
orientation = orient;
|
||||||
|
emit dirty();
|
||||||
|
} else {
|
||||||
|
qDebug() << "ERROR: Cannot set orientation of SecondaryCamera while attachedEntityId is set.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecondaryCameraJobConfig::enableSecondaryCameraRenderConfigs(bool enabled) {
|
||||||
|
qApp->getRenderEngine()->getConfiguration()->getConfig<SecondaryCameraRenderTask>()->setEnabled(enabled);
|
||||||
|
setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecondaryCameraJobConfig::resetSizeSpectatorCamera(int width, int height) { // Carefully adjust the framebuffer / texture.
|
||||||
|
qApp->getRenderEngine()->getConfiguration()->getConfig<SecondaryCameraRenderTask>()->resetSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecondaryCameraRenderTaskConfig::resetSize(int width, int height) { // FIXME: Add an arg here for "destinationFramebuffer"
|
||||||
|
bool wasEnabled = isEnabled();
|
||||||
|
setEnabled(false);
|
||||||
|
auto textureCache = DependencyManager::get<TextureCache>();
|
||||||
|
textureCache->resetSpectatorCameraFramebuffer(width, height); // FIXME: Call the correct reset function based on the "destinationFramebuffer" arg
|
||||||
|
setEnabled(wasEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
class EndSecondaryCameraFrame { // Restores renderContext.
|
class EndSecondaryCameraFrame { // Restores renderContext.
|
||||||
public:
|
public:
|
||||||
using JobModel = render::Job::ModelI<EndSecondaryCameraFrame, RenderArgsPointer>;
|
using JobModel = render::Job::ModelI<EndSecondaryCameraFrame, RenderArgsPointer>;
|
||||||
|
@ -119,7 +155,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void SecondaryCameraRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor) {
|
void SecondaryCameraRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor) {
|
||||||
const auto cachedArg = task.addJob<BeginSecondaryCameraFrame>("BeginSecondaryCamera");
|
const auto cachedArg = task.addJob<SecondaryCameraJob>("SecondaryCamera");
|
||||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor);
|
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor);
|
||||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||||
task.addJob<RenderDeferredTask>("RenderDeferredTask", items);
|
task.addJob<RenderDeferredTask>("RenderDeferredTask", items);
|
||||||
|
|
|
@ -28,34 +28,40 @@ public:
|
||||||
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred = true);
|
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
class BeginSecondaryCameraFrameConfig : public render::Task::Config { // Exposes secondary camera parameters to JavaScript.
|
class SecondaryCameraJobConfig : public render::Task::Config { // Exposes secondary camera parameters to JavaScript.
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(glm::vec3 position MEMBER position NOTIFY dirty) // of viewpoint to render from
|
Q_PROPERTY(QUuid attachedEntityId MEMBER attachedEntityId NOTIFY dirty) // entity whose properties define camera position and orientation
|
||||||
Q_PROPERTY(glm::quat orientation MEMBER orientation NOTIFY dirty) // of viewpoint to render from
|
Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPosition) // of viewpoint to render from
|
||||||
|
Q_PROPERTY(glm::quat orientation READ getOrientation WRITE setOrientation) // of viewpoint to render from
|
||||||
Q_PROPERTY(float vFoV MEMBER vFoV NOTIFY dirty) // Secondary camera's vertical field of view. In degrees.
|
Q_PROPERTY(float vFoV MEMBER vFoV NOTIFY dirty) // Secondary camera's vertical field of view. In degrees.
|
||||||
Q_PROPERTY(float nearClipPlaneDistance MEMBER nearClipPlaneDistance NOTIFY dirty) // Secondary camera's near clip plane distance. In meters.
|
Q_PROPERTY(float nearClipPlaneDistance MEMBER nearClipPlaneDistance NOTIFY dirty) // Secondary camera's near clip plane distance. In meters.
|
||||||
Q_PROPERTY(float farClipPlaneDistance MEMBER farClipPlaneDistance NOTIFY dirty) // Secondary camera's far clip plane distance. In meters.
|
Q_PROPERTY(float farClipPlaneDistance MEMBER farClipPlaneDistance NOTIFY dirty) // Secondary camera's far clip plane distance. In meters.
|
||||||
public:
|
public:
|
||||||
|
QUuid attachedEntityId{};
|
||||||
glm::vec3 position{};
|
glm::vec3 position{};
|
||||||
glm::quat orientation{};
|
glm::quat orientation{};
|
||||||
float vFoV{ 45.0f };
|
float vFoV{ 45.0f };
|
||||||
float nearClipPlaneDistance{ 0.1f };
|
float nearClipPlaneDistance{ 0.1f };
|
||||||
float farClipPlaneDistance{ 100.0f };
|
float farClipPlaneDistance{ 100.0f };
|
||||||
BeginSecondaryCameraFrameConfig() : render::Task::Config(false) {}
|
SecondaryCameraJobConfig() : render::Task::Config(false) {}
|
||||||
signals:
|
signals:
|
||||||
void dirty();
|
void dirty();
|
||||||
|
public slots:
|
||||||
|
glm::vec3 getPosition() { return position; }
|
||||||
|
void setPosition(glm::vec3 pos);
|
||||||
|
glm::quat getOrientation() { return orientation; }
|
||||||
|
void setOrientation(glm::quat orient);
|
||||||
|
void enableSecondaryCameraRenderConfigs(bool enabled);
|
||||||
|
void resetSizeSpectatorCamera(int width, int height);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SecondaryCameraRenderTaskConfig : public render::Task::Config {
|
class SecondaryCameraRenderTaskConfig : public render::Task::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SecondaryCameraRenderTaskConfig() : render::Task::Config(false) {}
|
SecondaryCameraRenderTaskConfig() : render::Task::Config(false) {}
|
||||||
private:
|
|
||||||
void resetSize(int width, int height);
|
void resetSize(int width, int height);
|
||||||
signals:
|
signals:
|
||||||
void dirty();
|
void dirty();
|
||||||
public slots:
|
|
||||||
void resetSizeSpectatorCamera(int width, int height);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SecondaryCameraRenderTask {
|
class SecondaryCameraRenderTask {
|
||||||
|
|
|
@ -28,33 +28,6 @@
|
||||||
Vec3.multiply(distance, Quat.getForward(orientation || MyAvatar.orientation)));
|
Vec3.multiply(distance, Quat.getForward(orientation || MyAvatar.orientation)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function Name: updateRenderFromCamera()
|
|
||||||
//
|
|
||||||
// Description:
|
|
||||||
// -The update function for the spectator camera. Modifies the camera's position
|
|
||||||
// and orientation.
|
|
||||||
//
|
|
||||||
// Relevant Variables:
|
|
||||||
// -spectatorFrameRenderConfig: The render configuration of the spectator camera
|
|
||||||
// render job. It controls the rendered texture size of the spectator camera.
|
|
||||||
// -beginSpectatorFrameRenderConfig: The render configuration of the spectator camera
|
|
||||||
// render job. It controls the orientation and position of the secondary camera whose viewport is rendered to
|
|
||||||
// the texture.
|
|
||||||
// -viewFinderOverlay: The in-world overlay that displays the spectator camera's view.
|
|
||||||
// -camera: The in-world entity that corresponds to the spectator camera.
|
|
||||||
// -cameraIsDynamic: "false" for now while we figure out why dynamic, parented overlays
|
|
||||||
// drift with respect to their parent.
|
|
||||||
var spectatorFrameRenderConfig = Render.getConfig("SecondaryCameraFrame");
|
|
||||||
var beginSpectatorFrameRenderConfig = Render.getConfig("BeginSecondaryCamera");
|
|
||||||
var viewFinderOverlay = false;
|
|
||||||
var camera = false;
|
|
||||||
var cameraIsDynamic = false;
|
|
||||||
function updateRenderFromCamera() {
|
|
||||||
var cameraData = Entities.getEntityProperties(camera, ['position', 'rotation']);
|
|
||||||
beginSpectatorFrameRenderConfig.orientation = cameraData.rotation;
|
|
||||||
beginSpectatorFrameRenderConfig.position = cameraData.position;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function Name: spectatorCameraOn()
|
// Function Name: spectatorCameraOn()
|
||||||
//
|
//
|
||||||
// Description:
|
// Description:
|
||||||
|
@ -62,6 +35,19 @@
|
||||||
// spawn the camera entity.
|
// spawn the camera entity.
|
||||||
//
|
//
|
||||||
// Relevant Variables:
|
// Relevant Variables:
|
||||||
|
// -spectatorCameraConfig: The render configuration of the spectator camera
|
||||||
|
// render job. It controls various attributes of the Secondary Camera, such as:
|
||||||
|
// -The entity ID to follow
|
||||||
|
// -Position
|
||||||
|
// -Orientation
|
||||||
|
// -Rendered texture size
|
||||||
|
// -Vertical field of view
|
||||||
|
// -Near clip plane distance
|
||||||
|
// -Far clip plane distance
|
||||||
|
// -viewFinderOverlay: The in-world overlay that displays the spectator camera's view.
|
||||||
|
// -camera: The in-world entity that corresponds to the spectator camera.
|
||||||
|
// -cameraIsDynamic: "false" for now while we figure out why dynamic, parented overlays
|
||||||
|
// drift with respect to their parent.
|
||||||
// -vFoV: The vertical field of view of the spectator camera.
|
// -vFoV: The vertical field of view of the spectator camera.
|
||||||
// -nearClipPlaneDistance: The near clip plane distance of the spectator camera (aka "camera").
|
// -nearClipPlaneDistance: The near clip plane distance of the spectator camera (aka "camera").
|
||||||
// -farClipPlaneDistance: The far clip plane distance of the spectator camera.
|
// -farClipPlaneDistance: The far clip plane distance of the spectator camera.
|
||||||
|
@ -71,8 +57,10 @@
|
||||||
// -viewFinderOverlayDim: The x, y, and z dimensions of the viewFinderOverlay.
|
// -viewFinderOverlayDim: The x, y, and z dimensions of the viewFinderOverlay.
|
||||||
// -camera: The camera model which is grabbable.
|
// -camera: The camera model which is grabbable.
|
||||||
// -viewFinderOverlay: The preview of what the spectator camera is viewing, placed inside the glass pane.
|
// -viewFinderOverlay: The preview of what the spectator camera is viewing, placed inside the glass pane.
|
||||||
// -cameraUpdateInterval: Used when setting Script.setInterval()
|
var spectatorCameraConfig = Render.getConfig("SecondaryCamera");
|
||||||
// -CAMERA_UPDATE_INTERVAL_MS: Defines the time between calls to updateRenderFromCamera()
|
var viewFinderOverlay = false;
|
||||||
|
var camera = false;
|
||||||
|
var cameraIsDynamic = false;
|
||||||
var vFoV = 45.0;
|
var vFoV = 45.0;
|
||||||
var nearClipPlaneDistance = 0.1;
|
var nearClipPlaneDistance = 0.1;
|
||||||
var farClipPlaneDistance = 100.0;
|
var farClipPlaneDistance = 100.0;
|
||||||
|
@ -83,17 +71,14 @@
|
||||||
// draws textures, but should be looked into at some point. Also the z dimension shouldn't affect
|
// draws textures, but should be looked into at some point. Also the z dimension shouldn't affect
|
||||||
// the overlay since it is an Image3DOverlay so it is set to 0.
|
// the overlay since it is an Image3DOverlay so it is set to 0.
|
||||||
var viewFinderOverlayDim = { x: glassPaneWidth, y: -glassPaneWidth, z: 0 };
|
var viewFinderOverlayDim = { x: glassPaneWidth, y: -glassPaneWidth, z: 0 };
|
||||||
var cameraUpdateInterval;
|
|
||||||
var CAMERA_UPDATE_INTERVAL_MS = 11; // Result of (1000 (ms/s)) / (90 (hz)) rounded down
|
|
||||||
function spectatorCameraOn() {
|
function spectatorCameraOn() {
|
||||||
// Sets the special texture size based on the window it is displayed in, which doesn't include the menu bar
|
// Sets the special texture size based on the window it is displayed in, which doesn't include the menu bar
|
||||||
spectatorFrameRenderConfig.resetSizeSpectatorCamera(Window.innerWidth, Window.innerHeight);
|
spectatorCameraConfig.enableSecondaryCameraRenderConfigs(true);
|
||||||
spectatorFrameRenderConfig.enabled = beginSpectatorFrameRenderConfig.enabled = true;
|
spectatorCameraConfig.resetSizeSpectatorCamera(Window.innerWidth, Window.innerHeight);
|
||||||
beginSpectatorFrameRenderConfig.vFoV = vFoV;
|
spectatorCameraConfig.vFoV = vFoV;
|
||||||
beginSpectatorFrameRenderConfig.nearClipPlaneDistance = nearClipPlaneDistance;
|
spectatorCameraConfig.nearClipPlaneDistance = nearClipPlaneDistance;
|
||||||
beginSpectatorFrameRenderConfig.farClipPlaneDistance = farClipPlaneDistance;
|
spectatorCameraConfig.farClipPlaneDistance = farClipPlaneDistance;
|
||||||
cameraRotation = MyAvatar.orientation, cameraPosition = inFrontOf(1, Vec3.sum(MyAvatar.position, { x: 0, y: 0.3, z: 0 }));
|
cameraRotation = MyAvatar.orientation, cameraPosition = inFrontOf(1, Vec3.sum(MyAvatar.position, { x: 0, y: 0.3, z: 0 }));
|
||||||
cameraUpdateInterval = Script.setInterval(updateRenderFromCamera, 11); // Update every 11ms (90.9hz)
|
|
||||||
camera = Entities.addEntity({
|
camera = Entities.addEntity({
|
||||||
"angularDamping": 1,
|
"angularDamping": 1,
|
||||||
"damping": 1,
|
"damping": 1,
|
||||||
|
@ -112,6 +97,7 @@
|
||||||
"type": "Model",
|
"type": "Model",
|
||||||
"userData": "{\"grabbableKey\":{\"grabbable\":true}}"
|
"userData": "{\"grabbableKey\":{\"grabbable\":true}}"
|
||||||
}, true);
|
}, true);
|
||||||
|
spectatorCameraConfig.attachedEntityId = camera;
|
||||||
updateOverlay();
|
updateOverlay();
|
||||||
setDisplay(monitorShowsCameraView);
|
setDisplay(monitorShowsCameraView);
|
||||||
}
|
}
|
||||||
|
@ -122,11 +108,8 @@
|
||||||
// -Call this function to shut down the spectator camera and
|
// -Call this function to shut down the spectator camera and
|
||||||
// destroy the camera entity.
|
// destroy the camera entity.
|
||||||
function spectatorCameraOff() {
|
function spectatorCameraOff() {
|
||||||
spectatorFrameRenderConfig.enabled = beginSpectatorFrameRenderConfig.enabled = false;
|
spectatorCameraConfig.attachedEntityId = false;
|
||||||
if (cameraUpdateInterval) {
|
spectatorCameraConfig.enableSecondaryCameraRenderConfigs(false);
|
||||||
Script.clearInterval(cameraUpdateInterval);
|
|
||||||
cameraUpdateInterval = false;
|
|
||||||
}
|
|
||||||
if (camera) {
|
if (camera) {
|
||||||
Entities.deleteEntity(camera);
|
Entities.deleteEntity(camera);
|
||||||
}
|
}
|
||||||
|
@ -235,7 +218,7 @@
|
||||||
// 4. Camera is on; "Monitor Shows" is "Camera View": "url" is "resource://spectatorCameraFrame"
|
// 4. Camera is on; "Monitor Shows" is "Camera View": "url" is "resource://spectatorCameraFrame"
|
||||||
function setDisplay(showCameraView) {
|
function setDisplay(showCameraView) {
|
||||||
// It would be fancy if the app would show instructions when (url === ""), but that's out of scope for now.
|
// It would be fancy if the app would show instructions when (url === ""), but that's out of scope for now.
|
||||||
var url = (camera && showCameraView && cameraUpdateInterval) ? "resource://spectatorCameraFrame" : "";
|
var url = (camera && showCameraView) ? "resource://spectatorCameraFrame" : "";
|
||||||
Window.setDisplayTexture(url);
|
Window.setDisplayTexture(url);
|
||||||
}
|
}
|
||||||
const MONITOR_SHOWS_CAMERA_VIEW_DEFAULT = false;
|
const MONITOR_SHOWS_CAMERA_VIEW_DEFAULT = false;
|
||||||
|
@ -299,7 +282,7 @@
|
||||||
viewFinderOverlayDim = { x: glassPaneWidth, y: -glassPaneWidth, z: 0 };
|
viewFinderOverlayDim = { x: glassPaneWidth, y: -glassPaneWidth, z: 0 };
|
||||||
}
|
}
|
||||||
updateOverlay();
|
updateOverlay();
|
||||||
spectatorFrameRenderConfig.resetSizeSpectatorCamera(geometryChanged.width, geometryChanged.height);
|
spectatorCameraConfig.resetSizeSpectatorCamera(geometryChanged.width, geometryChanged.height);
|
||||||
setDisplay(monitorShowsCameraView);
|
setDisplay(monitorShowsCameraView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue