private static void GenerateDrawMethod(SceneDefinitionServiceModel scene, SceneSettingsServiceModel settings, StringBuilder code)
        {
            code.AppendLine($"{_indent}public void OpenGLDraw(OpenGL gl)");
            code.AppendLine($"{_indent}{{");
            _indent += "\t";

            code.AppendLine($"{_indent}//  Clear the color and depth buffers.");
            code.AppendLine($"{_indent}gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);");
            code.AppendLine();

            code.AppendLine($"{_indent}//  Reset the modelview matrix.");
            code.AppendLine($"{_indent}gl.LoadIdentity();");
            code.AppendLine();

            code.AppendLine($"{_indent}gl.LookAt(");
            _indent += "\t";
            code.AppendLine($"{_indent}{settings.Camera.PositionX:F}, {settings.Camera.PositionY:F}, {settings.Camera.PositionZ:F},");
            code.AppendLine($"{_indent}{settings.Camera.AimX:F}, {settings.Camera.AimY:F}, {settings.Camera.AimZ:F},");
            code.AppendLine($"{_indent}{settings.Camera.UpX:F}, {settings.Camera.UpY:F}, {settings.Camera.UpZ:F}");
            _indent = _indent.Substring(0, _indent.Length - 1);
            code.AppendLine($"{_indent});");

            SetTransformations(code, settings.Transformations);
            code.AppendLine();

            //TODO: Apply material

            foreach (var face in scene.Scene.Faces)
            {
                var faceMode = GetFaceDrawingMode(face.IndexCount);

                code.AppendLine($"{_indent}gl.Begin({faceMode});");

                foreach (var indice in face.Indices)
                {
                    if (scene.Scene.HasNormals)
                    {
                        var normal = scene.Scene.Normals[(int)indice.NormalIndex];
                        code.AppendLine($"{_indent}gl.Normal({normal.X:F}, {normal.Y:F}, {normal.Z:F});");
                    }

                    var vertex = scene.Scene.Vertices[indice.VertexIndex];
                    code.AppendLine($"{_indent}gl.Vertex({vertex.X:F}, {vertex.Y:F}, {vertex.Z:F});");
                }

                code.AppendLine($"{_indent}gl.End();");

                code.AppendLine();
            }
            code.AppendLine();

            code.AppendLine($"{_indent}gl.Flush();");

            _indent = _indent.Substring(0, _indent.Length - 1);

            code.AppendLine($"{_indent}}}");
        }
        public static string GenerateCode(SceneDefinitionServiceModel scene, SceneSettingsServiceModel settings)
        {
            var code = new StringBuilder();

            code.AppendLine($"{_indent}using SharpGL;");
            code.AppendLine();
            code.AppendLine($"{_indent}public static class OpenGlGeneratedCode");
            code.AppendLine($"{_indent}{{");
            _indent += "\t";

            GenerateInitializeMethod(settings, code);

            code.AppendLine();

            GenerateDrawMethod(scene, settings, code);

            _indent = _indent.Substring(0, _indent.Length - 1);

            code.AppendLine($"{_indent}}}");

            return(code.ToString());
        }