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

0 Members and 1 Guest are viewing this topic.

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Grid looks better alligned now

How does it look for capital ships?
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 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!
How does it look for capital ships?

it wont, this is ship select screen only
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Luis Dias

  • 211
*cough* there's this mission in BP where you select a capital ship *cough cough*

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Take a look at "The Blade Itself" then.
It's a campaign included with BP: WiH, in which you can fly a capship, and it has ship selection screen in which you can see it.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
How does it look for capital ships?

it wont, this is ship select screen only
As already pointed out two posts above me. It's a bit of a bad assumption that this would only be used for retail things.
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 The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Well, I think you're misunderstanding the issue. It's only going to work in ship select, so as long as a ship is displayed there, it makes no difference whether it's a 5 meter fighter or a 5 kilometer Superdestroyer.
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!
tested blade itself, works like a charm.

but something more important. i need some suggestions how mods will control which effect will be used. I want to avoid a cmdline flag cause that is user controlled. Give me some ideas people
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Table is hands down the best option. Perhaps a flag in the ships.tbl?
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
Yeah, that could work pretty well.
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 Dragon

  • Citation needed
  • 212
  • The sky is the limit.
I think that's the best solution.
BTW, would that be possible to make a SEXP which would execute these effects in-game (of course, FS2 style effect would not have the grid)?
They'd make a great way to do combat cloaking.
Also, are different materialization styles possible to implement? Currently, I can think of simple fade in/out being useful for some mods that wouldn't like to use neither FS2 nor FS1 style effect (when controlled in mission by SEXP, an additional argument could be used to set the fade time, which could come in really handy for mission designers).

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Quote
BTW, would that be possible to make a SEXP which would execute these effects in-game (of course, FS2 style effect would not have the grid)?

Yes for the FS1 effect. No for the FS2 effect.

Quote
Also, are different materialization styles possible to implement?

Yes, if you know how to write shaders and OpenGL code.
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
Grid looks much better. Not perfect, but getting there.

 

Offline achtung

  • Friendly Neighborhood Mirror Guy
  • 210
  • ****in' Ace
    • Minecraft
    • Freespacemods.net
This is amazing.
FreeSpaceMods.net | FatHax | ??????
In the wise words of Charles de Gaulle, "China is a big country, inhabited by many Chinese."

Formerly known as Swantz

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Grid looks much better. Not perfect, but getting there.

The cables are too thick.
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!
I think that's the best solution.
BTW, would that be possible to make a SEXP which would execute these effects in-game (of course, FS2 style effect would not have the grid)?
They'd make a great way to do combat cloaking.
Also, are different materialization styles possible to implement? Currently, I can think of simple fade in/out being useful for some mods that wouldn't like to use neither FS2 nor FS1 style effect (when controlled in mission by SEXP, an additional argument could be used to set the fade time, which could come in really handy for mission designers).

SEXP is something i want to do generally yes. Ihave a generic animated shader system up and running where you set a function with a parameter which effect you want and then pass a timer to the model render function. You can add new effects to the main shader and execute them rather easily. Whats still missing is getting some data into the ship structs and a sexp so this can be triggered in mission. But fear not this is on my todolist.
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 
Wow this is looking slick!  Does the effect's timing match up with the accompanying SFX?  I suppose once you have the effect down just right you can worry about the timing later.
Find me as Hojo Norem elsewhere...

butter_pat_head... a name picked in sheer desperation more than 10 years ago from some super obscure Red Dwarf reference.

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Wow this is looking slick!  Does the effect's timing match up with the accompanying SFX?  I suppose once you have the effect down just right you can worry about the timing later.
the sfx is so much easier to match to the effects timing that its not even funny to ask XD
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

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 its cleaned up and ready to go, FS2 effect is default but you can insert $Selection Effect: FS1    or     $Selection Effect: off into ships and weapons in ships.tbl and weapons.tbl respectively to select the fs1 effect or turn off the effect and get the old spinning display. This is PER ship/weapon not a global flag. (Have fun FSPort  :pimp:)

