Demos : Parsing 3DS
Code:
<html>
<head>
<script type="text/javascript" src="//lib.ivank.net/ivank.js"></script>
<script type="text/javascript" src="//k3d.ivank.net/K3D.js"></script>
<script type="text/javascript">
function Start()
{
K3D.load("lexus.3ds", loaded); // loading file ...
}
function loaded(data)
{
var m = K3D.parse.from3DS(data); // done !
console.log(m);
var stage = new Stage("c");
var s = new Sprite();
stage.addChild(s);
s.x = stage.stageWidth/2;
s.y = stage.stageHeight/2 + 200;
s.z = 300;
s.scaleX = s.scaleY = s.scaleZ = 10;
var mesh = m.edit.objects[0].mesh;
K3D.edit.transform(mesh.vertices, K3D.mat.rotateDeg(-90,0,0));
s.graphics.beginBitmapFill(new BitmapData("lexus.jpg"));
s.graphics.drawTriangles3D(mesh.vertices, mesh.indices, mesh.uvt);
stage.addEventListener(Event.ENTER_FRAME,
function(e) { s.rotationY += 0.01*(stage.mouseX - stage.stageWidth/2); } );
}
</script>
</head>
<body onload="Start();"><canvas id="c"></canvas></body>
</html>