Hello all
I want to build a simple cube mapping viewer meaning viewer is in
center of a 3D cube, textured with cube mapping and perspective. The
cube rotates.
here is how my code looks like for displaying LEFT face
root.transform.perspectiveProjection.fieldOfView = 55;
root.transform.perspectiveProjection.projectionCenter =
new Point(0,0);
mat = new Matrix3D();
mat.identity();
mat.prepend(root.transform.perspectiveProjection.toMatrix3D().clone());
mat.prependRotation(-90, Vector3D.Y_AXIS);
mat.prependTranslation(0,0,t);
var t:Number=picWidth/2;
verts = new Vector.<Number>();
verts.push(-t,-t, 0, t,-t,0, t,t,0, -t,t,0);
var uvts:Vector.<Number> = new Vector.<Number>();
uvts.push(0,0,0 , 1,0,0, 1,1,0, 0,1,0);
var projecteds:Vector.<Number> = new Vector.<Number>();
projecteds.push(0,0, 0,0, 0,0, 0,0);
var indices:Vector.<int> = new Vector.<int>();
indices.push(0,1,3, 1,2,3);
Utils3D.projectVectors(mat, verts, projecteds, uvts);
cubeShape.graphics.beginBitmapFill(imageLoader.bitmapData[bmp]);
cubeShape.graphics.drawTriangles(projecteds, indices,
uvts);
cubeShape.graphics.endFill();
The problem:
Face is displayed, seem to be rotated correctly BUT....it goes to
infinity....flash renders it on LEFT and RIGHT sides in a loop
shrinking to infinity.
When looking to the transformation matrix the dump looks kinda weard
and something like
rawData = Vector.<Number> (@373d641)
[0] = 2.9405585632484924E-14
[1] = 0
[2] = 0.25
[3] = 1
[4] = 0
[5] = 480.24554443359375
[6] = 0
[7] = 0
[8] = -480.24554443359375
[9] = 0
[10] = 1.5307579422779716E-17
[11] = 6.123031769111886E-17
[12] = 0
[13] = 0
[14] = 0
[15] = 0
fixed = false
length = 16 [0x10]
These values happen after these 2 operations
mat.prepend(root.transform.perspectiveProjection.toMatrix3D().clone());
mat.prependRotation(-90, Vector3D.Y_AXIS);
Well...hope someone can help. Im kinda stuck
Thanks
Mihai
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders