@@ -109,20 +109,31 @@ void rad::LightmapWriter::sampleLightmap(FaceLightmap &lm, size_t faceIdx, float
109
109
for (unsigned neighbourIdx : neighbours) {
110
110
Face &neighbour = m_RadSim.m_Faces [neighbourIdx];
111
111
112
- if (neighbourIdx != faceIdx && neighbour.hasLightmap () &&
113
- normalDir == !!neighbour.nPlaneSide ) {
114
- glm::vec3 neighbourSamples[4 ] = {};
115
- glm::vec2 luxelPosHere = neighbour.worldToFace (luxelWorldPos);
116
- sampleFace (neighbour, luxelPosHere, radius, glm::vec2 (filterk),
117
- neighbourSamples, weightSum, true );
118
-
119
- // Adjust lightstyles
120
- for (int i = 0 ; i < 4 ; i++) {
121
- int idx = neighbour.findLightstyle (face.nStyles [i]);
122
-
123
- if (idx != -1 ) {
124
- output[i] += neighbourSamples[idx];
125
- }
112
+ if (neighbourIdx == faceIdx || !neighbour.hasLightmap ()) {
113
+ continue ;
114
+ }
115
+
116
+ if (normalDir != !!neighbour.nPlaneSide ) {
117
+ // Wrong side
118
+ continue ;
119
+ }
120
+
121
+ if (!isNullVector (neighbour.vLightColor )) {
122
+ // Ignore texlights, they have insane color values
123
+ continue ;
124
+ }
125
+
126
+ glm::vec3 neighbourSamples[4 ] = {};
127
+ glm::vec2 luxelPosHere = neighbour.worldToFace (luxelWorldPos);
128
+ sampleFace (neighbour, luxelPosHere, radius, glm::vec2 (filterk),
129
+ neighbourSamples, weightSum, true );
130
+
131
+ // Adjust lightstyles
132
+ for (int i = 0 ; i < 4 ; i++) {
133
+ int idx = neighbour.findLightstyle (face.nStyles [i]);
134
+
135
+ if (idx != -1 ) {
136
+ output[i] += neighbourSamples[idx];
126
137
}
127
138
}
128
139
}
0 commit comments