Dies ist das Repository meines kleinen Portfolios.
Im Hintergrund läuft eine Planetensimulation, geschrieben in JavaScript und Three.js.
Die zu sehenden Texturen stammen von:
https://www.solarsystemscope.com/textures/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
956 B
77 lines
956 B
import { TempNode } from '../core/TempNode.js'; |
|
|
|
class SubSlotNode extends TempNode { |
|
|
|
constructor( slots ) { |
|
|
|
super(); |
|
|
|
this.slots = slots || {}; |
|
|
|
} |
|
|
|
getType( builder, output ) { |
|
|
|
return output; |
|
|
|
} |
|
|
|
generate( builder, output ) { |
|
|
|
if ( this.slots[ builder.slot ] ) { |
|
|
|
return this.slots[ builder.slot ].build( builder, output ); |
|
|
|
} |
|
|
|
return builder.format( '0.0', 'f', output ); |
|
|
|
} |
|
|
|
copy( source ) { |
|
|
|
super.copy( source ); |
|
|
|
for ( const prop in source.slots ) { |
|
|
|
this.slots[ prop ] = source.slots[ prop ]; |
|
|
|
} |
|
|
|
return this; |
|
|
|
} |
|
|
|
toJSON( meta ) { |
|
|
|
let data = this.getJSONNode( meta ); |
|
|
|
if ( ! data ) { |
|
|
|
data = this.createJSONNode( meta ); |
|
|
|
data.slots = {}; |
|
|
|
for ( const prop in this.slots ) { |
|
|
|
const slot = this.slots[ prop ]; |
|
|
|
if ( slot ) { |
|
|
|
data.slots[ prop ] = slot.toJSON( meta ).uuid; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
SubSlotNode.prototype.nodeType = 'SubSlot'; |
|
|
|
export { SubSlotNode };
|
|
|