text: ﻿#pragma once
  
  #ifdef WIN32
  // needed to prevent macro redef
  #include <Windows.h>
  #endif  // win32
  
  #include <GL/glew.h>  // include GLEW and new version of GL on Windows
  #define GLFW_INCLUDE_NONE
  #include <GLFW/glfw3.h>
  
  #define GLM_FORCE_SILENT_WARNINGS 1
  
  #include <glm/ext/matrix_clip_space.hpp>  // glm::perspective
  #include <glm/ext/matrix_transform.hpp>   // glm::translate, glm::rotate, glm::scale
  #include <glm/ext/scalar_constants.hpp>   // glm::pi
  #include <glm/glm.hpp>
  #include <glm/gtc/matrix_transform.hpp>
  #include <glm/gtc/type_ptr.hpp>
  #include <glm/mat4x4.hpp>  // glm::mat4
  #include <glm/vec3.hpp>    // glm::vec3
  #include <glm/vec4.hpp>    // glm::vec4
  
  namespace RenderUtil
  {
  inline glm::mat4 camera(float Translate, glm::vec2 const& Rotate, float ratio)
  {
      glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, ratio, 0.1f, 100.f);
      /*
      glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, -Translate, 1.0f));
      View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
      View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
      */
      glm::mat4 r = glm::rotate(glm::mat4(1.0f), Rotate.y, glm::vec3(0, 0, 1));
      glm::vec4 offset = glm::vec4(0, -Translate, 1.0f, 1.0f);
      glm::vec4 o2 = offset * r;
      glm::mat4 View = glm::lookAtRH(glm::vec3(o2), glm::vec3(0, 0, 0), glm::vec3(0, 0, 1));
      return Projection * View;
  }
  
  }  // namespace RenderUtil
  