Author Topic: Valathil's Awesome Graphical Advancements  (Read 55497 times)

0 Members and 1 Guest are viewing this topic.

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Watch it. It is awesome.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline jg18

  • A very happy zod
  • 210
  • can do more than spellcheck
Watch it. It is awesome.

I hadn't seen the update to Valathil's post and confusedly thought you were talking about the music video... :confused:

But now that I've seen the update... :jaw:

holy **** Valathil that is ****ing amazing

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
:jaw:

That is all.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
 :eek:


I'm sorry I doubted you...

Could use a bit more glow on the white 'reveal' part though.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Wow.
BTW, could that be triggered in game, with SEXPs?
That effect is simply amazing.

 

Offline Tomo

  • 28
Wow.
BTW, could that be triggered in game, with SEXPs?
That effect is simply amazing.
Once the material system that The_E was working on turns up, then yes that becomes possible along with lots of other possibilities for procedural effect shaders.

Once you can pass arbitrary game and ship values to the shader, you can do *amazing* things. Coupled with a material-replace SEXP, the possibilities are endless.

- A while back I was working on a Warp Effect shader that squeezes the ship into a small tube and stretches it to infinity (well, a long way) as it warps. It looked really cool, but couldn't be used as there was no way for the shader to know that the ship was warping.
Equally, all the Star Trek warp effects (TOS, Next Gen and the reboot) can be done quite easily with shaders.

So The_E - how is it going? Is there anything any of us can do to help you?

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
i think its done

Wow.
BTW, could that be triggered in game, with SEXPs?
That effect is simply amazing.

This was the idea from the beginning, a generic animated shader thing to do crazy effects. However at this stage i did not need to implement a generic solution for ship models in missions to do what i wanted. But this is certainly a possible follow up to this.
Code: [Select]
Index: code/missionui/missionscreencommon.h
===================================================================
--- code/missionui/missionscreencommon.h (Revision 7380)
+++ code/missionui/missionscreencommon.h (Arbeitskopie)
@@ -200,7 +200,7 @@
 
 struct ship_info;
 void draw_model_icon(int model_id, int flags, float closeup_zoom, int x1, int x2, int y1, int y2, ship_info* sip=NULL, bool resize=true);
-void draw_model_rotating(int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, vec3d *closeup_pos=NULL, float closeup_zoom = .65f, float rev_rate = REVOLUTION_RATE, int flags = MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING, bool resize=true);
+void draw_model_rotating(int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, vec3d *closeup_pos=NULL, float closeup_zoom = .65f, float rev_rate = REVOLUTION_RATE, int flags = MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING, bool resize=true, float anim_timer = 0.0f);
 
 void common_set_team_pointers(int team);
 void common_reset_team_pointers();
Index: code/missionui/missionweaponchoice.cpp
===================================================================
--- code/missionui/missionweaponchoice.cpp (Revision 7380)
+++ code/missionui/missionweaponchoice.cpp (Arbeitskopie)
@@ -38,9 +38,9 @@
 #include "missionui/chatbox.h"
 #include "network/multi_pmsg.h"
 #include "parse/parselo.h"
+#include "io/timer.h"
 
 
-
 #define IS_BANK_PRIMARY(x) (x < MAX_SHIP_PRIMARY_BANKS)
 #define IS_BANK_SECONDARY(x) (x >= MAX_SHIP_PRIMARY_BANKS)
 
@@ -96,6 +96,7 @@
 #define WL_BUTTON_MULTI_LOCK 6
 #define WL_BUTTON_APPLY_ALL 7
 
+static int anim_timer_start = 0;
 
 // convenient struct for handling all button controls
 struct wl_buttons {
@@ -1221,6 +1222,8 @@
 {
  int weapon_class;
 
+ anim_timer_start = timer_get_milliseconds();
+
  // if a weapon is being carried, do nothing
  if ( wl_icon_being_carried() ) {
  return;
@@ -1256,6 +1259,8 @@
 void maybe_select_new_ship_weapon(int index)
 {
  int *wep, *wep_count;
+
+ anim_timer_start = timer_get_milliseconds();
 
  if ( Selected_wl_slot == -1 )
  return;
@@ -2791,7 +2796,9 @@
  NULL,
  .65f,
  REVOLUTION_RATE,
- MR_IS_MISSILE | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING);
+ MR_IS_MISSILE | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING | MR_ANIMATED_SHADER,
+ true,
+ MIN((timer_get_milliseconds()-anim_timer_start)/1500.0f,2.0f));
  }
 
  else if ( Weapon_anim_class != -1 && ( Selected_wl_class == Weapon_anim_class )) {
Index: code/missionui/missionshipchoice.cpp
===================================================================
--- code/missionui/missionshipchoice.cpp (Revision 7380)
+++ code/missionui/missionshipchoice.cpp (Arbeitskopie)
@@ -46,9 +46,9 @@
 #include "network/multiteamselect.h"
 #include "network/multiutil.h"
 #include "ai/aigoals.h"
+#include "io/timer.h"
 
 
-
 //////////////////////////////////////////////////////
 // Game-wide Globals
 //////////////////////////////////////////////////////
@@ -115,6 +115,7 @@
 int Hot_ss_icon; // index that icon is over in list (0..MAX_WING_SLOTS-1)
 int Hot_ss_slot; // index for slot that mouse is over (0..MAX_WSS_SLOTS)
 
+static int anim_timer_start = 0;
 ////////////////////////////////////////////////////////////
 // Ship Select UI
 ////////////////////////////////////////////////////////////
@@ -1555,7 +1556,10 @@
  &ShipSelectScreenShipRot,
  &sip->closeup_pos,
  sip->closeup_zoom * 1.3f,
- rev_rate);
+ rev_rate,
+ MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING | MR_ANIMATED_SHADER,
+ true,
+ MIN((timer_get_milliseconds()-anim_timer_start)/1500.0f,2.0f));
  }
  }
 