Code: [Select]
Index: code/missionui/missionscreencommon.h
===================================================================
--- code/missionui/missionscreencommon.h (Revision 7381)
+++ 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, int effect = 2);
 
 void common_set_team_pointers(int team);
 void common_reset_team_pointers();
Index: code/missionui/missionweaponchoice.cpp
===================================================================
--- code/missionui/missionweaponchoice.cpp (Revision 7381)
+++ 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
 
+extern int anim_timer_start;
 
 // 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;
@@ -2782,16 +2787,19 @@
  if(Wl_icons[Selected_wl_class].model_index != -1) {
  static float WeapSelectScreenWeapRot = 0.0f;
  wl_icon_info *sel_icon = &Wl_icons[Selected_wl_class];
+ weapon_info *wip = &Weapon_info[Selected_wl_class];
  draw_model_rotating(sel_icon->model_index,
  weapon_ani_coords[0],
  weapon_ani_coords[1],
  gr_screen.res == 0 ? 202 : 332,
- gr_screen.res == 0 ? 185 : 304,
+ gr_screen.res == 0 ? 185 : 260,
  &WeapSelectScreenWeapRot,
  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,
+ true,
+ wip->selection_effect);
  }
 
  else if ( Weapon_anim_class != -1 && ( Selected_wl_class == Weapon_anim_class )) {
Index: code/missionui/missionshipchoice.cpp
===================================================================
--- code/missionui/missionshipchoice.cpp (Revision 7381)
+++ 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
 //////////////////////////////////////////////////////
@@ -72,6 +72,7 @@
 float ShipSelectScreenShipRot = 0.0f;
 int ShipSelectModelNum = -1;
 
+int anim_timer_start = 0;
 //static matrix ShipScreenOrient = IDENTITY_MATRIX;
 
 //////////////////////////////////////////////////////
@@ -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,
+ true,
+ sip->selection_effect);
  }
  }
 
@@ -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 7381)
+++ code/missionui/missionscreencommon.cpp (Arbeitskopie)
@@ -42,8 +42,9 @@
 #include "cutscene/movie.h"
 #include "cutscene/cutscenes.h"
 #include "parse/sexp.h"
+#include "graphics/2d.h"
+#include "graphics/gropenglshader.h"
 
-
 //////////////////////////////////////////////////////////////////
 // Game Globals
 //////////////////////////////////////////////////////////////////
@@ -96,6 +97,7 @@
 extern void ss_reset_team_pointers();
 extern void wl_set_team_pointers(int team);
 extern void wl_reset_team_pointers();
+extern int anim_timer_start;
 
 //////////////////////////////////////////////////////////////////
 // UI
