IntNode.js 757 B

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