mirror of
https://github.com/overte-org/overte.git
synced 2025-04-12 19:58:15 +02:00
plz
This commit is contained in:
parent
16341312fa
commit
4e5ded0ba9
2 changed files with 8 additions and 6 deletions
|
@ -621,7 +621,12 @@ void GLBackend::do_restoreContextViewCorrection(const Batch& batch, size_t param
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::do_setContextMirrorViewCorrection(const Batch& batch, size_t paramOffset) {
|
void GLBackend::do_setContextMirrorViewCorrection(const Batch& batch, size_t paramOffset) {
|
||||||
|
bool prevMirrorViewCorrection = _transform._mirrorViewCorrection;
|
||||||
_transform._mirrorViewCorrection = batch._params[paramOffset + 1]._uint != 0;
|
_transform._mirrorViewCorrection = batch._params[paramOffset + 1]._uint != 0;
|
||||||
|
if (prevMirrorViewCorrection != _transform._mirrorViewCorrection) {
|
||||||
|
static const mat4 flipXScale = glm::scale(glm::mat4(), glm::vec3(-1.0f, 1.0f, 1.0f));
|
||||||
|
setCameraCorrection(_transform._correction.correction * flipXScale, _transform._correction.prevView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::do_disableContextStereo(const Batch& batch, size_t paramOffset) {
|
void GLBackend::do_disableContextStereo(const Batch& batch, size_t paramOffset) {
|
||||||
|
|
|
@ -108,14 +108,11 @@ void GLBackend::TransformStageState::preUpdate(size_t commandIndex, const Stereo
|
||||||
|
|
||||||
if (_invalidView) {
|
if (_invalidView) {
|
||||||
// Apply the correction
|
// Apply the correction
|
||||||
if (_viewIsCamera && (_viewCorrectionEnabled && _correction.correction != glm::mat4())) {
|
static const mat4 flipXScale = glm::scale(glm::mat4(), glm::vec3(-1.0f, 1.0f, 1.0f));
|
||||||
|
if (_viewIsCamera && (_viewCorrectionEnabled && _correction.correction != (_mirrorViewCorrection ? flipXScale : glm::mat4()))) {
|
||||||
// FIXME should I switch to using the camera correction buffer in Transform.slf and leave this out?
|
// FIXME should I switch to using the camera correction buffer in Transform.slf and leave this out?
|
||||||
Transform result;
|
Transform result;
|
||||||
glm::mat4 correction = _correction.correctionInverse;
|
_view.mult(result, _view, _correction.correctionInverse);
|
||||||
if (_mirrorViewCorrection) {
|
|
||||||
correction = correction * glm::scale(glm::mat4(), glm::vec3(-1.0f, 1.0f, 1.0f));
|
|
||||||
}
|
|
||||||
_view.mult(result, _view, correction);
|
|
||||||
if (_skybox) {
|
if (_skybox) {
|
||||||
result.setTranslation(vec3());
|
result.setTranslation(vec3());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue