Author Topic: haveing problems with something, any help  (Read 6529 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
I have started work on basic decal code, and it seems as if it should be working but it isn't, below are the two functions for makeing and rendering a basic non-clipped decal, and the header files for the new data, I also added
decal decals[MAX_SHIP_DECALS];   //the decals of the ship
to the ship strucure,
as far as I can tell the create function works, it seems to generate the proper polygons (in the form of vertex[poly][vert]) but it doesn't render them, as you can see there is quite a bit of debug text and the readout (seems to) show that the verts are getting positioned in the proper place, and I made it so that if it was getting rendered in global coords when it should be local or vice versa that the effect would be so big I could see it from quite a distance,
and I have called the rendering function from within both the ship render ruteen and the model render code got nothing on ether one
the code is designed to be compatable with future improvements that will clip decals to the hull of the ship
and I currently have the create function called from within beam_add_collision() just above the sheild hit code in order to give it a good oreintation matrix like this
I used the orientation of the hit ship as a second point becase I couldn't think of something better at the time, and I figured it would work
Code: [Select]

decal_point dec;
dec.orient.vec.fvec = cinfo->hit_normal;
//get a good orientation matrix baised on the normal of the hit face and the orientation of the ship it hit-Bobboau
vm_vec_normalize( &dec.orient.vec.fvec );
vm_vec_crossprod( &dec.orient.vec.uvec, &hit_object->orient.vec.rvec, &dec.orient.vec.fvec);
vm_vec_normalize( &dec.orient.vec.uvec );
vm_vec_crossprod( &dec.orient.vec.rvec, &dec.orient.vec.uvec, &dec.orient.vec.fvec);
vm_vec_normalize( &dec.orient.vec.rvec );
vm_vec_normalize( &dec.orient.vec.uvec );
vm_vec_normalize( &dec.orient.vec.fvec );

dec.pnt = cinfo->hit_point;
dec.radius = bwi->b_info.beam_muzzle_radius*2;

decal_create_simple(hit_object, &dec, bwi->b_info.beam_glow_bitmap);




Code: [Select]

#ifndef _DECAL_H
#define _DECAL_H

#define MAX_DECAL_POLY 20
#define MAX_DECAL_POINT 40
#define MAX_SHIP_DECALS 25
#include "globalincs/pstypes.h"
#include "object/object.h"

typedef struct decal{
vertex vert[MAX_DECAL_POLY][3];
int texture;
int is_valid; //this means it is a good decal that should be rendered-Bobboau
int n_poly;
}decal;

typedef struct decal_point{
vector pnt;
matrix orient;
float radius;
}decal_point;

#endif

int decal_create_simple(object * obj, decal_point *point, int texture);//makes a simple non-clipped decal

void decal_render_all(object * obj); //renders all decals

Code: [Select]

int decal_create_simple(object *obj, decal_point *point, int texture){//makes a simple non-clipped decal

mprintf(("a decal is about to be made at %0.2f, %0.2f, %0.2f\n", point->pnt.xyz.x, point->pnt.xyz.y, point->pnt.xyz.z));

if(obj->type != OBJ_SHIP){
return 0;
}
// vertex vert[1][2];
vector vec[4];

vector center = point->pnt;
float rad = point->radius * 100;
if(rad <=0) rad = 10;
mprintf(("radius %f\n",rad));
vector plain_point[4];
mprintf(("orient uvec x %0.2f %0.2f %0.2f\n", point->orient.vec.uvec.xyz.x, point->orient.vec.uvec.xyz.y, point->orient.vec.uvec.xyz.z));
mprintf(("orient rvec x %0.2f %0.2f %0.2f\n", point->orient.vec.rvec.xyz.x, point->orient.vec.rvec.xyz.y, point->orient.vec.rvec.xyz.z));
mprintf(("orient fvec x %0.2f %0.2f %0.2f\n", point->orient.vec.fvec.xyz.x, point->orient.vec.fvec.xyz.y, point->orient.vec.fvec.xyz.z));
plain_point[0] = point->orient.vec.uvec;
plain_point[1] = plain_point[0];
vm_vec_invert(&plain_point[1]);
plain_point[2] = point->orient.vec.rvec;
plain_point[3] = plain_point[2];
vm_vec_invert(&plain_point[3]);

vm_vec_scale_add( &vec[0], ¢er, &plain_point[0], rad );
vm_vec_scale_add( &vec[1], ¢er, &plain_point[2], rad );
vm_vec_scale_add( &vec[2], ¢er, &plain_point[1], rad );
vm_vec_scale_add( &vec[3], ¢er, &plain_point[3], rad );

mprintf(("\n"));

ship *shipp = &Ships[obj->instance];
decal *dec = shipp->decals;

dec[0].vert[0][0].x = vec[0].xyz.x;
dec[0].vert[0][0].y = vec[0].xyz.y;
dec[0].vert[0][0].z = vec[0].xyz.z;

dec[0].vert[0][1].x = vec[1].xyz.x;
dec[0].vert[0][1].y = vec[1].xyz.y;
dec[0].vert[0][1].z = vec[1].xyz.z;

dec[0].vert[0][2].x = vec[3].xyz.x;
dec[0].vert[0][2].y = vec[3].xyz.y;
dec[0].vert[0][2].z = vec[3].xyz.z;

dec[0].vert[1][0].x = vec[1].xyz.x;
dec[0].vert[1][0].y = vec[1].xyz.y;
dec[0].vert[1][0].z = vec[1].xyz.z;

dec[0].vert[1][1].x = vec[2].xyz.x;
dec[0].vert[1][1].y = vec[2].xyz.y;
dec[0].vert[1][1].z = vec[2].xyz.z;

dec[0].vert[1][2].x = vec[3].xyz.x;
dec[0].vert[1][2].y = vec[3].xyz.y;
dec[0].vert[1][2].z = vec[3].xyz.z;

dec[0].vert[0][0].u = 0;
dec[0].vert[0][1].u = 0;
dec[0].vert[0][2].u = 1;
dec[0].vert[0][0].v = 0;
dec[0].vert[0][1].v = 1;
dec[0].vert[0][2].v = 1;

dec[0].vert[1][0].u = 0;
dec[0].vert[1][1].u = 1;
dec[0].vert[1][2].u = 1;
dec[0].vert[1][0].v = 1;
dec[0].vert[1][1].v = 0;
dec[0].vert[1][2].v = 1;

mprintf(("poly 1 vert 1 x %0.2f y %0.2f z %0.2f\n",dec[0].vert[0][0].x, dec[0].vert[0][0].y, dec[0].vert[0][0].z));
mprintf(("poly 1 vert 2 x %0.2f y %0.2f z %0.2f\n",dec[0].vert[0][1].x, dec[0].vert[0][1].y, dec[0].vert[0][1].z));
mprintf(("poly 1 vert 3 x %0.2f y %0.2f z %0.2f\n",dec[0].vert[0][2].x, dec[0].vert[0][2].y, dec[0].vert[0][2].z));

mprintf(("poly 2 vert 1 x %0.2f y %0.2f z %0.2f\n",dec[0].vert[1][0].x, dec[0].vert[1][0].y, dec[0].vert[1][0].z));
mprintf(("poly 2 vert 2 x %0.2f y %0.2f z %0.2f\n",dec[0].vert[1][1].x, dec[0].vert[1][1].y, dec[0].vert[1][1].z));
mprintf(("poly 2 vert 3 x %0.2f y %0.2f z %0.2f\n",dec[0].vert[1][2].x, dec[0].vert[1][2].y, dec[0].vert[1][2].z));

dec[0].texture = texture;
dec[0].n_poly = 2;
dec[0].is_valid = 1;

mprintf(("a decal should have been made at %0.2f %0.2f %0.2f\n", point->pnt.xyz.x, point->pnt.xyz.y, point->pnt.xyz.z));
//Int3();
return 1;
}


void decal_render_all(object * obj){
vertex vecs[3];
vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };

mprintf(("about to render all decals\n"));

ship *shipp = &Ships[obj->instance];

for(int h = 0; h < MAX_SHIP_DECALS; h++){
decal *dec = &shipp->decals[h];
if(dec->is_valid){
mprintf(("decal %d is valid, and has %d polys\n",h,dec->n_poly));
for(int i = 0; in_poly; i++){

mprintf(("drawing decal poly %d, with bitmap %d\n", i, dec->texture));
gr_set_bitmap(dec->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
vecs[0] = dec->vert[i][0];
vecs[1] = dec->vert[i][1];
vecs[2] = dec->vert[i][2];
mprintf(("vert 1 at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", vecs[0].x, vecs[0].y, vecs[0].z, vecs[0].u, vecs[0].v));
mprintf(("vert 2 at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", vecs[1].x, vecs[1].y, vecs[1].z, vecs[1].u, vecs[1].v));
mprintf(("vert 3 at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", vecs[2].x, vecs[2].y, vecs[2].z, vecs[2].u, vecs[2].v));
gr_set_cull(0);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT );
gr_set_cull(1);
}
}
}
mprintf(("decals rendered\n"));

}


