Tile and stretch in Away3D

I'm having trouble getting a BitmapTexture for fragmentation, or, as another option, getting it to stretch. In both cases, the goal is to cover the grid ....

For example, the material and cylinder are created like this (suppose preExistingBitmapData is a valid BitmapData):

poleMaterial = new TextureMaterial(new BitmapTexture(preExistingBitmapData),true, true); poleMaterial.repeat = true; poleMaterial.animateUVs = true; var cG:CylinderGeometry = new CylinderGeometry(10, 10, 400); var mesh:Mesh = new Mesh(cG, poleMaterial); cG.topClosed = true; cG.scaleUV(1, 2); addChild(mesh); 

the .scaleUV and .animateUV part is just a guess to try and fix the problem ...

Any idea how to make a bitmap? When I omit scaleUV, it shows it once. when I put in the UV (1,2) scale, it does look like a tile, but at half height and with gaps between them.

I just want it to stroke smoothly. I can update the texture if necessary (right now its 64x64, but this is arbitrary)

It should also iron smoothly, even if the height of the cylinder changes in height (this can happen as part of the game)

The same goes for stretching, of course.

Thanks!

+4
source share
1 answer

You are close:

 var plane = new Mesh(new PlaneGeometry(3000,3000,30,30),new TextureMaterial(Cast.bitmapTexture(groundMaterial))); plane.geometry.scaleUV(25, 25); // tiles my material of grass image 25x25 plane.material.repeat = true; //repeats the my material scene.addchild( plane ); 

Let me know if you have problems :) To add every time you want to scale the material, tile / stretch again add the material to the object with its new properties.

0
source

Source: https://habr.com/ru/post/1497992/


All Articles