@@ -1542,71 +1544,263 @@
  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, int effect)
 {
  //WMC - Can't draw a non-model
  if(model_id < 0)
  return;
-
+
+ float time = (timer_get_milliseconds()-anim_timer_start)/1000.0f;
  angles rot_angles, view_angles;
  matrix model_orient;
+
+ if(effect == 2)  // FS2 Effect; Phase 0 Expand scanline, Phase 1 scan the grid and wireframe, Phase 2 scan up and reveal the ship, Phase 3 tilt the camera, Phase 4 start rotating the ship
+ {
+
+ // rotate the ship as much as required for this frame
+ if(time >= 4.0f) // Phase 4
+ *rotation_buffer += PI2 * flFrametime / rev_rate;
+ else
+ *rotation_buffer = PI; // No rotation before Phase 4
+ while (*rotation_buffer > PI2){
+ *rotation_buffer -= PI2;
+ }
 
- // rotate the ship as much as required for this frame
- *rotation_buffer += PI2 * flFrametime / rev_rate;
- while (*rotation_buffer > PI2){
- *rotation_buffer -= PI2;
- }
+ view_angles.p = -PI_2;
+ if(time >= 3.0f) // Phase 3
+ {
+ if(time >= 4.0f) // done tilting
+ {
+ view_angles.p = -0.6f;
+ }
+ else
+ {
+ view_angles.p = (PI_2-0.6f)*(time-3.0f) - PI_2; // Phase 3 Tilt animation
+ }
+ }
 
- view_angles.p = -0.6f;
- view_angles.b = 0.0f;
- view_angles.h = 0.0f;
- vm_angles_2_matrix(&model_orient, &view_angles);
+ view_angles.b = 0.0f;
+ view_angles.h = 0.0f;
+ vm_angles_2_matrix(&model_orient, &view_angles);
 
- rot_angles.p = 0.0f;
- rot_angles.b = 0.0f;
- rot_angles.h = *rotation_buffer;
- vm_rotate_matrix_by_angles(&model_orient, &rot_angles);
+ rot_angles.p = 0.0f;
+ rot_angles.b = 0.0f;
+ rot_angles.h = *rotation_buffer;
+ vm_rotate_matrix_by_angles(&model_orient, &rot_angles);
 
- gr_set_clip(x1, y1, x2, y2, resize);
+ gr_set_clip(x1, y1, x2, y2, resize);
+ vec3d wire_normal,ship_normal,plane_point;
+ // Clip the wireframe below the scanline
+ wire_normal.xyz.x = 0.0f;
+ wire_normal.xyz.y = 1.0f;
+ wire_normal.xyz.z = 0.0f;
+
+ // Clip the ship above the scanline
+ ship_normal.xyz.x = 0.0f;
+ ship_normal.xyz.y = -1.0f;
+ ship_normal.xyz.z = 0.0f;
 
- // render the ship
- g3_start_frame(1);
- if(closeup_pos != NULL)
- {
- g3_set_view_matrix(closeup_pos, &vmd_identity_matrix, closeup_zoom);
+ polymodel *pm = model_get(model_id);
+
+ //Make the clipping plane
+ float clip = -pm->rad*0.7f;
+ if(time < 1.5f && time >= 0.5f) // Phase 1 Move down
+ clip = pm->rad*(time-1.0f)*1.4f;
+ if(time >= 1.5f)
+ clip = pm->rad*(time-2.0f)*(-1.4f); // Phase 2 Move up
+ vm_vec_scale_sub(&plane_point,&vmd_zero_vector,&wire_normal,clip);
+
+ g3_start_frame(1);
+ if(closeup_pos != NULL)
+ {
+ g3_set_view_matrix(closeup_pos, &vmd_identity_matrix, closeup_zoom);
+ }
+ else
+ {
+ vec3d pos = { { { 0.0f, 0.0f, -(pm->rad * 1.5f) } } };
+ g3_set_view_matrix(&pos, &vmd_identity_matrix, closeup_zoom);
+ }
+
+ if (!Cmdline_nohtl) {
+ gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
+ gr_set_view_matrix(&Eye_position, &Eye_matrix);
+ }
+
+ vec3d start, stop;
+ float size = pm->rad*0.7f;
+ float start_scale = MIN(time,0.5f)*2.5f;
+ float offset = size*0.5f*MIN(MAX(time-3.0f,0.0f),1.0f);
+ if(time < 1.5f && time >= 0.5f)  // Clip the grid if were in phase 1
+ g3_start_user_clip_plane(&plane_point,&wire_normal);
+
+ g3_start_instance_angles(&vmd_zero_vector,&view_angles);
+ if( time < 0.5f ) // Do the expanding scanline in phase 0
+ {
+ gr_set_color(0,255,0);
+ start.xyz.x = size*start_scale;
+ start.xyz.y = 0.0f;
+ start.xyz.z = -clip;
+ stop.xyz.x = -size*start_scale;
+ stop.xyz.y = 0.0f;
+ stop.xyz.z = -clip;
+ g3_draw_htl_line(&start,&stop);
+ }
+ g3_done_instance(true);
+
+ gr_zbuffer_set(false); // Turn of Depthbuffer so we dont get gridlines over the ship or a disappearing scanline
+ if( time >= 0.5f) // Phase 1 onward draw the grid
+ {
+ start.xyz.y = -offset;
+ start.xyz.z = size+offset*0.5f;
+ stop.xyz.y = -offset;
+ stop.xyz.z = -size+offset*0.5f;
+
+ gr_set_color(0,200,0);
+
+ g3_start_instance_angles(&vmd_zero_vector,&view_angles);
+ for(int i = -3; i < 4; i++)
+ {
+ start.xyz.x = stop.xyz.x = size*0.333f*i;
+ g3_draw_htl_line(&start,&stop);
+ }
+
+ start.xyz.x = size;
+ stop.xyz.x = -size;
+ for(int i = -3; i < 4; i++)
+ {
+ start.xyz.z = stop.xyz.z = size*0.333f*i+offset*0.5f;
+ g3_draw_htl_line(&start,&stop);
+ }
+
+ g3_done_instance(true);
+
+
+ // lighting for techroom
+ light_reset();
+ vec3d light_dir = vmd_zero_vector;
+ light_dir.xyz.y = 1.0f;
+ light_add_directional(&light_dir, 0.65f, 1.0f, 1.0f, 1.0f);
+ light_rotate_all();
+ // lighting for techroom
+
+ // render the ships
+ model_clear_instance(model_id);
+ model_set_detail_level(0);
+ gr_set_color(80,49,160);
+ opengl_shader_set_animated_effect(ANIMATED_SHADER_LOADOUTSELECT_FS2);
+ opengl_shader_set_animated_timer(-clip);
+ if(time < 2.5f && time >= 0.5f) // Phase 1 and 2 render the wireframe
+ {
+ if(time >= 1.5f) // Just clip the wireframe after Phase 1
+ g3_start_user_clip_plane(&plane_point,&wire_normal);
+
+ model_render(model_id, &model_orient, &vmd_zero_vector, flags | MR_SHOW_OUTLINE_HTL | MR_NO_POLYS | MR_ANIMATED_SHADER);
+ g3_stop_user_clip_plane();
+ }
+ if(time >= 1.5f) // Render the ship in Phase 2 onwards
+ {
+
+ g3_start_user_clip_plane(&plane_point,&ship_normal);
+ model_render(model_id, &model_orient, &vmd_zero_vector, flags | MR_ANIMATED_SHADER);
+ g3_stop_user_clip_plane();
+ }
+
+ if( time < 2.5f ) // Render the scanline in Phase 1 and 2
+ {
+ gr_set_color(0,255,0);
+ start.xyz.x = size*1.25f;
+ start.xyz.y = 0.0f;
+ start.xyz.z = -clip;
+ stop.xyz.x = -size*1.25f;
+ stop.xyz.y = 0.0f;
+ stop.xyz.z = -clip;
+ g3_start_instance_angles(&vmd_zero_vector,&view_angles);
+ g3_draw_htl_line(&start,&stop);
+ g3_done_instance(true);
+ }
+
+ }
+ gr_zbuffer_set(true); // Turn of depthbuffer again
+ if (!Cmdline_nohtl)
+ {
+ gr_end_view_matrix();
+ gr_end_proj_matrix();
+ }
+
+ g3_end_frame();
+ gr_reset_clip();
  }
  else
  {
- polymodel *pm = model_get(model_id);
- vec3d pos = { { { 0.0f, 0.0f, -(pm->rad * 1.5f) } } };
- g3_set_view_matrix(&pos, &vmd_identity_matrix, closeup_zoom);
- }
+ // rotate the ship as much as required for this frame
+ *rotation_buffer += PI2 * flFrametime / rev_rate;
+ while (*rotation_buffer > PI2){
+ *rotation_buffer -= PI2;
+ }
 
- if (!Cmdline_nohtl) {
- gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
- gr_set_view_matrix(&Eye_position, &Eye_matrix);
- }
+ view_angles.p = -0.6f;
+ view_angles.b = 0.0f;
+ view_angles.h = 0.0f;
+ vm_angles_2_matrix(&model_orient, &view_angles);
 
- // lighting for techroom
- light_reset();
- vec3d light_dir = vmd_zero_vector;
- light_dir.xyz.y = 1.0f;
- light_add_directional(&light_dir, 0.65f, 1.0f, 1.0f, 1.0f);
- light_rotate_all();
- // lighting for techroom
+ rot_angles.p = 0.0f;
+ rot_angles.b = 0.0f;
+ rot_angles.h = *rotation_buffer;
+ vm_rotate_matrix_by_angles(&model_orient, &rot_angles);
+
+ gr_set_clip(x1, y1, x2, y2, resize);
+ vec3d normal;
+ normal.xyz.x = 0.0f;
+ normal.xyz.y = 1.0f;
+ normal.xyz.z = 0.0f;
+ g3_start_frame(1);
+ // render the ship
+
+ if(closeup_pos != NULL)
+ {
+ g3_set_view_matrix(closeup_pos, &vmd_identity_matrix, closeup_zoom);
+ }
+ else
+ {
+ polymodel *pm = model_get(model_id);
+ vec3d pos = { { { 0.0f, 0.0f, -(pm->rad * 1.5f) } } };
+ g3_set_view_matrix(&pos, &vmd_identity_matrix, closeup_zoom);
+ }
 
- model_clear_instance(model_id);
- model_set_detail_level(0);
- model_render(model_id, &model_orient, &vmd_zero_vector, flags);
+ if (!Cmdline_nohtl) {
+ gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
+ gr_set_view_matrix(&Eye_position, &Eye_matrix);
+ }
 
- if (!Cmdline_nohtl)
- {
- gr_end_view_matrix();
- gr_end_proj_matrix();
+ // lighting for techroom
+ light_reset();
+ vec3d light_dir = vmd_zero_vector;
+ light_dir.xyz.y = 1.0f;
+ light_add_directional(&light_dir, 0.65f, 1.0f, 1.0f, 1.0f);
+ light_rotate_all();
+ // lighting for techroom
+
+ model_clear_instance(model_id);
+ model_set_detail_level(0);
+ gr_set_color(0,128,0);
+ if(effect == 1) // FS1 effect
+ {
+ opengl_shader_set_animated_effect(ANIMATED_SHADER_LOADOUTSELECT_FS1);
+ opengl_shader_set_animated_timer(MIN(time*0.5f,2.0f));
+ model_render(model_id, &model_orient, &vmd_zero_vector, flags | MR_ANIMATED_SHADER);
+ }
+ else
+ model_render(model_id, &model_orient, &vmd_zero_vector, flags);
+
+ if (!Cmdline_nohtl)
+ {
+ gr_end_view_matrix();
+ gr_end_proj_matrix();
+ }
+
+ g3_end_frame();
+ gr_reset_clip();
  }
-
- g3_end_frame();
- gr_reset_clip();
 }
 
 // NEWSTUFF END
Index: code/weapon/weapon.h
===================================================================
--- code/weapon/weapon.h (Revision 7381)
+++ code/weapon/weapon.h (Arbeitskopie)
@@ -378,6 +378,7 @@
 
  char icon_filename[MAX_FILENAME_LEN]; // filename for icon that is displayed in weapon selection
  char anim_filename[MAX_FILENAME_LEN]; // filename for animation that plays in weapon selection
+ int selection_effect;
 
  int impact_weapon_expl_index; // Index into Weapon_expl_info of which ANI should play when this thing impacts something
  float impact_explosion_radius; // How big the explosion should be
Index: code/weapon/weapons.cpp
===================================================================
--- code/weapon/weapons.cpp (Revision 7381)
+++ code/weapon/weapons.cpp (Arbeitskopie)
@@ -2514,6 +2514,16 @@
  if (optional_string("$Thruster Glow Radius Factor:")) {
  stuff_float(&wip->thruster_glow_factor);
  }
+
+ wip->selection_effect = 2;
+ if(optional_string("$Selection Effect:")) {
+ char effect[NAME_LENGTH];
+ stuff_string(effect, F_NAME, NAME_LENGTH);
+ if (!strcmp(effect, "FS1"))
+ wip->selection_effect = 1;
+ if ((!strcmp(effect, "off"))||(!strcmp(effect, "Off"))||(!strcmp(effect, "OFF")))
+ wip->selection_effect = 0;
+ }
 
  //pretty stupid if a target must be tagged to shoot tag missiles at it
  if ((wip->wi_flags & WIF_TAG) && (wip->wi_flags2 & WIF2_TAGGED_ONLY))
Index: code/graphics/gropenglshader.h
===================================================================
--- code/graphics/gropenglshader.h (Revision 7381)
+++ 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 {
@@ -83,4 +83,12 @@
 void opengl_shader_init_uniform(const char *uniform_text);
 GLint opengl_shader_get_uniform(const char *uniform_text);
 
+void opengl_shader_set_animated_effect(int effect);
+int opengl_shader_get_animated_effect();
+void opengl_shader_set_animated_timer(float timer);
+float opengl_shader_get_animated_timer();
+
+#define ANIMATED_SHADER_LOADOUTSELECT_FS1 0
+#define ANIMATED_SHADER_LOADOUTSELECT_FS2 1
+
 #endif // _GROPENGLSHADER_H
Index: code/graphics/tmapper.h
===================================================================
--- code/graphics/tmapper.h (Revision 7381)
+++ 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 7381)
+++ code/graphics/gropengltnl.cpp (Arbeitskopie)
@@ -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,11 @@
  ibuffer = (GLubyte*)vbp->index_list;
  }
 
+ if(flags & TMAP_ANIMATED_SHADER)
+ {
+ vglUniform1fARB( opengl_shader_get_uniform("anim_timer"), opengl_shader_get_animated_timer() );
+ vglUniform1iARB( opengl_shader_get_uniform("effect_num"), opengl_shader_get_animated_effect() );
+ }
  int n_lights = MIN(Num_active_gl_lights, GL_max_lights) - 1;
  vglUniform1iARB( opengl_shader_get_uniform("n_lights"), n_lights );
 
Index: code/graphics/gropenglshader.cpp
===================================================================
--- code/graphics/gropenglshader.cpp (Revision 7381)
+++ code/graphics/gropenglshader.cpp (Arbeitskopie)
@@ -33,6 +33,8 @@
 static char *GLshader_info_log = NULL;
 static const int GLshader_info_log_size = 8192;
 
+static int effect_num = 0;
+static float anim_timer = 0.0f;
 /*
 struct opengl_shader_file_t {
  char *vert;
@@ -47,6 +49,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 +86,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 +122,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 +159,137 @@
  { "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", "la-f.sdr", (SDR_FLAG_ANIMATED),
+ 2, { "anim_timer", "effect_num" } },
+
+ { "la-v.sdr", "lba-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "ba-v.sdr", "ba-f.sdr", (SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_ANIMATED),
+ 3, { "sBasemap", "anim_timer", "effect_num" } },
+
+ { "ba-v.sdr", "bga-f.sdr", (SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "sGlowmap", "anim_timer", "effect_num" } },
+
+ { "la-v.sdr", "lbga-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sGlowmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "la-v.sdr", "lbgsa-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ANIMATED),
+ 6, { "sBasemap", "sGlowmap", "sSpecmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "la-v.sdr", "lbsa-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sSpecmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 9, { "sBasemap", "sGlowmap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lea-v.sdr", "lbsea-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ENV_MAP | SDR_FLAG_ANIMATED),
+ 8, { "sBasemap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lna-v.sdr", "lbgna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP| SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 6, { "sBasemap", "sGlowmap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 7, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lna-v.sdr", "lbna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lna-v.sdr", "lbsna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 6, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 10, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 9, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lfa-v.sdr", "lfba-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_ANIMATED),
+ 4, { "sBasemap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lfa-v.sdr", "lfbga-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_GLOW_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sGlowmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 6, { "sBasemap", "sGlowmap", "sSpecmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lfa-v.sdr", "lfbsa-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_SPEC_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sSpecmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 9, { "sBasemap", "sGlowmap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 8, { "sBasemap", "sSpecmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 6, { "sBasemap", "sGlowmap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 7, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "lfna-v.sdr", "lfbna-f.sdr", (SDR_FLAG_LIGHT | SDR_FLAG_FOG | SDR_FLAG_DIFFUSE_MAP | SDR_FLAG_NORMAL_MAP | SDR_FLAG_ANIMATED),
+ 5, { "sBasemap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 6, { "sBasemap", "sSpecmap", "sNormalmap", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 10, { "sBasemap", "sGlowmap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } },
+
+ { "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),
+ 9, { "sBasemap", "sSpecmap", "sNormalmap", "sEnvmap", "envMatrix", "alpha_spec", "n_lights", "anim_timer", "effect_num" } }
+
+ /* 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 +300,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 +431,10 @@
  if (flags & SDR_FLAG_SPEC_MAP) {
  sflags += "#define FLAG_SPEC_MAP\n";
  }
+
+ if (flags & SDR_FLAG_ANIMATED) {
+ sflags += "#define FLAG_ANIMATED\n";
+ }
  }
 
 
@@ -737,3 +828,24 @@
 
  return -1;
 }
+
+void opengl_shader_set_animated_effect(int effect)
+{
+ Assert(effect > -1);
+ effect_num = effect;
+}
+
+int opengl_shader_get_animated_effect()
+{
+ return effect_num;
+}
+
+void opengl_shader_set_animated_timer(float timer)
+{
+ anim_timer = timer;
+}
+
+float opengl_shader_get_animated_timer()
+{
+ return anim_timer;
+}
\ No newline at end of file
Index: code/lab/lab.cpp
===================================================================
--- code/lab/lab.cpp (Revision 7381)
+++ code/lab/lab.cpp (Arbeitskopie)
@@ -26,6 +26,8 @@
 #include "species_defs/species_defs.h"
 #include "playerman/managepilot.h"
 #include "object/objectsnd.h"
+#include "globalincs/pstypes.h"
+#include "graphics/gropenglshader.h"
 
 // flags
 #define LAB_FLAG_NORMAL (0) // default
@@ -84,6 +86,8 @@
 
 static int Lab_detail_texture_save = 0;
 
+static int anim_timer_start = 0;
+
 // damage lightning stuff
 static vec3d Lab_arc_pts[MAX_SHIP_ARCS][2];
 static int Lab_arc_timestamp[MAX_SHIP_ARCS];
@@ -185,6 +189,8 @@
 {
  bool change_model = true;
 
+ anim_timer_start = timer_get_milliseconds();
+
  if ( (model_fname != NULL) && (Lab_mode == LAB_MODE_SHIP) ) {
  if ( (Lab_selected_index >= 0) && (Lab_selected_index == sel_index) ) {
  change_model = false;
@@ -805,7 +811,8 @@
  }
  }
  }
-
+ opengl_shader_set_animated_effect(ANIMATED_SHADER_LOADOUTSELECT_FS1);
+ opengl_shader_set_animated_timer(MIN((timer_get_milliseconds()-anim_timer_start)/1500.0f,2.0f));
  model_render(Lab_model_num, &Lab_viewer_orient, &vmd_zero_vector, /*Lab_model_flags*/flagggs, -1, -1);
  }
 
