Author Topic: glow points  (Read 14967 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
OK lets get one of the wish list done, this should be one of the easier ones, glow points,
I want someone else to work on this too but I am going to try and get it implemented, what I need is someone who is willing to write a simple editor (Kazan would be my choice cause he could add to his PCS) that would let me have some ability to make the model to test this on the format is prety much the same as thruster glows at this point (could I just copy some FUEL chunk data and rename it to GLOW)

also I would like to restate that I am an idiot and don't realy know what I am doing, so I would like someone who does know what they are doing to see this more as a desperate plea than as "someone is already doing this, so I shouldn't waist my time".
I will post my changes in a minute so you can get a good chucle out of them
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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
what I added to the read_model_file function

Code: [Select]

case ID_GLOW:
char props[MAX_PROP_LEN];
pm->n_glows = cfread_int(fp);
pm->glows = (glow_bank *)malloc(sizeof(glow_bank) * pm->n_glows);
Assert( pm->glows != NULL );

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

bank->num_slots = cfread_int(fp);

if (pm->version < 2117) {
bank->glow_bitmap = -1;
} else {
cfread_string_len( props, MAX_PROP_LEN, fp );
// look for $glow_texture=xxx
int length = strlen(props);
if (length > 0) {
int base_length = strlen("$glow_texture=");
Assert( strstr( (const char *)&props, "$glow_texture=") != NULL );
Assert( length > base_length );
char *glow_texture_name = props + base_length;
if (glow_texture_name[0] == '$') {
glow_texture_name++;
}
bank->glow_bitmap = bm_load( glow_texture_name );
if (bank->glow_bitmap < 0) {
Error( LOCATION, "Couldn't open texture '%s'\nreferenced by model '%s'\n", glow_texture_name, pm->filename );
}

}
}
for (j = 0; j < bank->num_slots; j++) {

cfread_vector( &(bank->pnt[j]), fp );
cfread_vector( &(bank->norm[j]), fp );
if ( pm->version > 2004 ) {
bank->radius[j] = cfread_float( fp );
//mprintf(( "Rad = %.2f\n", rad ));
} else {
bank->radius[j] = 1.0f;
}
}
//mprintf(( "Num slots = %d\n", bank->num_slots ));

}
break;



I also added

int               n_glows;   
glow_bank    *glows;   

to

typedef struct polymodel {


just below the thruster equivelent, and

Code: [Select]

typedef struct glow_bank {
int num_slots;
vector pnt[MAX_THRUSTER_SLOTS];
vector norm[MAX_THRUSTER_SLOTS];
float radius[MAX_THRUSTER_SLOTS];
int glow_bitmap;
} glow_bank;


just below the thruster_bank typedef note there is a bitmap index number (int) were wash info index (char) used to be

also

#define ID_GLOW 'WOLG'   // glow points

in ModelsInc.h just below

#define ID_FUEL 'LEUF'   // thruster points

almost forgot that

this is all just trying to get the data parsed from a POF, if you thinks this should work now I'll try getting the actual effect working
« Last Edit: June 17, 2002, 09:43:53 am 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 Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
glow points? which ones?
SCREW CANON!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
well I want to make glow points like the thrusters but are not conected to engines and can have there own seperate textures
there like little sprites that look like lens flares
I war has them I beleve, and this is sort of a must have for BTP, and something everyone else will want
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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
what I have done so far doesn't seem to have broken anything, but I have yet to fully test this in a mission (just opened fs and went to the tech DB it didn't crash so I'm guessing it worked (also seems that just copying and renameing the fuel chunk worked))
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 Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
oh, ok, i see. Well, that would be neat indeed, but make sure to increase the allowed number of glows a pof can have. for now it's 15 I think, I did a test once, and I think FS2 crashed with about this amount of glows.
SCREW CANON!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
ok this is the rendering code

Code: [Select]

//start rendering glow points -Bobboau

if ( (pm->glows->glow_bitmap != -1) && (Interp_flags & MR_SHOW_THRUSTERS) /*&& (Detail.engine_glows)*/ ) {

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

for ( j=0; jnum_slots; j++ ) {
float d;
vector tempv;
vm_vec_sub(&tempv,&View_position,&bank->pnt[j]);
vm_vec_normalize(&tempv);

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

if ( d > 0.0f) {
vertex p;

// Make glow bitmap fade in/out quicker from sides.
d *= 3.0f;
if ( d > 1.0f ) d = 1.0f;

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

float w = bank->radius[j];

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

g3_rotate_vertex( &p, &bank->pnt[j] );
gr_set_bitmap( bank->glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, d );
{
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;
}
}

}
}
}

