Matrix4Node.js 855 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. THREE.Matrix4Node = function ( matrix ) {
  5. THREE.InputNode.call( this, 'm4' );
  6. this.value = matrix || new THREE.Matrix4();
  7. };
  8. THREE.Matrix4Node.prototype = Object.create( THREE.InputNode.prototype );
  9. THREE.Matrix4Node.prototype.constructor = THREE.Matrix4Node;
  10. THREE.Matrix4Node.prototype.nodeType = "Matrix4";
  11. THREE.Matrix4Node.prototype.generateReadonly = function ( builder, output, uuid, type, ns, needsUpdate ) {
  12. return builder.format( "mat4( " + this.value.elements.join( ", " ) + " )", type, output );
  13. };
  14. THREE.Matrix4Node.prototype.toJSON = function ( meta ) {
  15. var data = this.getJSONNode( meta );
  16. if ( ! data ) {
  17. data = this.createJSONNode( meta );
  18. data.elements = this.value.elements.concat();
  19. if ( this.readonly === true ) data.readonly = true;
  20. }
  21. return data;
  22. };