@@ -1692,6 +1699,7 @@
  ADD_RENDER_FLAG("Show Radius", Lab_model_flags, MR_SHOW_RADIUS);
  ADD_RENDER_FLAG("Show Shields", Lab_model_flags, MR_SHOW_SHIELDS);
  ADD_RENDER_FLAG("Show Thrusters", Lab_model_flags, MR_SHOW_THRUSTERS);
+ ADD_RENDER_FLAG("Animated Shader", Lab_model_flags, MR_ANIMATED_SHADER);
 
 
  // start tree
Index: code/model/modelinterp.cpp
===================================================================
--- code/model/modelinterp.cpp (Revision 7381)
+++ code/model/modelinterp.cpp (Arbeitskopie)
@@ -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;
 
Index: code/model/model.h
===================================================================
--- code/model/model.h (Revision 7381)
+++ 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
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp (Revision 7381)
+++ code/ship/ship.cpp (Arbeitskopie)
@@ -3059,6 +3059,16 @@
  SCP_string pathName(path_name);
  sip->pathMetadata[pathName] = metadata;
  }
+
+ sip->selection_effect = 2;
+ if(optional_string("$Selection Effect:")) {
+ char effect[NAME_LENGTH];
+ stuff_string(effect, F_NAME, NAME_LENGTH);
+ if (!strcmp(effect, "FS1"))
+ sip->selection_effect = 1;
+ if ((!strcmp(effect, "off"))||(!strcmp(effect, "Off"))||(!strcmp(effect, "OFF")))
+ sip->selection_effect = 0;
+ }
 
  int n_subsystems = 0;
  int cont_flag = 1;
Index: code/ship/ship.h
===================================================================
--- code/ship/ship.h (Revision 7381)
+++ code/ship/ship.h (Arbeitskopie)
@@ -1269,6 +1269,7 @@
  char icon_filename[MAX_FILENAME_LEN]; // filename for icon that is displayed in ship selection
  char anim_filename[MAX_FILENAME_LEN]; // filename for animation that plays in ship selection
  char overhead_filename[MAX_FILENAME_LEN]; // filename for animation that plays weapons loadout
+ int selection_effect;
 
  int score; // default score for this ship
 
Index: code/globalincs/def_files.cpp
===================================================================
--- code/globalincs/def_files.cpp (Revision 7381)
+++ code/globalincs/def_files.cpp (Arbeitskopie)
@@ -1253,6 +1253,11 @@
 varying float fogDist; \n\
 #endif \n\
  \n\
+#ifdef FLAG_ANIMATED \n\
+uniform int effect_num; \n\
+uniform float anim_timer; \n\
+#endif \n\
+ \n\
 varying vec4 position; \n\
 varying vec3 lNormal; \n\
  \n\
@@ -1407,7 +1412,22 @@
  fragmentColor.rgb = mix(fragmentColor.rgb, gl_Fog.color.rgb, fogDist); \n\
  #endif \n\
  \n\
