]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
new tcmod: "tcmod page <width> <height> <time>", as poor man's animmap alternative...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Sep 2008 07:24:19 +0000 (07:24 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Sep 2008 07:24:19 +0000 (07:24 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8501 d7cf8633-e32d-0410-b094-e92efae38249

darkplaces.txt
gl_rmain.c
model_shared.c
model_shared.h

index c20f3b28e0eb4aee7756c782351ce4f620903fea..91c3d6267e50396a58224aba905ff5ed4e0eb4fb 100644 (file)
@@ -1340,3 +1340,13 @@ Shader parameters for DP's own features:
   - set this to a small value like 0.1 to emphasize the reflection and make\r
   the water transparent; but if r_water is 0, alpha isn't used, so the water can\r
   be very visible then too.\r
+- tcmod page <width> <height> <delay>\r
+  The texture is shifted by 1/<width> every <delay> seconds, and by 1/<height>\r
+  every <delay>*<width> seconds. It is some sort of animmap replacement that keeps\r
+  all animation frames in a single texture.\r
+  To use it, make a texture with the frames aligned in a grid like this:\r
+    1   2   3   4\r
+    5   6   7   8\r
+  then align it in Radiant so only one of the animation frames can be seen on\r
+  the surface, and specify "tcmod page 4 2 0.1". DP will then display the frames\r
+  in order and the cycle will repeat every 0.8 seconds.\r
index b7f72257764cda09fae723f2f4512252a00d875d..912b1f28c6196b707e0a1cf71212c6436b5f5535 100644 (file)
@@ -4480,6 +4480,7 @@ static float R_EvaluateQ3WaveFunc(q3wavefunc_t func, const float *parms)
 
 void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
 {
+       int w, h, idx;
        int i;
        dp_model_t *model = ent->model;
        float f;
@@ -4608,6 +4609,14 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
                case Q3TCMOD_SCROLL:
                        Matrix4x4_CreateTranslate(&matrix, tcmod->parms[0] * r_refdef.scene.time, tcmod->parms[1] * r_refdef.scene.time, 0);
                        break;
+               case Q3TCMOD_PAGE: // poor man's animmap (to store animations into a single file, useful for HTTP downloaded textures)
+                       w = tcmod->parms[0];
+                       h = tcmod->parms[1];
+                       f = r_refdef.scene.time / (tcmod->parms[2] * w * h);
+                       f = f - floor(f);
+                       idx = floor(f * w * h);
+                       Matrix4x4_CreateTranslate(&matrix, (idx % w) / tcmod->parms[0], (idx / w) / tcmod->parms[1], 0);
+                       break;
                case Q3TCMOD_STRETCH:
                        f = 1.0f / R_EvaluateQ3WaveFunc(tcmod->wavefunc, tcmod->waveparms);
                        Matrix4x4_CreateFromQuakeEntity(&matrix, 0.5f * (1 - f), 0.5 * (1 - f), 0, 0, 0, 0, f);
index 7de6009601f20c4a33a8645710077781f141b976..ce2abdb8f82eda2bfafd5f8e54f8011e4e8225af 100644 (file)
@@ -1447,6 +1447,7 @@ void Mod_LoadQ3Shaders(void)
                                                                else if (!strcasecmp(parameter[1], "rotate"))          layer->tcmods[tcmodindex].tcmod = Q3TCMOD_ROTATE;
                                                                else if (!strcasecmp(parameter[1], "scale"))           layer->tcmods[tcmodindex].tcmod = Q3TCMOD_SCALE;
                                                                else if (!strcasecmp(parameter[1], "scroll"))          layer->tcmods[tcmodindex].tcmod = Q3TCMOD_SCROLL;
+                                                               else if (!strcasecmp(parameter[1], "page"))            layer->tcmods[tcmodindex].tcmod = Q3TCMOD_PAGE;
                                                                else if (!strcasecmp(parameter[1], "stretch"))
                                                                {
                                                                        layer->tcmods[tcmodindex].tcmod = Q3TCMOD_STRETCH;
index 9fcfff2512c982351a8432760c2a94ac45dbc177..c417733b7930c9d13212de2409e813efe8ef1c90 100644 (file)
@@ -287,6 +287,7 @@ typedef enum q3tcmod_e
        Q3TCMOD_STRETCH,
        Q3TCMOD_TRANSFORM,
        Q3TCMOD_TURBULENT,
+       Q3TCMOD_PAGE,
        Q3TCMOD_COUNT
 }
 q3tcmod_t;