mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-04-24 09:29:19 +00:00
Orthographic projection now working
the main fix is in tr_glsl.c, the other changes are peripheral and probably contribute nothing
This commit is contained in:
parent
e1a16cbeb2
commit
e8da743153
21 changed files with 194 additions and 197 deletions
Binary file not shown.
|
@ -60,12 +60,6 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
float screenXScale = cgs.screenXScale / 2.75f;
|
float screenXScale = cgs.screenXScale / 2.75f;
|
||||||
float screenYScale = cgs.screenYScale / 2.25f;
|
float screenYScale = cgs.screenYScale / 2.25f;
|
||||||
|
|
||||||
const auto depth = (int)trap_Cvar_VariableValue( "vr_hudDepth" );
|
|
||||||
int xoffset = 120 - (depth * 20);
|
|
||||||
if (cg.stereoView == STEREO_RIGHT) {
|
|
||||||
xoffset *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*x *= screenXScale;
|
*x *= screenXScale;
|
||||||
*y *= screenYScale;
|
*y *= screenYScale;
|
||||||
if (hudflags & HUD_FLAGS_DRAWMODEL)
|
if (hudflags & HUD_FLAGS_DRAWMODEL)
|
||||||
|
@ -81,7 +75,7 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
*h *= screenYScale;
|
*h *= screenYScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
*x += (cg.refdef.width - (640 * screenXScale)) / 2.0f + xoffset;
|
*x += (cg.refdef.width - (640 * screenXScale)) / 2.0f;
|
||||||
*y += (cg.refdef.height - (480 * screenYScale)) / 2.0f - trap_Cvar_VariableValue( "vr_hudYOffset" );
|
*y += (cg.refdef.height - (480 * screenYScale)) / 2.0f - trap_Cvar_VariableValue( "vr_hudYOffset" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,17 @@ uniform float u_Time;
|
||||||
|
|
||||||
uniform vec4 u_Color;
|
uniform vec4 u_Color;
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
layout(shared) uniform ViewMatrices
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
};
|
};
|
||||||
layout(shared) uniform ProjectionMatrix
|
layout(shared) uniform ProjectionMatrix
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
uniform mat4 u_ProjectionMatrix;
|
||||||
};
|
};
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
varying vec2 var_Tex1;
|
varying vec2 var_Tex1;
|
||||||
varying vec4 var_Color;
|
varying vec4 var_Color;
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec4 attr_TexCoord0;
|
attribute vec4 attr_TexCoord0;
|
||||||
|
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
layout(shared) uniform ViewMatrices
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
};
|
};
|
||||||
layout(shared) uniform ProjectionMatrix
|
layout(shared) uniform ProjectionMatrix
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
uniform mat4 u_ProjectionMatrix;
|
||||||
};
|
};
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
varying vec2 var_TexCoords;
|
varying vec2 var_TexCoords;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ uniform vec4 u_FogDistance;
|
||||||
uniform vec4 u_FogDepth;
|
uniform vec4 u_FogDepth;
|
||||||
uniform float u_FogEyeT;
|
uniform float u_FogEyeT;
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
#if defined(USE_DEFORM_VERTEXES)
|
#if defined(USE_DEFORM_VERTEXES)
|
||||||
uniform int u_DeformGen;
|
uniform int u_DeformGen;
|
||||||
uniform float u_DeformParams[5];
|
uniform float u_DeformParams[5];
|
||||||
|
@ -22,17 +24,6 @@ uniform float u_DeformParams[5];
|
||||||
|
|
||||||
uniform float u_Time;
|
uniform float u_Time;
|
||||||
|
|
||||||
// Uniforms
|
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
#if defined(USE_VERTEX_ANIMATION)
|
#if defined(USE_VERTEX_ANIMATION)
|
||||||
uniform float u_VertexLerp;
|
uniform float u_VertexLerp;
|
||||||
#elif defined(USE_BONE_ANIMATION)
|
#elif defined(USE_BONE_ANIMATION)
|
||||||
|
@ -41,6 +32,16 @@ uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
||||||
|
|
||||||
uniform vec4 u_Color;
|
uniform vec4 u_Color;
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying float var_Scale;
|
varying float var_Scale;
|
||||||
|
|
||||||
#if defined(USE_DEFORM_VERTEXES)
|
#if defined(USE_DEFORM_VERTEXES)
|
||||||
|
|
|
@ -36,6 +36,8 @@ uniform float u_FogEyeT;
|
||||||
uniform vec4 u_FogColorMask;
|
uniform vec4 u_FogColorMask;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
#if defined(USE_DEFORM_VERTEXES)
|
#if defined(USE_DEFORM_VERTEXES)
|
||||||
uniform int u_DeformGen;
|
uniform int u_DeformGen;
|
||||||
uniform float u_DeformParams[5];
|
uniform float u_DeformParams[5];
|
||||||
|
@ -43,17 +45,6 @@ uniform float u_Time;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
uniform vec4 u_BaseColor;
|
uniform vec4 u_BaseColor;
|
||||||
uniform vec4 u_VertColor;
|
uniform vec4 u_VertColor;
|
||||||
|
|
||||||
|
@ -72,6 +63,16 @@ uniform float u_VertexLerp;
|
||||||
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec2 var_DiffuseTex;
|
varying vec2 var_DiffuseTex;
|
||||||
varying vec4 var_Color;
|
varying vec4 var_Color;
|
||||||
|
|
||||||
|
|
|
@ -42,16 +42,7 @@ uniform vec4 u_DiffuseTexOffTurb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
uniform mat4 u_ModelMatrix;
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
uniform vec4 u_BaseColor;
|
uniform vec4 u_BaseColor;
|
||||||
uniform vec4 u_VertColor;
|
uniform vec4 u_VertColor;
|
||||||
|
@ -75,6 +66,16 @@ uniform vec4 u_PrimaryLightOrigin;
|
||||||
uniform float u_PrimaryLightRadius;
|
uniform float u_PrimaryLightRadius;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec4 var_TexCoords;
|
varying vec4 var_TexCoords;
|
||||||
|
|
||||||
varying vec4 var_Color;
|
varying vec4 var_Color;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec3 attr_Normal;
|
attribute vec3 attr_Normal;
|
||||||
|
|
||||||
// Uniforms
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
layout(shared) uniform ViewMatrices
|
layout(shared) uniform ViewMatrices
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
};
|
};
|
||||||
layout(shared) uniform ProjectionMatrix
|
layout(shared) uniform ProjectionMatrix
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
uniform mat4 u_ProjectionMatrix;
|
||||||
};
|
};
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
varying vec3 var_Position;
|
varying vec3 var_Position;
|
||||||
varying vec3 var_Normal;
|
varying vec3 var_Normal;
|
||||||
|
|
|
@ -10,6 +10,9 @@ attribute vec4 attr_BoneIndexes;
|
||||||
attribute vec4 attr_BoneWeights;
|
attribute vec4 attr_BoneWeights;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
|
||||||
//#if defined(USE_DEFORM_VERTEXES)
|
//#if defined(USE_DEFORM_VERTEXES)
|
||||||
uniform int u_DeformGen;
|
uniform int u_DeformGen;
|
||||||
uniform float u_DeformParams[5];
|
uniform float u_DeformParams[5];
|
||||||
|
@ -17,16 +20,7 @@ uniform float u_DeformParams[5];
|
||||||
|
|
||||||
uniform float u_Time;
|
uniform float u_Time;
|
||||||
|
|
||||||
// Uniforms
|
uniform mat4 u_ModelMatrix;
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
#if defined(USE_VERTEX_ANIMATION)
|
#if defined(USE_VERTEX_ANIMATION)
|
||||||
uniform float u_VertexLerp;
|
uniform float u_VertexLerp;
|
||||||
|
@ -34,6 +28,15 @@ uniform float u_VertexLerp;
|
||||||
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec3 var_Position;
|
varying vec3 var_Position;
|
||||||
|
|
||||||
vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st)
|
vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st)
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec4 attr_TexCoord0;
|
attribute vec4 attr_TexCoord0;
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec2 var_Tex1;
|
varying vec2 var_Tex1;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec4 attr_TexCoord0;
|
attribute vec4 attr_TexCoord0;
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
uniform mat4 u_ModelMatrix;
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
uniform vec3 u_ToneMinAvgMaxLinear;
|
uniform vec3 u_ToneMinAvgMaxLinear;
|
||||||
|
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
varying vec2 var_TexCoords;
|
varying vec2 var_TexCoords;
|
||||||
varying float var_InvWhite;
|
varying float var_InvWhite;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#include "tr_local.h"
|
#include "tr_local.h"
|
||||||
|
|
||||||
#include "tr_dsa.h"
|
#include "tr_dsa.h"
|
||||||
|
#include "../vr/vr_base.h"
|
||||||
|
|
||||||
|
|
||||||
extern const char *fallbackShader_bokeh_vp;
|
extern const char *fallbackShader_bokeh_vp;
|
||||||
|
@ -54,6 +55,8 @@ extern const char *fallbackShader_texturecolor_fp;
|
||||||
extern const char *fallbackShader_tonemap_vp;
|
extern const char *fallbackShader_tonemap_vp;
|
||||||
extern const char *fallbackShader_tonemap_fp;
|
extern const char *fallbackShader_tonemap_fp;
|
||||||
|
|
||||||
|
extern cvar_t *vr_hudDepth;
|
||||||
|
|
||||||
typedef struct uniformInfo_s
|
typedef struct uniformInfo_s
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -193,9 +196,16 @@ static void GLSL_ViewMatricesUniformBuffer(const float value[32]) {
|
||||||
|
|
||||||
if (i == ORTHO_PROJECTION)
|
if (i == ORTHO_PROJECTION)
|
||||||
{
|
{
|
||||||
|
//don't want depth when in screen view
|
||||||
|
const auto depth = VR_useScreenLayer() ? 0 : (5-vr_hudDepth->integer) * 20;
|
||||||
|
|
||||||
//For now just set identity matrices
|
//For now just set identity matrices
|
||||||
Mat4Identity(viewMatrices);
|
vec3_t translate;
|
||||||
Mat4Identity(viewMatrices + 16);
|
VectorSet(translate, depth, 0, 0);
|
||||||
|
Mat4Translation( translate, viewMatrices );
|
||||||
|
|
||||||
|
VectorSet(translate, -depth, 0, 0);
|
||||||
|
Mat4Translation( translate, viewMatrices + 16 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -327,9 +337,9 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLchar *extra, char *
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: use in main menu medium float precision (to prevent issue with missing models textures)
|
// HACK: use in main menu medium float precision (to prevent issue with missing models textures)
|
||||||
if (Cvar_Get("r_uiFullScreen", "1", 0)->integer)
|
// if (Cvar_Get("r_uiFullScreen", "1", 0)->integer)
|
||||||
Q_strcat(dest, size, "precision mediump float;\n");
|
// Q_strcat(dest, size, "precision mediump float;\n");
|
||||||
else
|
// else
|
||||||
Q_strcat(dest, size, "precision highp float;\n");
|
Q_strcat(dest, size, "precision highp float;\n");
|
||||||
|
|
||||||
if(shaderType == GL_VERTEX_SHADER)
|
if(shaderType == GL_VERTEX_SHADER)
|
||||||
|
@ -1652,40 +1662,16 @@ void GLSL_PrepareUniformBuffers(void)
|
||||||
height = glConfig.vidHeight;
|
height = glConfig.vidHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean first = qtrue;
|
float orthoProjectionMatrix[16];
|
||||||
static float defaultProjection[16];
|
Mat4Ortho(0, width, height, 0, 0, 1, orthoProjectionMatrix);
|
||||||
if (first)
|
|
||||||
{
|
|
||||||
first = qfalse;
|
|
||||||
memset(defaultProjection, 0, 16 * sizeof(float));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int vidWidth = 1;
|
//ortho projection matrix
|
||||||
static int vidHeight = 1;
|
GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[ORTHO_PROJECTION],
|
||||||
if (vidWidth != width || vidHeight != height)
|
orthoProjectionMatrix);
|
||||||
{
|
|
||||||
|
|
||||||
float orthoProjectionMatrix[16];
|
//VR projection matrix
|
||||||
Mat4Ortho(0, vidWidth, vidHeight, 0, 0, 1, orthoProjectionMatrix);
|
GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[NORMAL_PROJECTION],
|
||||||
|
tr.vrParms.projection);
|
||||||
//ortho projection matrix
|
|
||||||
GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[ORTHO_PROJECTION],
|
|
||||||
orthoProjectionMatrix);
|
|
||||||
|
|
||||||
vidWidth = width;
|
|
||||||
vidHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
//We only need to do the following if the default projection changes
|
|
||||||
if (memcmp(defaultProjection, tr.vrParms.projection, 16 * sizeof(float)) != 0)
|
|
||||||
{
|
|
||||||
//Take a copy of the default projection
|
|
||||||
memcpy(defaultProjection, tr.vrParms.projection, 16 * sizeof(float));
|
|
||||||
|
|
||||||
//unadjusted projection matrix
|
|
||||||
GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[NORMAL_PROJECTION],
|
|
||||||
tr.vrParms.projection);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set up the buffers that won't change this frame
|
//Set up the buffers that won't change this frame
|
||||||
GLSL_ViewMatricesUniformBuffer(tr.viewParms.world.eyeViewMatrix);
|
GLSL_ViewMatricesUniformBuffer(tr.viewParms.world.eyeViewMatrix);
|
||||||
|
@ -1704,7 +1690,6 @@ void GLSL_BindProgram(shaderProgram_t * program)
|
||||||
|
|
||||||
if (GL_UseProgram(programObject))
|
if (GL_UseProgram(programObject))
|
||||||
backEnd.pc.c_glslShaderBinds++;
|
backEnd.pc.c_glslShaderBinds++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint GLSL_CalculateProjection() {
|
static GLuint GLSL_CalculateProjection() {
|
||||||
|
|
|
@ -12,16 +12,17 @@ uniform float u_Time;
|
||||||
|
|
||||||
uniform vec4 u_Color;
|
uniform vec4 u_Color;
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
layout(shared) uniform ViewMatrices
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
};
|
};
|
||||||
layout(shared) uniform ProjectionMatrix
|
layout(shared) uniform ProjectionMatrix
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
uniform mat4 u_ProjectionMatrix;
|
||||||
};
|
};
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
varying vec2 var_Tex1;
|
varying vec2 var_Tex1;
|
||||||
varying vec4 var_Color;
|
varying vec4 var_Color;
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec4 attr_TexCoord0;
|
attribute vec4 attr_TexCoord0;
|
||||||
|
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
layout(shared) uniform ViewMatrices
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
};
|
};
|
||||||
layout(shared) uniform ProjectionMatrix
|
layout(shared) uniform ProjectionMatrix
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
uniform mat4 u_ProjectionMatrix;
|
||||||
};
|
};
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
varying vec2 var_TexCoords;
|
varying vec2 var_TexCoords;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ uniform vec4 u_FogDistance;
|
||||||
uniform vec4 u_FogDepth;
|
uniform vec4 u_FogDepth;
|
||||||
uniform float u_FogEyeT;
|
uniform float u_FogEyeT;
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
#if defined(USE_DEFORM_VERTEXES)
|
#if defined(USE_DEFORM_VERTEXES)
|
||||||
uniform int u_DeformGen;
|
uniform int u_DeformGen;
|
||||||
uniform float u_DeformParams[5];
|
uniform float u_DeformParams[5];
|
||||||
|
@ -22,17 +24,6 @@ uniform float u_DeformParams[5];
|
||||||
|
|
||||||
uniform float u_Time;
|
uniform float u_Time;
|
||||||
|
|
||||||
// Uniforms
|
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
#if defined(USE_VERTEX_ANIMATION)
|
#if defined(USE_VERTEX_ANIMATION)
|
||||||
uniform float u_VertexLerp;
|
uniform float u_VertexLerp;
|
||||||
#elif defined(USE_BONE_ANIMATION)
|
#elif defined(USE_BONE_ANIMATION)
|
||||||
|
@ -41,6 +32,16 @@ uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
||||||
|
|
||||||
uniform vec4 u_Color;
|
uniform vec4 u_Color;
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying float var_Scale;
|
varying float var_Scale;
|
||||||
|
|
||||||
#if defined(USE_DEFORM_VERTEXES)
|
#if defined(USE_DEFORM_VERTEXES)
|
||||||
|
|
|
@ -36,6 +36,8 @@ uniform float u_FogEyeT;
|
||||||
uniform vec4 u_FogColorMask;
|
uniform vec4 u_FogColorMask;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
#if defined(USE_DEFORM_VERTEXES)
|
#if defined(USE_DEFORM_VERTEXES)
|
||||||
uniform int u_DeformGen;
|
uniform int u_DeformGen;
|
||||||
uniform float u_DeformParams[5];
|
uniform float u_DeformParams[5];
|
||||||
|
@ -43,17 +45,6 @@ uniform float u_Time;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
uniform vec4 u_BaseColor;
|
uniform vec4 u_BaseColor;
|
||||||
uniform vec4 u_VertColor;
|
uniform vec4 u_VertColor;
|
||||||
|
|
||||||
|
@ -72,6 +63,16 @@ uniform float u_VertexLerp;
|
||||||
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec2 var_DiffuseTex;
|
varying vec2 var_DiffuseTex;
|
||||||
varying vec4 var_Color;
|
varying vec4 var_Color;
|
||||||
|
|
||||||
|
|
|
@ -42,16 +42,7 @@ uniform vec4 u_DiffuseTexOffTurb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
uniform mat4 u_ModelMatrix;
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
uniform vec4 u_BaseColor;
|
uniform vec4 u_BaseColor;
|
||||||
uniform vec4 u_VertColor;
|
uniform vec4 u_VertColor;
|
||||||
|
@ -75,6 +66,16 @@ uniform vec4 u_PrimaryLightOrigin;
|
||||||
uniform float u_PrimaryLightRadius;
|
uniform float u_PrimaryLightRadius;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec4 var_TexCoords;
|
varying vec4 var_TexCoords;
|
||||||
|
|
||||||
varying vec4 var_Color;
|
varying vec4 var_Color;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec3 attr_Normal;
|
attribute vec3 attr_Normal;
|
||||||
|
|
||||||
// Uniforms
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
layout(shared) uniform ViewMatrices
|
layout(shared) uniform ViewMatrices
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
};
|
};
|
||||||
layout(shared) uniform ProjectionMatrix
|
layout(shared) uniform ProjectionMatrix
|
||||||
{
|
{
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
uniform mat4 u_ProjectionMatrix;
|
||||||
};
|
};
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
varying vec3 var_Position;
|
varying vec3 var_Position;
|
||||||
varying vec3 var_Normal;
|
varying vec3 var_Normal;
|
||||||
|
|
|
@ -10,6 +10,9 @@ attribute vec4 attr_BoneIndexes;
|
||||||
attribute vec4 attr_BoneWeights;
|
attribute vec4 attr_BoneWeights;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
|
||||||
//#if defined(USE_DEFORM_VERTEXES)
|
//#if defined(USE_DEFORM_VERTEXES)
|
||||||
uniform int u_DeformGen;
|
uniform int u_DeformGen;
|
||||||
uniform float u_DeformParams[5];
|
uniform float u_DeformParams[5];
|
||||||
|
@ -17,16 +20,7 @@ uniform float u_DeformParams[5];
|
||||||
|
|
||||||
uniform float u_Time;
|
uniform float u_Time;
|
||||||
|
|
||||||
// Uniforms
|
uniform mat4 u_ModelMatrix;
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
#if defined(USE_VERTEX_ANIMATION)
|
#if defined(USE_VERTEX_ANIMATION)
|
||||||
uniform float u_VertexLerp;
|
uniform float u_VertexLerp;
|
||||||
|
@ -34,6 +28,15 @@ uniform float u_VertexLerp;
|
||||||
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
uniform mat4 u_BoneMatrix[MAX_GLSL_BONES];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec3 var_Position;
|
varying vec3 var_Position;
|
||||||
|
|
||||||
vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st)
|
vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st)
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec4 attr_TexCoord0;
|
attribute vec4 attr_TexCoord0;
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
|
uniform mat4 u_ModelMatrix;
|
||||||
|
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
varying vec2 var_Tex1;
|
varying vec2 var_Tex1;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
attribute vec3 attr_Position;
|
attribute vec3 attr_Position;
|
||||||
attribute vec4 attr_TexCoord0;
|
attribute vec4 attr_TexCoord0;
|
||||||
|
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
layout(shared) uniform ViewMatrices
|
uniform mat4 u_ModelMatrix;
|
||||||
{
|
|
||||||
uniform highp mat4 u_ViewMatrices[NUM_VIEWS];
|
|
||||||
};
|
|
||||||
layout(shared) uniform ProjectionMatrix
|
|
||||||
{
|
|
||||||
uniform highp mat4 u_ProjectionMatrix;
|
|
||||||
};
|
|
||||||
uniform highp mat4 u_ModelMatrix;
|
|
||||||
|
|
||||||
uniform vec3 u_ToneMinAvgMaxLinear;
|
uniform vec3 u_ToneMinAvgMaxLinear;
|
||||||
|
|
||||||
|
layout(shared) uniform ViewMatrices
|
||||||
|
{
|
||||||
|
uniform mat4 u_ViewMatrices[NUM_VIEWS];
|
||||||
|
};
|
||||||
|
layout(shared) uniform ProjectionMatrix
|
||||||
|
{
|
||||||
|
uniform mat4 u_ProjectionMatrix;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
varying vec2 var_TexCoords;
|
varying vec2 var_TexCoords;
|
||||||
varying float var_InvWhite;
|
varying float var_InvWhite;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue