mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 00:17:35 +02:00
Merge branch 'feature/quest_frame_player' into feature/quest
This commit is contained in:
commit
c46d73128b
12 changed files with 101 additions and 30 deletions
|
@ -3,10 +3,10 @@ apply plugin: 'com.android.application'
|
||||||
android {
|
android {
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
keyAlias 'key0'
|
storeFile project.hasProperty("HIFI_ANDROID_KEYSTORE") ? file(HIFI_ANDROID_KEYSTORE) : null
|
||||||
keyPassword 'password'
|
storePassword project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") ? HIFI_ANDROID_KEYSTORE_PASSWORD : ''
|
||||||
storeFile file('C:/android/keystore.jks')
|
keyAlias project.hasProperty("HIFI_ANDROID_KEY_ALIAS") ? HIFI_ANDROID_KEY_ALIAS : ''
|
||||||
storePassword 'password'
|
keyPassword project.hasProperty("HIFI_ANDROID_KEY_PASSWORD") ? HIFI_ANDROID_KEY_PASSWORD : ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ apply plugin: 'com.android.application'
|
||||||
android {
|
android {
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
keyAlias 'key0'
|
storeFile project.hasProperty("HIFI_ANDROID_KEYSTORE") ? file(HIFI_ANDROID_KEYSTORE) : null
|
||||||
keyPassword 'password'
|
storePassword project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") ? HIFI_ANDROID_KEYSTORE_PASSWORD : ''
|
||||||
storeFile file('C:/android/keystore.jks')
|
keyAlias project.hasProperty("HIFI_ANDROID_KEY_ALIAS") ? HIFI_ANDROID_KEY_ALIAS : ''
|
||||||
storePassword 'password'
|
keyPassword project.hasProperty("HIFI_ANDROID_KEY_PASSWORD") ? HIFI_ANDROID_KEY_PASSWORD : ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,12 +194,9 @@ void RenderThread::renderFrame() {
|
||||||
// Quest
|
// Quest
|
||||||
auto frameCorrection = _correction * ovr::toGlm(tracking.HeadPose.Pose);
|
auto frameCorrection = _correction * ovr::toGlm(tracking.HeadPose.Pose);
|
||||||
_backend->setCameraCorrection(glm::inverse(frameCorrection), frame->view);
|
_backend->setCameraCorrection(glm::inverse(frameCorrection), frame->view);
|
||||||
vec4 fovs[2];
|
|
||||||
ovr::for_each_eye([&](ovrEye eye){
|
ovr::for_each_eye([&](ovrEye eye){
|
||||||
const auto& eyeInfo = tracking.Eye[eye];
|
const auto& eyeInfo = tracking.Eye[eye];
|
||||||
eyeProjections[eye] = ovr::toGlm(eyeInfo.ProjectionMatrix);
|
eyeProjections[eye] = ovr::toGlm(eyeInfo.ProjectionMatrix);
|
||||||
auto& fov = fovs[eye];
|
|
||||||
ovrMatrix4f_ExtractFov(&eyeInfo.ProjectionMatrix, &fov.x, &fov.y, &fov.z, &fov.w);
|
|
||||||
eyeOffsets[eye] = ovr::toGlm(eyeInfo.ViewMatrix);
|
eyeOffsets[eye] = ovr::toGlm(eyeInfo.ViewMatrix);
|
||||||
});
|
});
|
||||||
_backend->recycle();
|
_backend->recycle();
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class QuestQtActivity extends QtActivity {
|
||||||
keepInterfaceRunning = true;
|
keepInterfaceRunning = true;
|
||||||
launchedQuestMode = true;
|
launchedQuestMode = true;
|
||||||
moveTaskToBack(true);
|
moveTaskToBack(true);
|
||||||
|
startActivity(new Intent(this, QuestRenderActivity.class));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,13 +73,10 @@ RUN mkdir "$HIFI_BASE" && \
|
||||||
|
|
||||||
RUN git clone https://github.com/jherico/hifi.git && \
|
RUN git clone https://github.com/jherico/hifi.git && \
|
||||||
cd ~/hifi && \
|
cd ~/hifi && \
|
||||||
git checkout feature/quest_move_interface
|
git checkout feature/quest_frame_player
|
||||||
|
|
||||||
WORKDIR /home/jenkins/hifi
|
WORKDIR /home/jenkins/hifi
|
||||||
|
|
||||||
RUN touch .test6 && \
|
|
||||||
git fetch && git reset origin/feature/quest_move_interface --hard
|
|
||||||
|
|
||||||
RUN mkdir build
|
RUN mkdir build
|
||||||
|
|
||||||
# Pre-cache the vcpkg managed dependencies
|
# Pre-cache the vcpkg managed dependencies
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
set(TARGET_NAME entities)
|
set(TARGET_NAME entities)
|
||||||
setup_hifi_library(Network Script)
|
setup_hifi_library(Network Script)
|
||||||
|
target_include_directories(${TARGET_NAME} PRIVATE "${OPENSSL_INCLUDE_DIR}")
|
||||||
include_hifi_library_headers(hfm)
|
include_hifi_library_headers(hfm)
|
||||||
include_hifi_library_headers(fbx)
|
include_hifi_library_headers(fbx)
|
||||||
include_hifi_library_headers(gpu)
|
include_hifi_library_headers(gpu)
|
||||||
|
|
|
@ -434,6 +434,9 @@ void GLBackend::render(const Batch& batch) {
|
||||||
GL_PROFILE_RANGE(render_gpu_gl, batch.getName().c_str());
|
GL_PROFILE_RANGE(render_gpu_gl, batch.getName().c_str());
|
||||||
|
|
||||||
_transform._skybox = _stereo._skybox = batch.isSkyboxEnabled();
|
_transform._skybox = _stereo._skybox = batch.isSkyboxEnabled();
|
||||||
|
// FIXME move this to between the transfer and draw passes, so that
|
||||||
|
// framebuffer setup can see the proper stereo state and enable things
|
||||||
|
// like foveation
|
||||||
// Allow the batch to override the rendering stereo settings
|
// Allow the batch to override the rendering stereo settings
|
||||||
// for things like full framebuffer copy operations (deferred lighting passes)
|
// for things like full framebuffer copy operations (deferred lighting passes)
|
||||||
bool savedStereo = _stereo._enable;
|
bool savedStereo = _stereo._enable;
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
class GLESTexture : public GLTexture {
|
class GLESTexture : public GLTexture {
|
||||||
using Parent = GLTexture;
|
using Parent = GLTexture;
|
||||||
friend class GLESBackend;
|
friend class GLESBackend;
|
||||||
|
friend class GLESFramebuffer;
|
||||||
GLuint allocate(const Texture& texture);
|
GLuint allocate(const Texture& texture);
|
||||||
protected:
|
protected:
|
||||||
GLESTexture(const std::weak_ptr<GLBackend>& backend, const Texture& buffer);
|
GLESTexture(const std::weak_ptr<GLBackend>& backend, const Texture& buffer);
|
||||||
|
|
|
@ -17,6 +17,34 @@
|
||||||
|
|
||||||
namespace gpu { namespace gles {
|
namespace gpu { namespace gles {
|
||||||
|
|
||||||
|
|
||||||
|
// returns the FOV from the projection matrix
|
||||||
|
static inline vec4 extractFov( const glm::mat4& m) {
|
||||||
|
static const std::array<vec4, 4> CLIPS{ {
|
||||||
|
{ 1, 0, 0, 1 },
|
||||||
|
{ -1, 0, 0, 1 },
|
||||||
|
{ 0, 1, 0, 1 },
|
||||||
|
{ 0, -1, 0, 1 }
|
||||||
|
} };
|
||||||
|
|
||||||
|
glm::mat4 mt = glm::transpose(m);
|
||||||
|
vec4 v, result;
|
||||||
|
// Left
|
||||||
|
v = mt * CLIPS[0];
|
||||||
|
result.x = -atanf(v.z / v.x);
|
||||||
|
// Right
|
||||||
|
v = mt * CLIPS[1];
|
||||||
|
result.y = atanf(v.z / v.x);
|
||||||
|
// Down
|
||||||
|
v = mt * CLIPS[2];
|
||||||
|
result.z = -atanf(v.z / v.y);
|
||||||
|
// Up
|
||||||
|
v = mt * CLIPS[3];
|
||||||
|
result.w = atanf(v.z / v.y);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class GLESFramebuffer : public gl::GLFramebuffer {
|
class GLESFramebuffer : public gl::GLFramebuffer {
|
||||||
using Parent = gl::GLFramebuffer;
|
using Parent = gl::GLFramebuffer;
|
||||||
static GLuint allocate() {
|
static GLuint allocate() {
|
||||||
|
@ -29,6 +57,24 @@ public:
|
||||||
GLint currentFBO = -1;
|
GLint currentFBO = -1;
|
||||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤tFBO);
|
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤tFBO);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
|
||||||
|
|
||||||
|
vec2 focalPoint{ -1.0f };
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
auto backend = _backend.lock();
|
||||||
|
if (backend && backend->isStereo()) {
|
||||||
|
glm::mat4 projections[2];
|
||||||
|
backend->getStereoProjections(projections);
|
||||||
|
vec4 fov = extractFov(projections[0]);
|
||||||
|
float fovwidth = fov.x + fov.y;
|
||||||
|
float fovheight = fov.z + fov.w;
|
||||||
|
focalPoint.x = fov.y / fovwidth;
|
||||||
|
focalPoint.y = (fov.z / fovheight) - 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gl::GLTexture* gltexture = nullptr;
|
gl::GLTexture* gltexture = nullptr;
|
||||||
TexturePointer surface;
|
TexturePointer surface;
|
||||||
if (_gpuObject.getColorStamps() != _colorStamps) {
|
if (_gpuObject.getColorStamps() != _colorStamps) {
|
||||||
|
@ -58,7 +104,7 @@ public:
|
||||||
surface = b._texture;
|
surface = b._texture;
|
||||||
if (surface) {
|
if (surface) {
|
||||||
Q_ASSERT(TextureUsageType::RENDERBUFFER == surface->getUsageType());
|
Q_ASSERT(TextureUsageType::RENDERBUFFER == surface->getUsageType());
|
||||||
gltexture = backend->syncGPUObject(surface);
|
gltexture = backend->syncGPUObject(surface);
|
||||||
} else {
|
} else {
|
||||||
gltexture = nullptr;
|
gltexture = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +112,24 @@ public:
|
||||||
if (gltexture) {
|
if (gltexture) {
|
||||||
if (gltexture->_target == GL_TEXTURE_2D) {
|
if (gltexture->_target == GL_TEXTURE_2D) {
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D, gltexture->_texture, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D, gltexture->_texture, 0);
|
||||||
|
#if 0
|
||||||
|
if (glTextureFoveationParametersQCOM && focalPoint.x != -1.0f) {
|
||||||
|
static GLint FOVEATION_QUERY = 0;
|
||||||
|
static std::once_flag once;
|
||||||
|
std::call_once(once, [&]{
|
||||||
|
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM, &FOVEATION_QUERY);
|
||||||
|
});
|
||||||
|
static const float foveaArea = 4.0f;
|
||||||
|
static const float gain = 16.0f;
|
||||||
|
GLESBackend::GLESTexture* glestexture = static_cast<GLESBackend::GLESTexture*>(gltexture);
|
||||||
|
glestexture->withPreservedTexture([=]{
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM, GL_FOVEATION_ENABLE_BIT_QCOM | GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM);
|
||||||
|
glTextureFoveationParametersQCOM(_id, 0, 0, -focalPoint.x, focalPoint.y, gain * 2.0f, gain, foveaArea);
|
||||||
|
glTextureFoveationParametersQCOM(_id, 0, 1, focalPoint.x, focalPoint.y, gain * 2.0f, gain, foveaArea);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, colorAttachments[unit], gltexture->_texture, 0,
|
glFramebufferTextureLayer(GL_FRAMEBUFFER, colorAttachments[unit], gltexture->_texture, 0,
|
||||||
b._subresource);
|
b._subresource);
|
||||||
|
|
|
@ -118,7 +118,6 @@ public:
|
||||||
static ContextMetricSize textureResourcePopulatedGPUMemSize;
|
static ContextMetricSize textureResourcePopulatedGPUMemSize;
|
||||||
static ContextMetricSize textureResourceIdealGPUMemSize;
|
static ContextMetricSize textureResourceIdealGPUMemSize;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool isStereo() const {
|
virtual bool isStereo() const {
|
||||||
return _stereo.isStereo();
|
return _stereo.isStereo();
|
||||||
}
|
}
|
||||||
|
@ -128,6 +127,7 @@ protected:
|
||||||
eyeProjections[i] = _stereo._eyeProjections[i];
|
eyeProjections[i] = _stereo._eyeProjections[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
|
||||||
void getStereoViews(mat4* eyeViews) const {
|
void getStereoViews(mat4* eyeViews) const {
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
|
|
@ -34,16 +34,26 @@ public:
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
Deserializer(const std::string& filename, uint32_t externalTexture, const TextureLoader& loader) :
|
static std::string getBaseDir(const std::string& filename) {
|
||||||
basename(getBaseName(filename)), externalTexture(externalTexture), textureLoader(loader) {
|
std::string result;
|
||||||
basedir = QFileInfo(filename.c_str()).absoluteDir().canonicalPath().toStdString();
|
if (0 == filename.find("assets:")) {
|
||||||
if (*basedir.rbegin() != '/') {
|
auto lastSlash = filename.rfind('/');
|
||||||
basedir += '/';
|
result = filename.substr(0, lastSlash + 1);
|
||||||
|
} else {
|
||||||
|
std::string result = QFileInfo(filename.c_str()).absoluteDir().canonicalPath().toStdString();
|
||||||
|
if (*result.rbegin() != '/') {
|
||||||
|
result += '/';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Deserializer(const std::string& filename, uint32_t externalTexture, const TextureLoader& loader) :
|
||||||
|
basename(getBaseName(filename)), basedir(getBaseDir(filename)), externalTexture(externalTexture), textureLoader(loader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string basename;
|
const std::string basename;
|
||||||
std::string basedir;
|
const std::string basedir;
|
||||||
std::string binaryFile;
|
std::string binaryFile;
|
||||||
const uint32_t externalTexture;
|
const uint32_t externalTexture;
|
||||||
TextureLoader textureLoader;
|
TextureLoader textureLoader;
|
||||||
|
@ -772,12 +782,6 @@ StereoState readStereoState(const json& node) {
|
||||||
FramePointer Deserializer::deserializeFrame() {
|
FramePointer Deserializer::deserializeFrame() {
|
||||||
{
|
{
|
||||||
std::string filename{ basename + ".json" };
|
std::string filename{ basename + ".json" };
|
||||||
if (0 == basename.find("assets:")) {
|
|
||||||
auto lastSlash = basename.rfind('/');
|
|
||||||
basedir = basename.substr(0, lastSlash);
|
|
||||||
} else {
|
|
||||||
basedir = QFileInfo(basename.c_str()).absolutePath().toStdString();
|
|
||||||
}
|
|
||||||
storage::FileStorage mappedFile(filename.c_str());
|
storage::FileStorage mappedFile(filename.c_str());
|
||||||
frameNode = json::parse(std::string((const char*)mappedFile.data(), mappedFile.size()));
|
frameNode = json::parse(std::string((const char*)mappedFile.data(), mappedFile.size()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,12 @@ void RenderThread::initialize(QWindow* window) {
|
||||||
|
|
||||||
_window = window;
|
_window = window;
|
||||||
#ifdef USE_GL
|
#ifdef USE_GL
|
||||||
|
_window->setFormat(getDefaultOpenGLSurfaceFormat());
|
||||||
_context.setWindow(window);
|
_context.setWindow(window);
|
||||||
_context.create();
|
_context.create();
|
||||||
_context.makeCurrent();
|
if (!_context.makeCurrent()) {
|
||||||
|
qFatal("Unable to make context current");
|
||||||
|
}
|
||||||
QOpenGLContextWrapper(_context.qglContext()).makeCurrent(_window);
|
QOpenGLContextWrapper(_context.qglContext()).makeCurrent(_window);
|
||||||
glGenTextures(1, &_externalTexture);
|
glGenTextures(1, &_externalTexture);
|
||||||
glBindTexture(GL_TEXTURE_2D, _externalTexture);
|
glBindTexture(GL_TEXTURE_2D, _externalTexture);
|
||||||
|
|
Loading…
Reference in a new issue