Hi Fabrice, I updated me code with your suggestion. Thanks for code. Now I see that rectangular faces has parallel lines, but in "trapezoid" faces, lines aren't parallel. My updated demo:
http://marcosamedida.tecnopixel.com/away3d.swf I think that in your demo "F" char is deformed too. Thanks for helping me. Regards. Jordi. On 3 nov, 12:20, Fabrice <[email protected]> wrote: > here preview of this codehttp://www.closier.nl/playground/cube_trapeze.swf > > cheers, > Fabrice > > On Nov 3, 12:10 pm, Fabrice3D <[email protected]> wrote: > > > > > hey Jordi, > > this was bugging me, > > so spend few minutes to see... > > > works perfectly :) > > > Fabrice > > > code : > > > private function buildTest():void > > { > > var mat:BitmapMaterial = new > > BitmapMaterial(somebitmapdatafor > > map6); //for test on my machine > > > var subd:int = 6; > > var cube:Cube = new Cube({map6:true, width:1500, > > height:1500, depth: > > 1500, material:mat, segmentsW:subd, segmentsH:subd}); > > > var startH:Number = 1000; > > var factor:Number = 1500/startH; > > var step:Number = factor/subd; > > > var sortedV:Array = (cube as > > Mesh).vertices.concat(); > > sortedV.sortOn("x", 16); > > > var basex:Number; > > var l:int = sortedV.length; > > > var dico:Dictionary = new Dictionary(); > > > for (var i:int = 0;i< l;++i){ > > basex = Math.floor(sortedV[i].x); > > while(i<l && Math.floor(sortedV[i].x) == > > basex){ > > //make sure its applied only once > > if(!dico[sortedV[i]]){ > > dico[sortedV[i]] = true; > > (cube as > > Mesh).updateVertex(sortedV[i], sortedV[i].x, > > sortedV[i].y*factor, sortedV[i].z); > > } > > > i++; > > } > > i--; > > > if(!dico[sortedV[i]]){ > > dico[sortedV[i]] = true; > > (cube as > > Mesh).updateVertex(sortedV[i], sortedV[i].x, > > sortedV[i].y*factor, sortedV[i].z); > > } > > > factor+= step; > > > } > > > this.scene.addChild(cube); > > } > > > On Nov 3, 2009, at 10:10 AM, jordi monty wrote: > > > > Hi, > > > I've a cube that I transform to a "trapezoid": > > > > cube = new Cube( {ownCanvas:true}); > > > cube.width=5; > > > cube.height=20; > > > cube.depth=2; > > > > cube.vertices[0].y*=0.5; > > > cube.vertices[1].y*=0.5; > > > cube.vertices[4].y*=0.5; > > > cube.vertices[5].y*=0.5; > > > > I want to apply this matrix texture: > > > >http://marcosamedida.tecnopixel.com/texture.jpg > > > > When my cube is a cube, the texture remains as a matrix, but when I > > > modify the vertices, the texture is deformed. > > > You can see it: > > >http://marcosamedida.tecnopixel.com/away3d.swf > > > > I've also tried with TransformBitmapMaterial with globalprojections > > > and projectionvector, but I cannot get it. > > > > Can anyone help me,please?
