46
Ask a Question / Re: Skewing / flipping actors
« on: July 16, 2020, 11:04:48 pm »Max,
That code only resizes the image and does not change the perspective.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
// skew function
pProjection = new PerspectiveProjection();
pProjection.fieldOfView = 54;
proj = pProjection.toMatrix3D();
mat.identity();
mat.appendRotation(degrees, Vector3D.Y_AXIS);
mat.appendRotation(0, Vector3D.X_AXIS);
mat.appendTranslation(0,0, 480.245531742791);
mat.append(proj);
projectedPoints = new Vector<Float>();
Utils3D.projectVectors(mat, vertices, projectedPoints, uvt);
plane.graphics.clear();
plane.graphics.beginBitmapFill(texture, null, false, true);
plane.graphics.drawTriangles(projectedPoints, indices, uvt, TriangleCulling.NONE);
plane.graphics.endFill();
return plane;
var bitm:BitmapData=sourceBitmapData.img.bitmapData;
var spr:Sprite = skew(Std.int(rotY), bitm);
var newBitmapWrapper=new BitmapWrapper(new Bitmap(new BitmapData(sw,sh)));
// Shift towards top
var rect = spr.getBounds(spr.parent);
var matrix = spr.transform.concatenatedMatrix;
matrix.translate(-rect.left, -rect.top); // move image to 0,0 : if you ommit this you don't see a thing
matrix.translate((sw/2)-((rect.width)/2), (sh-rect.height)/2); // move it to the center of the image
drawingText(spr,"W:"+Math.round(rect.width)+" H:"+Math.round(rect.height));
newBitmapWrapper.img.bitmapData.draw(spr,matrix);
matrix.translate(-rect.left, -rect.top); // move image to 0,0 : if you ommit this you don't see a thing
matrix.translate((sw/2)-((rect.width)/2), (sh-rect.height)/2); // move it to the center of the image
When you remove the getBounds movement you don't see anything on the bitmap that will be attached to the actor.mtllib reset.mtl
You point to the textfile that has texture information in it. This file also needs to be on a web-based location!o resetobject
If you have multiple OBJ files you need to be aware that this 'o' name is unique. Otherwise it will add all the OBJ files together.usemtl color_name
This part is your material. Previously only texture references could be used.