]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added r_farclip_base and r_farclip_world cvars to control farclip
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 8 Nov 2009 19:57:10 +0000 (19:57 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 8 Nov 2009 19:57:10 +0000 (19:57 +0000)
distance, also affects sky fogging, changed base from 4096 to 65536
added cl_decals_models cvar to decide whether to apply decals to non-bsp
models (requires cl_decals_newsystem 1)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9459 d7cf8633-e32d-0410-b094-e92efae38249

cl_particles.c
gl_rmain.c

index 51fe7c242e2dff5046ef555d7515a40c8dfeb38f..4ee4690139c56c4435727a2ef5bd653f26f44905 100644 (file)
@@ -218,6 +218,7 @@ cvar_t cl_decals_visculling = {CVAR_SAVE, "cl_decals_visculling", "1", "perform
 cvar_t cl_decals_time = {CVAR_SAVE, "cl_decals_time", "20", "how long before decals start to fade away"};
 cvar_t cl_decals_fadetime = {CVAR_SAVE, "cl_decals_fadetime", "1", "how long decals take to fade away"};
 cvar_t cl_decals_newsystem = {CVAR_SAVE, "cl_decals_newsystem", "0", "enables new advanced decal system"};
+cvar_t cl_decals_models = {CVAR_SAVE, "cl_decals_models", "0", "enables decals on animated models (if newsystem is also 1)"};
 cvar_t cl_decals_bias = {CVAR_SAVE, "cl_decals_bias", "0.125", "distance to bias decals from surface to prevent depth fighting"};
 
 
@@ -500,6 +501,7 @@ void CL_Particles_Init (void)
        Cvar_RegisterVariable (&cl_decals_time);
        Cvar_RegisterVariable (&cl_decals_fadetime);
        Cvar_RegisterVariable (&cl_decals_newsystem);
+       Cvar_RegisterVariable (&cl_decals_models);
        Cvar_RegisterVariable (&cl_decals_bias);
 }
 
index e44f24cbdb81669f436222fc778aff2a631f8ff2..d7ab26391564bece7a92026a1e41aadc73283162 100644 (file)
@@ -54,6 +54,8 @@ cvar_t r_animcache = {CVAR_SAVE, "r_animcache", "1", "cache animation frames to
 
 cvar_t r_depthfirst = {CVAR_SAVE, "r_depthfirst", "0", "renders a depth-only version of the scene before normal rendering begins to eliminate overdraw, values: 0 = off, 1 = world depth, 2 = world and model depth"};
 cvar_t r_useinfinitefarclip = {CVAR_SAVE, "r_useinfinitefarclip", "1", "enables use of a special kind of projection matrix that has an extremely large farclip"};
+cvar_t r_farclip_base = {0, "r_farclip_base", "65536", "farclip (furthest visible distance) for rendering when r_useinfinitefarclip is 0"};
+cvar_t r_farclip_world = {0, "r_farclip_world", "2", "adds map size to farclip multiplied by this value"};
 cvar_t r_nearclip = {0, "r_nearclip", "1", "distance from camera of nearclip plane" };
 cvar_t r_showbboxes = {0, "r_showbboxes", "0", "shows bounding boxes of server entities, value controls opacity scaling (1 = 10%,  10 = 100%)"};
 cvar_t r_showsurfaces = {0, "r_showsurfaces", "0", "1 shows surfaces as different colors, or a value of 2 shows triangle draw order (for analyzing whether meshes are optimized for vertex cache)"};
@@ -2984,6 +2986,8 @@ void GL_Main_Init(void)
        Cvar_RegisterVariable(&r_animcache);
        Cvar_RegisterVariable(&r_depthfirst);
        Cvar_RegisterVariable(&r_useinfinitefarclip);
+       Cvar_RegisterVariable(&r_farclip_base);
+       Cvar_RegisterVariable(&r_farclip_world);
        Cvar_RegisterVariable(&r_nearclip);
        Cvar_RegisterVariable(&r_showbboxes);
        Cvar_RegisterVariable(&r_showsurfaces);
@@ -4689,9 +4693,9 @@ void R_UpdateVariables(void)
 
        r_refdef.scene.ambient = r_ambient.value;
 
-       r_refdef.farclip = 4096;
+       r_refdef.farclip = r_farclip_base.value;
        if (r_refdef.scene.worldmodel)
-               r_refdef.farclip += r_refdef.scene.worldmodel->radius * 2;
+               r_refdef.farclip += r_refdef.scene.worldmodel->radius * r_farclip_world.value * 2;
        r_refdef.nearclip = bound (0.001f, r_nearclip.value, r_refdef.farclip - 1.0f);
 
        if (r_shadow_frontsidecasting.integer < 0 || r_shadow_frontsidecasting.integer > 1)
@@ -8257,6 +8261,7 @@ void R_DecalSystem_SpawnTriangle(decalsystem_t *decalsystem, const float *v0, co
 }
 
 extern cvar_t cl_decals_bias;
+extern cvar_t cl_decals_models;
 void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize)
 {
        matrix4x4_t projection;
@@ -8292,6 +8297,7 @@ void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, c
        float angles[3];
        float temp[3];
 
+       decalsystem = &ent->decalsystem;
        model = ent->model;
        if (!model || !ent->allowdecals || ent->alpha < 1 || (ent->flags & (RENDER_ADDITIVE | RENDER_NODEPTHTEST)))
        {
@@ -8299,7 +8305,13 @@ void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, c
                return;
        }
 
-       decalsystem = &ent->decalsystem;
+       if (!model->brush.data_nodes && !cl_decals_models.integer)
+       {
+               if (decalsystem->model)
+                       R_DecalSystem_Reset(decalsystem);
+               return;
+       }
+
        if (decalsystem->model != model)
                R_DecalSystem_Reset(decalsystem);
        decalsystem->model = model;