I'm writing a modification of the VBSP compile tool and I want to
calculate the lightmap coordinates at a given point on a face. I've
worked out how to calculate the offset into the lighting lump (or at least
I think I have see *) however I don't know how you calculate the lightmap
coordinates from this. Can anyone help me out?
* This is how I think you calculate the offset into the lighting lump, pt
is the point on the surface I'm calculating it for and pFace is a pointer
to the face:
float Lu, Lv;
Lu = DotProduct(pt.Base( ),
texinfo[pFace->texinfo].lightmapVecsLuxelsPerWorldUnits[0])
+ texinfo[pFace->texinfo].lightmapVecsLuxelsPerWorldUnits[0][3];
Lv = DotProduct(pt.Base( ),
texinfo[pFace->texinfo].lightmapVecsLuxelsPerWorldUnits[1])
+ texinfo[pFace->texinfo].lightmapVecsLuxelsPerWorldUnits[1][3];
Lu -= pFace->m_LightmapTextureMinsInLuxels[0];
Lv -= pFace->m_LightmapTextureMinsInLuxels[1];
int du = clamp(Lu, 0, pFace->m_LightmapTextureSizeInLuxels[0]);
int dv = clamp(Lv, 0, pFace->m_LightmapTextureSizeInLuxels[1]);
unsigned int offset = pFace->lightofs + dv *
pFace->m_LightmapTextureSizeInLuxels[0] + du;
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders