Author Topic: new glow point code  (Read 14399 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
http://freespace.volitionwatch.com/blackwater/newglow.zip
I have perfected type 1 glow points
they look like this

they are cool
this is the code
Code: [Select]

//start rendering glow points -Bobboau

if ( (pm->n_glows) /*&& (Interp_flags & MR_SHOW_THRUSTERS) /*&& (Detail.engine_glows)*/ ) {

for (i = 0; i < pm->n_glows; i++ ) {
glow_bank *bank = &pm->glows[i];
int j;
if(bank->is_on){

for ( j=0; jnum_slots; j++ ) {

int flick;
if(pm->submodel[pm->detail[0]].num_arcs){
flick = static_rand(timestamp()%20)%(pm->submodel[pm->detail[0]].num_arcs + j); //the more damage, the more arcs, the more likely the lights will fail
}else{
flick = 1;
}
 
if(flick == 1){
switch(bank->type){

case 0:
float d;
vector tempv;
if((bank->norm[j].xyz.x == 0.0f) && (bank->norm[j].xyz.z == 0.0f) && (bank->norm[j].xyz.z == 0.0f)){
d=1.0f; //if given a nul vector then always show it
}else{
vm_vec_sub(&tempv,&View_position,&bank->pnt[j]);
vm_vec_normalize(&tempv);

d = vm_vec_dot(&tempv,&bank->norm[j]);
d -= 0.25;
}

if ( d > 0.0f) {
vertex p;

d *= 3.0f;
if ( d > 1.0f ) d = 1.0f;

float w = bank->radius[j];

// fade them in the nebula as well
if(The_mission.flags & MISSION_FLAG_FULLNEB){
d *= (1.0f - Interp_fog_level);
w *= 1.5; //make it bigger in a nebula
}

// disable fogging
gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);

g3_rotate_vertex( &p, &bank->pnt[j] );

//need to rotate the vertex if it's parent is rotated
/*if(shipp->subsys_list.submodel_info_1.movement_axis){

matrix m;

vm_angles_2_matrix(&m, &pm->submodel[submodel_num].angs)

}*/

// if(bank->submodel_parent)
gr_set_bitmap( bank->glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, d );
// mprintf(( "rendering glow with texture %d\n", bank->glow_bitmap ));
extern int Gr_scaler_zbuffering;
Gr_scaler_zbuffering = 1;
g3_draw_bitmap(&p,0,w*0.5f, TMAP_FLAG_TEXTURED );
//g3_draw_rotated_bitmap(&p,0.0f,w,w, TMAP_FLAG_TEXTURED );
Gr_scaler_zbuffering = 0;

}//d>0
break;
case 1:
vertex h1[4]; // halves of a beam section
vertex *verts[4] = { &h1[0], &h1[1], &h1[2], &h1[3] };
vector fvec, top1, bottom1, top2, bottom2, start, end;

// vm_vec_add2();
// vm_vec_sub(&fvec, &bank->norm[j], &bank->pnt[j]);
// vm_vec_normalize(&fvec);

// vm_vec_add2(&fvec, &orient->vec.fvec);

vm_vec_rotate(&start, &bank->pnt[j], orient);
vm_vec_rotate(&end, &bank->norm[j], orient);
vm_vec_sub(&fvec, &end, &start);

vm_vec_normalize(&fvec);

moldel_calc_facing_pts(&top1, &bottom1, &fvec, &bank->pnt[j], 1.0f, 1.0f, &Eye_position);
moldel_calc_facing_pts(&top2, &bottom2, &fvec, &bank->norm[j], 1.0f, 1.0f, &Eye_position);

int idx = 0;
mR_VERTICES(); // rotate and project the vertices
mP_VERTICES();
mSTUFF_VERTICES(); // stuff the beam with creamy goodness (texture coords)


// gr_set_color_fast(&Color_bright_blue);
// gr_printf((0), (20 +(j * 10)), "x %0.2f, y %0.2f, z %0.2f", fvec.xyz.x, fvec.xyz.y, fvec.xyz.z);

gr_set_cull(0);
gr_set_bitmap(bank->glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.9999f);
g3_draw_poly( 4, verts, TMAP_FLAG_TILED | TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT); // added TMAP_FLAG_TILED flag for beam texture tileing -Bobboau
gr_set_cull(1);
}
}//flick
}//for slot
}//bank is on
}//for bank
}//any glow banks

