[Papervision3D] [SPAM] Re: Changing UV mapping at runtime

Jesse Ringrose jesse.ringrose at blastradius.com
Wed May 28 10:45:37 PDT 2008


If you're using a bitmap material, try calling yourMaterial.resetUVS();

-----Original Message-----
From: papervision3d-bounces at osflash.org
[mailto:papervision3d-bounces at osflash.org] On Behalf Of barbara
Sent: Wednesday, May 28, 2008 6:44 AM
To: papervision3D at osflash.org
Subject: [SPAM] Re: [Papervision3D] Changing UV mapping at runtime
Importance: Low


Unfortunately not, I've also tried to modify the uvs like this:

geometry.faces[0].uv = [t.uv00, t.uv01, t.uv02];
geometry.faces[1].uv = [t.uv10, t.uv11, t.uv12];
this.geometry.ready = true;

but it's still the same: in debugging mode, everything seems fine, the
Triangle3D's uvs are modified (uv0, uv1, uv2 and the uv array), but the
texture is still mapped the same old way on the plane. 

I'm sure there is just one small method to call or boolean to set in
order
for the Triangle3D to take into account the changes in the uvs, but I
can't
find it. And calling to new Triangle3D is way too costly with several
planes. :,(


Makc The Great wrote:
> 
> maybe this section of Triangle3D can help:
> 
> 
> 		public var uv0:NumberUV;
> 		public var uv1:NumberUV;
> 		public var uv2:NumberUV;
> 		
> 		private var _uvArray:Array;
> 		/**
> 		* An array of {x,y} objects for the corresponding UV
pixel
> coordinates of each triangle vertex.
> 		*/
> 		public function set uv(uv:Array):void
> 		{
> 			uv0 = NumberUV(uv[0]);
> 			uv1 = NumberUV(uv[1]);
> 			uv2 = NumberUV(uv[2]);
> 			_uvArray = uv;
> 		}
> 
> 
> On 5/28/08, barbara <barbara.yersin at gmail.com> wrote:
>>
>> Ok my euphoria left me quite quickly when I tried to work with
several
>> planes
>> at the same time.
>> It is VERY slow. The call to "new Triangle3D" is slowing down
everything.
>>
>> Is there no other possibility ? Having to create new Triangles3D at
each
>> iteration just to update their uvs is really painful.
>>
> 
>> > a geometry has a "faces" array, which I was completely re-writing
(see
>> > code in previous post), but it also possesses a "vertices" array. I
>> think
>> > somehow the vertices of each face in the "faces" array are related
to
>> the
>> > vertices in the "vertices" array (if you follow me)...
>> > So, in summary, I have directly used the vertices in
>> "geometry.vertices"
>> > to re-create the "geometry.faces". Here is an example:
>> >
>> > geometry.faces.push(new Triangle3D(this, [geometry.vertices[0],
>> > geometry.vertices[2], geometry.vertices[1]], this.material,
>> > [uv00,uv01,uv02]));
>> >
>> > You see, I use the vertices of geometry.vertices to re-create the
faces
>> > and it works fine now!
>> >>
>> >> Hello,
>> >>
>> >> I have exactly the same problem. I am creating a Plane composed of
2
>> >> Triangle3D and I want to change its uvs at runtime. I've tried to
do
>> as
>> >> you said: recreating the Triangles 3D and setting the ready
parameter
>> of
>> >> the geometry to true, but now the plane just disappears.
>> >>
>> >> Here is the portion of code called at every frame:
>> >>
>> >>                 var face0:Triangle3D = geometry.faces[0];
>> >>                 var face1:Triangle3D = geometry.faces[1];
>> >>
>> >>
>> >>                 var v00:Vertex3D = new Vertex3D(face0.v0.x,
>> face0.v0.y,
>> >> face0.v0.z);
>> >>                 var v10:Vertex3D = new Vertex3D(face0.v1.x,
>> face0.v1.y,
>> >> face0.v1.z);
>> >>                 var v01:Vertex3D = new Vertex3D(face0.v2.x,
>> face0.v2.y,
>> >> face0.v2.z);
>> >>                 var v11:Vertex3D = new Vertex3D(face1.v0.x,
>> face1.v0.y,
>> >> face1.v0.z);
>> >>
>> >>                 var uv00:NumberUV = new NumberUV(myNewUV00.x,
>> >> myNewUV00.y);
>> >>                 var uv10:NumberUV = new NumberUV(myNewUV10.x,
>> >> myNewUV10.y);
>> >>                 var uv01:NumberUV = new NumberUV(myNewUV01.x,
>> >> myNewUV01.y);
>> >>                 var uv11:NumberUV = new NumberUV(myNewUV11.x,
>> >> myNewUV11.y);
>> >>
>> >>                 geometry.faces.length = 0;
>> >>                 geometry.faces.push(new Triangle3D(this,
>> [v00,v10,v01],
>> >> this.material, [uv00, uv10, uv01]));
>> >>                 geometry.faces.push(new Triangle3D(this,
>> [v11,v01,v10],
>> >> this.material, [uv11,uv01,uv10]));
>> >>                 this.visible = true;
>> >>
>> >>                 this.geometry.ready = true;
>> >>
>> >> please, let me know if you did the same or where I am wrong.
>> >>
>> >> Thanks a lot!
>> >>
>> >> Barbara.
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Changing-UV-mapping-at-runtime-tp16231217p17509570
.html
>> Sent from the Papervision3D mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D at osflash.org
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
> 
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> 
> 

-- 
View this message in context:
http://www.nabble.com/Changing-UV-mapping-at-runtime-tp16231217p17513009
.html
Sent from the Papervision3D mailing list archive at Nabble.com.


_______________________________________________
Papervision3D mailing list
Papervision3D at osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



More information about the Papervision3D mailing list