diff --git a/Release/Skeleton.log b/Release/Skeleton.log index b7e4ebb4437874e00cd730374ac92e98c76bcd88..77e76fe891391892d7a06ede7c5f508fc94b0565 100644 --- a/Release/Skeleton.log +++ b/Release/Skeleton.log @@ -1,34 +1,14 @@ Skeleton.cpp D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\framework.h(167,17): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\Skeleton.cpp(156,1): warning C4305: 'initializing': truncation from 'double' to 'float' -D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\xmemory(701,103): warning C4244: 'argument': conversion from '_Ty' to 'float', possible loss of data - with - [ - _Ty=double - ] -D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\vector(687): message : see reference to function template instantiation 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double,double>(_Alloc &,_Objty *const ,double &&,double &&)' being compiled - with - [ - _Alloc=std::allocator<vec2>, - _Ty=vec2, - _Objty=vec2 - ] -D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\vector(687): message : see reference to function template instantiation 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double,double>(_Alloc &,_Objty *const ,double &&,double &&)' being compiled - with - [ - _Alloc=std::allocator<vec2>, - _Ty=vec2, - _Objty=vec2 - ] -D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\vector(705): message : see reference to function template instantiation 'void std::vector<vec2,std::allocator<vec2>>::_Emplace_back_with_unused_capacity<_Ty,_Ty>(_Ty &&,_Ty &&)' being compiled - with - [ - _Ty=double - ] -D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\Skeleton.cpp(162): message : see reference to function template instantiation 'void std::vector<vec2,std::allocator<vec2>>::emplace_back<double,double>(double &&,double &&)' being compiled +D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\Skeleton.cpp(162,83): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data +D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\Skeleton.cpp(162,30): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data +D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\Skeleton.cpp(165,85): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data +D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\Skeleton.cpp(165,30): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data +D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\Skeleton\Skeleton.cpp(254,21): warning C4018: '<': signed/unsigned mismatch Generating code - 10 of 184 functions ( 5.4%) were compiled, the rest were copied from previous compilation. - 7 functions were new in current compilation - 4 functions had inline decision re-evaluated but remain unchanged + 5 of 297 functions ( 1.7%) were compiled, the rest were copied from previous compilation. + 0 functions were new in current compilation + 0 functions had inline decision re-evaluated but remain unchanged Finished generating code Skeleton.vcxproj -> D:\Grafika\GrafikaHaziCsomag\Programs\Skeleton\bin\Skeleton.exe diff --git a/Release/Skeleton.obj b/Release/Skeleton.obj index 3138918fd7fc0b59eca36f035030eba5dd995ecb..be341efcd7d0cf10b5f4d2baf54de03683c9d372 100644 Binary files a/Release/Skeleton.obj and b/Release/Skeleton.obj differ diff --git a/Release/Skeleton.tlog/Skeleton.write.1u.tlog b/Release/Skeleton.tlog/Skeleton.write.1u.tlog index 4b82f1b09cf2a9cd841827683808c481f1078702..115230f67d569a307ea76b2411f6de8606579c4a 100644 Binary files a/Release/Skeleton.tlog/Skeleton.write.1u.tlog and b/Release/Skeleton.tlog/Skeleton.write.1u.tlog differ diff --git a/Release/Skeleton.tlog/link.read.1.tlog b/Release/Skeleton.tlog/link.read.1.tlog index 18fb8db4698aeb1c306d65207eb1a3530d79d416..6f128485175f1960b8731413ff44ef6a69600137 100644 Binary files a/Release/Skeleton.tlog/link.read.1.tlog and b/Release/Skeleton.tlog/link.read.1.tlog differ diff --git a/Release/vc142.pdb b/Release/vc142.pdb index b7cd53eaead60a01141043276430dbfa817d06ea..1b400551259cdfa906974de46bf80e1991a2af9e 100644 Binary files a/Release/vc142.pdb and b/Release/vc142.pdb differ diff --git a/Skeleton.cpp b/Skeleton.cpp index b060dceef3debac7a50c3e9ef3e9ee41acee1755..ff6c09c9c05964eca73f9274f6f1d2c417b2719e 100644 --- a/Skeleton.cpp +++ b/Skeleton.cpp @@ -129,14 +129,14 @@ public: class GraphPoint : drawableBase { - std::vector<GraphPoint*> neighbours; //vec3 c; //center of the point in hyperbolic splace vec2 p; // center on the base disk public: - GraphPoint(vec2 a = vec2(0.0f,0.0f)) { - p = a; + GraphPoint() { + p = vec2((((float)rand() / (float)(RAND_MAX))*2)-1, (((float)rand() / (float)(RAND_MAX)) * 2) - 1); + placeCircleToNewCoordinates(); setColor(Color(244, 164, 96)); } @@ -157,12 +157,12 @@ public: float courrentTriangleAngle = 0; for (int i = 0; i < BASECIRCLESEG; i++) { - points.emplace_back(p.x, p.y); + points.push_back(vec2(p.x, p.y)); - points.emplace_back(p.x +(cos(courrentTriangleAngle * M_PI / 180.0) /30),p.y + (sin(courrentTriangleAngle * M_PI / 180.0) /30)); + points.push_back(vec2(p.x +(cos(courrentTriangleAngle * M_PI / 180.0) /30),p.y + (sin(courrentTriangleAngle * M_PI / 180.0) /30))); courrentTriangleAngle += piece; - points.emplace_back(p.x + (cos(courrentTriangleAngle * M_PI / 180.0) /30), p.y + (sin(courrentTriangleAngle * M_PI / 180.0)/30)); + points.push_back(vec2(p.x + (cos(courrentTriangleAngle * M_PI / 180.0) /30), p.y + (sin(courrentTriangleAngle * M_PI / 180.0)/30))); } } @@ -183,10 +183,6 @@ public: color = newColor; } - void addNeighbour(GraphPoint* p) { - neighbours.push_back(p); - } - void draw() override { @@ -199,24 +195,10 @@ public: } }; -GraphPoint* gps = new GraphPoint[50]; - -void graphPointSetNeighbour() { - for (int i = 0; i < 50; i++) { - for (int j = 0; j < 50; j++) { - if (i != j) - gps[i].addNeighbour(&gps[j]); - } - } -} - - -//Beallitja, hogy kinek ki lesz kozvetlen szomszedja ellel, es ki nem -void graphPointsRandomiseNeighbour() { - for (int i = 0; i < 50; i++) { - gps[i]; - } -} +struct pairs { + GraphPoint p1; + GraphPoint p2; +}; class Line : drawableBase { @@ -244,14 +226,44 @@ public: } }; +class graphManager { + + GraphPoint* gps = new GraphPoint[50]; + std::vector<pairs> pair; + std::vector<Line> line; +public: + + graphManager() { + for (int i = 0; i < 50; i++) { + for (int j = i+1; j < 50; j++) { + int rndm = rand() % 100; + if (rndm < 5) { + pairs p; p.p1 = gps[i]; p.p2 = gps[j]; + pair.push_back(p); + } + } + } + } + + void draw() { + for (int i = 0; i < 50; i++) { + gps[i].draw(); + } + + for (int i = 0; i < pair.size(); i++) { + Line temp(pair[i].p1.getPoint(), pair[i].p2.getPoint()); + temp.draw(); + line.push_back(temp); + } + } +}; + +graphManager gm; // Initialization, create an OpenGL context void onInitialization() { glViewport(0, 0, windowWidth, windowHeight); - - //graphPointSetNeighbour(); - //graphPointsRandomiseNeighbour(); - + // create program for the GPU gpuProgram.create(vertexSource, fragmentSource, "outColor"); } @@ -260,13 +272,7 @@ void onInitialization() { void onDisplay() { MVPInit(); setBackgroundColor(Color(0,0,0)); //set the background color to black - gps[1].setCoordinates(vec2(0.4f, 0.4f)); - - Line l2(gps[1].getPoint(), gps[0].getPoint()); - l2.draw(); - gps[1].draw(); - gps[0].draw(); - + gm.draw(); glutSwapBuffers(); // exchange buffers for double buffering }