mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-15 16:09:40 +00:00
Fixed false staticness of VRGUILayer by editing camera ortography rather than texture coordinates.
This commit is contained in:
parent
ee25d7be38
commit
64d586929c
3 changed files with 10 additions and 8 deletions
|
@ -612,6 +612,7 @@ osg::ref_ptr<osg::Geometry> VRAnimation::createPointerGeometry(void)
|
|||
geometry->setVertexArray(vertexArray);
|
||||
geometry->setColorArray(colorArray, osg::Array::BIND_PER_VERTEX);
|
||||
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, numVertices));
|
||||
geometry->setSupportsDisplayList(false);
|
||||
geometry->setDataVariance(osg::Object::STATIC);
|
||||
|
||||
auto stateset = geometry->getOrCreateStateSet();
|
||||
|
|
|
@ -173,6 +173,7 @@ VRGUILayer::VRGUILayer(
|
|||
mGeometry->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
||||
mGeometry->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4));
|
||||
mGeometry->setDataVariance(osg::Object::STATIC);
|
||||
mGeometry->setSupportsDisplayList(false);
|
||||
mGeometry->setName("VRGUILayer");
|
||||
|
||||
// Create the camera that will render the menu texture
|
||||
|
@ -369,12 +370,14 @@ void VRGUILayer::update()
|
|||
mTransform->setScale(osg::Vec3(w / res, 1.f, h / res));
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Vec2Array> texCoords{ new osg::Vec2Array(4) };
|
||||
(*texCoords)[0].set(mRealRect.left, 1.f - mRealRect.top);
|
||||
(*texCoords)[1].set(mRealRect.left, 1.f - mRealRect.bottom);
|
||||
(*texCoords)[2].set(mRealRect.right, 1.f - mRealRect.bottom);
|
||||
(*texCoords)[3].set(mRealRect.right, 1.f - mRealRect.top);
|
||||
mGeometry->setTexCoordArray(0, texCoords);
|
||||
// Convert from [0,1] range to [-1,1]
|
||||
float menuLeft = mRealRect.left * 2. - 1.;
|
||||
float menuRight = mRealRect.right * 2. - 1.;
|
||||
// Opposite convention
|
||||
float menuBottom = (1.f - mRealRect.bottom) * 2. - 1.;
|
||||
float menuTop = (1.f - mRealRect.top) * 2.f - 1.;
|
||||
|
||||
mMyGUICamera->setProjectionMatrixAsOrtho2D(menuLeft, menuRight, menuBottom, menuTop);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -71,8 +71,6 @@ namespace MWVR
|
|||
|
||||
~VRViewer(void);
|
||||
|
||||
//virtual void traverse(osg::NodeVisitor& visitor) override;
|
||||
|
||||
const XrCompositionLayerBaseHeader* layer();
|
||||
|
||||
void traversals();
|
||||
|
|
Loading…
Reference in a new issue