【发布时间】:2023-03-11 04:07:01
【问题描述】:
所以在three.js 中,我们似乎需要使用texture.offset 和texture.repeat 属性来提取纹理(图集)的各个部分以应用于不同的网格。这很好用,但据我所知,不可能选择重复纹理的那部分?因为重复属性已被用于定义纹理子部分的“边缘”。 我使用 texture.offset 和 texture.repeat 提取纹理部分的代码:`
var texture = atlasTexture.clone();
texture.repeat.set(section.w / atlasTexture.width, section.h / atlasTexture.height);
texture.offset.x = ((section.x) / atlasTexture.width);
texture.offset.y = 1 - (section.h / atlasTexture.height) - (section.y / atlasTexture.height);
【问题讨论】:
-
查看example 了解如何使用纹理 altas。
标签: three.js textures texture-mapping texture-atlas