mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-29 10:03:46 +00:00
fix opengl; update librw
This commit is contained in:
parent
2c4a3b5f5e
commit
e2014cfd92
7 changed files with 19 additions and 27 deletions
|
@ -41,7 +41,7 @@ static int32 u_emiss;
|
||||||
static int32 u_colorscale;
|
static int32 u_colorscale;
|
||||||
|
|
||||||
static int32 u_texMatrix;
|
static int32 u_texMatrix;
|
||||||
static int32 u_fxparams;
|
static int32 u_shininess;
|
||||||
|
|
||||||
static int32 u_skyTop;
|
static int32 u_skyTop;
|
||||||
static int32 u_skyBot;
|
static int32 u_skyBot;
|
||||||
|
@ -98,7 +98,7 @@ uploadEnvMatrix(rw::Frame *frame)
|
||||||
convMatrix(&invMtx, &invMat);
|
convMatrix(&invMtx, &invMat);
|
||||||
RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord_flipU);
|
RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord_flipU);
|
||||||
}
|
}
|
||||||
glUniformMatrix4fv(U(u_texMatrix), 1, GL_FALSE, (float*)&envMtx);
|
setUniform(u_texMatrix, &envMtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -141,7 +141,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
if(gGlassCarsCheat)
|
if(gGlassCarsCheat)
|
||||||
coef = 1.0f;
|
coef = 1.0f;
|
||||||
}
|
}
|
||||||
glUniform1f(U(u_fxparams), coef);
|
glUniform1f(U(u_shininess), coef);
|
||||||
|
|
||||||
setMaterial(m->color, m->surfaceProps);
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *hea
|
||||||
if(gGlassCarsCheat)
|
if(gGlassCarsCheat)
|
||||||
coef = 1.0f;
|
coef = 1.0f;
|
||||||
}
|
}
|
||||||
glUniform1f(U(u_fxparams), coef);
|
glUniform1f(U(u_shininess), coef);
|
||||||
|
|
||||||
setMaterial(m->color, m->surfaceProps);
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
@ -809,8 +809,8 @@ CustomPipeRegisterGL(void)
|
||||||
u_emiss = rw::gl3::registerUniform("u_emiss");
|
u_emiss = rw::gl3::registerUniform("u_emiss");
|
||||||
u_colorscale = rw::gl3::registerUniform("u_colorscale");
|
u_colorscale = rw::gl3::registerUniform("u_colorscale");
|
||||||
|
|
||||||
u_texMatrix = rw::gl3::registerUniform("u_texMatrix");
|
u_texMatrix = rw::gl3::registerUniform("u_texMatrix", rw::gl3::UNIFORM_MAT4);
|
||||||
u_fxparams = rw::gl3::registerUniform("u_fxparams");
|
u_shininess = rw::gl3::registerUniform("u_shininess");
|
||||||
|
|
||||||
u_skyTop = rw::gl3::registerUniform("u_skyTop");
|
u_skyTop = rw::gl3::registerUniform("u_skyTop");
|
||||||
u_skyBot = rw::gl3::registerUniform("u_skyBot");
|
u_skyBot = rw::gl3::registerUniform("u_skyBot");
|
||||||
|
|
|
@ -741,7 +741,7 @@ uint32 im2D_UV2_Vao;
|
||||||
void
|
void
|
||||||
openim2d_uv2(void)
|
openim2d_uv2(void)
|
||||||
{
|
{
|
||||||
u_xform = rw::gl3::registerUniform("u_xform"); // this doesn't add a new one, so it's safe
|
u_xform = rw::gl3::registerUniform("u_xform", rw::gl3::UNIFORM_VEC4); // this doesn't add a new one, so it's safe
|
||||||
|
|
||||||
glGenBuffers(1, &im2D_UV2_Ibo);
|
glGenBuffers(1, &im2D_UV2_Ibo);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im2D_UV2_Ibo);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im2D_UV2_Ibo);
|
||||||
|
@ -803,7 +803,7 @@ RenderIndexedPrimitive_UV2(RwPrimitiveType primType, Im2DVertexUV2 *vertices, Rw
|
||||||
setAttribPointers(im2d_UV2_attribDesc, 4);
|
setAttribPointers(im2d_UV2_attribDesc, 4);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glUniform4fv(currentShader->uniformLocations[u_xform], 1, xform);
|
setUniform(u_xform, xform);
|
||||||
|
|
||||||
flushCache();
|
flushCache();
|
||||||
glDrawElements(primTypeMap[primType], numIndices,
|
glDrawElements(primTypeMap[primType], numIndices,
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
uniform sampler2D tex0;
|
uniform sampler2D tex0;
|
||||||
uniform sampler2D tex1;
|
uniform sampler2D tex1;
|
||||||
|
|
||||||
uniform float u_fxparams;
|
uniform float u_shininess;
|
||||||
uniform vec4 u_colorscale;
|
uniform vec4 u_colorscale;
|
||||||
|
|
||||||
#define shininess (u_fxparams)
|
|
||||||
|
|
||||||
FSIN vec4 v_color;
|
FSIN vec4 v_color;
|
||||||
FSIN vec2 v_tex0;
|
FSIN vec2 v_tex0;
|
||||||
#if defined(PASS_BLEND) || defined(PASS_ADD)
|
#if defined(PASS_BLEND) || defined(PASS_ADD)
|
||||||
|
@ -23,7 +21,7 @@ main(void)
|
||||||
vec4 color;
|
vec4 color;
|
||||||
#if defined(PASS_BLEND) || defined(PASS_ADD)
|
#if defined(PASS_BLEND) || defined(PASS_ADD)
|
||||||
vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));
|
vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));
|
||||||
pass2.a *= shininess;
|
pass2.a *= u_shininess;
|
||||||
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
|
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
|
||||||
|
|
||||||
// We simulate drawing this in two passes.
|
// We simulate drawing this in two passes.
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
uniform sampler2D tex0;
|
uniform sampler2D tex0;
|
||||||
uniform sampler2D tex1;
|
uniform sampler2D tex1;
|
||||||
|
|
||||||
uniform float u_fxparams;
|
uniform float u_shininess;
|
||||||
uniform vec3 u_skyTop;
|
uniform vec3 u_skyTop;
|
||||||
uniform vec3 u_skyBot;
|
uniform vec3 u_skyBot;
|
||||||
|
|
||||||
#define shininess (u_fxparams)
|
|
||||||
|
|
||||||
// matfx:
|
// matfx:
|
||||||
// case 1 normal envmap
|
// case 1 normal envmap
|
||||||
// custom1 (4.0, 1.0, 1.0, coef)
|
// custom1 (4.0, 1.0, 1.0, coef)
|
||||||
|
@ -59,10 +57,10 @@ main(void)
|
||||||
vec3 skyColour = mix(u_skyBot, u_skyTop, envtex.g);
|
vec3 skyColour = mix(u_skyBot, u_skyTop, envtex.g);
|
||||||
vec3 envOut = mix(envtex.rrr, skyColour, envtex.b);
|
vec3 envOut = mix(envtex.rrr, skyColour, envtex.b);
|
||||||
|
|
||||||
float fresnel = mix(shininess, shininess * 2.0, v_NdotV);
|
float fresnel = mix(u_shininess, u_shininess * 2.0, v_NdotV);
|
||||||
fresnel = pow(v_NdotV * preMult, power);
|
fresnel = pow(v_NdotV * preMult, power);
|
||||||
fresnel = clamp(fresnel * postMult, 0.0, 1.0);
|
fresnel = clamp(fresnel * postMult, 0.0, 1.0);
|
||||||
float reflectivity = v_lightingCont * mix(minRefl, maxRefl, fresnel)*shininess;
|
float reflectivity = v_lightingCont * mix(minRefl, maxRefl, fresnel)*u_shininess;
|
||||||
|
|
||||||
float opacity = mix(minOpacity, maxOpacity, fresnel)*pass1.a;
|
float opacity = mix(minOpacity, maxOpacity, fresnel)*pass1.a;
|
||||||
vec4 color = pass1 + vec4(reflectivity * envOut, 0.0);
|
vec4 color = pass1 + vec4(reflectivity * envOut, 0.0);
|
||||||
|
|
|
@ -2,11 +2,9 @@ const char *leedsDefault_frag_src =
|
||||||
"uniform sampler2D tex0;\n"
|
"uniform sampler2D tex0;\n"
|
||||||
"uniform sampler2D tex1;\n"
|
"uniform sampler2D tex1;\n"
|
||||||
|
|
||||||
"uniform float u_fxparams;\n"
|
"uniform float u_shininess;\n"
|
||||||
"uniform vec4 u_colorscale;\n"
|
"uniform vec4 u_colorscale;\n"
|
||||||
|
|
||||||
"#define shininess (u_fxparams)\n"
|
|
||||||
|
|
||||||
"FSIN vec4 v_color;\n"
|
"FSIN vec4 v_color;\n"
|
||||||
"FSIN vec2 v_tex0;\n"
|
"FSIN vec2 v_tex0;\n"
|
||||||
"#if defined(PASS_BLEND) || defined(PASS_ADD)\n"
|
"#if defined(PASS_BLEND) || defined(PASS_ADD)\n"
|
||||||
|
@ -24,7 +22,7 @@ const char *leedsDefault_frag_src =
|
||||||
" vec4 color;\n"
|
" vec4 color;\n"
|
||||||
"#if defined(PASS_BLEND) || defined(PASS_ADD)\n"
|
"#if defined(PASS_BLEND) || defined(PASS_ADD)\n"
|
||||||
" vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
|
" vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
|
||||||
" pass2.a *= shininess;\n"
|
" pass2.a *= u_shininess;\n"
|
||||||
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
|
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
|
||||||
|
|
||||||
" // We simulate drawing this in two passes.\n"
|
" // We simulate drawing this in two passes.\n"
|
||||||
|
|
|
@ -2,12 +2,10 @@ const char *leedsVehicle_mobile_frag_src =
|
||||||
"uniform sampler2D tex0;\n"
|
"uniform sampler2D tex0;\n"
|
||||||
"uniform sampler2D tex1;\n"
|
"uniform sampler2D tex1;\n"
|
||||||
|
|
||||||
"uniform float u_fxparams;\n"
|
"uniform float u_shininess;\n"
|
||||||
"uniform vec3 u_skyTop;\n"
|
"uniform vec3 u_skyTop;\n"
|
||||||
"uniform vec3 u_skyBot;\n"
|
"uniform vec3 u_skyBot;\n"
|
||||||
|
|
||||||
"#define shininess (u_fxparams)\n"
|
|
||||||
|
|
||||||
"// matfx:\n"
|
"// matfx:\n"
|
||||||
"// case 1 normal envmap\n"
|
"// case 1 normal envmap\n"
|
||||||
"// custom1 (4.0, 1.0, 1.0, coef)\n"
|
"// custom1 (4.0, 1.0, 1.0, coef)\n"
|
||||||
|
@ -60,10 +58,10 @@ const char *leedsVehicle_mobile_frag_src =
|
||||||
" vec3 skyColour = mix(u_skyBot, u_skyTop, envtex.g);\n"
|
" vec3 skyColour = mix(u_skyBot, u_skyTop, envtex.g);\n"
|
||||||
" vec3 envOut = mix(envtex.rrr, skyColour, envtex.b);\n"
|
" vec3 envOut = mix(envtex.rrr, skyColour, envtex.b);\n"
|
||||||
|
|
||||||
" float fresnel = mix(shininess, shininess * 2.0, v_NdotV);\n"
|
" float fresnel = mix(u_shininess, u_shininess * 2.0, v_NdotV);\n"
|
||||||
" fresnel = pow(v_NdotV * preMult, power);\n"
|
" fresnel = pow(v_NdotV * preMult, power);\n"
|
||||||
" fresnel = clamp(fresnel * postMult, 0.0, 1.0);\n"
|
" fresnel = clamp(fresnel * postMult, 0.0, 1.0);\n"
|
||||||
" float reflectivity = v_lightingCont * mix(minRefl, maxRefl, fresnel)*shininess;\n"
|
" float reflectivity = v_lightingCont * mix(minRefl, maxRefl, fresnel)*u_shininess;\n"
|
||||||
|
|
||||||
" float opacity = mix(minOpacity, maxOpacity, fresnel)*pass1.a;\n"
|
" float opacity = mix(minOpacity, maxOpacity, fresnel)*pass1.a;\n"
|
||||||
" vec4 color = pass1 + vec4(reflectivity * envOut, 0.0);\n"
|
" vec4 color = pass1 + vec4(reflectivity * envOut, 0.0);\n"
|
||||||
|
|
2
vendor/librw
vendored
2
vendor/librw
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 65c619b3e7dcec6f5dbd05d3203b530d667ba90f
|
Subproject commit 4c4b199057e9570557cdf108d21795236a076755
|
Loading…
Reference in a new issue