UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

33 lines (25 loc) 886 B
import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js"; /** * * @param {THREE.Material} material * @returns {Generator<{texture:THREE.Texture, name:string}>} */ export function* iterate_three_material_textures(material) { //patch textures const materialType = material.type; /** * * @type {TextureAttachment[]} */ const attachments = TextureAttachmentsByMaterialType[materialType]; if (attachments !== undefined) { for (let i = 0; i < attachments.length; i++) { const attachment = attachments[i]; const texture = attachment.read(material); if (texture === undefined || texture === null) { continue; } yield { texture, name: attachment.name }; } } }