mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
GL3: Rename some CVars to gl3_*, fix water brightness
* gl3_particle_size: in GL3 the particles should be a bit bigger because the particles fade out towards the edge, so I put it in a seperate CVar * gl3_intensity: in GL3 the intensity can have any floating point value, in GL1 only integers, so it gets its own CVar * gl3_overbrightbits: gl_overbrightbits had to be 1, 2 or 4, in GL3 it can have any floating point value. Changed the particle scaling a bit so they look bigger.
This commit is contained in:
parent
182948fecc
commit
ea6dacbc12
4 changed files with 41 additions and 25 deletions
|
@ -533,8 +533,8 @@ R_DrawParticles(void)
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
// assume the particle size looks good with window height 600px and scale according to real resolution
|
// assume the particle size looks good with window height 480px and scale according to real resolution
|
||||||
glPointSize(gl_particle_size->value * (float)r_newrefdef.height/600.0f);
|
glPointSize(gl_particle_size->value * (float)r_newrefdef.height/480.0f);
|
||||||
|
|
||||||
for ( i = 0, p = r_newrefdef.particles; i < r_newrefdef.num_particles; i++, p++ )
|
for ( i = 0, p = r_newrefdef.particles; i < r_newrefdef.num_particles; i++, p++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,14 +92,14 @@ cvar_t *gl_anisotropic;
|
||||||
cvar_t *gl_texturemode;
|
cvar_t *gl_texturemode;
|
||||||
cvar_t *gl_drawbuffer;
|
cvar_t *gl_drawbuffer;
|
||||||
cvar_t *gl_clear;
|
cvar_t *gl_clear;
|
||||||
cvar_t *gl_particle_size;
|
cvar_t *gl3_particle_size;
|
||||||
|
|
||||||
cvar_t *gl_lefthand;
|
cvar_t *gl_lefthand;
|
||||||
cvar_t *gl_farsee;
|
cvar_t *gl_farsee;
|
||||||
|
|
||||||
cvar_t *intensity;
|
cvar_t *gl3_intensity;
|
||||||
cvar_t *gl_lightlevel;
|
cvar_t *gl_lightlevel;
|
||||||
cvar_t *gl_overbrightbits;
|
cvar_t *gl3_overbrightbits;
|
||||||
|
|
||||||
cvar_t *gl_norefresh;
|
cvar_t *gl_norefresh;
|
||||||
cvar_t *gl_drawentities;
|
cvar_t *gl_drawentities;
|
||||||
|
@ -202,7 +202,7 @@ GL3_Register(void)
|
||||||
gl_mode = ri.Cvar_Get("gl_mode", "4", CVAR_ARCHIVE);
|
gl_mode = ri.Cvar_Get("gl_mode", "4", CVAR_ARCHIVE);
|
||||||
gl_customwidth = ri.Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE);
|
gl_customwidth = ri.Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE);
|
||||||
gl_customheight = ri.Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
|
gl_customheight = ri.Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
|
||||||
gl_particle_size = ri.Cvar_Get("gl_particle_size", "40", CVAR_ARCHIVE);
|
gl3_particle_size = ri.Cvar_Get("gl3_particle_size", "60", CVAR_ARCHIVE);
|
||||||
|
|
||||||
gl_norefresh = ri.Cvar_Get("gl_norefresh", "0", 0);
|
gl_norefresh = ri.Cvar_Get("gl_norefresh", "0", 0);
|
||||||
gl_drawentities = ri.Cvar_Get("gl_drawentities", "1", 0);
|
gl_drawentities = ri.Cvar_Get("gl_drawentities", "1", 0);
|
||||||
|
@ -218,10 +218,10 @@ GL3_Register(void)
|
||||||
|
|
||||||
vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
||||||
vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
|
vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
|
||||||
intensity = ri.Cvar_Get("intensity", "2.0", CVAR_ARCHIVE);
|
gl3_intensity = ri.Cvar_Get("gl3_intensity", "1.5", CVAR_ARCHIVE);
|
||||||
|
|
||||||
gl_lightlevel = ri.Cvar_Get("gl_lightlevel", "0", 0);
|
gl_lightlevel = ri.Cvar_Get("gl_lightlevel", "0", 0);
|
||||||
gl_overbrightbits = ri.Cvar_Get("gl_overbrightbits", "0", CVAR_ARCHIVE);
|
gl3_overbrightbits = ri.Cvar_Get("gl3_overbrightbits", "1.5", CVAR_ARCHIVE);
|
||||||
|
|
||||||
gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0);
|
gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0);
|
||||||
gl_shadows = ri.Cvar_Get("gl_shadows", "0", CVAR_ARCHIVE);
|
gl_shadows = ri.Cvar_Get("gl_shadows", "0", CVAR_ARCHIVE);
|
||||||
|
@ -811,14 +811,14 @@ GL3_DrawParticles(void)
|
||||||
//qboolean stereo_split_tb = ((gl_state.stereo_mode == STEREO_SPLIT_VERTICAL) && gl_state.camera_separation);
|
//qboolean stereo_split_tb = ((gl_state.stereo_mode == STEREO_SPLIT_VERTICAL) && gl_state.camera_separation);
|
||||||
//qboolean stereo_split_lr = ((gl_state.stereo_mode == STEREO_SPLIT_HORIZONTAL) && gl_state.camera_separation);
|
//qboolean stereo_split_lr = ((gl_state.stereo_mode == STEREO_SPLIT_HORIZONTAL) && gl_state.camera_separation);
|
||||||
|
|
||||||
//if (gl_config.pointparameters && !(stereo_split_tb || stereo_split_lr))
|
//if (!(stereo_split_tb || stereo_split_lr))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int numParticles = gl3_newrefdef.num_particles;
|
int numParticles = gl3_newrefdef.num_particles;
|
||||||
unsigned char color[4];
|
unsigned char color[4];
|
||||||
const particle_t *p;
|
const particle_t *p;
|
||||||
// assume the size looks good with window height 600px and scale according to real resolution
|
// assume the size looks good with window height 480px and scale according to real resolution
|
||||||
float pointSize = gl_particle_size->value * (float)gl3_newrefdef.height/600.0f;
|
float pointSize = gl3_particle_size->value * (float)gl3_newrefdef.height/480.0f;
|
||||||
|
|
||||||
typedef struct part_vtx {
|
typedef struct part_vtx {
|
||||||
GLfloat pos[3];
|
GLfloat pos[3];
|
||||||
|
@ -1615,28 +1615,28 @@ GL3_BeginFrame(float camera_separation)
|
||||||
}
|
}
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
if (vid_gamma->modified || intensity->modified)
|
if (vid_gamma->modified || gl3_intensity->modified)
|
||||||
{
|
{
|
||||||
vid_gamma->modified = false;
|
vid_gamma->modified = false;
|
||||||
intensity->modified = false;
|
gl3_intensity->modified = false;
|
||||||
|
|
||||||
gl3state.uniCommonData.gamma = 1.0f/vid_gamma->value;
|
gl3state.uniCommonData.gamma = 1.0f/vid_gamma->value;
|
||||||
gl3state.uniCommonData.intensity = intensity->value;
|
gl3state.uniCommonData.intensity = gl3_intensity->value;
|
||||||
GL3_UpdateUBOCommon();
|
GL3_UpdateUBOCommon();
|
||||||
}
|
}
|
||||||
|
|
||||||
// in GL3, overbrightbits can have any positive value
|
// in GL3, overbrightbits can have any positive value
|
||||||
// TODO: rename to gl3_overbrightbits?
|
// TODO: rename to gl3_overbrightbits?
|
||||||
if (gl_overbrightbits->modified)
|
if (gl3_overbrightbits->modified)
|
||||||
{
|
{
|
||||||
gl_overbrightbits->modified = false;
|
gl3_overbrightbits->modified = false;
|
||||||
|
|
||||||
if(gl_overbrightbits->value < 0.0f)
|
if(gl3_overbrightbits->value < 0.0f)
|
||||||
{
|
{
|
||||||
ri.Cvar_Set("gl_overbrightbits", "0");
|
ri.Cvar_Set("gl_overbrightbits", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
gl3state.uni3DData.overbrightbits = (gl_overbrightbits->value <= 0.0f) ? 1.0f : gl_overbrightbits->value;
|
gl3state.uni3DData.overbrightbits = (gl3_overbrightbits->value <= 0.0f) ? 1.0f : gl3_overbrightbits->value;
|
||||||
GL3_UpdateUBO3D();
|
GL3_UpdateUBO3D();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,6 +391,23 @@ static const char* fragmentSrc3D = MULTILINE_STRING(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static const char* fragmentSrc3Dwater = MULTILINE_STRING(
|
||||||
|
|
||||||
|
// it gets attributes and uniforms from fragmentCommon3D
|
||||||
|
|
||||||
|
uniform sampler2D tex;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 texel = texture(tex, passTexCoord);
|
||||||
|
|
||||||
|
// apply intensity and gamma
|
||||||
|
texel.rgb *= intensity*0.5;
|
||||||
|
outColor.rgb = pow(texel.rgb, vec3(gamma));
|
||||||
|
outColor.a = texel.a*alpha; // I think alpha shouldn't be modified by gamma and intensity
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
static const char* fragmentSrc3Dlm = MULTILINE_STRING(
|
static const char* fragmentSrc3Dlm = MULTILINE_STRING(
|
||||||
|
|
||||||
// it gets attributes and uniforms from fragmentCommon3D
|
// it gets attributes and uniforms from fragmentCommon3D
|
||||||
|
@ -629,8 +646,7 @@ static const char* vertexSrcParticles = MULTILINE_STRING(
|
||||||
// abusing texCoord for pointSize, pointDist for particles
|
// abusing texCoord for pointSize, pointDist for particles
|
||||||
float pointDist = texCoord.y*0.1; // with factor 0.1 it looks good.
|
float pointDist = texCoord.y*0.1; // with factor 0.1 it looks good.
|
||||||
|
|
||||||
// 1.4 to make them a bit bigger, they look smaller due to fading (see fragment shader)
|
gl_PointSize = texCoord.x/pointDist;
|
||||||
gl_PointSize = 1.4*texCoord.x/pointDist;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -906,7 +922,7 @@ err_cleanup:
|
||||||
static void initUBOs(void)
|
static void initUBOs(void)
|
||||||
{
|
{
|
||||||
gl3state.uniCommonData.gamma = 1.0f/vid_gamma->value;
|
gl3state.uniCommonData.gamma = 1.0f/vid_gamma->value;
|
||||||
gl3state.uniCommonData.intensity = intensity->value;
|
gl3state.uniCommonData.intensity = gl3_intensity->value;
|
||||||
gl3state.uniCommonData.color = HMM_Vec4(1, 1, 1, 1);
|
gl3state.uniCommonData.color = HMM_Vec4(1, 1, 1, 1);
|
||||||
|
|
||||||
glGenBuffers(1, &gl3state.uniCommonUBO);
|
glGenBuffers(1, &gl3state.uniCommonUBO);
|
||||||
|
@ -930,7 +946,7 @@ static void initUBOs(void)
|
||||||
gl3state.uni3DData.time = 0.0f;
|
gl3state.uni3DData.time = 0.0f;
|
||||||
gl3state.uni3DData.alpha = 1.0f;
|
gl3state.uni3DData.alpha = 1.0f;
|
||||||
// gl_overbrightbits 0 means "no scaling" which is equivalent to multiplying with 1
|
// gl_overbrightbits 0 means "no scaling" which is equivalent to multiplying with 1
|
||||||
gl3state.uni3DData.overbrightbits = (gl_overbrightbits->value <= 0.0f) ? 1.0f : gl_overbrightbits->value;
|
gl3state.uni3DData.overbrightbits = (gl3_overbrightbits->value <= 0.0f) ? 1.0f : gl3_overbrightbits->value;
|
||||||
|
|
||||||
glGenBuffers(1, &gl3state.uni3DUBO);
|
glGenBuffers(1, &gl3state.uni3DUBO);
|
||||||
glBindBuffer(GL_UNIFORM_BUFFER, gl3state.uni3DUBO);
|
glBindBuffer(GL_UNIFORM_BUFFER, gl3state.uni3DUBO);
|
||||||
|
@ -981,7 +997,7 @@ qboolean GL3_InitShaders(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if(!initShader3D(&gl3state.si3Dturb, vertexSrc3Dwater, fragmentSrc3D))
|
if(!initShader3D(&gl3state.si3Dturb, vertexSrc3Dwater, fragmentSrc3Dwater))
|
||||||
{
|
{
|
||||||
R_Printf(PRINT_ALL, "WARNING: Failed to create shader program for water rendering!\n");
|
R_Printf(PRINT_ALL, "WARNING: Failed to create shader program for water rendering!\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -498,11 +498,11 @@ extern cvar_t *gl_farsee;
|
||||||
extern cvar_t *gl_drawworld;
|
extern cvar_t *gl_drawworld;
|
||||||
|
|
||||||
extern cvar_t *vid_gamma;
|
extern cvar_t *vid_gamma;
|
||||||
extern cvar_t *intensity;
|
extern cvar_t *gl3_intensity;
|
||||||
extern cvar_t *gl_anisotropic;
|
extern cvar_t *gl_anisotropic;
|
||||||
|
|
||||||
extern cvar_t *gl_lightlevel;
|
extern cvar_t *gl_lightlevel;
|
||||||
extern cvar_t *gl_overbrightbits;
|
extern cvar_t *gl3_overbrightbits;
|
||||||
|
|
||||||
extern cvar_t *gl_modulate;
|
extern cvar_t *gl_modulate;
|
||||||
extern cvar_t *gl_lightmap;
|
extern cvar_t *gl_lightmap;
|
||||||
|
|
Loading…
Reference in a new issue