now I have been trying to solve this for about a week now and I just can't figure out what I'm doing wrong

*update* just had a weird bug in my test mission were a distorted poly got put accros my view like a huf item, I think I need to unflag them as projected, gona try it now
« Last Edit: November 17, 2002, 05:53:52 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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
hey, I thought after this much time I would have gotten at least a basic egnolegement type responce
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 Anaz

  • 210
haveing problems with something, any help
acknowledgement IIRC....but yeah....

I hope you get this working, and I have no idea how to sling polys, so I couldn't help you...
Arrr. I'm a pirate.

AotD, DatDB, TVWP, LM. Ph34r.

You WILL go to warpstorm...

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
hello...
anybody here
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 Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
haveing problems with something, any help
I'm not entirely sure what this is. Is it for applying 'damage decals' onto ships, like 2D bomb crater marks, and beam scorches?
"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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
yes, it's very primitave though.
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

haveing problems with something, any help
I'll post this on a couple of dev boards, maybe we can get you some help...
No signature.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
I'm fairly sure it's something in the rendering function, and that its something fairly FS specific, I'm probly not rotateing a vert around the location of the parent object or something
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
haveing problems with something, any help
ok if I have three vertexes with coordanants relitive to an object and I want to render a polygon with thouse verts relitive to that object what do I need to do
Code: [Select]
for( int j = 0; j < 3; j++){
vecs[j] = dec->vert[i][j];
g3_rotate_vertex(&vecs[j], &obj->pos);
mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));

}