//end rendering glow points


put it right under the thruster glow rendering code,
it works in the tech room, but it crashes after rendering the first frame in game,
don't know why,
did that quickly though

that goes into
model_really_render()
wich is in
ModelInterp.ccp
line 2808 or around there
BTW

I'm gona try to figure out what I broke now, please if you can, tell me what I did wrong
« Last Edit: June 16, 2002, 07:07:41 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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213

works in tech room but not in game
(had to coment out the && (Interp_flags & MR_SHOW_THRUSTERS) bit to get it to work in tech room)
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 Grey Wolf

You see things; and you say "Why?" But I dream things that never were; and I say "Why not?" -George Bernard Shaw

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Now THATS cool!

I'd like to be able to set them to blink as well.  Just imagine a carrier landing...or flying past a destroyer with a set of lights winking every once in a while.
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
would be cool but if I or someone who does know what there doing can't get it working, it will just end up like the fighter beams, just functional enough to show off how cool it would be, but not enough to actualy use it anywere

please please please, anybody with an understanding of C please help me, I am beond novice at this stuff, I've taken no classes, only read part of one realy crappy C++ book, I have (ok, almost :rolleyes: ) no Idea what I'm doing, I'm sure you can do better
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
Iwar2 has "glow points" and "glow channels" These are two different things entirely.

A "Glow point" is an omnidirectional light source in the ship's setup scene. The light source has its various lens flare properties set, including animation channels (like the intensity channel, for flashing the glow point).

A "glow channel" is a specially named surface. There are, I think, two basic glow channels (glow1 and glow2). Basically, the polygons that are assigned to this special surface become self illuminated in the engine. The two basic glow channels are simple fade-in/fade-outs.

You can also specify an animation channel hook to glows. For example, if you have a ring of polys around an engine that you want to glow brighter as the ships throttle is increased, you would include the throttle handle (Z+ in this case) and a range of values that determine how bright the glow is at 0% deflection and 100% deflection. The engine interpolates the 'tweens. The same goes for glow points (this is how engine flare glows are handled).
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
yes, well, does that... have anything to do with ... this
:confused:
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
Quote
Originally posted by Bobboau
yes, well, does that... have anything to do with ... this
:confused:


Well, yes, as a matter of fact it does, since it was you that mentioned Iwar glowpoints. Um... here:
Quote
Originally posted by Bobboau
well I want to make glow points like the thrusters but are not conected to engines and can have there own seperate textures
there like little sprites that look like lens flares
I war has them I beleve, and this is sort of a must have for BTP, and something everyone else will want


I explained them so that you could, perhaps, use the same sort of methodology for implementing the same in Freespace, should you so desire (being that it is a damned good system allowing for all kinds of wonderful dynamic in-game effects).
« Last Edit: June 16, 2002, 10:40:01 pm by 440 »
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
oh, ok, well yes, I could link the glows to diferent things if I so wanted, but I'd need to get them working in some sort of basic fasion first

sorry if I'm comming off as an ass here :D eh he
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

 
Well, there's atleast one bug in your loading function.

glow_bank *bank = &pm->glows;

should be

glow_bank *bank = &pm->glows;


From quickly looking, I can't spot anything else. I can't do more "looks" at the moment, I'll try at evening.

 

Offline Raven2001

  • Machina Terra Reborn
  • 211
  • Im not the droid your looking for, move along
Also, make the glows throw some lightning... like a blue glow blinks and releases blue lighning :)
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 Inquisitor

Wanna put this in CVS?
No signature.

 

Offline Fineus

  • ...But you *have* heard of me.
  • Administrator
  • 212
    • Hard Light Productions
Quote
Originally posted by IceFire
Now THATS cool!

I'd like to be able to set them to blink as well.  Just imagine a carrier landing...or flying past a destroyer with a set of lights winking every once in a while.

Amen, totally - thats a great boost to the incentive to get things rolling! If you could get the blink rate adjustable as a ships.tbl function that'd be great - thus "0" would be no blinks per second - always on. 2 would be 2 blinks per second and so on...

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
it looks like the code frames saw the and thought I meant I wanted something itialisised, I'll change it to something less confusing

and this can go in CVS when it stops crashing the game

and sence this isn't conected to anything that is currently in the ships table, it would probly be easier to add "on time" and "off time" into the glow chunk for each bank probly also be nice to have a time displacement value
« Last Edit: June 17, 2002, 09:51:37 am 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