/// <summary> /// is called from <see cref="OpenGlDevice.setTexture(Texture)"/> to set the values to the current <see cref="OpenGlDevice.Shader"/>. /// </summary> /// <param name="Shader">the current <see cref="OpenGlDevice.Shader"/>.</param> public void SetAttributes(GLShader Shader) { Matrix M = Matrix.Scale(new xyz(1 / WorldWidth, -1 / WorldHeight, 1 / WorldWidth)); Matrix TextureMatrix = Matrix.identity; if (SoBigAsPossible != Texture.BigAsPosible.None) { TextureMatrix = Matrix.Scale(new xyz(1, -1, 1)); } else { TextureMatrix = M * Matrix.Translation(new xyz(-Translation.x, -Translation.y, 0)) * Matrix.Rotation(new xyz(0, 0, 1), -Rotation); } GL.ActiveTexture(TextureUnit.Texture0 + Index); GL.BindTexture(TextureTarget.Texture2D, Handle); OpenGlDevice.CheckError(); Field T = Shader.getvar("Texture" + Index.ToString() + "Enabled"); if (T != null) { T.SetValue(1); } T = Shader.getvar("Texture" + Index.ToString() + "_"); if (T != null) { T.SetValue(Index); } T = Shader.getvar("Texture" + Index.ToString() + "Matrix"); if (T != null) { T.SetMatrix(TextureMatrix); } if (NormalMap) { T = Shader.getvar("NormalMap"); if (T != null) { T.SetValue(true); } } if (Tesselation) { T = Shader.getvar("Tesselation"); if (T != null) { T.SetValue(true); } } }