Chances are high you do not respect a clockwize system in your code...
the face order seams shifted. Of course the image is not the best one
to say for sure...
On otherhand, why don't you alter the Cube class?
The way I see it, you would just need to add a simple linecross code
to the class to define the new side lines.
Then the cube/trapezoid would keep its 3 mappings and subdivisions and
all other properties...
Another fast way to do this is simply to make a Cube,
sortOn vertices on the axis you want, then calculate diff in percent
from start/center/end (factor/1/factor) and multiple all vertices
sorted on axis you have selected.
this approach would also work on 2 axes, allowing shapes such as 4
sides pyramides.
Fabrice
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?