我无法让 BitmapTexture 平铺,或者作为另一种选择,让它拉伸(stretch)。在这两种情况下,目标都是覆盖网格......
例如,一个 Material 和圆柱体是这样创建的(假设 preExistingBitmapData 是一个有效的 BitmapData):
poleMaterial = new TextureMaterial(new BitmapTexture(preExistingBitmapData),true, true);
poleMaterial.repeat = true;
poleMaterial.animateUVs = true;
var cG:CylinderGeometry = new CylinderGeometry(10, 10, 400);
var mesh:Mesh = new Mesh(cG, poleMaterial);
cG.topClosed = true;
cG.scaleUV(1, 2);
addChild(mesh);
.scaleUV 部分和 .animateUVs 只是尝试解决问题的猜测......
知道如何制作位图拼贴吗?当我省略 scaleUV 时,它会显示一次。当我放入 scaleUV(1,2) 时,它确实有点像瓷砖,但高度只有一半,中间有间隙。
我只是想让它平铺平铺。如有必要,我可以重新创建纹理(现在是 64x64,但这是任意的)
即使圆柱几何形状的高度会发生变化,它也需要平滑平铺(这可能是游戏的一部分)
当然,这同样适用于拉伸(stretch)。
谢谢!
最佳答案
你很接近:
var plane = new Mesh(new PlaneGeometry(3000,3000,30,30),new TextureMaterial(Cast.bitmapTexture(groundMaterial)));
plane.geometry.scaleUV(25, 25); // tiles my material of grass image 25x25
plane.material.repeat = true; //repeats the my material
scene.addchild( plane );
如果您有问题,请告诉我:)
要添加每次您想要更改 Material 平铺/拉伸(stretch)的比例时,请使用其新属性再次将 Material 重新添加到对象中。
关于actionscript-3 - Away3D 中的平铺和拉伸(stretch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18334722/