@@ -42,7 +42,6 @@ func (lc *LightingColors) initShaders(v1, f1, v2, f2 string) error {
42
42
}
43
43
return nil
44
44
}
45
-
46
45
func (lc * LightingColors ) initCamera () {
47
46
// Camera
48
47
lc .camera = glutils .NewCamera (
@@ -65,7 +64,6 @@ func (lc *LightingColors) initCamera() {
65
64
lc .scaleMat = mgl32 .Scale3D (0.2 , 0.2 , 0.2 )
66
65
lc .rotationAxis = mgl32.Vec3 {1.0 , 0.3 , 0.5 }.Normalize ()
67
66
}
68
-
69
67
func (lc * LightingColors ) getVertices () []float32 {
70
68
return []float32 {
71
69
- 0.5 , - 0.5 , - 0.5 ,
@@ -111,7 +109,6 @@ func (lc *LightingColors) getVertices() []float32 {
111
109
- 0.5 , 0.5 , - 0.5 ,
112
110
}
113
111
}
114
-
115
112
func (lc * LightingColors ) initContainers (vertices []float32 ) {
116
113
117
114
attr := glutils .NewAttributesMap ()
@@ -136,7 +133,6 @@ func (lc *LightingColors) initContainers(vertices []float32) {
136
133
}
137
134
lc .lightVa .Setup ()
138
135
}
139
-
140
136
func (lc * LightingColors ) InitGL () error {
141
137
lc .initCamera ()
142
138
if err := lc .initShaders (
@@ -170,25 +166,23 @@ func (lc *LightingColors) Update() {
170
166
lc .camera .ProcessKeyboard (glutils .RIGHT , lc .deltaTime )
171
167
}
172
168
}
169
+
173
170
func (lc * LightingColors ) clear () {
174
171
// Clear the colorbuffer
175
172
gl .ClearColor (lc .Color32 .R , lc .Color32 .G , lc .Color32 .B , lc .Color32 .A )
176
173
gl .Clear (gl .COLOR_BUFFER_BIT | gl .DEPTH_BUFFER_BIT )
177
174
}
178
-
179
175
func (lc * LightingColors ) setLightingUniforms () {
180
176
// Use corresponding shader when setting uniforms/drawing objects
181
177
gl .Uniform3f (lc .lightingShader .Uniforms ["objectColor" ], 1.0 , 0.5 , 0.31 )
182
178
gl .Uniform3f (lc .lightingShader .Uniforms ["lightColor" ], 1.0 , 0.5 , 1.0 )
183
179
}
184
-
185
180
func (lc * LightingColors ) getCameraTransforms () (mgl32.Mat4 , mgl32.Mat4 ) {
186
181
// Create camera transformations
187
182
view := lc .camera .GetViewMatrix ()
188
183
projection := mgl32 .Perspective (float32 (lc .camera .Zoom ), sections .RATIO , 0.1 , 100.0 )
189
184
return view , projection
190
185
}
191
-
192
186
func (lc * LightingColors ) transformShader (shader glutils.Shader , view , projection mgl32.Mat4 ) {
193
187
// Pass the matrices to the shader
194
188
gl .UniformMatrix4fv (shader .Uniforms ["view" ], 1 , false , & view [0 ])
@@ -213,7 +207,6 @@ func (lc *LightingColors) drawLamp() {
213
207
gl .DrawArrays (gl .TRIANGLES , 0 , 36 )
214
208
gl .BindVertexArray (0 )
215
209
}
216
-
217
210
func (lc * LightingColors ) Draw () {
218
211
lc .clear ()
219
212
gl .UseProgram (lc .lightingShader .Program )
0 commit comments