// gr_printf((200), (20), "x %0.2f, y %0.2f, z %0.2f", Eye_position.xyz.x, Eye_position.xyz.y, Eye_position.xyz.z);

//end rendering glow points


that exe also has working blink code, and
particle spew stuff
note the bottom of this entry, it suports animated and non-animated bitmaps, oh, almost forgot, it should also suport animated laser bitmap and glow bitmaps
Code: [Select]


$Name:                                 pspewtest1
+Title:                                XSTR("GTW-83 Lamprey", 3302)
+Description:
XSTR(
"
Tactical Weapon
Medium Energy Usage
Level 3 Shield Damage", 3303)
$end_multi_text
+Tech Title:   XSTR("GTW-83 Lamprey", 3304)
+Tech Anim:   Tech_GTW-83_Lamprey
+Tech Description:
XSTR(
".", 3305)
$end_multi_text
$Model File: none
@Laser Bitmap: newglo6
@Laser Glow:   2_laserglow03
@Laser Color:   120, 120, 30
@Laser Color2:   120, 120, 30
@Laser Length: 2.0
@Laser Head Radius: 1.0
@Laser Tail Radius: 1.0
$Mass:                                 0.2
$Velocity:                             450.0                          
$Fire Wait:                            0.3                            
$Damage:                               14
$Armor Factor: 0.1
$Shield Factor: 1.0
$Subsystem Factor: 0.0
$Lifetime:                             2.0
$Energy Consumed: 1.2
$Cargo Size: 0.0
$Homing:                               NO
$LaunchSnd:                            84
$ImpactSnd:                            85
$Flags:                                ( "player allowed" "esuck" "particle spew")
$Icon:                                 iconLich
$Anim:                                 Lich
$Impact Explosion: none
$Pspew:
+Count: 1
+Time: 500
+Vel: 1.2
+Radius: 6.0
+Life: 0.5
+Scale: 0.5
+Bitmap: particleexp01


I think I may have broken fighter beams, on player ships at least, but other than that I'd like some playing around
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Fury

  • The Curmudgeon
  • 213
Looking good as always. :) :yes:

By the way, Bobboau, did you got the email I sent?

 

Offline Raven2001

  • Machina Terra Reborn
  • 211
  • Im not the droid your looking for, move along
Bobboau, can you make these changes (or is it already done...) to imrove realism?:

1- The glows "beam" should be set up with the color of the glow itself, and shoulb oriented(so that I can make a glow to enlight me a wall of the ship...)
2- Please give them self lightning like in the primary weapons!! Again. this should be oriented and an angle should be defined...
Yeah, I know you were waiting for a very nice sig, in which I was quoting some very famous scientist or philosopher... guess what?!? I wont indulge you...

Why, you ask? What, do I look like a Shivan to you?!?


Raven is a god.

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Wowzers!
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Zarax

  • 210
