Author Topic: haveing problems with something, any help  (Read 6485 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
are you useing a mod (and if so are you useing DTP's mod code)?
I've had some problems recently regarding this

and yes it could do that
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 Sesquipedalian

  • Atankharz'ythi
  • 211
haveing problems with something, any help
You leave me speechless, Bobboau. :D

Any screenies?  And what sort of performance hit do decals produce?
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
haveing problems with something, any help
No mods.  And oddly enough, I just went back in and it worked fine.  Looks like a bug. :)

EDIT: Ah, nuts.  Happened again.  Same error, and it appeared to be completely random. :confused:
« Last Edit: November 22, 2002, 12:01:06 am by 561 »

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
hmm, that ain't good...
here are some pics
they show both new glow point code and the decal code, note the decals show up in the target view, and I have to use the same transparency code as used in the weapon effects for now, I'm hopeing we to set a transparency bitmap soon




the last one shows the big problem with this method
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
haveing problems with something, any help
Given the description of your algorithm earlier, Bob, I would have expected that dangling decal to have folded over to the top surface. I think that I may have misunderstood your methodology.
[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
haveing problems with something, any help
decal_create_simple only projects a two poly plain perpindicular to the normal of the hit poly, the rendering code should work with more complex decals, but I'm gona make what is basicly a boolein intersection with a projected cube, but I havn't done that yet (not sure I will be able to at all in fact)

the description was what I'm going to do not what I've done
« Last Edit: November 22, 2002, 12:51:21 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 Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
haveing problems with something, any help
Once you've got that down, would we be able to apply this technology to having shield effects of a set size on a capship without needing a seperate mesh?

Bah, I'm getting ahead of myself here... this is teh l33t. :D When you hit the rotating panels with the beam, does the decal stick?
"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
the simple decals could be used in place of the current hit effect for capships, yes

I havn't gotten the rotating submodels covered yet, I'll have to make a submodel parent and do something similar to what I did with the glow points,
and odd thing if you hit were the submodel it in it's default position, it will act like it is hitting it right there

eventualy I'd like to use diferent bitmaps for decals that are getting hit at a diferent angle, and decals that rebuild themselves with beams so you end up with big ass swaths'o destruction
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
it's weird how nobody cares about this
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
As you said, they're probably turned off by the title.  Start a new thread. :nod:

 

Offline DTP

  • ImPortant Coder
  • 28
    • http://www.c4-group.dk
haveing problems with something, any help
Quote
Originally posted by Bobboau
are you useing a mod (and if so are you useing DTP's mod code)?
I've had some problems recently regarding this

and yes it could do that


i would love to hear all about them

your troubles, so if there is a problem, so that i can solve it.
VBB member; reg aug 1999; total posts 600.
War is a lion, on whos back you fall, never to get up.
Think big. Invade Space.

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
haveing problems with something, any help
Quote
Originally posted by Bobboau
it's weird how nobody cares about this


...I care. :(
"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
Me too! :(

Especially since I can't get it to work, and I want to see it. :(

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
haveing problems with something, any help
Moi aussi
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
haveing problems with something, any help
I  just got my subobject interpeter to spit out a trianglulated version of the hull, which means I can now start on the real hard part of the clipped decals code
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
mkey, I've gotten the first version of the clipped decal code in it's first revision, it of corse does not work, but here it is, anyone who can find the many many bugs in it befor me will have the great honor of beeing 13373|2 than me
Code: [Select]

int decal_create(object * obj, decal_point *point, int subobject, int texture){
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;
}

vector center = point->pnt;
float rad = point->radius * 2;
if(rad <=0) rad = 10;
mprintf(("radius %f\n",rad));
vector plain_point[4];
vector cube_point[8];
//define the decals dimentions
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]);

vector topcenter;
vector bvec = point->orient.vec.fvec;
vm_vec_negate(&bvec);
vm_vec_scale_add(&topcenter, ¢er, &bvec, rad);

for(int i = 0; i < 4; i++){
vm_vec_scale_add( &cube_point[i], &topcenter, &plain_point[i], rad );
vm_vec_scale_add( &cube_point[i+4], &cube_point[i], &point->orient.vec.fvec, rad*2);
}

float max_rad = vm_vec_dist(¢er, &cube_point[0]); //the cube points are all equidistant, right?
mprintf(("decal defined\n"));

//define the decals dimentions

//set up the decal model
ship *shipp = &Ships[obj->instance];
decal *sdec = &shipp->decals[0];
polymodel *pm = model_get(shipp->modelnum);
bsp_info * sm;
sm = &pm->submodel[subobject];
decal_model dmod = sm->dec_model;
decal_model tdec; //temporary decal model for holding the culled down part of the decal
//end set up the decal model
mprintf(("decal model set up\n"));

//cull out all polys you are defanantly not going to be useing
tdec.n_polys = 0;
for(i=0; i<1200; i++) tdec.vert[i] = dmod.vert[i];//make sure they have the same def points

for(i = 0; i < dmod.n_polys; i++){
if(vm_vec_dist(¢er, &dmod.poly[i].center) <= (dmod.poly[i].radius + max_rad)){
tdec.poly[tdec.n_polys++] = dmod.poly[i];
}
}
mprintf(("culled unwanted poleis\n"));

//end cull out all polys you are defanantly not going to be useing

//the good part, find what part of wich poly you are going to be useing and copy that to a ship decal

sdec->n_poly = 0;
// find defpoints

int dec_vert = 0;
int decal_vert_index[1200];
for(int j = 0; j < 3; j ++){ //if this def point is inside the box, copy it
vector test_point, temp;
vm_vec_sub(&test_point, &tdec.vert[tdec.poly[i].point[j]], &point->pnt); //make it relitive to the decal point
vm_vec_unrotate(&temp, &test_point, &point->orient); //unrotate it
test_point = temp;
if(
test_point.xyz.x < (center.xyz.x + rad) &&
test_point.xyz.x > (center.xyz.x - rad) &&
test_point.xyz.y < (center.xyz.y + rad) &&
test_point.xyz.y > (center.xyz.y - rad) &&
test_point.xyz.z < (center.xyz.z + rad) &&
test_point.xyz.z > (center.xyz.z - rad)
)
{
decal_vert_index[j] = dec_vert; //this says wich index in the ship decal relates to the decal model
sdec->vert[dec_vert++] = tdec.vert[j];
mprintf(("defpoint %d copied\n", j));
}else{
decal_vert_index[j] = -1; //if it isn't in the box then there is no vert to relate to
mprintf(("defpoint %d isn't in the cube\n", j));
}
}
mprintf(("defpoints copied\n"));


for(i = 0; i < tdec.n_polys; i++){
mprintf(("procesing tdec poly %d, there are currently %d polys in the decal\n",tdec.n_polys, sdec->n_poly));

int verts_in_cube = 0;
//find how many of the verts of this poly are in the cube
for( int k = 0; k< 3; k++){
if(decal_vert_index[tdec.poly[i].point[k]] != -1){
verts_in_cube++;
}
}
mprintf(("%d of it's verts are in the cube\n",verts_in_cube));

int n_point = 0;
int poly_point[6];
int l, r, p, v, newpnt;
vector poly_pnts[3];
switch(verts_in_cube){
case 3:
//if all verts are in the box just copy it
for(l = 0; l < 3; l++){
sdec->poly[sdec->n_poly].point[i] = decal_vert_index[tdec.poly[i].point[l]];
}
sdec->n_poly++;
break;
case 2:
//if two of the verts are in make a (posably up to five-pointed, no less than four) poly
n_point = 0;
r=0;
for( l = 0; l < 3; l++){
if(decal_vert_index[tdec.poly[i].point[l]] != -1){
//if the point is in the cube just copy it
poly_point[r++] = decal_vert_index[tdec.poly[i].point[l]];
}else{
//else find one somewere between
//this one and the previus
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l-1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
//posably one from a cube intersection
for(v = 0; v<3; v++)poly_pnts[v]= tdec.vert[tdec.poly[i].point[v]];
if(decal_intersect_poly_with_cube(&sdec->vert[dec_vert], poly_pnts, cube_point, 0) == 1){
poly_point[r++] = dec_vert++;
}

//this one and the next
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l+1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}

}
}
//then copy the triangulated version to the ship decal

for(p = 1; p<(r-1); p++){
sdec->poly[sdec->n_poly].point[0] = poly_point[0];
sdec->poly[sdec->n_poly].point[p] = poly_point[p];
sdec->poly[sdec->n_poly].point[p+1] = poly_point[p+1];
sdec->n_poly++;
}

break;
case 1:
//if one of the verts are in make a (posably up to 5-pointed, at least 3) poly
n_point = 0;
r=0;
for( l = 0; l < 3; l++){
if(decal_vert_index[tdec.poly[i].point[l]] != -1){
//if the point is in the cube just copy it
poly_point[r++] = decal_vert_index[tdec.poly[i].point[l]];
}else{
//else find one somewere between
//this one and the previus
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l-1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
//posably one from a cube intersection
vector poly_pnts[3];
vector temppnt1;
vector temppnt2;
newpnt = 0;
for(v = 0; v<3; v++)poly_pnts[v]= tdec.vert[tdec.poly[i].point[v]];
if(decal_intersect_poly_with_cube(&temppnt1, poly_pnts, cube_point, 0) == 1){
newpnt = 1;
}

//posably another one from a cube intersection
for(v = 0; v<3; v++)poly_pnts[v]= tdec.vert[tdec.poly[i].point[v]];
if(decal_intersect_poly_with_cube(&temppnt2, poly_pnts, cube_point, 1) == 1){
newpnt = 2;
}

//that function doesn't generate points in any particular order so if the first one is closer to the last point make it the naext one
if(newpnt == 1){
sdec->vert[dec_vert] = temppnt1;
poly_point[r++] = dec_vert++;
}else if(newpnt == 2){
if(vm_vec_dist(&sdec->vert[dec_vert - 1], &temppnt1) < vm_vec_dist(&sdec->vert[dec_vert - 1], &temppnt2)){
sdec->vert[dec_vert] = temppnt1;
poly_point[r++] = dec_vert++;
sdec->vert[dec_vert] = temppnt2;
poly_point[r++] = dec_vert++;
}else{
sdec->vert[dec_vert] = temppnt2;
poly_point[r++] = dec_vert++;
sdec->vert[dec_vert] = temppnt1;
poly_point[r++] = dec_vert++;
}

poly_point[r++] = dec_vert++;
}

//this one and the next
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l+1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}

}
}
//then copy the triangulated version to the ship decal
for(p = 1; p<(r-1); p++){
sdec->poly[sdec->n_poly].point[0] = poly_point[0];
sdec->poly[sdec->n_poly].point[p] = poly_point[p];
sdec->poly[sdec->n_poly].point[p+1] = poly_point[p+1];
sdec->n_poly++;
}

break;
case 0:
//if none of the verts are in make a (posably up to 6-pointed) poly
n_point = 0;
r=0;
newpnt = 0;
vector newpoint[4];
for(v = 0; v<3; v++)poly_pnts[v]= tdec.vert[tdec.poly[i].point[v]];

for(k = 0; k<4; k++){
if( decal_intersect_poly_with_cube(&newpoint[k], poly_pnts, cube_point, k) == 1){
newpnt = k;
}
}

float dist;
switch(newpnt){
//four cube intersections
case 4:
for(v = 0; v<4; v++){
sdec->vert[dec_vert+v] = newpoint[v];
poly_point[r++] = dec_vert++;
}
r=4;
break;
//tree cube intersections
case 3:
for(l=0; l<3; l++){
//this one and the next
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l+1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
//this one and the previus
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l-1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}

}

for(l = 0; l<3; l++){
dist = vm_vec_dist(&sdec->vert[poly_point[r-1]], &newpoint[l%3]);
//if this intersection point is closer than the other two, use it as the next point
if((dist < vm_vec_dist(&sdec->vert[poly_point[r-1]], &newpoint[(l+1)%3])) && (dist < vm_vec_dist(&sdec->vert[poly_point[r-1]], &newpoint[(l+2)%3])) ){
sdec->vert[dec_vert] = newpoint[l];
k = l;
}
}
poly_point[r++] = dec_vert++;

//of the remaining two points wich one is the farthest from the first point is next
dist = vm_vec_dist(&sdec->vert[poly_point[0]], &newpoint[(k + 1)%3]);
if(dist > vm_vec_dist(&sdec->vert[poly_point[0]], &newpoint[(k+2)%3]) ){
sdec->vert[dec_vert] = newpoint[(k + 1)%3];
poly_point[r++] = dec_vert++;
sdec->vert[dec_vert] = newpoint[(k + 2)%3];
poly_point[r++] = dec_vert++;
}else{
sdec->vert[dec_vert] = newpoint[(k + 2)%3];
poly_point[r++] = dec_vert++;
sdec->vert[dec_vert] = newpoint[(k + 1)%3];
poly_point[r++] = dec_vert++;
}


break;
//two cube intersections
case 2:
//get the two poly points
for(l=0; l<3; l++){
//this one and the next
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l+1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
//this one and the previus
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l-1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}

}
//get the two cube intersections
for(l = 0; l<3; l++){
dist = vm_vec_dist(&sdec->vert[poly_point[r-1]], &newpoint[l%3]);
//if this intersection point is closer than the other, use it as the next point
if((dist < vm_vec_dist(&sdec->vert[poly_point[r-1]], &newpoint[(l+1)%3])) ){
sdec->vert[dec_vert] = newpoint[l];
k = l;
}
}
poly_point[r++] = dec_vert++;

//the remaining point is next
sdec->vert[dec_vert] = newpoint[(k + 2)%3];
poly_point[r++] = dec_vert++;
break;
//one cube intersection
case 1:
for(l=0; l<3; l++){
//this one and the next
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l+1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
//this one and the previus
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l-1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
}

sdec->vert[dec_vert] = newpoint[0];
poly_point[r++] = dec_vert++;

break;
//no cube intersections
case 0:
for(l=0; l<3; l++){
//this one and the next
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l+1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
//this one and the previus
if(decal_intersect_seg_with_cube(&sdec->vert[dec_vert], tdec.vert[tdec.poly[i].point[l]], tdec.vert[tdec.poly[i].point[(l-1)%3]], cube_point, point->orient)){
poly_point[r++] = dec_vert++;
}
}
break;
}
//then copy the triangulated version to the ship decal
//IT IS POSABLE THAT THERE IS NO INTERSECTION AT ALL

for(p = 1; p<(r-1); p++){
sdec->poly[sdec->n_poly].point[0] = poly_point[0];
sdec->poly[sdec->n_poly].point[p] = poly_point[p];
sdec->poly[sdec->n_poly].point[p+1] = poly_point[p+1];
sdec->n_poly++;
}

break;
}
}

