mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
the stereo rendering is working correctly, will now look for more performances
This commit is contained in:
parent
f23f3a8c2d
commit
8a233ec9a1
3 changed files with 7 additions and 3 deletions
|
@ -120,7 +120,7 @@ void GLBackend::updateInput() {
|
|||
glVertexAttribFormat(slot + locNum, count, type, isNormalized, offset + locNum * perLocationSize);
|
||||
glVertexAttribBinding(slot + locNum, attrib._channel);
|
||||
}
|
||||
glVertexBindingDivisor(attrib._channel, attrib._frequency);
|
||||
glVertexBindingDivisor(attrib._channel, attrib._frequency * (isStereo() ? 2 : 1));
|
||||
}
|
||||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ void GLBackend::updateInput() {
|
|||
for (size_t locNum = 0; locNum < locationCount; ++locNum) {
|
||||
glVertexAttribPointer(slot + (GLuint)locNum, count, type, isNormalized, stride,
|
||||
reinterpret_cast<GLvoid*>(pointer + perLocationStride * (GLuint)locNum));
|
||||
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency);
|
||||
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereo() ? 2 : 1));
|
||||
}
|
||||
|
||||
// TODO: Support properly the IAttrib version
|
||||
|
|
|
@ -103,7 +103,7 @@ TransformObject getTransformObject() {
|
|||
#ifdef GPU_TRANSFORM_IS_STEREO
|
||||
vec4 eyeClipEdge[2]= vec4[2](vec4(-1,0,0,1), vec4(1,0,0,1));
|
||||
vec2 eyeOffsetScale = vec2(-0.5, +0.5);
|
||||
uint eyeIndex = gl_InstanceID % 2;
|
||||
uint eyeIndex = _stereoSide;
|
||||
gl_ClipDistance[0] = dot(<$clipPos$>, eyeClipEdge[eyeIndex]);
|
||||
float newClipPosX = <$clipPos$>.x * 0.5 + eyeOffsetScale[eyeIndex] * <$clipPos$>.w;
|
||||
<$clipPos$>.x = newClipPosX;
|
||||
|
@ -189,6 +189,8 @@ TransformObject getTransformObject() {
|
|||
<@func transformEyeToClipPos(cameraTransform, eyePos, clipPos)@>
|
||||
{ // transformEyeToClipPos
|
||||
<$clipPos$> = <$cameraTransform$>._projection * vec4(<$eyePos$>.xyz, 1.0);
|
||||
|
||||
<$transformStereoClipsSpace($cameraTransform$, $clipPos$)$>
|
||||
}
|
||||
<@endfunc@>
|
||||
|
||||
|
|
|
@ -36,4 +36,6 @@ void main(void) {
|
|||
|
||||
// Position is supposed to come in clip space
|
||||
gl_Position = vec4(inPosition.xy, 0.0, 1.0);
|
||||
|
||||
<$transformStereoClipsSpace(cam, gl_Position)$>
|
||||
}
|
Loading…
Reference in a new issue