gr_set_cull(0);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT );
gr_set_cull(1);


I tryed this it doesn't work
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
haveing problems with something, any help
this is a segment of the debug spew I get, as you can see the local coords are corect (this was a faustus getting hit tward the front), the radius is corect as I want it huge so if it shows up anyware I will be able to see it, but, depending on what fiddeling I've done, I ether see nothing or I get the effect smeared across the screen (it isn't out in space if I swich veiws I still see it)


a decal is about to be made at -8.73, -0.05, 75.55
radius 200.000000
orient uvec x 0.00 -0.85 -0.53
orient rvec x -1.00 0.00 -0.00
orient fvec x -0.00 -0.53 0.85

poly 1 vert 1 x -8.73 y -169.22 z -31.13
poly 1 vert 2 x -208.73 y -0.05 z 75.55
poly 1 vert 3 x 191.27 y -0.05 z 75.55
poly 2 vert 1 x -208.73 y -0.05 z 75.55
poly 2 vert 2 x -8.73 y 169.12 z 182.23
poly 2 vert 3 x 191.27 y -0.05 z 75.55
a decal should have been made at -8.73 -0.05 75.55

about to render all decals
decal 0 is valid, and has 2 polys
drawing decal poly 0, with bitmap 63022
vert 0 at x -41.99 y -60.45 z 262.46 u 1.00 v 1.00
vert 1 at x -41.99 y -60.45 z 262.46 u 1.00 v 0.00
vert 2 at x -41.99 y -60.45 z 262.46 u 0.00 v 0.00
drawing decal poly 1, with bitmap 63022
vert 0 at x -41.99 y -60.45 z 262.46 u 1.00 v 0.00
vert 1 at x -41.99 y -60.45 z 262.46 u 0.00 v 1.00
vert 2 at x -41.99 y -60.45 z 262.46 u 0.00 v 0.00
decals rendered

this doesn't work ether
Code: [Select]
for( int j = 0; j < 3; j++){
vecs[j] = dec->vert[i][j];
g3_rotate_vertex(&vecs[j], &obj->pos);
g3_project_vertex(&vecs[j]);
mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));

}



:sigh: I no nobody is gona even look at this, but it helps the frustration
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
haveing problems with something, any help
ah HA!!!
it sort of works!!!
Code: [Select]
for( int j = 0; j < 3; j++){
vecs[j] = dec->vert[i][j];
vector pos;
vm_vert2vec(&vecs[j], &pos);
vm_vec_add2(&pos, &obj->pos);
g3_rotate_vertex(&vecs[j], &pos);
g3_project_vertex(&vecs[j]);
mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));

}