@@ -1759,6 +1763,8 @@
  char *p;
  char animation_filename[CF_MAX_FILENAME_LENGTH+4];
 
+ anim_timer_start = timer_get_milliseconds();
+
  if ( Cmdline_ship_choice_3d || !strlen(sip->anim_filename) ) {
  if (ship_class < 0) {
  mprintf(("No ship class passed in to start_ship_animation\n"));
Index: code/missionui/missionscreencommon.cpp
===================================================================
--- code/missionui/missionscreencommon.cpp (Revision 7380)
+++ code/missionui/missionscreencommon.cpp (Arbeitskopie)
@@ -1542,7 +1542,7 @@
  gr_reset_clip();
 }
 
-void draw_model_rotating(int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, vec3d *closeup_pos, float closeup_zoom, float rev_rate, int flags, bool resize)
+void draw_model_rotating(int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, vec3d *closeup_pos, float closeup_zoom, float rev_rate, int flags, bool resize, float anim_timer)
 {
  //WMC - Can't draw a non-model
  if(model_id < 0)
@@ -1597,7 +1597,7 @@
 
  model_clear_instance(model_id);
  model_set_detail_level(0);
- model_render(model_id, &model_orient, &vmd_zero_vector, flags);
+ model_render(model_id, &model_orient, &vmd_zero_vector, flags,-1,-1,(int*)0,anim_timer);
 
  if (!Cmdline_nohtl)
  {
Index: code/graphics/gropengltnl.h
===================================================================
--- code/graphics/gropengltnl.h (Revision 7380)
+++ code/graphics/gropengltnl.h (Arbeitskopie)
@@ -43,7 +43,7 @@
 bool gr_opengl_config_buffer(const int buffer_id, vertex_buffer *vb);
 void gr_opengl_destroy_buffer(int idx);
 void gr_opengl_set_buffer(int idx);
-void gr_opengl_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags);
+void gr_opengl_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags, float anim_timer = 0.0f);
 void gr_opengl_render_to_env(int FACE);
 
 void gr_opengl_start_state_block();
Index: code/graphics/gropenglshader.h
===================================================================
--- code/graphics/gropenglshader.h (Revision 7380)
+++ code/graphics/gropenglshader.h (Arbeitskopie)
@@ -34,8 +34,8 @@
 #define SDR_FLAG_NORMAL_MAP (1<<13)
 #define SDR_FLAG_HEIGHT_MAP (1<<14)
 #define SDR_FLAG_ENV_MAP (1<<15)
+#define SDR_FLAG_ANIMATED (1<<16)
 
-
 #define MAX_SHADER_UNIFORMS 15
 
 struct opengl_shader_file_t {
Index: code/graphics/tmapper.h
===================================================================
--- code/graphics/tmapper.h (Revision 7380)
+++ code/graphics/tmapper.h (Arbeitskopie)
@@ -72,6 +72,8 @@
 // use greyscale texture
 #define TMAP_FLAG_BW_TEXTURE (1<<18)
 
+// use animated Shader - Valathil
+#define TMAP_ANIMATED_SHADER (1<<19)
 
 #define TMAP_ADDRESS_WRAP 1
 #define TMAP_ADDRESS_MIRROR 2
Index: code/graphics/gropengltnl.cpp
===================================================================
--- code/graphics/gropengltnl.cpp (Revision 7380)
+++ code/graphics/gropengltnl.cpp (Arbeitskopie)
@@ -506,7 +506,7 @@
 
 static void opengl_render_pipeline_fixed(int start, const vertex_buffer *bufferp, const buffer_data *datap, int flags);
 
-static void opengl_render_pipeline_program(int start, const vertex_buffer *bufferp, const buffer_data *datap, int flags)
+static void opengl_render_pipeline_program(int start, const vertex_buffer *bufferp, const buffer_data *datap, int flags, float anim_timer = 0.0f)
 {
  float u_scale, v_scale;
  int render_pass = 0;
@@ -534,6 +534,9 @@
  shader_flags |= SDR_FLAG_FOG;
  }
 
+ if (flags & TMAP_ANIMATED_SHADER)
+ shader_flags |= SDR_FLAG_ANIMATED;
+
  if (textured) {
  if ( !Basemap_override ) {
  shader_flags |= SDR_FLAG_DIFFUSE_MAP;
@@ -616,6 +619,9 @@
  ibuffer = (GLubyte*)vbp->index_list;
  }
 
+ if(flags & TMAP_ANIMATED_SHADER)
+ vglUniform1fARB( opengl_shader_get_uniform("anim_timer"), anim_timer );
+
  int n_lights = MIN(Num_active_gl_lights, GL_max_lights) - 1;
  vglUniform1iARB( opengl_shader_get_uniform("n_lights"), n_lights );
 
@@ -1067,7 +1073,7 @@
 }
 
 // start is the first part of the buffer to render, n_prim is the number of primitives, index_list is an index buffer, if index_list == NULL render non-indexed
-void gr_opengl_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags)
+void gr_opengl_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags, float anim_timer)
 {
  Assert( GL_htl_projection_matrix_set );
  Assert( GL_htl_view_matrix_set );
@@ -1085,7 +1091,7 @@
  const buffer_data *datap = &bufferp->tex_buf[texi];
 
  if ( (Use_GLSL > 1) && !GLSL_override ) {
- opengl_render_pipeline_program(start, bufferp, datap, flags);
+ opengl_render_pipeline_program(start, bufferp, datap, flags, anim_timer);
  } else {
  opengl_render_pipeline_fixed(start, bufferp, datap, flags);
  }
Index: code/graphics/gropenglshader.cpp
===================================================================
--- code/graphics/gropenglshader.cpp (Revision 7380)
+++ code/graphics/gropenglshader.cpp (Arbeitskopie)
@@ -47,6 +47,7 @@
 static opengl_shader_file_t GL_shader_file[] = {
  { "null-v.sdr", "null-f.sdr", (0), 0, { NULL }, },
 
+ // with diffuse Textures
  { "l-v.sdr", "lb-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP),
  2, { "sBasemap", "n_lights" } },
 
@@ -83,30 +84,12 @@
  { "ln-v.sdr", "lbsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
  4, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights" } },
 
- { "ln-v.sdr", "lbgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 5, { "sBasemap", "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
-
- { "ln-v.sdr", "lbgsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
-
- { "ln-v.sdr", "lbnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 4, { "sBasemap", "sNormalmap", "sHeightmap", "n_lights" } },
-
- { "ln-v.sdr", "lbsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 5, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
-
  { "lne-v.sdr", "lbgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
  8, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
 
  { "lne-v.sdr", "lbsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
  7, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
 
- { "lne-v.sdr", "lbgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
- 9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
-
- { "lne-v.sdr", "lbsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
- 8, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
-
  { "lf-v.sdr", "lfb-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP),
  2, { "sBasemap", "n_lights" } },
 
@@ -137,30 +120,13 @@
  { "lfn-v.sdr", "lfbsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
  4, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights" } },
 
- { "lfn-v.sdr", "lfbgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 5, { "sBasemap", "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
-
- { "lfn-v.sdr", "lfbgsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
-
- { "lfn-v.sdr", "lfbnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 4, { "sBasemap", "sNormalmap", "sHeightmap", "n_lights" } },
-
- { "lfn-v.sdr", "lfbsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 5, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
-
  { "lfne-v.sdr", "lfbgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
  8, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
 
  { "lfne-v.sdr", "lfbsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
  7, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
 
- { "lfne-v.sdr", "lfbgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
- 9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
-
- { "lfne-v.sdr", "lfbsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
- 8, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
-
+ // no diffuse Textures
  { "l-v.sdr", "null-f.sdr", (SDR_FLAG_LIGHT),
  1, { "n_lights" } },
 
@@ -191,6 +157,134 @@
  { "ln-v.sdr", "lsn-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP),
  3, { "sSpecmap", "sNormalmap", "n_lights" } },
 
+ { "lne-v.sdr", "lgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
+ 7, { "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
+ { "lne-v.sdr", "lsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
+ 6, { "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
+ // Animated Shaders
+ { "la-v.sdr", "lba-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 3, { "sBasemap", "n_lights", "anim_timer" } },
+
+ { "ba-v.sdr", "ba-f.sdr", (SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 2, { "sBasemap", "anim_timer" } },
+
+ { "ba-v.sdr", "bga-f.sdr", (SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 3, { "sBasemap", "sGlowmap", "anim_timer" } },
+
+ { "la-v.sdr", "lbga-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "sGlowmap", "n_lights", "anim_timer" } },
+
+ { "la-v.sdr", "lbgsa-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sGlowmap", "sSpecmap", "n_lights", "anim_timer" } },
+
+ { "la-v.sdr", "lbsa-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "sSpecmap", "n_lights", "anim_timer" } },
+
+ { "lea-v.sdr", "lbgsea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 8, { "sBasemap", "sGlowmap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } },
+
+ { "lea-v.sdr", "lbsea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 7, { "sBasemap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } },
+
+ { "lna-v.sdr", "lbgna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sGlowmap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lna-v.sdr", "lbgsna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lna-v.sdr", "lbna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lna-v.sdr", "lbsna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lnea-v.sdr", "lbgsnea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } },
+
+ { "lnea-v.sdr", "lbsnea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 8, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } },
+
+ { "lfa-v.sdr", "lfba-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_ANIMATED | SDR_FLAG_ANIMATED),
+ 3, { "sBasemap", "n_lights", "anim_timer" } },
+
+ { "lfa-v.sdr", "lfbga-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "sGlowmap", "n_lights", "anim_timer" } },
+
+ { "lfa-v.sdr", "lfbgsa-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sGlowmap", "sSpecmap", "n_lights", "anim_timer" } },
+
+ { "lfa-v.sdr", "lfbsa-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "sSpecmap", "n_lights", "anim_timer" } },
+
+ { "lfea-v.sdr", "lfbgsea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED),
+ 8, { "sBasemap", "sGlowmap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } },
+
+ { "lfea-v.sdr", "lfbsea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED),
+ 7, { "sBasemap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } },
+
+ { "lfna-v.sdr", "lfbgna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sGlowmap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lfna-v.sdr", "lfbgsna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lfna-v.sdr", "lfbna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lfna-v.sdr", "lfbsna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer" } },
+
+ { "lfnea-v.sdr", "lfbgsnea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED),
+ 9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } },
+
+ { "lfnea-v.sdr", "lfbsnea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED),
+ 8, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer" } }
+
+ /* No Heightmapping for now - Valathil
+ { "lne-v.sdr", "lgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
+ 8, { "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
+ { "lne-v.sdr", "lsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
+ 7, { "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
+ { "ln-v.sdr", "lbgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 5, { "sBasemap", "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "ln-v.sdr", "lbgsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "ln-v.sdr", "lbnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 4, { "sBasemap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "ln-v.sdr", "lbsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 5, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "lne-v.sdr", "lbgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
+ 9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
+ { "lne-v.sdr", "lbsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
+ 8, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
+ { "lfn-v.sdr", "lfbgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 5, { "sBasemap", "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "lfn-v.sdr", "lfbgsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 6, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "lfn-v.sdr", "lfbnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 4, { "sBasemap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "lfn-v.sdr", "lfbsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
+ 5, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
+
+ { "lfne-v.sdr", "lfbgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
+ 9, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
+ { "lfne-v.sdr", "lfbsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
+ 8, { "sBasemap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
+
  { "ln-v.sdr", "lgnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
  4, { "sGlowmap", "sNormalmap", "sHeightmap", "n_lights" } },
 
@@ -201,19 +295,7 @@
  3, { "sNormalmap", "sHeightmap", "n_lights" } },
 
  { "ln-v.sdr", "lsnh-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP),
- 4, { "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } },
-
- { "lne-v.sdr", "lgsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
- 7, { "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
-
- { "lne-v.sdr", "lsne-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ENV_MAP),
- 6, { "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
-
- { "lne-v.sdr", "lgsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
- 8, { "sGlowmap", "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } },
-
- { "lne-v.sdr", "lsnhe-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_HEIGHT_MAP | SDR_FLAG_ENV_MAP),
- 7, { "sSpecmap", "sNormalmap", "sHeightmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights" } }
+ 4, { "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" } }*/
 };
 
 static const int Num_shader_files = sizeof(GL_shader_file) / sizeof(opengl_shader_file_t);
@@ -344,6 +426,10 @@
  if (flags & SDR_FLAG_SPEC_MAP) {
  sflags += "#define FLAG_SPEC_MAP\n";
  }
+
+ if (flags & SDR_FLAG_ANIMATED) {
+ sflags += "#define FLAG_ANIMATED\n";
+ }
  }
 
 
Index: code/graphics/grstub.cpp
===================================================================
--- code/graphics/grstub.cpp (Revision 7380)
+++ code/graphics/grstub.cpp (Arbeitskopie)
@@ -235,7 +235,7 @@
 {
 }
 
-void gr_stub_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags)
+void gr_stub_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags, float anim_timer)
 {
 }
 
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (Revision 7380)
+++ code/graphics/2d.h (Arbeitskopie)
@@ -444,7 +444,7 @@
  bool (*gf_config_buffer)(const int buffer_id, vertex_buffer *vb);
  void (*gf_destroy_buffer)(int);
  void (*gf_set_buffer)(int);
- void (*gf_render_buffer)(int, const vertex_buffer*, int, int);
+ void (*gf_render_buffer)(int, const vertex_buffer*, int, int, float);
 
  int (*gf_make_flat_buffer)(poly_list*);
  int (*gf_make_line_buffer)(line_list*);
@@ -741,9 +741,9 @@
 #define gr_pack_buffer GR_CALL(*gr_screen.gf_pack_buffer)
 #define gr_config_buffer GR_CALL(*gr_screen.gf_config_buffer)
 #define gr_destroy_buffer GR_CALL(*gr_screen.gf_destroy_buffer)
-__inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags = TMAP_FLAG_TEXTURED)
+__inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags = TMAP_FLAG_TEXTURED, float anim_timer = 0.0f)
 {
- (*gr_screen.gf_render_buffer)(start, bufferp, texi, flags);
+ (*gr_screen.gf_render_buffer)(start, bufferp, texi, flags, anim_timer);
 }
 
 #define gr_set_buffer GR_CALL(*gr_screen.gf_set_buffer)     
Index: code/model/modelinterp.cpp
===================================================================
--- code/model/modelinterp.cpp (Revision 7380)
+++ code/model/modelinterp.cpp (Arbeitskopie)
@@ -170,13 +170,13 @@
 
 // forward references
 int model_interp_sub(void *model_ptr, polymodel * pm, bsp_info *sm, int do_box_check);
-void model_really_render(int model_num, matrix *orient, vec3d * pos, uint flags, int objnum = -1);
+void model_really_render(int model_num, matrix *orient, vec3d * pos, uint flags, int objnum = -1, float anim_timer = 0.0f);
 void model_interp_sortnorm_b2f(ubyte * p,polymodel * pm, bsp_info *sm, int do_box_check);
 void model_interp_sortnorm_f2b(ubyte * p,polymodel * pm, bsp_info *sm, int do_box_check);
 void (*model_interp_sortnorm)(ubyte * p,polymodel * pm, bsp_info *sm, int do_box_check) = model_interp_sortnorm_b2f;
 int model_should_render_engine_glow(int objnum, int bank_obj);
-void model_render_buffers(polymodel *pm, int mn, bool is_child = false);
-void model_render_children_buffers(polymodel * pm, int mn, int detail_level);
+void model_render_buffers(polymodel *pm, int mn, bool is_child = false, float anim_timer = 0.0f);
+void model_render_children_buffers(polymodel * pm, int mn, int detail_level, float anim_timer = 0.0f);
 int model_interp_get_texture(texture_info *tinfo, fix base_frametime);
 
 
@@ -2304,7 +2304,7 @@
 }
 */
 
-void model_render(int model_num, matrix *orient, vec3d * pos, uint flags, int objnum, int lighting_skip, int *replacement_textures)
+void model_render(int model_num, matrix *orient, vec3d * pos, uint flags, int objnum, int lighting_skip, int *replacement_textures, float anim_timer)
 {
  int cull = 0;
  // replacement textures - Goober5000
@@ -2405,7 +2405,7 @@
  num_lights = light_filter_push( objnum, pos, pm->rad );
  }
 
- model_really_render(model_num, orient, pos, flags, objnum);
+ model_really_render(model_num, orient, pos, flags, objnum,anim_timer);
 
  if ( !(flags & MR_NO_LIGHTING ) ) {
  light_filter_pop();
@@ -2996,7 +2996,7 @@
 
 extern int Warp_model;
 
-void model_really_render(int model_num, matrix *orient, vec3d * pos, uint flags, int objnum )
+void model_really_render(int model_num, matrix *orient, vec3d * pos, uint flags, int objnum, float anim_timer)
 {
  int i;
  int cull = 1;
@@ -3072,6 +3072,9 @@
  }
  }
 
+ if ( Interp_flags & MR_ANIMATED_SHADER )
+ Interp_tmap_flags |= TMAP_ANIMATED_SHADER;
+
  save_gr_zbuffering_mode = gr_zbuffering_mode;
  zbuf_mode = gr_zbuffering_mode;
 
@@ -3310,7 +3313,7 @@
  if ( !pm->submodel[i].is_thruster ) {
  // When in htl mode render with htl method unless its a jump node
  if (is_outlines_only_htl || (!Cmdline_nohtl && !is_outlines_only)) {
- model_render_children_buffers( pm, i, Interp_detail_level );
+ model_render_children_buffers( pm, i, Interp_detail_level, anim_timer );
  } else {
  model_interp_subcall( pm, i, Interp_detail_level );
  }
@@ -3329,7 +3332,7 @@
 
  // When in htl mode render with htl method unless its a jump node
  if (is_outlines_only_htl || (!Cmdline_nohtl && !is_outlines_only)) {
- model_render_buffers(pm, pm->detail[Interp_detail_level]);
+ model_render_buffers(pm, pm->detail[Interp_detail_level], false, anim_timer);
  } else {
  model_interp_subcall(pm, pm->detail[Interp_detail_level], Interp_detail_level);
  }
@@ -3342,7 +3345,7 @@
  if (pm->submodel[i].is_thruster) {
  // When in htl mode render with htl method unless its a jump node
  if (is_outlines_only_htl || (!Cmdline_nohtl && !is_outlines_only)) {
- model_render_children_buffers( pm, i, Interp_detail_level );
+ model_render_children_buffers( pm, i, Interp_detail_level, anim_timer );
  } else {
  model_interp_subcall( pm, i, Interp_detail_level );
  }
@@ -4685,7 +4688,7 @@
 }
 
 
-void model_render_children_buffers(polymodel *pm, int mn, int detail_level)
+void model_render_children_buffers(polymodel *pm, int mn, int detail_level, float anim_timer)
 {
  int i;
 
@@ -4754,7 +4757,7 @@
 
  g3_start_instance_matrix(&model->offset, &submodel_matrix, true);
 
- model_render_buffers(pm, mn, true);
+ model_render_buffers(pm, mn, true, anim_timer);
 
  if (Interp_flags & MR_SHOW_PIVOTS)
  model_draw_debug_points( pm, &pm->submodel[mn] );
@@ -4767,7 +4770,7 @@
 
  while (i >= 0) {
  if ( !pm->submodel[i].is_thruster ) {
- model_render_children_buffers( pm, i, detail_level );
+ model_render_children_buffers( pm, i, detail_level, anim_timer );
  }
 
  i = pm->submodel[i].next_sibling;
@@ -4786,7 +4789,7 @@
  g3_done_instance(true);
 }
 
-void model_render_buffers(polymodel *pm, int mn, bool is_child)
+void model_render_buffers(polymodel *pm, int mn, bool is_child, float anim_timer)
 {
  if (pm->vertex_buffer_id < 0)
  return;
@@ -4945,7 +4948,7 @@
 
  gr_set_bitmap(texture, blend_filter, GR_BITBLT_MODE_NORMAL, alpha);
 
- gr_render_buffer(0, &model->buffer, i, Interp_tmap_flags);
+ gr_render_buffer(0, &model->buffer, i, Interp_tmap_flags, anim_timer);
 
  GLOWMAP = -1;
  SPECMAP = -1;
Index: code/model/model.h
===================================================================
--- code/model/model.h (Revision 7380)
+++ code/model/model.h (Arbeitskopie)
@@ -778,6 +778,7 @@
 #define MR_NO_GLOWMAPS (1<<27) // disable rendering of glowmaps - taylor
 #define MR_FULL_DETAIL (1<<28) // render all valid objects, particularly ones that are otherwise in/out of render boxes - taylor
 #define MR_FORCE_CLAMP (1<<29) // force clamp - Hery
+#define MR_ANIMATED_SHADER (1<<30) // Use a animated Shader - Valathil
 
 // old/obsolete flags
 //#define MR_SHOW_DAMAGE (1<<4) // Show the "destroyed" subobjects
@@ -785,7 +786,7 @@
 
 // Renders a model and all it's submodels.
 // See MR_? defines for values for flags
-void model_render(int model_num, matrix *orient, vec3d * pos, uint flags = MR_NORMAL, int objnum = -1, int lighting_skip = -1, int *replacement_textures = NULL);
+void model_render(int model_num, matrix *orient, vec3d * pos, uint flags = MR_NORMAL, int objnum = -1, int lighting_skip = -1, int *replacement_textures = NULL, float anim_timer = 0.0f);
 
 // Renders just one particular submodel on a model.
 // See MR_? defines for values for flags
Index: code/globalincs/def_files.cpp
===================================================================
--- code/globalincs/def_files.cpp (Revision 7380)
+++ code/globalincs/def_files.cpp (Arbeitskopie)
@@ -1253,6 +1253,10 @@
 varying float fogDist; \n\
 #endif \n\
  \n\
+#ifdef FLAG_ANIMATED \n\
+uniform float anim_timer; \n\
+#endif \n\
+ \n\
 varying vec4 position; \n\
 varying vec3 lNormal; \n\
  \n\
@@ -1407,7 +1411,13 @@
  fragmentColor.rgb = mix(fragmentColor.rgb, gl_Fog.color.rgb, fogDist); \n\
  #endif \n\
  \n\
+ #ifdef FLAG_ANIMATED \n\
+ float shinefactor = 1.0/(1.0 + pow((gl_TexCoord[0].x-anim_timer) * 2000.0, 2.0)) * 2000.0;\n\
+ gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor); \n\
+ gl_FragColor.a = fragmentColor.a * shinefactor * (gl_TexCoord[0].x-anim_timer) * -10000.0;\n\
+ #else \n\
  gl_FragColor = fragmentColor; \n\
+ #endif \n\
 } \n\
 ";
 

Code: [Select]
#ifdef FLAG_LIGHT
uniform int n_lights;
#endif

#ifdef FLAG_DIFFUSE_MAP
uniform sampler2D sBasemap;
#endif

#ifdef FLAG_GLOW_MAP
uniform sampler2D sGlowmap;
#endif

#ifdef FLAG_SPEC_MAP
uniform sampler2D sSpecmap;
#endif

#ifdef FLAG_ENV_MAP
uniform samplerCube sEnvmap;
uniform bool alpha_spec;
varying vec3 envReflect;
#endif

#ifdef FLAG_NORMAL_MAP
uniform sampler2D sNormalmap;
varying mat3 tbnMatrix;
#endif

#ifdef FLAG_FOG
varying float fogDist;
#endif

#ifdef FLAG_ANIMATED
uniform float anim_timer;
#endif

varying vec4 position;
varying vec3 lNormal;

#if SHADER_MODEL == 2
  #define MAX_LIGHTS 2
#else
  #define MAX_LIGHTS 8
#endif

#define SPEC_INTENSITY_POINT 5.3 // Point light
#define SPEC_INTENSITY_DIRECTIONAL 3.0 // Directional light
#define SPECULAR_FACTOR 1.75
#define SPECULAR_ALPHA 0.1
#define SPEC_FACTOR_NO_SPEC_MAP 0.6
#define ENV_ALPHA_FACTOR 0.3
#define GLOW_MAP_INTENSITY 1.5
#define AMBIENT_LIGHT_BOOST 1.0

void main()
{
vec3 eyeDir = vec3(normalize(-position).xyz); // Camera is at (0,0,0) in ModelView space
vec4 lightAmbientDiffuse = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightDiffuse = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightAmbient = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightSpecular = vec4(0.0, 0.0, 0.0, 1.0);
vec2 texCoord = gl_TexCoord[0].xy;

 #ifdef FLAG_LIGHT
  #ifdef FLAG_NORMAL_MAP
// Normal map - convert from DXT5nm
vec3 normal;

normal.rg = (texture2D(sNormalmap, texCoord).ag * 2.0) - 1.0;
  #ifdef FLAG_ENV_MAP
vec3 envOffset = vec3(0.0);
envOffset.xy = normal.xy;
  #endif
normal.b = sqrt(1.0 - dot(normal.rg, normal.rg));
normal = tbnMatrix * normal;
float norm = length(normal);
if( length(normal) > 0.0)  // fix broken normal maps
normal /= norm ;
else
normal = tbnMatrix * vec3(0.0, 0.0, 1.0);
  #else
vec3 normal = lNormal;
  #endif

vec3 lightDir;
lightAmbient = gl_FrontMaterial.emission + (gl_LightModel.ambient * gl_FrontMaterial.ambient);
float dist;
#pragma optionNV unroll all
for (int i = 0; i < MAX_LIGHTS; ++i) {
  #if SHADER_MODEL > 2
if (i > n_lights)
break;
  #endif
float specularIntensity = 1.0;
float attenuation = 1.0;

// Attenuation and light direction
  #if SHADER_MODEL > 2
if (gl_LightSource[i].position.w == 1.0) {
  #else
if (gl_LightSource[i].position.w == 1.0 && i != 0) {
  #endif
// Positional light source
float dist = distance(gl_LightSource[i].position.xyz, position.xyz);

lightDir = (gl_LightSource[i].position.xyz - position.xyz);

  #if SHADER_MODEL > 2
if (gl_LightSource[i].spotCutoff < 91.0) {  // Tube light
float beamlength = length(gl_LightSource[i].spotDirection);
vec3 beamDir = normalize(gl_LightSource[i].spotDirection);
float neardist = dot(position.xyz - gl_LightSource[i].position.xyz , beamDir); // Get nearest point on line
vec3 nearest = gl_LightSource[i].position.xyz - beamDir * abs(neardist); // Move back from the endpoint of the beam along the beam by the distance we calculated
lightDir = nearest - position.xyz;
dist = length(lightDir);
}
  #endif

lightDir = normalize(lightDir);

attenuation = 1.0 / (gl_LightSource[i].constantAttenuation + (gl_LightSource[i].linearAttenuation * dist) + (gl_LightSource[i].quadraticAttenuation * dist * dist));

specularIntensity = SPEC_INTENSITY_POINT;
} else {
// Directional light source
lightDir = normalize(gl_LightSource[i].position.xyz);
specularIntensity = SPEC_INTENSITY_DIRECTIONAL; // Directional light
}

// Ambient and Diffuse
lightAmbient += (gl_FrontLightProduct[i].ambient * attenuation);
lightDiffuse += (gl_FrontLightProduct[i].diffuse * (max(dot(normal, lightDir), 0.0)) * attenuation);
// Specular
float NdotHV = clamp(dot(normal, normalize(eyeDir + lightDir)), 0.0, 1.0);
lightSpecular += ((gl_FrontLightProduct[i].specular * pow(NdotHV, gl_FrontMaterial.shininess)) * attenuation) * specularIntensity;
}

lightAmbientDiffuse = lightAmbient + lightDiffuse;
 #else
lightAmbientDiffuse = gl_Color;
lightSpecular = gl_SecondaryColor;
 #endif

 #ifdef FLAG_DIFFUSE_MAP
 // Base color
vec4 baseColor = texture2D(sBasemap, texCoord);
 #else
vec4 baseColor = gl_Color;
 #endif
 
vec4 fragmentColor;
fragmentColor.rgb = baseColor.rgb * max(lightAmbientDiffuse.rgb * AMBIENT_LIGHT_BOOST, gl_LightModel.ambient.rgb - 0.425);
fragmentColor.a = baseColor.a;

 #ifdef FLAG_SPEC_MAP
 // Spec color
fragmentColor.rgb += lightSpecular.rgb * (texture2D(sSpecmap, texCoord).rgb * SPECULAR_FACTOR);
fragmentColor.a += (dot(lightSpecular.a, lightSpecular.a) * SPECULAR_ALPHA);
 #else
fragmentColor.rgb += lightSpecular.rgb * (baseColor.rgb * SPEC_FACTOR_NO_SPEC_MAP);
 #endif

 #ifdef FLAG_ENV_MAP
 // Env color
  #ifdef FLAG_NORMAL_MAP
vec3 envReflectNM = envReflect + envOffset;
vec3 envIntensity = (alpha_spec) ? vec3(texture2D(sSpecmap, texCoord).a) : texture2D(sSpecmap, texCoord).rgb;
fragmentColor.a += (dot(textureCube(sEnvmap, envReflectNM).rgb, textureCube(sEnvmap, envReflectNM).rgb) * ENV_ALPHA_FACTOR);
fragmentColor.rgb += textureCube(sEnvmap, envReflectNM).rgb * envIntensity;
  #else
vec3 envIntensity = (alpha_spec) ? vec3(texture2D(sSpecmap, texCoord).a) : texture2D(sSpecmap, texCoord).rgb;
fragmentColor.a += (dot(textureCube(sEnvmap, envReflect).rgb, textureCube(sEnvmap, envReflect).rgb) * ENV_ALPHA_FACTOR);
fragmentColor.rgb += textureCube(sEnvmap, envReflect).rgb * envIntensity;
  #endif
 #endif

 #ifdef FLAG_GLOW_MAP
 // Glow color
fragmentColor.rgb += texture2D(sGlowmap, texCoord).rgb * GLOW_MAP_INTENSITY;
 #endif

 #ifdef FLAG_FOG
fragmentColor.rgb = mix(fragmentColor.rgb, gl_Fog.color.rgb, fogDist);
 #endif

 #ifdef FLAG_ANIMATED
float shinefactor = 1.0/(1.0 + pow((gl_TexCoord[0].x-anim_timer) * 2000.0, 2.0)) * 2000.0;
gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor);
gl_FragColor.a = fragmentColor.a * shinefactor * (gl_TexCoord[0].x-anim_timer) * -10000.0;
 #else
gl_FragColor = fragmentColor;
 #endif
}
« Last Edit: July 24, 2011, 08:00:33 am by Valathil »
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Valathil continues to be awesome  :yes:
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Steam
amazing :yes:
el hombre vicio...

 

Offline Kolgena

  • 211
wow. O_O You did that in like, a day.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
This is how the effect looks on a Solaris: http://www.youtube.com/watch?v=v3ZCeM2b55w
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
This is how the effect looks on a Solaris: http://www.youtube.com/watch?v=v3ZCeM2b55w

which is like the worst ship to show it cause of the flat texture coordinates this things having. better show a raynor or hecate THAT looks AWESOME.

wow. O_O You did that in like, a day.

Why my good friend should it take longer if you know what you are doing?
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
So.. how about an FS2 varient?

 :nervous:
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Apparently, he's working on it.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

  

Offline Kolgena

  • 211
Does this work for weapon models too?

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
So.. how about an FS2 varient?

 :nervous:

In good time, don't be hasty good sir.
In the meantime here's a prototype of what I've been doing, I know its wrong with the up down thing ill fix it tomorrow just something to look at.
http://www.youtube.com/watch?v=V61MQ2nbqkU

Does this work for weapon models too?

Yes
« Last Edit: July 24, 2011, 02:52:26 pm by Valathil »
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
needs moar grid!

but it's a great start. Should have a fancy glow covering the transition.. but I bet you knew that already.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Great for a prototype, this alone would make the briefings increase in awesomeness ten-thousand fold.
You're on quite a roll with this stuff.

 

Offline Kolgena

  • 211
Soon there will legitimately no reason why people shouldn't be using 3D weapon/ship select!

(Also, seriously, you are a tank.)

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Good thing I made all those primary weapon models...
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.