зеркало из https://github.com/mozilla/Spoke.git
Merge pull request #971 from mozilla/feature/fix-lightmap-support
Fix lightmap support and add support for lightmap intensity
This commit is contained in:
Коммит
f3a350bb64
|
@ -59,7 +59,9 @@ async function meshBasicMaterialComparator(group, a, b) {
|
|||
a.side === b.side &&
|
||||
a.transparent === b.transparent &&
|
||||
a.color.equals(b.color) &&
|
||||
(await compareTextures(imageHashes, a.map, b.map))
|
||||
a.lightMapIntensity === b.lightMapIntensity &&
|
||||
(await compareTextures(imageHashes, a.map, b.map)) &&
|
||||
(await compareTextures(imageHashes, a.lightMap, b.lightMap))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -120,6 +122,7 @@ export default class MeshCombinationGroup {
|
|||
material.aoMap = await dedupeTexture(imageHashes, textureCache, material.aoMap);
|
||||
material.normalMap = await dedupeTexture(imageHashes, textureCache, material.normalMap);
|
||||
material.emissiveMap = await dedupeTexture(imageHashes, textureCache, material.emissiveMap);
|
||||
material.lightMap = await dedupeTexture(imageHashes, textureCache, material.lightMap);
|
||||
}
|
||||
|
||||
await asyncTraverse(rootObject, async object => {
|
||||
|
|
|
@ -9,7 +9,8 @@ export class LightmapExporterExtension extends ExporterExtension {
|
|||
if (material.lightMap) {
|
||||
materialDef.extensions.MOZ_lightmap = {
|
||||
index: this.exporter.processTexture(material.lightMap),
|
||||
texCoord: 1
|
||||
texCoord: 1,
|
||||
intensity: material.lightMapIntensity
|
||||
};
|
||||
this.exporter.extensionsUsed.MOZ_lightmap = true;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ export class LightmapLoaderExtension extends LoaderExtension {
|
|||
const lightmap = getLightmap(materialDef);
|
||||
|
||||
if (lightmap) {
|
||||
material.lightMapIntensity = lightmap.intensity === undefined ? 1 : lightmap.intensity;
|
||||
await this.loader.assignTexture(material, "lightMap", lightmap, sRGBEncoding, RGBFormat);
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче