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.
63 lines
877 B
63 lines
877 B
import { Matrix4 } from 'three'; |
|
|
|
import { InputNode } from '../core/InputNode.js'; |
|
|
|
class Matrix4Node extends InputNode { |
|
|
|
constructor( matrix ) { |
|
|
|
super( 'm4' ); |
|
|
|
this.value = matrix || new Matrix4(); |
|
|
|
} |
|
|
|
get elements() { |
|
|
|
return this.value.elements; |
|
|
|
} |
|
|
|
set elements( val ) { |
|
|
|
this.value.elements = val; |
|
|
|
} |
|
|
|
generateReadonly( builder, output, uuid, type /*, ns, needsUpdate */ ) { |
|
|
|
return builder.format( 'mat4( ' + this.value.elements.join( ', ' ) + ' )', type, output ); |
|
|
|
} |
|
|
|
copy( source ) { |
|
|
|
super.copy( source ); |
|
|
|
this.scope.value.fromArray( source.elements ); |
|
|
|
return this; |
|
|
|
} |
|
|
|
toJSON( meta ) { |
|
|
|
let data = this.getJSONNode( meta ); |
|
|
|
if ( ! data ) { |
|
|
|
data = this.createJSONNode( meta ); |
|
|
|
data.elements = this.value.elements.concat(); |
|
|
|
} |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
Matrix4Node.prototype.nodeType = 'Matrix4'; |
|
|
|
export { Matrix4Node };
|
|
|