|
2120 | 2120 |
|
2121 | 2121 | if (Array.isArray( child.material )) { |
2122 | 2122 | child.material.forEach( mtrl => { |
2123 | | - if (mtrl.aoMap && child.geometry.attributes.uv1 === undefined && child.geometry.attributes.uv !== undefined) { |
| 2123 | + set_texture_colorSpace( mtrl ); |
| 2124 | + |
| 2125 | + if ((mtrl.aoMap || mtrl.lightMap) && child.geometry.attributes.uv1 === undefined && |
| 2126 | + child.geometry.attributes.uv !== undefined) { |
| 2127 | + |
2124 | 2128 | child.geometry.setAttribute( 'uv1', child.geometry.attributes.uv ); |
2125 | | - mtrl.aoMap.channel = 1; |
| 2129 | + if (mtrl.aoMap) mtrl.aoMap.channel = 1; |
| 2130 | + if (mtrl.lightMap) mtrl.lightMap.channel = 1; |
2126 | 2131 | } |
2127 | 2132 |
|
2128 | | - set_texture_colorSpace( mtrl ); |
2129 | | - |
2130 | 2133 | mtrl.vertexColors = child.geometry.hasAttribute( 'color' ); |
2131 | 2134 | if (child.isPoints) mtrl.size = isMobile === true ? 0.8 : 1.25; |
2132 | 2135 |
|
2133 | 2136 | mtrl.needsUpdate = true; |
2134 | 2137 | }); |
2135 | 2138 | } else { |
2136 | | - if (child.material.aoMap && child.geometry.attributes.uv1 === undefined && child.geometry.attributes.uv !== undefined) { |
| 2139 | + set_texture_colorSpace( child.material ); |
| 2140 | + |
| 2141 | + if ((child.material.aoMap || child.material.lightMap) && child.geometry.attributes.uv1 === undefined && |
| 2142 | + child.geometry.attributes.uv !== undefined) { |
| 2143 | + |
2137 | 2144 | child.geometry.setAttribute( 'uv1', child.geometry.attributes.uv ); |
2138 | | - child.material.aoMap.channel = 1; |
| 2145 | + if (child.material.aoMap) child.material.aoMap.channel = 1; |
| 2146 | + if (child.material.lightMap) child.material.lightMap.channel = 1; |
2139 | 2147 | } |
2140 | 2148 |
|
2141 | | - set_texture_colorSpace( child.material ); |
2142 | | - |
2143 | 2149 | child.material.vertexColors = child.geometry.hasAttribute( 'color' ); |
2144 | 2150 | if (child.isPoints) child.material.size = isMobile === true ? 0.8 : 1.25; |
2145 | 2151 |
|
|
0 commit comments