|
|
|
@ -9,14 +9,14 @@ bool sample_lightmap(const world_t* world, const face_t* face, const FaceBound& |
|
|
|
Vec3 minBounds = (bounds.lightmapBounds.min / 16).floor(); |
|
|
|
Vec3 maxBounds = (bounds.lightmapBounds.max / 16).ceil(); |
|
|
|
|
|
|
|
int width = (int)((maxBounds.x - minBounds.x) * 16.f); // extents[0]
|
|
|
|
int height = (int)((maxBounds.y - minBounds.y) * 16.f); // extents[1]
|
|
|
|
|
|
|
|
minBounds = minBounds * 16.f; // texturemins.xy
|
|
|
|
int width = ((int)maxBounds.x - (int)minBounds.x) * 16; // extents[0]
|
|
|
|
int height = ((int)maxBounds.y - (int)minBounds.y) * 16; // extents[1]
|
|
|
|
int minX = (int)minBounds.x * 16; // texturemins[0]
|
|
|
|
int minY = (int)minBounds.y * 16; // texturemins[1]
|
|
|
|
|
|
|
|
Vec3 uv = bounds.lightmapTransform.TransformPoint(point); |
|
|
|
int u = (int)(uv.x - minBounds.x); |
|
|
|
int v = (int)(uv.y - minBounds.y); |
|
|
|
int u = (int)uv.x - minX; |
|
|
|
int v = (int)uv.y - minY; |
|
|
|
|
|
|
|
if (u < 0 || v < 0 || u > width || v > height) |
|
|
|
return false; |
|
|
|
@ -312,6 +312,11 @@ SurfaceList group_surfaces(const world_t* world, const VertexFaces& vertexFaces) |
|
|
|
return surfaces; |
|
|
|
} |
|
|
|
|
|
|
|
unsigned char compute_faceVertex_light3(const world_t* world, const face_t* refFace, const FaceBounds& faceBounds, Vec3 point) |
|
|
|
{ |
|
|
|
return sample_lightmap(world, refFace, faceBounds.find(refFace)->second, point); |
|
|
|
} |
|
|
|
|
|
|
|
unsigned char compute_faceVertex_light4(const world_t* world, const face_t* refFace, const FaceBounds& faceBounds, Vec3 point) |
|
|
|
{ |
|
|
|
if (refFace->lightmap < 0) |
|
|
|
|