2013-08-20 49 views
4

我無法獲得BitmapTexture平鋪,或作爲另一個選項,讓它拉伸。在兩種情況下,目標是覆蓋網狀....平鋪和拉伸3 3

例如,材料和氣缸都是這樣創建的(假設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只是一個猜測,試圖解決問題...

任何想法如何使位圖瓦片?當我忽略了尺度UV時,它會顯示一次。當我放入刻度尺UV(1,2)時,它確實有點像瓷磚,但高度只有一半,並且有間隙。

我只想讓它平滑地平鋪。如果需要的話我可以重新紋理(現在它64×64,但這是任意)

它還需要瓷磚順利即使cylinderGeometry將在高度變化(這可能發生,因爲遊戲的一部分)

同當然適用於拉伸。

謝謝!

回答

0

你接近:

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); 

讓我知道,如果你有問題:) 添加要再次改變材料拼接的規模/拉伸重新添加該物質對對象每次與其新的屬性。

+0

給你的獎金,因爲你是唯一一個回答:) 真相在最後,問題是我的紋理 - 它不是從閃光輸出作爲2的乾淨力量,所以有黑色像素來填補空白;) – davidkomer

+0

大聲笑,這是一個簡單的解決方案時,它會傷害,Away3d文檔可以改善一點,我發現教程和信息總是過時或信息像你經歷失蹤... – joshua