2020-09-08 22:10:45 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm)
|
|
|
|
* Copyright (c) 2019 Gabriel Cuvillier.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "glsl_shaders.h"
|
|
|
|
|
|
|
|
const char * const zfillShaderVP = R"(
|
2020-10-07 18:05:09 +00:00
|
|
|
#version 300 es
|
|
|
|
|
|
|
|
// Multiview
|
|
|
|
#define NUM_VIEWS 2
|
|
|
|
#extension GL_OVR_multiview2 : enable
|
|
|
|
layout(num_views=NUM_VIEWS) in;
|
|
|
|
|
2020-09-08 22:10:45 +00:00
|
|
|
precision mediump float;
|
|
|
|
|
|
|
|
// In
|
2020-10-07 18:05:09 +00:00
|
|
|
in highp vec4 attr_Vertex;
|
|
|
|
in vec4 attr_TexCoord;
|
2020-09-08 22:10:45 +00:00
|
|
|
|
|
|
|
// Uniforms
|
2020-10-07 18:05:09 +00:00
|
|
|
uniform ShaderMatrices
|
|
|
|
{
|
2020-10-08 20:16:18 +00:00
|
|
|
uniform highp mat4 viewMatrix[NUM_VIEWS];
|
2020-10-07 18:05:09 +00:00
|
|
|
} u_shaderMatrices;
|
2020-10-08 20:16:18 +00:00
|
|
|
uniform highp mat4 u_modelMatrix;
|
|
|
|
uniform highp mat4 u_projectionMatrix;
|
2020-09-08 22:10:45 +00:00
|
|
|
uniform mat4 u_textureMatrix;
|
|
|
|
|
|
|
|
// Out
|
|
|
|
// gl_Position
|
2020-10-07 18:05:09 +00:00
|
|
|
out vec2 var_TexDiffuse;
|
2020-09-08 22:10:45 +00:00
|
|
|
|
2020-10-07 18:05:09 +00:00
|
|
|
void main()
|
2020-09-08 22:10:45 +00:00
|
|
|
{
|
|
|
|
var_TexDiffuse = (u_textureMatrix * attr_TexCoord).xy; // Homogeneous coordinates of textureMatrix supposed to be 1
|
|
|
|
|
2020-10-08 20:16:18 +00:00
|
|
|
gl_Position = u_projectionMatrix * (u_shaderMatrices.viewMatrix[gl_ViewID_OVR] * (u_modelMatrix * attr_Vertex));
|
2020-09-08 22:10:45 +00:00
|
|
|
}
|
|
|
|
)";
|