I know OpenGL has such a thing as a "Texture Matrix" transforming uv
coordinates. That'd be more efficient, transferring computation to gpu
as much as possible to offload cpu. I guess you'd probably have to
write your own fragment shader program for that though and somehow
integrate it with Away3D4 ;o   No idea how to do that though :P

On 12 apr, 14:17, John Brookes <[email protected]> wrote:
> I would guess its better done though that AGAL thang but.
>
> I was playing about with shifting the UVs other day didnt do rotation.
>
> Make sure the bitmapmaterial has tile set to true.
>
> private function incrementUV(m:Mesh, pos:Point):void
> {
>     var v:Vector.<Number> = SubGeometry(m.geometry.subGeometries[0]).UVData;
>     for (var i:int = 0; i < v.length; i=i+2)
>     {
>         v[i] += pos.x;
>         v[i + 1] += pos.y;
>         SubGeometry(m.geometry.subGeometries[0]).updateUVData(v);
>     }
>
> }
>
> private function scaleUV(m:Mesh, pos:Point):void
> {
>     var v:Vector.<Number> = SubGeometry(m.geometry.subGeometries[0]).UVData;
>     for (var i:int = 0; i < v.length; i=i+2)
>     {
>         v[i] += ( pos.x - 1) * 0.5;
>         v[i + 1] += (pos.y - 1) * 0.5;
>
>         v[i] /= pos.x
>         v[i + 1] /= pos.y;
>
>         SubGeometry(m.geometry.subGeometries[0]).updateUVData(v);
>     }
>
> }
>
> eg
> incrementUV(plane, new Point(0.01, 0.01));
> scaleUV(plane, new Point(0.99, 0.99));
>
> No idea how safe/good.
> was just playing about :)

Reply via email to