:ha:
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
haveing problems with something, any help
GOT IT!!!
ya!!!
Code: [Select]
for( int j = 0; j < 3; j++){
vecs[j] = dec->vert[i][j];
vector pos;
vm_vert2vec(&vecs[j], &pos);
g3_rotate_vertex(&vecs[j], &pos);
g3_project_vertex(&vecs[j]);
mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));

:p

I still need to take into acount rotateing submodels and I have to fix the UVs, but it's working
then I need to get it to make more than one, wich will be basicly only be recycleing the oldest point
then I have to make cliped decals
« Last Edit: November 18, 2002, 02:47:05 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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
hey this things prety fun, use a fighter beam and hit a cap ship, it will project the beam's muzle glow texture upon the surface you hittry it
in addition to clipped decals I am going to make an effect baised on this that makes an impact effect for weapons that looks like energy getting sheathed off
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 Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
haveing problems with something, any help
Wow! Now THAT's interesting. I just tried it. BTW, if you force your weapon (using cheats) to sgreen or another beam, it leaves a HUGE decal.
"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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
ok I've reworked it I think it's a bit faster this way
Code: [Select]

typedef struct decal{
struct{
uv_pair uv[3];
int point[3]; //an index to the vert list-Bobboau
}poly[MAX_DECAL_POLY];
vector vert[MAX_DECAL_POLY * 3]; //the defpoints-Bobboau
int texture;
int is_valid; //this means it is a good decal that should be rendered-Bobboau
int n_poly;
int timestamp; //is to start fadeing away-Bobboau
}decal;

typedef struct decal_point{
vector pnt;
matrix orient;
float radius;
}decal_point;


Code: [Select]
int decal_create_simple(object *obj, decal_point *point, int texture){//makes a simple non-clipped decal

mprintf(("a decal is about to be made at %0.2f, %0.2f, %0.2f\n", point->pnt.xyz.x, point->pnt.xyz.y, point->pnt.xyz.z));

if(obj->type != OBJ_SHIP){
return 0;
}
// vertex vert[1][2];
// vector vec[4];

vector center = point->pnt;
float rad = point->radius * 2;
if(rad <=0) rad = 10;
mprintf(("radius %f\n",rad));
vector plain_point[4];
// mprintf(("orient uvec x %0.2f %0.2f %0.2f\n", point->orient.vec.uvec.xyz.x, point->orient.vec.uvec.xyz.y, point->orient.vec.uvec.xyz.z));
// mprintf(("orient rvec x %0.2f %0.2f %0.2f\n", point->orient.vec.rvec.xyz.x, point->orient.vec.rvec.xyz.y, point->orient.vec.rvec.xyz.z));
// mprintf(("orient fvec x %0.2f %0.2f %0.2f\n", point->orient.vec.fvec.xyz.x, point->orient.vec.fvec.xyz.y, point->orient.vec.fvec.xyz.z));
plain_point[0] = point->orient.vec.uvec;
plain_point[1] = plain_point[0];
vm_vec_negate(&plain_point[1]);
plain_point[2] = point->orient.vec.rvec;
plain_point[3] = plain_point[2];
vm_vec_negate(&plain_point[3]);

mprintf(("\n"));

ship *shipp = &Ships[obj->instance];
decal *dec = shipp->decals;

vm_vec_scale_add( &dec[0].vert[0], ¢er, &plain_point[0], rad );
vm_vec_scale_add( &dec[0].vert[1], ¢er, &plain_point[2], rad );
vm_vec_scale_add( &dec[0].vert[2], ¢er, &plain_point[1], rad );
vm_vec_scale_add( &dec[0].vert[3], ¢er, &plain_point[3], rad );

dec[0].poly[0].point[0] = 0;
dec[0].poly[0].point[1] = 1;
dec[0].poly[0].point[2] = 2;

dec[0].poly[1].point[0] = 0;
dec[0].poly[1].point[1] = 3;
dec[0].poly[1].point[2] = 2;

dec[0].poly[0].uv[0].u = 0; dec[0].poly[0].uv[0].v = 0;
dec[0].poly[0].uv[1].u = 0; dec[0].poly[0].uv[1].v = 1;
dec[0].poly[0].uv[2].u = 1; dec[0].poly[0].uv[2].v = 1;

dec[0].poly[1].uv[0].u = 0; dec[0].poly[1].uv[0].v = 0;
dec[0].poly[1].uv[1].u = 1; dec[0].poly[1].uv[1].v = 0;
dec[0].poly[1].uv[2].u = 1; dec[0].poly[1].uv[2].v = 1;

dec[0].texture = texture;
dec[0].n_poly = 2;
dec[0].is_valid = 1;
dec[0].timestamp = timestamp();

mprintf(("a decal should have been made at %0.2f %0.2f %0.2f\n", point->pnt.xyz.x, point->pnt.xyz.y, point->pnt.xyz.z));
//Int3();
return 1;
}