+ #ifdef FLAG_ANIMATED \n\
+ if(effect_num == 0) \n\
+ { \n\
+ float shinefactor = 1.0/(1.0 + pow((fract(abs(gl_TexCoord[0].x))-anim_timer) * 1000.0, 2.0)) * 1000.0;\n\
+ gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor); \n\
+ gl_FragColor.a = fragmentColor.a * shinefactor * (fract(abs(gl_TexCoord[0].x))-anim_timer) * -10000.0;\n\
+ } \n\
+ if(effect_num == 1) \n\
+ { \n\
+ float shinefactor = 1.0/(1.0 + pow((position.y-anim_timer), 2.0)); \n\
+ gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor); \n\
+ gl_FragColor.a = fragmentColor.a; \n\
+ } \n\
+ #else \n\
  gl_FragColor = fragmentColor; \n\
+ #endif \n\
 } \n\
 ";
 

and external main-f.sdr

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 int effect_num;
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
if(effect_num == 0)
{
float shinefactor = 1.0/(1.0 + pow((fract(abs(gl_TexCoord[0].x))-anim_timer) * 1000.0, 2.0)) * 1000.0;
gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor);
gl_FragColor.a = fragmentColor.a * shinefactor * (fract(abs(gl_TexCoord[0].x))-anim_timer) * -10000.0;
}
if(effect_num == 1)
{
float shinefactor = 1.0/(1.0 + pow((position.y-anim_timer), 2.0));
gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor);
gl_FragColor.a = fragmentColor.a;
}
 #else
