Ups sorry, it's better to put "mat = new BitmapMaterial()" outside the repetition, if you use only one material for all faces.
On Thu, Jan 6, 2011 at 7:29 PM, Aji Pamungkas <[email protected]>wrote: > Hi Fabio, > > I guess you haven't described uv-mapping in your "face" :p > And maybe, it's better when your "face" is a triangle. > > Something like this : > > mesh = new Mesh(); > > repeat until max number of triangle faces: > v0 = new Vertex(x,y,z); // x,y,z are the locations of your vertex > v1 = new Vertex(x,y,z); > v2 = new Vertex(x,y,z); > mat = new BitmapMaterial(); > uv1 = new UV(uv00,uv01); // u, v are the mapping of your "face" to the > texture > uv2 = new UV(uv10,uv11); > uv3 = new UV(uv20,uv21); > mesh.addChild(new Face(v0,v1,v2,mat,uv1,uv2,uv3)); > > > On Thu, Jan 6, 2011 at 6:03 PM, Fabio Silva <[email protected]> wrote: > >> Hi, >> >> when creating a face like: >> >> var f:Face = new Face(); >> f.moveTo(0, 0, 0); >> f.lineTo(50, -50, 0); >> f.lineTo(100, -50, 0); >> f.lineTo(100, 0, 0); >> f.lineTo(50, 50, 0); >> f.lineTo( -50, 50, 0); >> f.lineTo( -100, 0, 0); >> f.lineTo( -100, -50, 0); >> f.lineTo( -50, -50, 0); >> >> var m:Mesh = new Mesh(); >> m.addFace(f); >> >> var mat:BitmapMaterial = new BitmapMaterial(Cast.bitmap(terrain)); >> mat.repeat = true; >> f.material = mat; >> >> when applying the BitmapMaterial to the face the face is clipped to a >> triangle formed with the first two lines. >> Is there any other way to apply the material or create this type of >> faces? >> >> >> Regards, >> >> Fabio > > > > > -- > Aji Pamungkas > > -- Aji Pamungkas
