Fix floating point precision loss in renderer [part 2]

Fix floatTime using float precision instead of double using GCC.
Fix R_BindAnimatedImage to be in sync with function table.
Fix vertexDeform bulge, vertexDeform normals, noise wave function
at high level time.

Revert unnecessary float -> double conversions.
This commit is contained in:
Zack Middleton 2017-08-02 23:29:46 -05:00
parent 30fdd88c9f
commit 59b1262b82
12 changed files with 62 additions and 69 deletions

View file

@ -268,10 +268,10 @@ typedef enum {
typedef struct {
genFunc_t func;
double base;
double amplitude;
double phase;
double frequency;
float base;
float amplitude;
float phase;
float frequency;
} waveForm_t;
#define TR_MAX_TEXMODS 4
@ -331,7 +331,7 @@ typedef struct {
typedef struct {
image_t *image[MAX_IMAGE_ANIMATIONS];
int numImageAnimations;
double imageAnimationSpeed;
float imageAnimationSpeed;
texCoordGen_t tcGen;
vec3_t tcGenVectors[2];
@ -479,29 +479,6 @@ typedef struct shader_s {
struct shader_s *next;
} shader_t;
static ID_INLINE qboolean ShaderRequiresCPUDeforms(const shader_t * shader)
{
if(shader->numDeforms)
{
const deformStage_t *ds = &shader->deforms[0];
if (shader->numDeforms > 1)
return qtrue;
switch (ds->deformation)
{
case DEFORM_WAVE:
case DEFORM_BULGE:
return qfalse;
default:
return qtrue;
}
}
return qfalse;
}
enum
{
ATTR_INDEX_POSITION = 0,
@ -1791,6 +1768,32 @@ extern cvar_t *r_marksOnTriangleMeshes;
//====================================================================
static ID_INLINE qboolean ShaderRequiresCPUDeforms(const shader_t * shader)
{
if(shader->numDeforms)
{
const deformStage_t *ds = &shader->deforms[0];
if (shader->numDeforms > 1)
return qtrue;
switch (ds->deformation)
{
case DEFORM_WAVE:
case DEFORM_BULGE:
// need CPU deforms at high level-times to avoid floating point percision loss
return ( backEnd.refdef.floatTime != (float)backEnd.refdef.floatTime );
default:
return qtrue;
}
}
return qfalse;
}
//====================================================================
void R_SwapBuffers( int );
void R_RenderView( viewParms_t *parms );