HTML5+CSS on Canvas 3D WebGL (TM) Library
 

UV Mapping

If the 3D Model contains a material named "HTML" as discussed in HTML Material and in addition texture coordinates (UV Coordinates) then taccgl™ uses these for mapping the HTML element on the surfaces of the 3D model. This only works for surfaces of material "HTML", UV coordinates of all other surfaces are currently ignored.

For example this scene contains a sphere of material HTML. The following examples show this scene. It is associated with an hidden HTML element named "pinned", which is subsequently mapped on the Plane.

var to=taccgl.objFile().read('/objtest/uvsphere1.obj',false); to.mtl.ambientAdjust(0.4);
var a=taccgl.a("Layout",to.objs("Sphere")).paint().modFit("mmF","xy").dur(5).start();
RUN
var to=taccgl.objFile().read('/objtest/uvsphere1.obj',false); to.mtl.ambientAdjust(0.4);
var a=taccgl.actor("Layout",to.objs("Sphere")).modFit("mmm","xy").rotateMiddle(0,0.7,0.7).dur(5).start();
RUN
var to=taccgl.objFile().read('/objtest/uvsphere1.obj',false); to.mtl.ambientAdjust(0.4);
var a=taccgl.a("ex4",to.objs("Sphere")).mapActor("Layout").modFit("mmm","xy").
to(0,0,-2000).rotateMiddle(0,0.7,0.7).dur(5).start();
RUN

All the methods used for coloring and texturing like color, blend, mapActor etc. become operational now and apply to the surfaces with HTML material. All other surfaces of the 3D Model keep colors and textures as defined in the 3D Model.

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:taccgl3DObject.material
Previous Page: HTML Material