void decal_render_all(object * obj){
vertex vecs[3];
vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };

mprintf(("about to render all decals\n"));

ship *shipp = &Ships[obj->instance];

for(int h = 0; h < MAX_SHIP_DECALS; h++){
decal *dec = &shipp->decals[h];
if(dec->is_valid){
mprintf(("decal %d is valid, and has %d polys\n",h,dec->n_poly));
for(int i = 0; in_poly; i++){

//mprintf(("drawing decal poly %d, with bitmap %d\n", i, dec->texture));
gr_set_bitmap(dec->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );

for( int j = 0; j < 3; j++){
// vecs[j] = dec->vert[i][j];
// vector pos;
// vm_vert2vec(&vecs[j], &pos);
// vm_vec_add2(&pos, &obj->pos);
g3_rotate_vertex(&vecs[j], &dec->vert[dec->poly[i].point[j]]);
g3_project_vertex(&vecs[j]);
vecs[j].u = dec->poly[i].uv[j].u;
vecs[j].v = dec->poly[i].uv[j].v;
//mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));

}

gr_set_cull(0);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT );
gr_set_cull(1);
}
}
}
mprintf(("decals rendered\n"));

}
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 Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
haveing problems with something, any help


DOES ANYONE ELSE CARE? THIS IS SO COOL!
"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 Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
haveing problems with something, any help
I want to check it out, but every time I try to load a mission it crashes saying "Could not load model ." :confused:

By the way, Bobboau, I've started work on the ballistics primary conversion, so no need to feel swamped with requests. :)

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
maybe they are all put off by the title,
anyway, I'm currently working on the fully cliped version, and as such I'm going to make a function that makes a triangulated version of the hull in this format
Code: [Select]

typedef struct decal_model{ //this will store a triangulated version of the ships polygons
int point[800][3]; //an index to the vert list-Bobboau
vector vert[1200]; //the defpoints-Bobboau
int n_polys;
}decal_model;



I'm going to make the cliped decals by first figuring out wich faces (useing the decal_model) are posably going to be used, then on a polygon by polygon basis, I'm going to figure out what part of the poly is going to be used (if any), so if the entire poly is inside the decal box I'll just copy it to the ship's decal's poly list, if two of it's three verts are in side I'll copy the two verts, do a colision calculation to find the other two\three verts, thriangulate and stor the results, then when I'm all done I'll calculate the UV coords for each vert of each polygon, the rest of the code should be able to handel it from there.

as I was writeing up the submodel interpeter I needed, I started to think would it be faster if we stuffed all the poly data into an actual structure rather than the gobuldy gook it's all in now, it would ceranly make things clearer than they are now, though it might not be faster, wich I wouldn't want to harm
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
haveing problems with something, any help
"I want to check it out, but every time I try to load a mission it crashes saying "Could not load model ." "
see if this fixes it
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 Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
haveing problems with something, any help
Well, it let the mission start, but as soon as a ship was about to warp in it crashed again.

Quote
Assert: Polygon_models[num]->id == model_num
File: D:\Games\projects\freespace2_public\fs2_open\code\Model\ModelRead.cpp
Line: 2461

Call stack:
------------------------------------------------------------------
    model_render()    warpin_render()    fireball_render()    obj_render()    obj_render_all()    game_render_frame()    game_frame()    game_do_frame()    game_do_state()    gameseq_process_events()    WinMainSub()    WinMain()    WinMainCRTStartup()    KERNEL32.DLL bff8b560()
    KERNEL32.DLL bff8b412()
------------------------------------------------------------------



By the way, I just thought of something funny. :) Bobboau, how customizable is your decal trick?  If we could configure the TAG missiles to leave a bright primary-colored decal on every ship they hit, we could have ourselves a genuine game of paintball. :lol: