![]() |
DDM君 (2009-06-09 09:20:40) |
不能移动UV,只能在固有(三维软件设置好的UV)的下,移动贴图。 下面这个类是 John Brookes君写的,看看有没有帮助。 /* * * UV1 UV0 * UV2 a X X X X X X X X X * a a X X * a a X face1 X * a a X X * a a X X * a face0 a X X * a a X X * a a a a a a a a X UV2 * UV0 UV1 * */ package { import flash.display.Bitmap; import flash.events.Event; import org.papervision3d.core.math.NumberUV; import org.papervision3d.materials.BitmapMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView; /** * ... * @author me */ public class UVMove extends BasicView { [Embed(source = "../lib/shrewby.jpg")] public var mainImage:Class; private var aPlane:Plane; private var bitMatImage:BitmapMaterial; public function UVMove():void { super (0, 0, true, true, "Target"); fluffykitten(); startRendering(); } private function fluffykitten():void { bitMatImage = new BitmapMaterial(Bitmap(new mainImage()).bitmapData, true); bitMatImage.doubleSided = true; aPlane = new Plane( bitMatImage, 569, 441 ); scene.addChild(aPlane); } override protected function onRenderTick(event:Event=null):void { aPlane.yaw(-1); moveUV((viewport.mouseX -(viewport.width/2))/ -1000, (viewport.mouseY -(viewport.height/2))/ 1000 ); super.onRenderTick(event); } private function moveUV(mX:Number, mY:Number):void { aPlane.geometry.faces[0].uv = [new NumberUV(0 + mX, 0 + mY), new NumberUV(1 + mX, 0 + mY), new NumberUV(0 + mX, 1 + mY)]; aPlane.geometry.faces[1].uv = [new NumberUV(1 + mX, 1 + mY), new NumberUV(0 + mX, 1 + mY), new NumberUV(1 + mX, 0 + mY)]; bitMatImage.resetUVS(); } } } |
![]() |
xixidao (2009-06-09 10:30:16) |
这个功能我本身也可以实现,但我是想移动模型上的UV哈哈 |
![]() |
DDM君 (2009-06-10 09:33:11) |
正确的移动UV到不是特别可能哈,移UV就跟移顶点一样属于核心操作,而且实际用途也不佳,因为点太多。 |
|
|