IntNode.js 904 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.copy = function ( source ) {
  15. THREE.InputNode.prototype.copy.call( this, source );
  16. this.value = source.value;
  17. };
  18. THREE.IntNode.prototype.toJSON = function ( meta ) {
  19. var data = this.getJSONNode( meta );
  20. if ( ! data ) {
  21. data = this.createJSONNode( meta );
  22. data.value = this.value;
  23. if ( this.readonly === true ) data.readonly = true;
  24. }
  25. return data;
  26. };
粤ICP备19079148号