Does they require changes in existing models?
The Best is Yet to Come

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
you have to add glow points, I included a version of pcs that suports them (though it will crash after you try to save more than once, so after you'r first save close it and reopen)
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline mikhael

  • Back to skool
  • 211
  • Fnord!
    • http://www.google.com/search?q=404error.com
I haven't followed the glow point development, Bobbaou, so forgive me if these are dumb questions:

What types of glow points, beyond Type1 are there? Can glow points be set up to pulse or rotate?
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Quote
Originally posted by mikhael
Can glow points be set up to pulse or rotate?


:eek2: Police sirens! Caution lights around airlocks! Floodlights! The possibilities are endless!
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline Zarax

  • 210
Does anyone made some models supporting the new glow points?
The Best is Yet to Come

 

Offline mikhael

  • Back to skool
  • 211
  • Fnord!
    • http://www.google.com/search?q=404error.com
Quote
Originally posted by GalacticEmperor


:eek2: Police sirens! Caution lights around airlocks! Floodlights! The possibilities are endless!


Exactly. My tug in I-war2 has that. I've got another version where the yellow/blue flashers come on only when the ship is moving in reverse. :D
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline Solatar

  • 211
We need runway lights on the Orion. And the Shivans could look freaky if they are glowing red.

 

Offline mikhael

  • Back to skool
  • 211
  • Fnord!
    • http://www.google.com/search?q=404error.com
Quote
Originally posted by Hades
We need runway lights on the Orion. And the Shivans could look freaky if they are glowing red.


Of course if you wanted to get really freaky you'd create a new beam type whose "warmup" would be a scriptable event. Then you could have glowpoints over the hull of the $ShivanSuperCapHere wink on bit by bit, until the the big glowpoints on the  beam apertures themselves come on and the beam actually fires.

Just for those silly cosmetic effects.
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline Zarax

  • 210
FS2 reported this error...


Setting language to English
soundcard = EAX
** MAX_CHANNELS set to 64.  DS reported 64.
GR_CPU: Family 6, MMX=Yes
D3D Device 0: Direct 3D - Driver video primario
Using one that matched Direct3D registry value 'Direct 3D - Driver

video primario (32 bit) (1024x768)'.
Window in debugging mode... mouse clicking may cause problems!
RGB, 5:5:5
ARGB, 1:5:5:5
ARGB, 4:4:4:4
RGB, 5:6:5
RGB, 8:8:8
ARGB, 8:8:8:8
Palettized 8 bpp
Alpha texture format = ARGB,

4:4:4:4
Non-alpha texture format = ARGB, 1:5:5:5
Screen format = RGB, 8:8:8
Direct3D Initialized OK!
TEXTURE RAM:

85255411 bytes (81 MB) available, size divisor = 1
Woohoo! Driver doesn't need square textures!
Textures must be

power of 2.
Doesn't support wide surfaces. Bashing max down to 1024
Large textures enabled!
Detecting uv type...
Trial #1
Trial #2
Pixel 1 = eeeeee , 0
Pixel 2 = eeeeee , 0
Rendition uvs: 0
Detecting line offset...
Trial #1
Trial #2
Pixel 1 = 0 , 0
Pixel 2 = 0 , 0
Line offset: 0.0
Couldn't open 'cursor.pcx'
ANI cursorweb with size 24x24

(25.0% wasted)
Using high memory settings...
ANI 2_radar1 with size 170x170 (33.6% wasted)
ML Freespace Multi Log -

Opened Tue, Nov 12, 2002  at 09:46PM
----
----
----


Windoze reported 16 joysticks, we found 0
Current soundtrack

set to -1 in event_music_reset_choices
weapons.tbl(1):Error: Required token = [#Primary Weapons], found [4].
Direct3D activate: 0
Direct3D activate: 0

Warning: weapons.tbl(1):
Error: Required token = [#Primary Weapons], found [4].

File:D:\Games\projects\freespace2_public\fs2_open\code\Parse\PARSELO.CPP
Line: 329

Call stack:
------------------------------------------------------------------
    required_string()    parse_weaponstbl()    weapon_init()    game_init()    WinMainSub()    WinMain()    

WinMainCRTStartup()    kernel32.dll 77e5eb69()
------------------------------------------------------------------
The Best is Yet to Come

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Quote
Originally posted by mikhael


Of course if you wanted to get really freaky you'd create a new beam type whose "warmup" would be a scriptable event. Then you could have glowpoints over the hull of the $ShivanSuperCapHere wink on bit by bit, until the the big glowpoints on the  beam apertures themselves come on and the beam actually fires.

Just for those silly cosmetic effects.


That would be incredibly cool. Like the whole neck part of the collocus glows before the BFGreen fires. *drools*
Freelance Modeler | Amateur Artist

 

Offline aldo_14

  • Gunnery Control
  • 213
Looks good... must play around with this sometime.  Do the lights cast a glow atall?  You could maybe adapt the code for the 'muzzleflash' (laser fire) for that........

 

Offline Inquisitor

Bobbau, did you ever get CVS sorted?
No signature.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I did last night, but there is a bug in the fighter beams I want to get fixed first

"We need runway lights on the Orion"
did you even look in that zip ? ;)

"Can glow points be set up to pulse"
yes
"or rotate"
[edit]yes, but they need to be atached to a subobject[/edit]

Zarax what are the first few lines of you're weapons table?

I could make a glow point type that only comes on when a turret is fireing

and it has been discused adding dynamic lighting to the glow points but it has been determined that it would be too costly at this time,
but there may be a new light chunck that could be linked to a glow point
« Last Edit: November 13, 2002, 01:55:13 pm by 57 »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Inquisitor

No signature.

 

Offline Solatar

  • 211
Your Orion looks awesome. I meant moving runway lights. But I'm not sure if this has been done YET.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
hey hey, I think I've just about gotten glow points to rotate with there model parent
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together