RohamCsiga

Vik Wiki Grafika - Spekuláris anyagok

Jan 26th, 2014
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.44 KB | None | 0 0
  1. #include <math.h>
  2. #include <stdlib.h>
  3.  
  4. #if defined(__APPLE__)
  5.   #include <OpenGL/gl.h>
  6.   #include <OpenGL/glu.h>
  7.   #include <GLUT/glut.h>
  8. #else
  9.   #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  10.     #include <windows.h>
  11.   #endif
  12.   #include <GL/gl.h>
  13.   #include <GL/glu.h>
  14.   #include <GL/glut.h>
  15. #endif
  16.  
  17. #ifndef M_PI
  18.   #define M_PI 3.14159265359
  19. #endif
  20.  
  21. template <typename T>
  22. T max(T a, T b) {
  23.   return a > b ? a : b;
  24. }
  25.  
  26. template <typename T>
  27. T min(T a, T b) {
  28.   return a < b ? a : b;
  29. }
  30.  
  31. struct Vector {
  32.   union { float x, r; }; // x és r néven is lehessen hivatkozni erre a tagra.
  33.   union { float y, g; };
  34.   union { float z, b; };
  35.  
  36.   Vector(float v = 0) : x(v), y(v), z(v) { }
  37.   Vector(float x, float y, float z) : x(x), y(y), z(z) { }
  38.   Vector operator+(const Vector& v) const { return Vector(x + v.x, y + v.y, z + v.z); }
  39.   Vector operator-(const Vector& v) const { return Vector(x - v.x, y - v.y, z - v.z); }
  40.   Vector operator*(const Vector& v) const { return Vector(x * v.x, y * v.y, z * v.z); }
  41.   Vector operator/(const Vector& v) const { return Vector(x / v.x, y / v.y, z / v.z); }
  42.   Vector& operator+=(const Vector& v) { x += v.x, y += v.y, z += v.z; return *this; }
  43.   Vector& operator-=(const Vector& v) { x -= v.x, y -= v.y, z -= v.z; return *this; }
  44.   Vector& operator*=(const Vector& v) { x *= v.x, y *= v.y, z *= v.z; return *this; }
  45.   Vector& operator/=(const Vector& v) { x /= v.x, y /= v.y, z /= v.z; return *this; }
  46.   Vector operator-() const { return Vector(-x, -y, -z); }
  47.   float dot(const Vector& v) const { return x*v.x + y*v.y + z*v.z; }
  48.   Vector cross(const Vector& v) const { return Vector(y*v.z - z*v.y, z*v.x - x*v.z, x*v.y - y*v.x); }
  49.   float length() const { return sqrt(x*x + y*y + z*z); }
  50.   Vector normalize() const { float l = length(); if(l > 1e-3) { return (*this/l); } else { return Vector(); } }
  51.   bool isNull() const { return length() < 1e-3; }
  52.   Vector toneMap() const {
  53.     // Filmic tonemap approximation by Jim Hejl
  54.     Vector v = Vector(max(r - 0.004f, 0.0f), max(g - 0.004f, 0.0f), max(b - 0.004f, 0.0f));
  55.     v = (v*(v*6.2f+0.5f))/(v*(v*6.2f+1.7f)+0.06f);
  56.     return Vector(pow(v.x, 2.2f), pow(v.y, 2.2f), pow(v.z, 2.2f));
  57.   }
  58. };
  59.  
  60. // Azoknak, akik a shader kódokban használt szintakszishoz hozzá vannak szokva (mint pl. én)
  61. inline float dot(const Vector& lhs, const Vector& rhs) {
  62.   return lhs.dot(rhs);
  63. }
  64.  
  65. inline Vector cross(const Vector& lhs, const Vector& rhs) {
  66.   return lhs.cross(rhs);
  67. }
  68.  
  69. inline Vector operator*(float f, const Vector& v) {
  70.   return v*f;
  71. }
  72.  
  73. typedef Vector Color;
  74.  
  75. struct Screen {
  76.   static const int width = 600;
  77.   static const int height = 600;
  78.   static Color image[width * height];
  79.   static void Draw() {
  80.     glDrawPixels(width, height, GL_RGB, GL_FLOAT, image);
  81.   }
  82.   static Color& Pixel(size_t x, size_t y) {
  83.     return image[y*width + x];
  84.   }
  85. };
  86. Color Screen::image[width * height]; // A statikus adattagat out-of-line példányosítani kell (kivéve az inteket és enumokat).
  87.  
  88. struct Ray {
  89.   Vector origin, direction;
  90. };
  91.  
  92. struct Intersection {
  93.   Vector pos, normal;
  94.   bool is_valid;
  95.   Intersection(Vector pos = Vector(), Vector normal = Vector(), bool is_valid = false)
  96.     : pos(pos), normal(normal), is_valid(is_valid) { }
  97. };
  98.  
  99. struct Light {
  100.   enum LightType {Ambient, Directional, Point, Spot} type;
  101.   Vector pos, dir;
  102.   Color color;
  103.   float spot_cutoff;
  104. };
  105.  
  106. struct Material {
  107.   virtual ~Material() { }
  108.   virtual Color getColor(Intersection, const Light[], size_t) = 0;
  109. };
  110.  
  111. struct Object {
  112.   Material *mat;
  113.   Object(Material* m) : mat(m) { }
  114.   virtual ~Object() { }
  115.   virtual Intersection intersectRay(Ray) = 0;
  116. };
  117.  
  118. struct Scene {
  119.   static const size_t max_obj_num = 100;
  120.   size_t obj_num;
  121.   Object* objs[max_obj_num];
  122.  
  123.   void AddObject(Object *o) {
  124.     objs[obj_num++] = o;
  125.   }
  126.  
  127.   ~Scene() {
  128.     for(int i = 0; i != obj_num; ++i) {
  129.       delete objs[i];
  130.     }
  131.   }
  132.  
  133.   static const size_t max_lgt_num = 10;
  134.   size_t lgt_num;
  135.   Light lgts[max_obj_num];
  136.  
  137.   void AddLight(const Light& l) {
  138.     lgts[lgt_num++] = l;
  139.   }
  140.  
  141.   static const Vector env_color;
  142.  
  143.   Scene() : obj_num(0) { }
  144.  
  145.   Intersection getClosestIntersection(Ray r, int* index = NULL) const {
  146.     Intersection closest_intersection;
  147.     float closest_intersection_dist;
  148.     int closest_index = -1;
  149.  
  150.     for(int i = 0; i < obj_num; ++i) {
  151.       Intersection inter = objs[i]->intersectRay(r);
  152.       if(!inter.is_valid)
  153.         continue;
  154.       float dist = (inter.pos - r.origin).length();
  155.       if(closest_index == -1 || dist < closest_intersection_dist) {
  156.         closest_intersection = inter;
  157.         closest_intersection_dist = dist;
  158.         closest_index = i;
  159.       }
  160.     }
  161.  
  162.     if(index) {
  163.       *index = closest_index;
  164.     }
  165.     return closest_intersection;
  166.   }
  167.  
  168.   Color shootRay(Ray r) const {
  169.     int index;
  170.     Intersection inter = getClosestIntersection(r, &index);
  171.  
  172.     if(index != -1) {
  173.       return objs[index]->mat->getColor(inter, lgts, lgt_num).toneMap();
  174.     } else {
  175.       return env_color;
  176.     }
  177.   }
  178. } scene;
  179. const Vector Scene::env_color = Vector(135./255., 206./255., 235./255.);
  180.  
  181. struct Camera {
  182.   Vector pos, plane_pos, right, up;
  183.  
  184.   Camera(float fov, const Vector& eye, const Vector& target, const Vector& plane_up)
  185.       : pos(eye - (target-eye).normalize() / (2*tan((fov*M_PI/180)/2))), plane_pos(eye)
  186.    {
  187.       Vector fwd = (plane_pos - pos).normalize();
  188.       right = cross(fwd, plane_up).normalize();
  189.       up = cross(right, fwd).normalize();
  190.    }
  191.  
  192.   void takePicture() {
  193.     for(int x = 0; x < Screen::height; ++x)
  194.       for(int y = 0; y < Screen::width; ++y)
  195.         capturePixel(x, y);
  196.   }
  197.  
  198.   void capturePixel(float x, float y) {
  199.     Vector pos_on_plane = Vector(
  200.       (x - Screen::width/2) / (Screen::width/2),
  201.       // Itt nem kell megfordítani az y tengelyt. A bal fölső sarok az origó most.
  202.       (y - Screen::height/2) / (Screen::height/2),
  203.       0
  204.     );
  205.  
  206.     Vector plane_intersection = plane_pos + pos_on_plane.x * right + pos_on_plane.y * up;
  207.  
  208.     Ray r = {pos, (plane_intersection - pos).normalize()};
  209.     Screen::Pixel(x, y) = scene.shootRay(r);
  210.   }
  211. } camera(60, Vector(-1.2f, 1.6f, -1.5f), Vector(), Vector(0, 1, 0));
  212.  
  213. // Idáig egy általános raytracert definiáltam. Innentől jönnek a konkrétumok.
  214.  
  215. struct DiffuseMaterial : public Material {
  216.   Color own_color;
  217.  
  218.   DiffuseMaterial(const Color& color) : own_color(color) { }
  219.  
  220.   Color getColor(Intersection inter, const Light* lgts, size_t lgt_num) {
  221.     Color accum_color;
  222.  
  223.     for(int i = 0; i < lgt_num; ++i) {
  224.       const Light& light = lgts[i];
  225.  
  226.       switch(light.type) {
  227.         case Light::Ambient: {
  228.           accum_color += light.color * own_color;
  229.         } break;
  230.         case Light::Directional: {
  231.           // Lőjjünk egy sugarat a fényforrás irányába.
  232.           Ray shadow_checker = {inter.pos + 1e-3*light.dir, light.dir}; // Az irányfény iránya nálam a forrás felé futat.
  233.           Intersection shadow_checker_int = scene.getClosestIntersection(shadow_checker);
  234.           if(shadow_checker_int.is_valid) {
  235.             break; // Ha bármivel is ütközik, akkor árnyékban vagyunk
  236.           }
  237.  
  238.           float intensity = max(dot(inter.normal, light.dir.normalize()), 0.0f);
  239.           accum_color += intensity * light.color * own_color;
  240.         } break;
  241.         case Light::Spot: {
  242.           Vector light_to_pos = inter.pos - light.pos;
  243.           if(dot(light_to_pos.normalize(), light.dir) < light.spot_cutoff) {
  244.             break; // Ha nincs megvilágítva, akkor ne csináljuk semmit.
  245.           } // Különben számoljuk pont fényforrással.
  246.         } // NINCS break!
  247.         case Light::Point: {
  248.           // Lőjjünk egy sugarat a fényforrás felől a konkrét pont irányába
  249.           Ray shadow_checker = {light.pos, (inter.pos - light.pos).normalize()};
  250.           Intersection shadow_checker_int = scene.getClosestIntersection(shadow_checker);
  251.           if(shadow_checker_int.is_valid &&
  252.             (shadow_checker_int.pos-light.pos).length() + 1e-3 < (inter.pos-light.pos).length()) {
  253.             break; // Ha bármivel is ütközik, ami közelebb van a fényhez, mint mi, akkor árnyékban vagyunk
  254.           }
  255.  
  256.           Vector pos_to_light = light.pos - inter.pos;
  257.           float attenuation = pow(1/pos_to_light.length(), 2);
  258.           float intensity = max(dot(inter.normal, pos_to_light.normalize()), 0.0f);
  259.           accum_color += attenuation * intensity * light.color * own_color;
  260.         } break;
  261.       }
  262.     }
  263.  
  264.     return accum_color;
  265.   }
  266. };
  267.  
  268. inline Vector reflect(Vector I, Vector N) {
  269.   return I - (2.0 * dot(N, I)) * N;
  270. }
  271.  
  272. struct SpecularMaterial : DiffuseMaterial {
  273.   const Color specular_color;
  274.   const float shininess;
  275.  
  276.   SpecularMaterial(const Color& diffuse_color, const Color& specular_color, float shininess)
  277.     : DiffuseMaterial(diffuse_color), specular_color(specular_color), shininess(shininess) { }
  278.  
  279.   Color getColor(Intersection inter, const Light* lgts, size_t lgt_num) {
  280.     Color accum_color = DiffuseMaterial::getColor(inter, lgts, lgt_num);
  281.  
  282.     for(int i = 0; i < lgt_num; ++i) {
  283.       const Light& light = lgts[i];
  284.  
  285.       switch(light.type) {
  286.         case Light::Directional: {
  287.           // Lőjjünk egy sugarat a fényforrás irányába.
  288.           Ray shadow_checker = {inter.pos + 1e-3*light.dir, light.dir}; // Az irányfény iránya nálam a forrás felé futat.
  289.           Intersection shadow_checker_int = scene.getClosestIntersection(shadow_checker);
  290.           if(shadow_checker_int.is_valid) {
  291.             break; // Ha bármivel is ütközik, akkor árnyékban vagyunk
  292.           }
  293.  
  294.           float specular_power =
  295.             pow(
  296.               max(0.0f, dot(
  297.                 reflect(-light.dir.normalize(), inter.normal),
  298.                 (camera.pos-inter.pos).normalize())
  299.               ), shininess
  300.             );
  301.           accum_color += specular_power * light.color * specular_color;
  302.         } break;
  303.         case Light::Spot: {
  304.           Vector light_to_pos = inter.pos - light.pos;
  305.           if(dot(light_to_pos.normalize(), light.dir) < light.spot_cutoff) {
  306.             break;
  307.           }
  308.         }
  309.         case Light::Point: {
  310.           Ray shadow_checker = {light.pos, (inter.pos - light.pos).normalize()};
  311.           Intersection shadow_checker_int = scene.getClosestIntersection(shadow_checker);
  312.           if(shadow_checker_int.is_valid &&
  313.             (shadow_checker_int.pos-light.pos).length() + 1e-3 < (inter.pos-light.pos).length()) {
  314.             break; // Ha bármivel is ütközik, ami közelebb van a fényhez, mint mi, akkor árnyékban vagyunk
  315.           }
  316.  
  317.           Vector light_to_pos = inter.pos-light.pos;
  318.           float attenuation = pow(1/light_to_pos.length(), 2);
  319.  
  320.           float specular_power =
  321.             pow(
  322.               max(0.0f, dot(
  323.                 reflect((light_to_pos).normalize(), inter.normal),
  324.                 (camera.pos-inter.pos).normalize())
  325.               ), shininess
  326.             );
  327.           accum_color += specular_power * attenuation * light.color * specular_color;
  328.         } break;
  329.         default:
  330.           break;
  331.       }
  332.     }
  333.  
  334.     return accum_color;
  335.   }
  336. };
  337.  
  338. DiffuseMaterial white(Color(1.0f, 1.0f, 1.0f));
  339. DiffuseMaterial blue(Color(0.0f, 0.4f, 1.0f));
  340. SpecularMaterial specular_white(Color(1.0f, 1.0f, 1.0f), Color(3, 3, 3), 32);
  341. SpecularMaterial specular_blue(Color(0.0f, 0.4f, 1.0f), Color(1, 1, 1), 64);
  342.  
  343. struct Triangle : public Object {
  344.   Vector a, b, c, normal;
  345.  
  346.   // Az óra járásával ellentétes (CCW) körüljárási irányt feltételez ez a kód.
  347.   Triangle(Material* mat, const Vector& a, const Vector& b, const Vector& c)
  348.     : Object(mat), a(a), b(b), c(c) {
  349.       Vector ab = b - a;
  350.       Vector ac = c - a;
  351.       normal = cross(ab.normalize(), ac.normalize()).normalize();
  352.   }
  353.  
  354.   // Ennek a függvénynek a megértéséhez rajzolj magadnak egyszerű ábrákat!
  355.   Intersection intersectRay(Ray r) {
  356.     // Először számoljuk ki, hogy melyen mekkora távot
  357.     // tesz meg a sugár, míg eléri a háromszög síkját
  358.     // A számoláshoz tudnuk kell hogy ha egy 'v' vektort
  359.     // skaliráisan szorzunk egy egységvektorral, akkor
  360.     // az eredmény a 'v'-nek az egységvektorra vetített
  361.     // hossza lesz. Ezt felhasználva, ha a sugár kiindulási
  362.     // pontjából a sík egy pontjba mutató vektort levetítjük
  363.     // a sík normál vektorára, akkor megkapjuk, hogy milyen
  364.     // távol van a sugár kiindulási pontja a síktól. Továbbá,
  365.     // ha az a sugár irányát vetítjük a normálvektorra, akkor meg
  366.     // megtudjuk, hogy az milyen gyorsan halad a sík fele.
  367.     // Innen a már csak a t = s / v képletet kell csak használnunk.
  368.     float ray_travel_dist = dot(a - r.origin, normal) / dot(r.direction, normal);
  369.  
  370.     // Ha a háromszög az ellenkező irányba van, mint
  371.     // amerre a sugár megy, akkor nincs metszéspontjuk
  372.     if(ray_travel_dist < 0)
  373.       return Intersection();
  374.  
  375.     // Számoljuk ki, hogy a sugár hol metszi a sugár síkját.
  376.     Vector plane_intersection = r.origin + ray_travel_dist * r.direction;
  377.  
  378.     /* Most már csak el kell döntenünk, hogy ez a pont a háromszög
  379.        belsejében van-e. Erre két lehetőség van:
  380.      
  381.        - A háromszög összes élére megnézzük, hogy a pontot a hároszög
  382.        egy megfelelő pontjával összekötve a kapott szakasz, és a háromszög
  383.        élének a vektoriális szorzata a normál irányába mutat-e.
  384.        Pl:
  385.      
  386.                  a
  387.                / |
  388.               /  |
  389.              /   |
  390.             /  x |  y
  391.            /     |
  392.           b------c
  393.  
  394.        Nézzük meg az x és y pontra ezt az algoritmust.
  395.        A cross(ab, ax), a cross(bc, bx), és a cross(ca, cx) és kifele mutat a
  396.        képernyőből, ugyan abba az irányba mint a normál vektor. Ezt amúgy a
  397.        dot(cross(ab, ax), normal) >= 0 összefüggéssel egyszerű ellenőrizni.
  398.        Az algoritmus alapján az x a háromszög belsejében van.
  399.  
  400.        Míg az y esetében a cross(ca, cy) befele mutat, a normállal ellenkező irányba,
  401.        tehát a dot(cross(ca, cy), normal) < 0 ami az algoritmus szerint azt jelenti,
  402.        hogy az y pont a háromszögön kívül van.
  403.      
  404.        - A ötlet lehetőség a barycentrikus koordinátáknak azt a tulajdonságát használja
  405.        ki, hogy azok a háromszög belsejében lévő pontokra kivétel nélkül nem negatívak,
  406.        míg a háromszögön kívül lévő pontokra legalább egy koordináta negatív.
  407.        Ennek a megoldásnak a használatához ki kell jelölnünk két tetszőleges, de egymásra
  408.        merőleges vektort a síkon, ezekre le kell vetíteninünk a háromszög pontjait, és
  409.        kérdéses pontot, és az így kapott koordinátákra alakzmanunk kell egy a wikipediáról
  410.        egyszerűen kimásolható képletet:
  411.        http://en.wikipedia.org/wiki/Barycentric_coordinate_system#Converting_to_barycentric_coordinates
  412.      
  413.        Én az első lehetőséget implementálom. */
  414.  
  415.     const Vector& x = plane_intersection;
  416.  
  417.     Vector ab = b - a;
  418.     Vector ax = x - a;
  419.  
  420.     Vector bc = c - b;
  421.     Vector bx = x - b;
  422.  
  423.     Vector ca = a - c;
  424.     Vector cx = x - c;
  425.  
  426.     if(dot(cross(ab, ax), normal) >= 0)
  427.       if(dot(cross(bc, bx), normal) >= 0)
  428.         if(dot(cross(ca, cx), normal) >= 0)
  429.           return Intersection(x, normal, true);
  430.  
  431.     return Intersection();
  432.   }
  433. };
  434.  
  435. void onDisplay() {
  436.   glClear(GL_COLOR_BUFFER_BIT);
  437.  
  438.   camera.takePicture();
  439.   Screen::Draw();
  440.  
  441.   glutSwapBuffers();
  442. }
  443.  
  444. void onIdle() {
  445.   static bool first_call = true;
  446.   if(first_call) {
  447.     glutPostRedisplay();
  448.     first_call = false;
  449.   }
  450. }
  451.  
  452. void onInitialization() {
  453.   Light amb = {Light::Ambient, Vector(), Vector(), Color(0.2f, 0.2f, 0.2f)};
  454.   Light point = {Light::Point, Vector(1.5f, 2, 1), Vector(), 0.5f*Color(20.0f, 20.0f, 20.0f)};
  455.   Light point2 = {Light::Point, Vector(-3.2f, 4, 4.5f), Vector(), 0.4f*Color(20.0f, 20.0f, 20.0f)};
  456.   scene.AddLight(amb);
  457.   scene.AddLight(point);
  458.   scene.AddLight(point2);
  459.  
  460.   // Ground
  461.   scene.AddObject(new Triangle(&specular_white, Vector(-10, -1.1f, -10), Vector(-10, -1.1f, +10), Vector(+10, -1.1f, +10)));
  462.   scene.AddObject(new Triangle(&specular_white, Vector(+10, -1.1f, +10), Vector(+10, -1.1f, -10), Vector(-10, -1.1f, -10)));
  463.  
  464.   // Front face
  465.   scene.AddObject(new Triangle(&specular_blue, Vector(+1, -1, -1), Vector(-1, -1, -1), Vector(-1, +1, -1)));
  466.   scene.AddObject(new Triangle(&specular_blue, Vector(-1, +1, -1), Vector(+1, +1, -1), Vector(+1, -1, -1)));
  467.  
  468.   // Back face
  469.   scene.AddObject(new Triangle(&specular_blue, Vector(+1, -1, +1), Vector(-1, -1, +1), Vector(-1, +1, +1)));
  470.   scene.AddObject(new Triangle(&specular_blue, Vector(-1, +1, +1), Vector(+1, +1, +1), Vector(+1, -1, +1)));
  471.  
  472.   // Right face
  473.   scene.AddObject(new Triangle(&specular_blue, Vector(+1, -1, -1), Vector(+1, -1, +1), Vector(+1, +1, +1)));
  474.   scene.AddObject(new Triangle(&specular_blue, Vector(+1, +1, +1), Vector(+1, +1, -1), Vector(+1, -1, -1)));
  475.  
  476.   // Left face
  477.   scene.AddObject(new Triangle(&specular_blue, Vector(-1, -1, -1), Vector(-1, -1, +1), Vector(-1, +1, +1)));
  478.   scene.AddObject(new Triangle(&specular_blue, Vector(-1, +1, +1), Vector(-1, +1, -1), Vector(-1, -1, -1)));
  479.  
  480.   // Upper face
  481.   scene.AddObject(new Triangle(&specular_blue, Vector(-1, +1, -1), Vector(-1, +1, +1), Vector(+1, +1, +1)));
  482.   scene.AddObject(new Triangle(&specular_blue, Vector(+1, +1, -1), Vector(-1, +1, -1), Vector(+1, +1, +1)));
  483.  
  484.   // Lower face
  485.   scene.AddObject(new Triangle(&specular_blue, Vector(-1, -1, +1), Vector(-1, -1, -1), Vector(+1, -1, +1)));
  486.   scene.AddObject(new Triangle(&specular_blue, Vector(+1, -1, -1), Vector(+1, -1, +1), Vector(-1, -1, -1)));
  487. }
  488.  
  489. void onKeyboard(unsigned char key, int, int) {}
  490.  
  491. void onKeyboardUp(unsigned char key, int, int) {}
  492.  
  493. void onMouse(int, int, int, int) {}
  494.  
  495. void onMouseMotion(int, int) {}
  496.  
  497. int main(int argc, char **argv) {
  498.   glutInit(&argc, argv);
  499.   glutInitWindowSize(Screen::width, Screen::height);
  500.   glutInitWindowPosition(100, 100);
  501.   glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
  502.  
  503.   glutCreateWindow("Grafika pelda program");
  504.  
  505.   glMatrixMode(GL_MODELVIEW);
  506.   glLoadIdentity();
  507.   glMatrixMode(GL_PROJECTION);
  508.   glLoadIdentity();
  509.  
  510.   onInitialization();
  511.  
  512.   glutDisplayFunc(onDisplay);
  513.   glutMouseFunc(onMouse);
  514.   glutIdleFunc(onIdle);
  515.   glutKeyboardFunc(onKeyboard);
  516.   glutKeyboardUpFunc(onKeyboardUp);
  517.   glutMotionFunc(onMouseMotion);
  518.  
  519.   glutMainLoop();
  520.  
  521.   return 0;
  522. }
Advertisement
Add Comment
Please, Sign In to add comment