Dart DocumentationthreeExtrudeGeometryWorldUVGenerator

ExtrudeGeometryWorldUVGenerator class

class ExtrudeGeometryWorldUVGenerator {
 generateTopUV( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC) {
   var ax = geometry.vertices[ indexA ].x,
     ay = geometry.vertices[ indexA ].y,

     bx = geometry.vertices[ indexB ].x,
     by = geometry.vertices[ indexB ].y,

     cx = geometry.vertices[ indexC ].x,
     cy = geometry.vertices[ indexC ].y;

   return [
     new UV( ax, 1 - ay ),
     new UV( bx, 1 - by ),
     new UV( cx, 1 - cy )
   ];
 }

 generateBottomUV( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC) {
   return generateTopUV( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC );
 }

 generateSideWallUV( geometry, extrudedShape, wallContour, extrudeOptions,
                               indexA, indexB, indexC, indexD, stepIndex, stepsLength) {
   var ax = geometry.vertices[ indexA ].x,
     ay = geometry.vertices[ indexA ].y,
     az = geometry.vertices[ indexA ].z,

     bx = geometry.vertices[ indexB ].x,
     by = geometry.vertices[ indexB ].y,
     bz = geometry.vertices[ indexB ].z,

     cx = geometry.vertices[ indexC ].x,
     cy = geometry.vertices[ indexC ].y,
     cz = geometry.vertices[ indexC ].z,

     dx = geometry.vertices[ indexD ].x,
     dy = geometry.vertices[ indexD ].y,
     dz = geometry.vertices[ indexD ].z;

   if ( ( ay - by ).abs() < 0.01 ) {
     return [
       new UV( ax, az ),
       new UV( bx, bz ),
       new UV( cx, cz ),
       new UV( dx, dz )
     ];
   } else {
     return [
       new UV( ay, az ),
       new UV( by, bz ),
       new UV( cy, cz ),
       new UV( dy, dz )
     ];
   }
 }
}

Methods

dynamic generateBottomUV(geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC) #

generateBottomUV( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC) {
 return generateTopUV( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC );
}

dynamic generateSideWallUV(geometry, extrudedShape, wallContour, extrudeOptions, indexA, indexB, indexC, indexD, stepIndex, stepsLength) #

generateSideWallUV( geometry, extrudedShape, wallContour, extrudeOptions,
                             indexA, indexB, indexC, indexD, stepIndex, stepsLength) {
 var ax = geometry.vertices[ indexA ].x,
   ay = geometry.vertices[ indexA ].y,
   az = geometry.vertices[ indexA ].z,

   bx = geometry.vertices[ indexB ].x,
   by = geometry.vertices[ indexB ].y,
   bz = geometry.vertices[ indexB ].z,

   cx = geometry.vertices[ indexC ].x,
   cy = geometry.vertices[ indexC ].y,
   cz = geometry.vertices[ indexC ].z,

   dx = geometry.vertices[ indexD ].x,
   dy = geometry.vertices[ indexD ].y,
   dz = geometry.vertices[ indexD ].z;

 if ( ( ay - by ).abs() < 0.01 ) {
   return [
     new UV( ax, az ),
     new UV( bx, bz ),
     new UV( cx, cz ),
     new UV( dx, dz )
   ];
 } else {
   return [
     new UV( ay, az ),
     new UV( by, bz ),
     new UV( cy, cz ),
     new UV( dy, dz )
   ];
 }
}

dynamic generateTopUV(geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC) #

generateTopUV( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC) {
 var ax = geometry.vertices[ indexA ].x,
   ay = geometry.vertices[ indexA ].y,

   bx = geometry.vertices[ indexB ].x,
   by = geometry.vertices[ indexB ].y,

   cx = geometry.vertices[ indexC ].x,
   cy = geometry.vertices[ indexC ].y;

 return [
   new UV( ax, 1 - ay ),
   new UV( bx, 1 - by ),
   new UV( cx, 1 - cy )
 ];
}