for(i=0; in_poly; i++){
for(int k=0; k<3; k++){
sdec->poly[i].uv[k].u = 0.5f;
sdec->poly[i].uv[k].v = 0.5f;
}
}

sdec->texture = texture;
sdec->is_valid = 1;
sdec->timestamp = timestamp();

mprintf(("a decal should have been made with %d polys\n",sdec->n_poly));

return 1;
}



these are two subrouteens used by that
Code: [Select]
int decal_intersect_seg_with_cube(vector * poly_point, vector start, vector end, vector cube_point[8], matrix orient){
mprintf(("entering decal_intersect_seg_with_cube\n"));

//for each four sided face of the cube
vector *pointlist[4];
vector plnorm = orient.vec.fvec;
pointlist[0] = &cube_point[4];
pointlist[1] = &cube_point[6];
pointlist[2] = &cube_point[5];
pointlist[3] = &cube_point[7];
if(fvi_segment_plane(poly_point, &cube_point[5], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
vm_vec_negate(&plnorm);
pointlist[0] = &cube_point[0];
pointlist[1] = &cube_point[3];
pointlist[2] = &cube_point[1];
pointlist[3] = &cube_point[2];
if(fvi_segment_plane(poly_point, &cube_point[0], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out

vector veca;
vector vecb;

veca = orient.vec.uvec;
vecb = orient.vec.rvec;
vm_vec_negate(&veca);
vm_vec_avg(&plnorm, &veca, &vecb);

vm_vec_normalize(&plnorm);
pointlist[0] = &cube_point[2];
pointlist[1] = &cube_point[1];
pointlist[2] = &cube_point[5];
pointlist[3] = &cube_point[6];
if(fvi_segment_plane(poly_point, &cube_point[5], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
vm_vec_negate(&plnorm);
pointlist[0] = &cube_point[3];
pointlist[1] = &cube_point[0];
pointlist[2] = &cube_point[4];
pointlist[3] = &cube_point[7];
if(fvi_segment_plane(poly_point, &cube_point[0], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out

veca = orient.vec.uvec;
vecb = orient.vec.rvec;
vm_vec_avg(&plnorm, &veca, &vecb);

vm_vec_normalize(&plnorm);
pointlist[0] = &cube_point[2];
pointlist[1] = &cube_point[0];
pointlist[2] = &cube_point[4];
pointlist[3] = &cube_point[6];
if(fvi_segment_plane(poly_point, &cube_point[0], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
vm_vec_negate(&plnorm);
pointlist[0] = &cube_point[3];
pointlist[1] = &cube_point[1];
pointlist[2] = &cube_point[5];
pointlist[3] = &cube_point[7];
if(fvi_segment_plane(poly_point, &cube_point[5], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
mprintf(("leaveing decal_intersect_seg_with_cube\n"));

return 0;//it couldn't find any

}

int decal_intersect_poly_with_cube(vector * poly_point, vector point[3], vector cube_point[8], int ints){
mprintf(("entering decal_intersect_poly_with_cube\n"));

vector plnorm;
vector *pointlist[3];
for(int i = 0; i<3; i++)pointlist[i] = &point[i];
vm_vec_perp(&plnorm, &point[0], &point[1], &point[2]);

vector pnt1 = cube_point[0];
vector pnt2 = cube_point[2];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face, and this isn't the last one
return 1;//and if it is, then get out

pnt1 = cube_point[2];
pnt2 = cube_point[1];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[1];
pnt2 = cube_point[3];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[3];
pnt2 = cube_point[0];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[0];
pnt2 = cube_point[4];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[2];
pnt2 = cube_point[6];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[1];
pnt2 = cube_point[5];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[3];
pnt2 = cube_point[7];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[4];
pnt2 = cube_point[6];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[6];
pnt2 = cube_point[5];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[5];
pnt2 = cube_point[7];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[7];
pnt2 = cube_point[4];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

mprintf(("leaveing decal_intersect_poly_with_cube\n"));

return 0;
}


now this is the object interpeter I made, that sets a trianglulated version of all submodels into a specal polymodel format I have incerted into the submodel data type
Code: [Select]
int decal_intersect_seg_with_cube(vector * poly_point, vector start, vector end, vector cube_point[8], matrix orient){
mprintf(("entering decal_intersect_seg_with_cube\n"));

//for each four sided face of the cube
vector *pointlist[4];
vector plnorm = orient.vec.fvec;
pointlist[0] = &cube_point[4];
pointlist[1] = &cube_point[6];
pointlist[2] = &cube_point[5];
pointlist[3] = &cube_point[7];
if(fvi_segment_plane(poly_point, &cube_point[5], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
vm_vec_negate(&plnorm);
pointlist[0] = &cube_point[0];
pointlist[1] = &cube_point[3];
pointlist[2] = &cube_point[1];
pointlist[3] = &cube_point[2];
if(fvi_segment_plane(poly_point, &cube_point[0], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out

vector veca;
vector vecb;

veca = orient.vec.uvec;
vecb = orient.vec.rvec;
vm_vec_negate(&veca);
vm_vec_avg(&plnorm, &veca, &vecb);

vm_vec_normalize(&plnorm);
pointlist[0] = &cube_point[2];
pointlist[1] = &cube_point[1];
pointlist[2] = &cube_point[5];
pointlist[3] = &cube_point[6];
if(fvi_segment_plane(poly_point, &cube_point[5], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
vm_vec_negate(&plnorm);
pointlist[0] = &cube_point[3];
pointlist[1] = &cube_point[0];
pointlist[2] = &cube_point[4];
pointlist[3] = &cube_point[7];
if(fvi_segment_plane(poly_point, &cube_point[0], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out

veca = orient.vec.uvec;
vecb = orient.vec.rvec;
vm_vec_avg(&plnorm, &veca, &vecb);

vm_vec_normalize(&plnorm);
pointlist[0] = &cube_point[2];
pointlist[1] = &cube_point[0];
pointlist[2] = &cube_point[4];
pointlist[3] = &cube_point[6];
if(fvi_segment_plane(poly_point, &cube_point[0], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
vm_vec_negate(&plnorm);
pointlist[0] = &cube_point[3];
pointlist[1] = &cube_point[1];
pointlist[2] = &cube_point[5];
pointlist[3] = &cube_point[7];
if(fvi_segment_plane(poly_point, &cube_point[5], &plnorm, &start, &end, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 4, pointlist, &plnorm, NULL, NULL, NULL))//then see if it is on the face
return 1;//and if it is, then get out
mprintf(("leaveing decal_intersect_seg_with_cube\n"));

return 0;//it couldn't find any

}

int decal_intersect_poly_with_cube(vector * poly_point, vector point[3], vector cube_point[8], int ints){
mprintf(("entering decal_intersect_poly_with_cube\n"));

vector plnorm;
vector *pointlist[3];
for(int i = 0; i<3; i++)pointlist[i] = &point[i];
vm_vec_perp(&plnorm, &point[0], &point[1], &point[2]);

vector pnt1 = cube_point[0];
vector pnt2 = cube_point[2];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face, and this isn't the last one
return 1;//and if it is, then get out

pnt1 = cube_point[2];
pnt2 = cube_point[1];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[1];
pnt2 = cube_point[3];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[3];
pnt2 = cube_point[0];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[0];
pnt2 = cube_point[4];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[2];
pnt2 = cube_point[6];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[1];
pnt2 = cube_point[5];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[3];
pnt2 = cube_point[7];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[4];
pnt2 = cube_point[6];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[6];
pnt2 = cube_point[5];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[5];
pnt2 = cube_point[7];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

pnt1 = cube_point[7];
pnt2 = cube_point[4];
if(fvi_segment_plane(poly_point, &point[0], &plnorm, &pnt1, &pnt2, 0.0) == 1)//see if the segment intersecs the plane
if(fvi_point_face(poly_point, 3, pointlist, &plnorm, NULL, NULL, NULL) && (0 != ints--))//then see if it is on the face
return 1;//and if it is, then get out

mprintf(("leaveing decal_intersect_poly_with_cube\n"));

return 0;
}


and these are the current versions of the data types
Code: [Select]
typedef struct decal_model{ //this will store a triangulated version of the ships polygons
struct{
int point[3]; //an index to the vert list-Bobboau
vector center; //the center of the poly
float radius; //the max radius of the poly
}poly[800];
vector vert[1200]; //the defpoints-Bobboau
int n_polys;
}decal_model;

//extern decal_model d_model;

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;
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
AIEE! Too much code! What does it all mean?
"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
it means cliped decals, eventualy
though right now it means a crash as soon as any thing tries to read the data in the tdec (temporary decal model)
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

  
haveing problems with something, any help
Quote
Originally posted by GalacticEmperor
AIEE! Too much code! What does it all mean?


And Bob wonders why nobody replies....

For the part I do understand.. Great work!...
As for The Day I am going to understand The Code, that wil be the day Volition's freespace 5 wil be going gold after i bought them out and put them to work on the freespace series
;)