簡體   English   中英

Away3D中的平鋪和拉伸

[英]Tiling and Stretching in Away3D

我無法將BitmapTexture設置為tile,或者作為另一種選擇,讓它延伸。 在這兩種情況下,目標都是覆蓋網格....

例如,像這樣創建材質和圓柱體(假設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部分和.animateUV只是猜測嘗試解決問題...

知道如何制作位圖圖塊嗎? 當我省略scaleUV時,它會顯示一次。 當我放入scaleUV(1,2)時,它確實有點瓦片,但是高度的一半並且兩者之間有間隙。

我只是想讓它順利平鋪。 如有必要,我可以重新創建紋理(現在它是64x64,但這是任意的)

即使cylinderGeometry的高度發生變化,它也需要平滑地平鋪(這可能是游戲的一部分)

同樣適用於拉伸。

謝謝!

你很親密:

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

如果您遇到問題,請告訴我:)每次想要更改材料的比例時,添加平鋪/拉伸都會將材料再次添加到具有新屬性的對象中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM