mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 05:52:03 +00:00
Now rendering!
2D stuff doesn't draw, and 3D is all wonky, but this is progress!
This commit is contained in:
parent
d6ade0215f
commit
170f32709b
14 changed files with 99 additions and 209 deletions
|
@ -197,13 +197,11 @@ void main()
|
|||
|
||||
gl_Position = u_ProjectionMatrix * (u_ViewMatrices[gl_ViewID_OVR] * (u_ModelMatrix * vec4(position, 1.0)));
|
||||
|
||||
#if defined(USE_MODELMATRIX)
|
||||
position = (u_ModelMatrix * vec4(position, 1.0)).xyz;
|
||||
normal = (u_ModelMatrix * vec4(normal, 0.0)).xyz;
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
tangent = (u_ModelMatrix * vec4(tangent, 0.0)).xyz;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
vec3 bitangent = cross(normal, tangent) * attr_Tangent.w;
|
||||
|
@ -213,10 +211,8 @@ void main()
|
|||
vec3 L = u_LightOrigin.xyz - (position * u_LightOrigin.w);
|
||||
#elif defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
vec3 L = attr_LightDirection;
|
||||
#if defined(USE_MODELMATRIX)
|
||||
L = (u_ModelMatrix * vec4(L, 0.0)).xyz;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHTMAP)
|
||||
var_TexCoords.zw = attr_TexCoord1.st;
|
||||
|
|
|
@ -270,31 +270,13 @@ void GL_State( unsigned long stateBits )
|
|||
void GL_SetProjectionMatrix(mat4_t matrix)
|
||||
{
|
||||
Mat4Copy(matrix, glState.projection);
|
||||
Mat4Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
|
||||
}
|
||||
|
||||
|
||||
void GL_SetModelviewMatrix(mat4_t matrix, qboolean applyStereoView)
|
||||
{
|
||||
/*
|
||||
if (applyStereoView)
|
||||
{
|
||||
if (tr.refdef.stereoFrame == STEREO_LEFT) {
|
||||
Mat4Multiply(tr.vrParms.viewL, matrix, glState.modelview);
|
||||
} else if (tr.refdef.stereoFrame == STEREO_RIGHT) {
|
||||
Mat4Multiply(tr.vrParms.viewR, matrix, glState.modelview);
|
||||
} else {
|
||||
Mat4Copy(matrix, glState.modelview);
|
||||
}
|
||||
} else
|
||||
*/
|
||||
void GL_SetModelviewMatrix(mat4_t matrix)
|
||||
{
|
||||
Mat4Copy(matrix, glState.modelview);
|
||||
}
|
||||
|
||||
Mat4Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -427,7 +409,7 @@ void RB_BeginDrawingView (void) {
|
|||
plane2[2] = DotProduct (backEnd.viewParms.or.axis[2], plane);
|
||||
plane2[3] = DotProduct (plane, backEnd.viewParms.or.origin) - plane[3];
|
||||
#endif
|
||||
GL_SetModelviewMatrix( s_flipMatrix, qtrue );
|
||||
GL_SetModelviewMatrix( s_flipMatrix );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +528,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.or );
|
||||
}
|
||||
|
||||
GL_SetModelviewMatrix( backEnd.or.eyeViewMatrix[2], qtrue );
|
||||
GL_SetModelviewMatrix( backEnd.or.eyeViewMatrix[2] );
|
||||
|
||||
//
|
||||
// change depthrange. Also change projection matrix so first person weapon does not look like coming
|
||||
|
@ -618,7 +600,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
|
||||
// go back to the world modelview matrix
|
||||
|
||||
GL_SetModelviewMatrix( backEnd.viewParms.world.eyeViewMatrix[2], qtrue );
|
||||
GL_SetModelviewMatrix( backEnd.viewParms.world.eyeViewMatrix[2] );
|
||||
|
||||
#ifdef __ANDROID__
|
||||
glDepthRangef(0, 1);
|
||||
|
@ -670,7 +652,7 @@ void RB_SetGL2D (void) {
|
|||
Mat4Ortho(0, width, height, 0, 0, 1, matrix);
|
||||
GL_SetProjectionMatrix(matrix);
|
||||
Mat4Identity(matrix);
|
||||
GL_SetModelviewMatrix(matrix, false);
|
||||
GL_SetModelviewMatrix(matrix);
|
||||
|
||||
GL_State( GLS_DEPTHTEST_DISABLE |
|
||||
GLS_SRCBLEND_SRC_ALPHA |
|
||||
|
@ -754,7 +736,8 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
|
|||
GLSL_BindProgram(&tr.textureColorShader);
|
||||
|
||||
//GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(&tr.textureColorShader);
|
||||
GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
|
|
@ -410,130 +410,22 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
|
|||
ri.Error(ERR_FATAL, "RE_BeginFrame() - glGetError() failed (0x%x)!", err);
|
||||
}
|
||||
|
||||
if (glConfig.stereoEnabled) {
|
||||
{
|
||||
if (tr.renderFbo && tr.vrParms.renderBufferOriginal == 0) {
|
||||
tr.vrParms.renderBufferOriginal = tr.renderFbo->frameBuffer;
|
||||
}
|
||||
|
||||
/* if ( stereoFrame == STEREO_LEFT ) {
|
||||
{
|
||||
if (tr.vrParms.valid == qtrue) {
|
||||
if (tr.renderFbo) {
|
||||
switchEyeCommand_t* sec;
|
||||
if (!(sec = R_GetCommandBuffer(sizeof(*sec))))
|
||||
return;
|
||||
sec->commandId = RC_SWITCH_EYE;
|
||||
sec->eye = tr.vrParms.renderBufferL;
|
||||
sec->eye = tr.vrParms.renderBuffer;
|
||||
sec->stereoFrame = stereoFrame;
|
||||
}
|
||||
}
|
||||
} else if ( stereoFrame == STEREO_RIGHT ) {
|
||||
if (tr.vrParms.valid == qtrue) {
|
||||
if (tr.renderFbo) {
|
||||
switchEyeCommand_t* sec;
|
||||
if (!(sec = R_GetCommandBuffer(sizeof(*sec))))
|
||||
return;
|
||||
sec->commandId = RC_SWITCH_EYE;
|
||||
sec->eye = tr.vrParms.renderBufferR;
|
||||
sec->stereoFrame = stereoFrame;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is enabled, but stereoFrame was %i", stereoFrame );
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if(r_anaglyphMode->integer)
|
||||
{
|
||||
if(r_anaglyphMode->modified)
|
||||
{
|
||||
// clear both, front and backbuffer.
|
||||
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
backEnd.colorMask[0] = GL_FALSE;
|
||||
backEnd.colorMask[1] = GL_FALSE;
|
||||
backEnd.colorMask[2] = GL_FALSE;
|
||||
backEnd.colorMask[3] = GL_FALSE;
|
||||
|
||||
if (glRefConfig.framebufferObject)
|
||||
{
|
||||
// clear all framebuffers
|
||||
if (tr.msaaResolveFbo)
|
||||
{
|
||||
FBO_Bind(tr.msaaResolveFbo);
|
||||
qglClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
if (tr.renderFbo)
|
||||
{
|
||||
FBO_Bind(tr.renderFbo);
|
||||
qglClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
|
||||
qglDrawBuffer(GL_FRONT);
|
||||
qglClear(GL_COLOR_BUFFER_BIT);
|
||||
qglDrawBuffer(GL_BACK);
|
||||
qglClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
r_anaglyphMode->modified = qfalse;
|
||||
}
|
||||
|
||||
if(stereoFrame == STEREO_LEFT)
|
||||
{
|
||||
if( !(cmd = R_GetCommandBuffer(sizeof(*cmd))) )
|
||||
return;
|
||||
|
||||
if( !(colcmd = R_GetCommandBuffer(sizeof(*colcmd))) )
|
||||
return;
|
||||
}
|
||||
else if(stereoFrame == STEREO_RIGHT)
|
||||
{
|
||||
clearDepthCommand_t *cldcmd;
|
||||
|
||||
if( !(cldcmd = R_GetCommandBuffer(sizeof(*cldcmd))) )
|
||||
return;
|
||||
|
||||
cldcmd->commandId = RC_CLEARDEPTH;
|
||||
|
||||
if( !(colcmd = R_GetCommandBuffer(sizeof(*colcmd))) )
|
||||
return;
|
||||
}
|
||||
else
|
||||
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is enabled, but stereoFrame was %i", stereoFrame );
|
||||
|
||||
R_SetColorMode(colcmd->rgba, stereoFrame, r_anaglyphMode->integer);
|
||||
colcmd->commandId = RC_COLORMASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(stereoFrame != STEREO_CENTER)
|
||||
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is disabled, but stereoFrame was %i", stereoFrame );
|
||||
|
||||
if( !(cmd = R_GetCommandBuffer(sizeof(*cmd))) )
|
||||
return;
|
||||
}
|
||||
|
||||
if(cmd)
|
||||
{
|
||||
cmd->commandId = RC_DRAW_BUFFER;
|
||||
|
||||
if(r_anaglyphMode->modified)
|
||||
{
|
||||
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
backEnd.colorMask[0] = 0;
|
||||
backEnd.colorMask[1] = 0;
|
||||
backEnd.colorMask[2] = 0;
|
||||
backEnd.colorMask[3] = 0;
|
||||
r_anaglyphMode->modified = qfalse;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(r_drawBuffer->string, "GL_FRONT"))
|
||||
cmd->buffer = (int)GL_FRONT;
|
||||
else
|
||||
cmd->buffer = (int)GL_BACK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -577,8 +577,8 @@ void FBO_BlitFromTexture(struct image_s *src, vec4_t inSrcTexCorners, vec2_t inS
|
|||
|
||||
GLSL_BindProgram(shaderProgram);
|
||||
|
||||
GLSL_SetUniformMat4(shaderProgram, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
// GLSL_SetUniformMat4(shaderProgram, UNIFORM_MODELVIEWPROJECTIONMATRIX, projection);
|
||||
GLSL_SetUniformMat4(shaderProgram, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(shaderProgram);
|
||||
GLSL_SetUniformVec4(shaderProgram, UNIFORM_COLOR, color);
|
||||
GLSL_SetUniformVec2(shaderProgram, UNIFORM_INVTEXRES, invTexRes);
|
||||
GLSL_SetUniformVec2(shaderProgram, UNIFORM_AUTOEXPOSUREMINMAX, tr.refdef.autoExposureMinMax);
|
||||
|
|
|
@ -529,7 +529,7 @@ void RB_RenderFlares (void) {
|
|||
Mat4Copy(glState.projection, oldprojection);
|
||||
Mat4Copy(glState.modelview, oldmodelview);
|
||||
Mat4Identity(matrix);
|
||||
GL_SetModelviewMatrix(matrix, qtrue);
|
||||
GL_SetModelviewMatrix(matrix);
|
||||
Mat4Ortho( backEnd.viewParms.viewportX, backEnd.viewParms.viewportX + backEnd.viewParms.viewportWidth,
|
||||
backEnd.viewParms.viewportY, backEnd.viewParms.viewportY + backEnd.viewParms.viewportHeight,
|
||||
-99999, 99999, matrix );
|
||||
|
@ -544,7 +544,7 @@ void RB_RenderFlares (void) {
|
|||
}
|
||||
|
||||
GL_SetProjectionMatrix(oldprojection);
|
||||
GL_SetModelviewMatrix(oldmodelview, qtrue);
|
||||
GL_SetModelviewMatrix(oldmodelview);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -312,6 +312,7 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLchar *extra, char *
|
|||
Q_strcat(dest, size, "#define NUM_VIEWS 2\n");
|
||||
Q_strcat(dest, size, "#extension GL_OVR_multiview2 : enable\n");
|
||||
Q_strcat(dest, size, "layout(num_views=NUM_VIEWS) in;\n");
|
||||
}
|
||||
|
||||
// HACK: use in main menu medium float precision (to prevent issue with missing models textures)
|
||||
if (Cvar_Get("r_uiFullScreen", "1", 0)->integer)
|
||||
|
@ -319,17 +320,13 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLchar *extra, char *
|
|||
else
|
||||
Q_strcat(dest, size, "precision highp float;\n");
|
||||
|
||||
if(shaderType == GL_VERTEX_SHADER)
|
||||
{
|
||||
Q_strcat(dest, size, "#define attribute in\n");
|
||||
Q_strcat(dest, size, "#define varying out\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// HACK: use in main menu medium float precision (to prevent issue with missing models textures)
|
||||
if (Cvar_Get("r_uiFullScreen", "1", 0)->integer)
|
||||
Q_strcat(dest, size, "precision mediump float;\n");
|
||||
else
|
||||
Q_strcat(dest, size, "precision highp float;\n");
|
||||
|
||||
Q_strcat(dest, size, "#define varying in\n");
|
||||
|
||||
Q_strcat(dest, size, "out vec4 out_Color;\n");
|
||||
|
@ -1316,7 +1313,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
if (i & LIGHTDEF_ENTITY_VERTEX_ANIMATION)
|
||||
{
|
||||
Q_strcat(extradefines, 1024, "#define USE_VERTEX_ANIMATION\n#define USE_MODELMATRIX\n");
|
||||
Q_strcat(extradefines, 1024, "#define USE_VERTEX_ANIMATION\n");
|
||||
attribs |= ATTR_POSITION2 | ATTR_NORMAL2;
|
||||
|
||||
if (r_normalMapping->integer)
|
||||
|
@ -1326,7 +1323,6 @@ void GLSL_InitGPUShaders(void)
|
|||
}
|
||||
else if (i & LIGHTDEF_ENTITY_BONE_ANIMATION)
|
||||
{
|
||||
Q_strcat(extradefines, 1024, "#define USE_MODELMATRIX\n");
|
||||
Q_strcat(extradefines, 1024, va("#define USE_BONE_ANIMATION\n#define MAX_GLSL_BONES %d\n", glRefConfig.glslMaxAnimatedBones));
|
||||
attribs |= ATTR_BONE_INDEXES | ATTR_BONE_WEIGHTS;
|
||||
}
|
||||
|
@ -1689,7 +1685,33 @@ void GLSL_BindProgram(shaderProgram_t * program)
|
|||
if (GL_UseProgram(programObject))
|
||||
backEnd.pc.c_glslShaderBinds++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static GLuint GLSL_CalculateProjection() {
|
||||
GLuint result = NORMAL_PROJECTION;
|
||||
|
||||
mat4_t matrix;
|
||||
Mat4Ortho(0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, matrix);
|
||||
|
||||
if (
|
||||
//Is this set up as an orthographic projection?
|
||||
glState.projection[0] == matrix[0] &&
|
||||
glState.projection[5] == matrix[5] &&
|
||||
glState.projection[10] == matrix[10] &&
|
||||
glState.projection[12] == matrix[12]&&
|
||||
glState.projection[13] == matrix[13] &&
|
||||
glState.projection[14] == matrix[14] &&
|
||||
glState.projection[15] == matrix[15])
|
||||
{
|
||||
result = ORTHO_PROJECTION;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void GLSL_BindBuffers( shaderProgram_t * program )
|
||||
{
|
||||
qglBindBufferBase(
|
||||
GL_UNIFORM_BUFFER,
|
||||
program->viewMatricesBinding,
|
||||
|
@ -1698,7 +1720,7 @@ void GLSL_BindProgram(shaderProgram_t * program)
|
|||
qglBindBufferBase(
|
||||
GL_UNIFORM_BUFFER,
|
||||
program->projectionMatrixBinding,
|
||||
projectionMatricesBuffer[backEnd.projection2D ? ORTHO_PROJECTION : NORMAL_PROJECTION]);
|
||||
projectionMatricesBuffer[GLSL_CalculateProjection()]);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1390,9 +1390,9 @@ typedef struct {
|
|||
uint32_t vertexAttribsEnabled; // global if no VAOs, tess only otherwise
|
||||
FBO_t *currentFBO;
|
||||
vao_t *currentVao;
|
||||
|
||||
mat4_t modelview;
|
||||
mat4_t projection;
|
||||
mat4_t modelviewProjection;
|
||||
} glstate_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -1923,7 +1923,7 @@ void GL_CheckErrs( char *file, int line );
|
|||
#define GL_CheckErrors(...) GL_CheckErrs(__FILE__, __LINE__)
|
||||
void GL_State( unsigned long stateVector );
|
||||
void GL_SetProjectionMatrix(mat4_t matrix);
|
||||
void GL_SetModelviewMatrix(mat4_t matrix, qboolean applyStereoView);
|
||||
void GL_SetModelviewMatrix(mat4_t matrix);
|
||||
void GL_Cull( int cullType );
|
||||
|
||||
#define GLS_SRCBLEND_ZERO 0x00000001
|
||||
|
@ -2244,6 +2244,7 @@ void GLSL_PrepareShaders(void);
|
|||
void GLSL_ShutdownGPUShaders(void);
|
||||
void GLSL_VertexAttribPointers(uint32_t attribBits);
|
||||
void GLSL_BindProgram(shaderProgram_t * program);
|
||||
void GLSL_BindBuffers( shaderProgram_t * program );
|
||||
|
||||
void GLSL_SetUniformInt(shaderProgram_t *program, int uniformNum, GLint value);
|
||||
void GLSL_SetUniformFloat(shaderProgram_t *program, int uniformNum, GLfloat value);
|
||||
|
|
|
@ -582,7 +582,7 @@ void R_RotateForViewer (void)
|
|||
if (eye < 2)
|
||||
{
|
||||
float scale = ((r_stereoSeparation->value / 1000.0f) / 2.0f) * (32.0f);
|
||||
VectorMA(origin, (eye == 0 ? 1.0f : -1.0f) * 100.0f, tr.viewParms.or.axis[1], origin);
|
||||
// VectorMA(origin, (eye == 0 ? 1.0f : -1.0f) * 100.0f, tr.viewParms.or.axis[1], origin);
|
||||
}
|
||||
|
||||
viewerMatrix[0] = tr.viewParms.or.axis[0][0];
|
||||
|
|
|
@ -114,8 +114,8 @@ static void DrawTris (shaderCommands_t *input) {
|
|||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
VectorSet4(color, 1, 1, 1, 1);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_COLOR, color);
|
||||
GLSL_SetUniformInt(sp, UNIFORM_ALPHATEST, 0);
|
||||
|
@ -353,8 +353,8 @@ static void ProjectDlightTexture( void ) {
|
|||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
|
||||
|
||||
|
@ -693,8 +693,8 @@ static void ForwardDlight( void ) {
|
|||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_VIEWORIGIN, backEnd.viewParms.or.origin);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin);
|
||||
|
||||
|
@ -756,7 +756,8 @@ static void ForwardDlight( void ) {
|
|||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL );
|
||||
GLSL_SetUniformInt(sp, UNIFORM_ALPHATEST, 0);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
if (pStage->bundle[TB_DIFFUSEMAP].image[0])
|
||||
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DIFFUSEMAP], TB_DIFFUSEMAP);
|
||||
|
@ -847,8 +848,8 @@ static void ProjectPshadowVBOGLSL( void ) {
|
|||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
VectorCopy(origin, vector);
|
||||
vector[3] = 1.0f;
|
||||
|
@ -924,8 +925,8 @@ static void RB_FogPass( void ) {
|
|||
|
||||
fog = tr.world->fogs + tess.fogNum;
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
|
||||
|
||||
|
@ -1099,8 +1100,8 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_VIEWORIGIN, backEnd.viewParms.or.origin);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin);
|
||||
|
||||
|
@ -1216,7 +1217,8 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
}
|
||||
}
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_NORMALSCALE, pStage->normalScale);
|
||||
|
||||
|
@ -1421,7 +1423,8 @@ static void RB_RenderShadowmap( shaderCommands_t *input )
|
|||
|
||||
// GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
|
||||
|
||||
|
|
|
@ -439,8 +439,8 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
|
|||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
color[0] =
|
||||
color[1] =
|
||||
|
@ -805,7 +805,7 @@ void RB_DrawSun( float scale, shader_t *shader ) {
|
|||
|
||||
Mat4Translation( backEnd.viewParms.or.origin, translation );
|
||||
Mat4Multiply( backEnd.viewParms.world.eyeViewMatrix[2], translation, modelview );
|
||||
GL_SetModelviewMatrix( modelview, qtrue );
|
||||
GL_SetModelviewMatrix( modelview );
|
||||
}
|
||||
|
||||
dist = backEnd.viewParms.zFar / 1.75; // div sqrt(3)
|
||||
|
@ -885,13 +885,13 @@ void RB_StageIteratorSky( void ) {
|
|||
Mat4Copy( glState.modelview, oldmodelview );
|
||||
Mat4Translation( backEnd.viewParms.or.origin, trans );
|
||||
Mat4Multiply( glState.modelview, trans, product );
|
||||
GL_SetModelviewMatrix( product, qtrue );
|
||||
GL_SetModelviewMatrix( product );
|
||||
|
||||
}
|
||||
|
||||
DrawSkyBox( tess.shader );
|
||||
|
||||
GL_SetModelviewMatrix( oldmodelview, qtrue );
|
||||
GL_SetModelviewMatrix( oldmodelview );
|
||||
}
|
||||
|
||||
// generate the vertexes for all the clouds, which will be drawn
|
||||
|
|
|
@ -227,8 +227,8 @@ void RB_InstantQuad(vec4_t quadVerts[4])
|
|||
|
||||
GLSL_BindProgram(&tr.textureColorShader);
|
||||
|
||||
GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
//GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(&tr.textureColorShader);
|
||||
GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
@ -540,8 +540,8 @@ static void RB_SurfaceBeam( void )
|
|||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
// GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, glState.modelview);
|
||||
GLSL_BindBuffers(sp);
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_COLOR, colorRed);
|
||||
|
||||
|
|
|
@ -339,10 +339,8 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
|
||||
Com_Frame();
|
||||
|
||||
for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; ++eye) {
|
||||
engine->framebuffers.swapchainIndex = (engine->framebuffers.swapchainIndex + 1) %
|
||||
engine->framebuffers.swapchainLength;
|
||||
}
|
||||
|
||||
// Hand over the eye images to the time warp.
|
||||
vrapi_SubmitFrame2(engine->ovr, &frameDesc);
|
||||
|
@ -363,6 +361,7 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
layer.Textures[eye].SwapChainIndex = engine->framebuffers.swapchainIndex;
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_TanAngleMatrixFromProjection(&defaultProjection);
|
||||
}
|
||||
layer.Header.Flags |= VRAPI_FRAME_LAYER_FLAG_CHROMATIC_ABERRATION_CORRECTION;
|
||||
|
||||
VR_ClearFrameBuffer(engine->framebuffers.framebuffers[engine->framebuffers.swapchainIndex], eyeW, eyeH);
|
||||
|
||||
|
@ -371,10 +370,8 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
|
||||
Com_Frame();
|
||||
|
||||
for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; ++eye) {
|
||||
engine->framebuffers.swapchainIndex = (engine->framebuffers.swapchainIndex + 1) %
|
||||
engine->framebuffers.swapchainLength;
|
||||
}
|
||||
|
||||
const ovrLayerHeader2* layers[] = {
|
||||
&layer.Header
|
||||
|
|
|
@ -67,7 +67,7 @@ int main(int argc, char* argv[]) {
|
|||
engine_t* engine = NULL;
|
||||
engine = VR_Init(java);
|
||||
|
||||
sleep(30);
|
||||
//sleep(30);
|
||||
|
||||
//First set up resolution cached values
|
||||
int width, height;
|
||||
|
|
|
@ -197,13 +197,11 @@ void main()
|
|||
|
||||
gl_Position = u_ProjectionMatrix * (u_ViewMatrices[gl_ViewID_OVR] * (u_ModelMatrix * vec4(position, 1.0)));
|
||||
|
||||
#if defined(USE_MODELMATRIX)
|
||||
position = (u_ModelMatrix * vec4(position, 1.0)).xyz;
|
||||
normal = (u_ModelMatrix * vec4(normal, 0.0)).xyz;
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
tangent = (u_ModelMatrix * vec4(tangent, 0.0)).xyz;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
vec3 bitangent = cross(normal, tangent) * attr_Tangent.w;
|
||||
|
@ -213,10 +211,8 @@ void main()
|
|||
vec3 L = u_LightOrigin.xyz - (position * u_LightOrigin.w);
|
||||
#elif defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
vec3 L = attr_LightDirection;
|
||||
#if defined(USE_MODELMATRIX)
|
||||
L = (u_ModelMatrix * vec4(L, 0.0)).xyz;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHTMAP)
|
||||
var_TexCoords.zw = attr_TexCoord1.st;
|
||||
|
|
Loading…
Reference in a new issue