UV layout issue for custom geometry

Software: Away3D 4.x

oh_meeeeee, Newbie
Posted: 29 October 2012 10:58 PM   Total Posts: 7

Hey everyone,

I am writing the following code to create custom geometry, which is basically few planes beside each other - as seen in the attached image.

PROBLEM:
The way I have created the UVs is not giving me the desired result. Current code applies a planner UV to each plane. Rather I want to apply a single UV for the entire mesh - please see attached image

Any pointers on how to achieve this. Appreciate your time and efforts.

Thanks a lot,
ak

var geometry:Geometry = new Geometry();
var 
subGeometry:SubGeometry = new SubGeometry();
var 
vertices:Vector.<Number> = new Vector.<Number>();

vertices.push( -100,  100);
vertices.push(  100,  100);
vertices.push(  100, -100);
vertices.push( -100, -100);

vertices.push100,  100);
vertices.push(  200,  100);
vertices.push(  20080);
vertices.push10080);

vertices.push200,  100);
vertices.push(  400,  100);
vertices.push(  400, -100);
vertices.push200, -100);

var 
indices:Vector.<uint> = new Vector.<uint>();
for (var 
i:int 0<= vertices.length/4i+=4{
 indices
.pushi1);
 
indices.pushi2);
}

var rawUvData:Vector.<Number>
 
rawUvData Vector.<Number>([0010110100101101,00101101]);
 
subGeometry.updateUVData(rawUvData);  

//make it double sided
indices indices.concatindices.concat().reverse() );
subGeometry.updateIndexDataindices );

geometry.addSubGeometrysubGeometry );

subGeometry.autoDeriveVertexTangents  true;
subGeometry.autoDeriveVertexNormals true;

var 
mesh:Mesh = new Mesh(geometrygradMat);
mesh.scale(2);
view.scene.addChildmesh ); 

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X