Permalink
Browse files

Add morph normals and morph targets to binary loader

  • Loading branch information...
1 parent 30ffd32 commit 192f16b145702535fca259994d7db659af011305 @patrickkidd committed May 22, 2012
Showing with 334 additions and 24 deletions.
  1. +12 −2 src/loaders/BinaryLoader.js
  2. +322 −22 utils/exporters/obj/convert_obj_three.py
@@ -38,7 +38,7 @@ THREE.BinaryLoader.prototype.load = function( url, callback, texturePath, binary
THREE.BinaryLoader.prototype.loadAjaxJSON = function ( context, url, callback, texturePath, binaryPath, callbackProgress ) {
var xhr = new XMLHttpRequest();
-
+
xhr.onreadystatechange = function () {
if ( xhr.readyState == 4 ) {
@@ -71,14 +71,15 @@ THREE.BinaryLoader.prototype.loadAjaxBuffers = function ( json, callback, binary
url = binaryPath + "/" + json.buffers;
var length = 0;
+ var context = this;
xhr.onreadystatechange = function () {
if ( xhr.readyState == 4 ) {
if ( xhr.status == 200 || xhr.status == 0 ) {
- THREE.BinaryLoader.prototype.createBinModel( xhr.response, callback, texturePath, json.materials );
+ context.createBinModel( xhr.response, callback, texturePath, json.materials );
} else {
@@ -116,8 +117,13 @@ THREE.BinaryLoader.prototype.loadAjaxBuffers = function ( json, callback, binary
// Binary AJAX parser
+
+THREE.BinaryLoader.prototype.init_extra_data = function ( data, start, geometry ) { }
+
THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texturePath, materials ) {
+ var context = this;
+
var Model = function ( texturePath ) {
var scope = this,
@@ -179,6 +185,8 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
start_quad_flat_uv = start_quad_smooth + len_quad_smooth + handlePadding( md.nquad_smooth * 2 );
start_quad_smooth_uv= start_quad_flat_uv + len_quad_flat_uv + handlePadding( md.nquad_flat_uv * 2 );
+ start_extra_data = start_quad_smooth_uv + len_quad_smooth_uv + handlePadding( md.nquad_smooth_uv * 2 );
+
// have to first process faces with uvs
// so that face and uv indices match
@@ -195,6 +203,8 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
init_quads_flat( start_quad_flat );
init_quads_smooth( start_quad_smooth );
+
+ context.init_extra_data( data, start_extra_data, this )
this.computeCentroids();
this.computeFaceNormals();
Oops, something went wrong.

0 comments on commit 192f16b

Please sign in to comment.