void Mainloop(float delta) { this.window.SwapBuffers(); GL.ClearColor(1f, 0f, 1f, 1.0f); GL.Clear(ClearBufferMask.ColorBufferBit); GL.Clear(ClearBufferMask.DepthBufferBit); this.window.Title = delta.ToString(); return; if (b_W) { camera.moveFront(delta * camaraSpeed); } if (b_S) { camera.moveFront(delta * -camaraSpeed); } if (b_A) { camera.moveSideways(delta * -camaraSpeed); } if (b_D) { camera.moveSideways(delta * camaraSpeed); } if (b_Q) { camera.moveUp(delta * camaraSpeed); } if (b_E) { camera.moveUp(-delta * camaraSpeed); } if (b_F) { spotColor = new Vector3(2); } else { spotColor = new Vector3(0); } GL.Uniform3(GL.GetUniformLocation(shader.GetShaderID(), "u_spot_light.diffuse"), ref spotColor); GL.Uniform3(GL.GetUniformLocation(shader.GetShaderID(), "u_spot_light.specular"), ref spotColor); spotColor *= 0.1F; GL.Uniform3(GL.GetUniformLocation(shader.GetShaderID(), "u_spot_light.ambient"), ref spotColor); camera.update(); modelViewProj = camera.GetViewProj() * camModelRender; Matrix4 modelView = camera.GetView() * camModelRender; var matrix4 = new OpenTK.Matrix4(); matrix4.Transpose(); Matrix4 invModelView = new Matrix4(); //TODO: glm.transpose( inverse( modelView ) ); Vector3 transformedSunDirection = new Vector3(); //TODO: transpose( inverse( camera.GetView() ) ) * vec4( sunDirection, 1.0F ); GL.Uniform3(directionLocation, ref transformedSunDirection); Matrix4 pointLightMatrix = glm.rotate(new mat4(1f), -delta, new vec3(0, 1, 0)).M(); pointLightPosition = pointLightMatrix * pointLightPosition; Vector3 transformedPointLightPosition = new Vector3(); //TODO:(Vector3) ( camera.GetView() * ( pointLightPosition ) ); GL.Uniform3(pointLightLocation, ref transformedPointLightPosition); GL.UniformMatrix4(modelViewProjMatrixLocation, false, ref modelViewProj); GL.UniformMatrix4(modelViewLocation, false, ref modelView); GL.UniformMatrix4(invModelViewLocation, false, ref invModelView); /// for (int i = 0; i < this.mats.Count; ++i) { //mats[i] =Matrix4.ro rotate(mats[i],time * , Vector3 (0, time,0)); modelViewProj = camera.GetViewProj() * mats[i]; modelView = camera.GetView() * mats[i]; invModelView = (modelView.Inverted()); GL.UniformMatrix4(modelViewProjMatrixLocation, false, ref modelViewProj); GL.UniformMatrix4(modelViewLocation, false, ref modelView); GL.UniformMatrix4(invModelViewLocation, false, ref invModelView); //TODO:models[i] -> Render(); } }