gl_FragColor = fragmentColor;
 #endif
}
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Luis Dias

  • 211
So if it is default, what happens to FSport? Has to be redesigned?

EDIT: Scratch that, I picked up your comment ;)
« Last Edit: July 26, 2011, 04:04:38 pm by Luis Dias »

 

Offline MatthTheGeek

  • Captain Obvious
  • 212
  • Frenchie McFrenchface
Quote
...FS2 effect is default but you can insert $Selection Effect: FS1...
People are stupid, therefore anything popular is at best suspicious.

Mod management tools     -     Wiki stuff!     -     Help us help you

666maslo666: Releasing a finished product is not a good thing! It is a modern fad.

SpardaSon21: it seems like you exist in a permanent state of half-joking misanthropy

Axem: when you put it like that, i sound like an insane person

bigchunk1: it's not retarded it's american!
bigchunk1: ...

batwota: steele's maneuvering for the coup de gras
MatthTheGeek: you mispelled grâce
Awaesaar: grace
batwota: oh right :P
Darius: ah!
Darius: yes, i like that
MatthTheGeek: the way you just spelled it it means fat
Awaesaar: +accent I forgot how to keyboard
MatthTheGeek: or grease
Darius: the killing fat!
Axem: jabba does the coup de gras
MatthTheGeek: XD
Axem: bring me solo and a cookie