From 27408aeed3a9b11814a4edd930c7dad2fcca9b4f Mon Sep 17 00:00:00 2001 From: Brulijam Date: Thu, 30 Nov 2023 22:37:29 +0100 Subject: [PATCH] Formatting --- Abgabe_4/lightTODOs/common/objects3D.js | 45 ++++--------------------- Abgabe_4/lightTODOs/index.html | 4 +-- Abgabe_4/lightTODOs/main.js | 10 +----- 3 files changed, 9 insertions(+), 50 deletions(-) diff --git a/Abgabe_4/lightTODOs/common/objects3D.js b/Abgabe_4/lightTODOs/common/objects3D.js index 6aea002..8bc2300 100644 --- a/Abgabe_4/lightTODOs/common/objects3D.js +++ b/Abgabe_4/lightTODOs/common/objects3D.js @@ -1,10 +1,6 @@ class Object3D { // DONE: Füge Default-Materialkoeffizienten hinzu - constructor( - ka = [0.5, 0.5, 0.5], - kd = [0.5, 0.5, 0.5], - ks = [0.5, 0.5, 0.5] - ) { + constructor(ka = [0.5, 0.5, 0.5], kd = [0.5, 0.5, 0.5], ks = [0.5, 0.5, 0.5]) { this.posVBO = gl.createBuffer(); // DONE: Kein colorVBO mehr! (Farben werden über Materialkoeffizienten bestimmt) this.indexVBO = gl.createBuffer(); @@ -27,25 +23,13 @@ class Object3D { InitBuffers() { gl.bindBuffer(gl.ARRAY_BUFFER, this.posVBO); - gl.bufferData( - gl.ARRAY_BUFFER, - new Float32Array(this.positions), - gl.STATIC_DRAW - ); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.positions), gl.STATIC_DRAW); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexVBO); - gl.bufferData( - gl.ELEMENT_ARRAY_BUFFER, - new Uint16Array(this.indices), - gl.STATIC_DRAW - ); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), gl.STATIC_DRAW); } - SetModelMatrix( - position = this.position, - orientation = this.orientation, - scale = this.scale - ) { + SetModelMatrix(position = this.position, orientation = this.orientation, scale = this.scale) { this.position = position; this.orientation = [ (orientation[0] * Math.PI) / 180, @@ -56,24 +40,9 @@ class Object3D { this.modelMatrix = mat4.create(); mat4.translate(this.modelMatrix, this.modelMatrix, position); - mat4.rotate( - this.modelMatrix, - this.modelMatrix, - this.orientation[0], - [1, 0, 0] - ); - mat4.rotate( - this.modelMatrix, - this.modelMatrix, - this.orientation[1], - [0, 1, 0] - ); - mat4.rotate( - this.modelMatrix, - this.modelMatrix, - this.orientation[2], - [0, 0, 1] - ); + mat4.rotate(this.modelMatrix, this.modelMatrix, this.orientation[0], [1, 0, 0]); + mat4.rotate(this.modelMatrix, this.modelMatrix, this.orientation[1], [0, 1, 0]); + mat4.rotate(this.modelMatrix, this.modelMatrix, this.orientation[2], [0, 0, 1]); mat4.scale(this.modelMatrix, this.modelMatrix, scale); } diff --git a/Abgabe_4/lightTODOs/index.html b/Abgabe_4/lightTODOs/index.html index a58981d..950397b 100644 --- a/Abgabe_4/lightTODOs/index.html +++ b/Abgabe_4/lightTODOs/index.html @@ -82,9 +82,7 @@

Lorem Ipsum

- - If you see this, your browser doesn't support WebGL. - + If you see this, your browser doesn't support WebGL. diff --git a/Abgabe_4/lightTODOs/main.js b/Abgabe_4/lightTODOs/main.js index 51b4716..3c58754 100644 --- a/Abgabe_4/lightTODOs/main.js +++ b/Abgabe_4/lightTODOs/main.js @@ -6,15 +6,7 @@ let objects = []; let posLoc; // DONE: Deklariere benötigte Locations von Shadervariablen als globale Variablen -let normalLoc, - lightPositionLoc, - IaLoc, - IdLoc, - IsLoc, - kaLoc, - kdLoc, - ksLoc, - specularExponentLoc; +let normalLoc, lightPositionLoc, IaLoc, IdLoc, IsLoc, kaLoc, kdLoc, ksLoc, specularExponentLoc; let modelMatrixLoc;