mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
first cut, still stereo
This commit is contained in:
parent
ee86638c4e
commit
b41c470064
5 changed files with 37 additions and 18 deletions
|
@ -227,7 +227,7 @@ Rectangle {
|
|||
height: 250;
|
||||
color: spectatorCameraPreview.visible ? "transparent" : "black";
|
||||
|
||||
|
||||
|
||||
|
||||
AnimatedImage {
|
||||
source: "../../images/static.gif"
|
||||
|
@ -235,7 +235,7 @@ Rectangle {
|
|||
anchors.fill: parent;
|
||||
opacity: 0.15;
|
||||
}
|
||||
|
||||
|
||||
// Instructions (visible when display texture isn't set)
|
||||
FiraSansRegular {
|
||||
id: spectatorCameraInstructions;
|
||||
|
@ -247,7 +247,7 @@ Rectangle {
|
|||
horizontalAlignment: Text.AlignHCenter;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
}
|
||||
|
||||
|
||||
// Spectator Camera Preview
|
||||
Hifi.ResourceImageItem {
|
||||
id: spectatorCameraPreview;
|
||||
|
@ -360,6 +360,8 @@ Rectangle {
|
|||
}
|
||||
break;
|
||||
case 'showPreviewTextureNotInstructions':
|
||||
console.log('showPreviewTextureNotInstructions recvd', JSON.stringify(message));
|
||||
spectatorCameraPreview.url = message.url;
|
||||
spectatorCameraPreview.visible = message.setting;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -134,7 +134,7 @@ void HmdDisplayPlugin::customizeContext() {
|
|||
state->setBlendFunction(true,
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||
|
||||
|
||||
gpu::Shader::BindingSet bindings;
|
||||
bindings.insert({ "lineData", LINE_DATA_SLOT });;
|
||||
gpu::Shader::makeProgram(*program, bindings);
|
||||
|
@ -287,6 +287,7 @@ void HmdDisplayPlugin::internalPresent() {
|
|||
|
||||
viewport.z *= 2;
|
||||
}
|
||||
DependencyManager::get<TextureCache>()->setHmdPreviewTexture(_compositeFramebuffer->getRenderBuffer(0));
|
||||
renderFromTexture(batch, _compositeFramebuffer->getRenderBuffer(0), viewport, scissor);
|
||||
});
|
||||
swapBuffers();
|
||||
|
@ -312,7 +313,7 @@ void HmdDisplayPlugin::internalPresent() {
|
|||
_previewTexture->assignStoredMip(0, image.byteCount(), image.constBits());
|
||||
_previewTexture->setAutoGenerateMips(true);
|
||||
}
|
||||
|
||||
|
||||
auto viewport = getViewportForSourceSize(uvec2(_previewTexture->getDimensions()));
|
||||
|
||||
render([&](gpu::Batch& batch) {
|
||||
|
@ -323,7 +324,7 @@ void HmdDisplayPlugin::internalPresent() {
|
|||
}
|
||||
postPreview();
|
||||
|
||||
// If preview is disabled, we need to check to see if the window size has changed
|
||||
// If preview is disabled, we need to check to see if the window size has changed
|
||||
// and re-render the no-preview message
|
||||
if (_disablePreview) {
|
||||
auto window = _container->getPrimaryWidget();
|
||||
|
@ -510,7 +511,7 @@ void HmdDisplayPlugin::OverlayRenderer::build() {
|
|||
indices = std::make_shared<gpu::Buffer>();
|
||||
|
||||
//UV mapping source: http://www.mvps.org/directx/articles/spheremap.htm
|
||||
|
||||
|
||||
static const float fov = CompositorHelper::VIRTUAL_UI_TARGET_FOV.y;
|
||||
static const float aspectRatio = CompositorHelper::VIRTUAL_UI_ASPECT_RATIO;
|
||||
static const uint16_t stacks = 128;
|
||||
|
@ -672,7 +673,7 @@ bool HmdDisplayPlugin::setHandLaser(uint32_t hands, HandLaserMode mode, const ve
|
|||
_handLasers[1] = info;
|
||||
}
|
||||
});
|
||||
// FIXME defer to a child class plugin to determine if hand lasers are actually
|
||||
// FIXME defer to a child class plugin to determine if hand lasers are actually
|
||||
// available based on the presence or absence of hand controllers
|
||||
return true;
|
||||
}
|
||||
|
@ -687,7 +688,7 @@ bool HmdDisplayPlugin::setExtraLaser(HandLaserMode mode, const vec4& color, cons
|
|||
_extraLaserStart = sensorSpaceStart;
|
||||
});
|
||||
|
||||
// FIXME defer to a child class plugin to determine if hand lasers are actually
|
||||
// FIXME defer to a child class plugin to determine if hand lasers are actually
|
||||
// available based on the presence or absence of hand controllers
|
||||
return true;
|
||||
}
|
||||
|
@ -702,7 +703,7 @@ void HmdDisplayPlugin::compositeExtra() {
|
|||
if (_presentHandPoses[0] == IDENTITY_MATRIX && _presentHandPoses[1] == IDENTITY_MATRIX && !_presentExtraLaser.valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
render([&](gpu::Batch& batch) {
|
||||
batch.setFramebuffer(_compositeFramebuffer);
|
||||
batch.setModelTransform(Transform());
|
||||
|
|
|
@ -54,6 +54,7 @@ const std::string TextureCache::KTX_EXT { "ktx" };
|
|||
|
||||
static const QString RESOURCE_SCHEME = "resource";
|
||||
static const QUrl SPECTATOR_CAMERA_FRAME_URL("resource://spectatorCameraFrame");
|
||||
static const QUrl HMD_PREVIEW_FRAME_URL("resource://hmdPreviewFrame");
|
||||
|
||||
static const float SKYBOX_LOAD_PRIORITY { 10.0f }; // Make sure skybox loads first
|
||||
static const float HIGH_MIPS_LOAD_PRIORITY { 9.0f }; // Make sure high mips loads after skybox but before models
|
||||
|
@ -969,6 +970,12 @@ void ImageReader::read() {
|
|||
Q_ARG(int, texture->getHeight()));
|
||||
}
|
||||
|
||||
void TextureCache::setHmdPreviewTexture(gpu::TexturePointer texturePointer) {
|
||||
if (!_hmdPreviewNetworkTexture) {
|
||||
_hmdPreviewNetworkTexture.reset(new NetworkTexture(HMD_PREVIEW_FRAME_URL));
|
||||
}
|
||||
_hmdPreviewNetworkTexture->setImage(texturePointer, texturePointer->getWidth(), texturePointer->getHeight());
|
||||
}
|
||||
|
||||
NetworkTexturePointer TextureCache::getResourceTexture(QUrl resourceTextureUrl) {
|
||||
gpu::TexturePointer texture;
|
||||
|
@ -984,6 +991,11 @@ NetworkTexturePointer TextureCache::getResourceTexture(QUrl resourceTextureUrl)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (resourceTextureUrl == HMD_PREVIEW_FRAME_URL) {
|
||||
if (_hmdPreviewNetworkTexture) {
|
||||
return _hmdPreviewNetworkTexture;
|
||||
}
|
||||
}
|
||||
|
||||
return NetworkTexturePointer();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ protected:
|
|||
virtual bool isCacheable() const override { return _loaded; }
|
||||
|
||||
virtual void downloadFinished(const QByteArray& data) override;
|
||||
|
||||
|
||||
Q_INVOKABLE void loadContent(const QByteArray& content);
|
||||
Q_INVOKABLE void setImage(gpu::TexturePointer texture, int originalWidth, int originalHeight);
|
||||
|
||||
|
@ -170,6 +170,7 @@ public:
|
|||
NetworkTexturePointer getResourceTexture(QUrl resourceTextureUrl);
|
||||
const gpu::FramebufferPointer& getSpectatorCameraFramebuffer();
|
||||
void resetSpectatorCameraFramebuffer(int width, int height);
|
||||
void setHmdPreviewTexture(gpu::TexturePointer texturePointer);
|
||||
|
||||
protected:
|
||||
// Overload ResourceCache::prefetch to allow specifying texture type for loads
|
||||
|
@ -202,6 +203,8 @@ private:
|
|||
|
||||
NetworkTexturePointer _spectatorCameraNetworkTexture;
|
||||
gpu::FramebufferPointer _spectatorCameraFramebuffer;
|
||||
|
||||
NetworkTexturePointer _hmdPreviewNetworkTexture;
|
||||
};
|
||||
|
||||
#endif // hifi_TextureCache_h
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
onTabletButtonClicked, wireEventBridge, startup, shutdown, registerButtonMappings;
|
||||
|
||||
// Function Name: inFrontOf()
|
||||
//
|
||||
//
|
||||
// Description:
|
||||
// -Returns the position in front of the given "position" argument, where the forward vector is based off
|
||||
// the "orientation" argument and the amount in front is based off the "distance" argument.
|
||||
|
@ -29,7 +29,7 @@
|
|||
}
|
||||
|
||||
// Function Name: spectatorCameraOn()
|
||||
//
|
||||
//
|
||||
// Description:
|
||||
// -Call this function to set up the spectator camera and
|
||||
// spawn the camera entity.
|
||||
|
@ -103,7 +103,7 @@
|
|||
}
|
||||
|
||||
// Function Name: spectatorCameraOff()
|
||||
//
|
||||
//
|
||||
// Description:
|
||||
// -Call this function to shut down the spectator camera and
|
||||
// destroy the camera entity.
|
||||
|
@ -217,8 +217,9 @@
|
|||
// 3. Camera is on; "Monitor Shows" is "HMD Preview": "url" is ""
|
||||
// 4. Camera is on; "Monitor Shows" is "Camera View": "url" is "resource://spectatorCameraFrame"
|
||||
function setDisplay(showCameraView) {
|
||||
var url = (camera && showCameraView) ? "resource://spectatorCameraFrame" : "";
|
||||
sendToQml({ method: 'showPreviewTextureNotInstructions', setting: !!url });
|
||||
|
||||
var url = (camera) ? (showCameraView ? "resource://spectatorCameraFrame" : "resource://hmdPreviewFrame") : "";
|
||||
sendToQml({ method: 'showPreviewTextureNotInstructions', setting: !!url, url: url});
|
||||
Window.setDisplayTexture(url);
|
||||
}
|
||||
const MONITOR_SHOWS_CAMERA_VIEW_DEFAULT = false;
|
||||
|
@ -420,7 +421,7 @@
|
|||
}
|
||||
|
||||
// Function Name: onHMDChanged()
|
||||
//
|
||||
//
|
||||
// Description:
|
||||
// -Called from C++ when HMD mode is changed. The argument "isHMDMode" should be true if HMD is on; false otherwise.
|
||||
function onHMDChanged(isHMDMode) {
|
||||
|
@ -432,7 +433,7 @@
|
|||
}
|
||||
|
||||
// Function Name: shutdown()
|
||||
//
|
||||
//
|
||||
// Description:
|
||||
// -shutdown() will be called when the script ends (i.e. is stopped).
|
||||
function shutdown() {
|
||||
|
|
Loading…
Reference in a new issue