How would I go to do that? All plane gives me is a normal. Say I wanted to spawn a particle right in the pixel center of each repeated texture, like say fire from lava, smoke from demn faces, blood out of wall jesuses and jesus switches, etc... there's got to be SOME clue in the leaf data to do this in world space.
NOT GL btw.
Determining surface center of plane
Determining surface center of plane
i should not be here
Re: Determining surface center of plane
I'm giving a GLQuake example but this could be converted to software.
To draw a texture poly, you have to know sl, sh, tl, th.
If you are drawing a polygon where sl < 0.5 < sh and tl < 0.5 < th, you have a polygon that contains the center of the texture. So calculate the x,y,z for s = 0.5 and t = 0.5.
And then you have what you want. Even though I'm talking GL here, software has to know the texture coordinates.
To draw a texture poly, you have to know sl, sh, tl, th.
If you are drawing a polygon where sl < 0.5 < sh and tl < 0.5 < th, you have a polygon that contains the center of the texture. So calculate the x,y,z for s = 0.5 and t = 0.5.
And then you have what you want. Even though I'm talking GL here, software has to know the texture coordinates.
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Re: Determining surface center of plane
There are no brush polygons in software.
I wonder if anyone ever implemented that function though
Code: Select all
void D_DrawPoly (void)
{
// this driver takes spans, not polygons
}
i should not be here
Re: Determining surface center of plane
If you really wanted it, you pull out the calculations in GLQuake's BuildSursurfceDisplayList, which go like this in a very condensed version (using surface info that should be available in the software renderer from model load) ...
void BuildSursurfceDisplayList (model_t *curmodel, msurface_t *surf)
Code: Select all
float *vec, s, t;
for (i=0 ; i < surf->numedges ; i++)
{
int lindex = curmodel->surfedges[surf->firstedge + i];
medge_t *r_pedge = lindex > 0 ? &pedges[lindex] : &pedges[-lindex];
vec = lindex > 0 ? curmodel->vertexes[r_pedge->v[0]].position : curmodel->vertexes[r_pedge->v[1]].position;
s = (DotProduct (vec, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]) / surf->texinfo->texture->width;
t = (DotProduct (vec, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]); / surf->texinfo->texture->height;
}
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Re: Determining surface center of plane
Pixel center of each texture... Pick it up from the texture source coords as it proceeds through spans. Has nothing to do with the title of this thread.