From 97fcc6cddacef7d70aceb4dee6a29a2e502bed57 Mon Sep 17 00:00:00 2001 From: leca Date: Sat, 1 Mar 2025 13:08:36 +0300 Subject: [PATCH] fixed wrong rotation side --- .../index/coil.cpp.430626AC9C964D13.idx | Bin 886 -> 1384 bytes .../index/coil.hpp.679854B715F05634.idx | Bin 904 -> 958 bytes .../index/main.cpp.40336BE2C71C0AAD.idx | Bin 3280 -> 1224 bytes .../index/segment.cpp.E58BEE5B986EAFA7.idx | Bin 4304 -> 5024 bytes .../index/segment.hpp.C426421540A83234.idx | Bin 1584 -> 1680 bytes .../index/utils.cpp.9EA3B96F5F89167F.idx | Bin 0 -> 2552 bytes .../index/utils.hpp.66E4232BF41BB544.idx | Bin 0 -> 690 bytes CMakeLists.txt | 2 + src/coil/coil.cpp | 21 ++++- src/coil/coil.hpp | 1 + src/coil/segment.cpp | 35 +++----- src/coil/segment.hpp | 5 +- src/main.cpp | 77 ---------------- src/utils/utils.cpp | 82 ++++++++++++++++++ src/utils/utils.hpp | 12 +++ 15 files changed, 131 insertions(+), 104 deletions(-) create mode 100644 .cache/clangd/index/utils.cpp.9EA3B96F5F89167F.idx create mode 100644 .cache/clangd/index/utils.hpp.66E4232BF41BB544.idx create mode 100644 src/utils/utils.cpp create mode 100644 src/utils/utils.hpp diff --git a/.cache/clangd/index/coil.cpp.430626AC9C964D13.idx b/.cache/clangd/index/coil.cpp.430626AC9C964D13.idx index d8688a6a16b1892523b14160e9fb635ce83800ba..159e30a22c7cfa3695c0ef97af4f15e7b11c1847 100644 GIT binary patch literal 1384 zcmWIYbaP8!Wngel@vO*AElFfyU|98-v72h)R;5S>Fp!V4wa<3ZqG&difxA5cKXDQwWT-W&dyqC1fy0V3d zExpy)HFc(q_TKe-Os4O4St?v4Gs*R>#@hX+hGuQbrXTj)c5!!R_wVtn=`4L(Zn$_I8IA%HVHRK=bvxw|8>s9Oz5l8enMld^n-DJESN{j7d<4L4=)+ol8`hMVNzu11JXs3wxgXHSG*uF2E!W zlos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ya8!Xu_l!ic-^xX9Gh%#7{{5#Y7uc zMjjz9RxWOsHqTqjUROjqsxa{gF*7ss!Q8?l#45q64C5(!_BRC0%rao%5n^IsVu1+* zc|ga)B!T8iamm5Vj?^e;D)FiaT8Q)JRa z@K~8xxnMk)Yk+PBMHnoIVD%aa|xcx)8R&ix+k_96JgXgVfuPY)Q zRrr{gnHX63dHE&41Oo@q~r zrWJPp!z9E{Nd3h`8&)PB76DEHewc@NSVTBQ_+e(i0-2Eu9JsJRh0#pVK!t=K0}nU^ zVUlrPbC|E({t^nZKtMnm$pQfpX_y7DSYYHt(OaGIcMeOdL^9A`77i8xsQC=ANC66i zVgzOr%xIu6C?;USut)$3gJJ+C3=4dqFev0tSQ!8bk^#m5 literal 904 zcmWIYbaQK9W?*nm@vO*AElFfyU|b(p%3{nRR(<ga6zz4dYfDgG=kIryMN1U*g-H zy|Rl-dHHAdEw9!asqnvIJIQwcnDFTrm-QuW?wjlLF3L&02b^(VNjUEY=RjL z6b6MgOc)l-Kw(fA!-QeM3ls*0Elike&4;r#v;I9}=3(V$;pc(*9Ox%bVL_NPfjoI( zbr=s86F|pn+a diff --git a/.cache/clangd/index/main.cpp.40336BE2C71C0AAD.idx b/.cache/clangd/index/main.cpp.40336BE2C71C0AAD.idx index 13e1b9f7faa71650f03daadbb224de2905638a71..0e4a6a2b34d04a117cdbb6fa4513377cb489fd9b 100644 GIT binary patch literal 1224 zcmWIYbaOkv!oc91;#rZKT9OE4G6(~4aY<2T4kH5tD^Q?f&eTc%{>p|tM?a@pEIg8R zlUuv+rkBE!r&pHB1gd@X*?V?=;2e=7%j37_1X>C%2{ifmXP)|dORwyuTlKdbUzGf< z!Z2mhy*Ap5$FW7urFjtn9 zSzUi`&f>gHK?zIe=S+B3G;K|Zj`DOG;cqqj7TfhN=zLdzLo*ag;Xv=b5-ks`Urw1?%e0qrV;}ZM%Ex@|6DW zo2NYYuT7bwwCq>zM|U&zi;9aTPv3oiyZ@uqnw?h0#e6%upXyg8d_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v~lOGu{sL&Rd;0LhiD^kw6+bej@>*?AFQ>7S!4;wM*Cs8GHQi;{y*A z<>!3lenn6e*ZdSU#wj4>9%&rihuX2<{cUbu-hRHaF+LJ0CE?f<_jV!wmsBmNWFZoZ Rd3;7795veA)6Ihx{TJJe<$3@B diff --git a/.cache/clangd/index/segment.cpp.E58BEE5B986EAFA7.idx b/.cache/clangd/index/segment.cpp.E58BEE5B986EAFA7.idx index f87191554def009949a80f1cf164dff3de00f03d..5165fd0acfeb3d43ab5cc7fbab8e1d056b0c2522 100644 GIT binary patch literal 5024 zcmZ8ld0bT09>2fKMQ4};bGgg{12b?3SyW&KNR(}u85eNNVku55|Lwe>O;}1XQdw=J5&hLDG>zF=r z#E8v43^R1f$m0B|v$HvdVK8KhW*5%*5*X&LJHr%j*`3k6>Y|xH+tI!M_|Wu;x^G9j zE&J@wiHqI7su`EZ3>-aeMBE<_%PQJtc`Tbdw5dEb_UGi%u8Mc+TQ4*{XS^8IcYa== zVa+4275^27b$iWiKl-H>F8y}buHO?o{98|zTb|o}Hvd-L-rAw>U+Lsu^P270_E}S| zS)2G}-juE3tv$2HxBMD$K5N7Yw|V;){oXa|gM0C}cP<;duYJ*SuZ1$_{g9t0BB&HXAXGTz@3V>xuDPyRa9cf4leuHp4di{5x}Xx0A2SNG>#Td?i% z=TV+qbHnEu19t0tmu9ERKfRFs=+?r{!K=ax>PGqB9XD-5TSh^9)y?AinD2+D49mQm zJk$8rzl{4%8%F)myh(BX)zi_cCH;pjIcE7~`~C8BF|VXoEDf!G=lo4EllkPpn{$^e z)LfsCoiOXS=*INGn?JpG`@s9NvNuhsJ=nN!&YlsjOS{c-`e1x#LFMwfe4E zp(V3_{Q9<~qvZ9l&Z9lsn@V0C8Dj$I;@nMa`Uc zu&mZxe|1v$_~@UuUg+NSuxyGpO+PiuBzOKW!SNuZ^3;hLJ1)j;dz>`3{tvg9vwq`? z-pbEuU>Rn5fl;H@tXJw-Gxm1xpQu%6RZo@-lVD+w=Pq8a)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l{H^d(0IA$uVaT}Q}L&6vmF~!RK6xma=R(D)PF*``FS>eBUhuu z1AB_!8O?6mU$MVdXaCLJKWk-X_Olk4*FT(eG}!JuH>dQytGb60lNWvE+Ti)D)IG33 z#IG`@)N3*Sp~aWH%Y^PNi@SdDn$CmV;;Kw2m>cO zGlLihLs4p4aU)Oy<_1Pih}}@NFuQ@mU^}70!JMvpb5jNSn0WZuS=qVacJQ%Fu`9rM zFoyy4f*l0a3zG&4gB=1D2D&6C5yUPoN-nkrG5B&POkbENl(UhAmtR1TfgdCW0Rk`v M1A`!f$%|kD0O2##LI3~& literal 0 HcmV?d00001 diff --git a/CMakeLists.txt b/CMakeLists.txt index ece0ce6..b622d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,14 @@ include(FetchContent) SET(PROJECT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp src/glad.c ${CMAKE_CURRENT_SOURCE_DIR}/src/coil/coil.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/coil/segment.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/utils.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src/coil ${CMAKE_CURRENT_SOURCE_DIR}/src/ui + ${CMAKE_CURRENT_SOURCE_DIR}/src/utils ) add_executable(TimeCoil ${PROJECT_SOURCES}) diff --git a/src/coil/coil.cpp b/src/coil/coil.cpp index 7f769a9..def6554 100644 --- a/src/coil/coil.cpp +++ b/src/coil/coil.cpp @@ -1,4 +1,9 @@ -#include "coil.hpp" +#include +#include + +#include +#include +#include Coil::Coil(uint32_t currentYear, uint32_t amountOfSegments) : currentYear(currentYear) { @@ -14,4 +19,18 @@ std::vector &Coil::getSegments() { double Coil::getWidth() { return width; +} + +void Coil::render() { + prepareShaders(); + uint64_t VBO; + glGenBuffers(1, (unsigned int*) &(VBO)); + glBindBuffer(GL_ARRAY_BUFFER, VBO); + for (CoilSegment segment : segments) { + double* vertices = segment.getVertices(); + uint64_t verticesLength = segment.getVerticesLength(); + glBufferData(GL_ARRAY_BUFFER, verticesLength, vertices, GL_STATIC_DRAW); + + + } } \ No newline at end of file diff --git a/src/coil/coil.hpp b/src/coil/coil.hpp index 456c230..f4b5d75 100644 --- a/src/coil/coil.hpp +++ b/src/coil/coil.hpp @@ -20,6 +20,7 @@ class Coil { Coil(uint32_t currentYear, uint32_t amountOfSegments); std::vector &getSegments(); double getWidth(); + void render(); }; #endif // COIL_HPP \ No newline at end of file diff --git a/src/coil/segment.cpp b/src/coil/segment.cpp index dc0ee2b..da5e022 100644 --- a/src/coil/segment.cpp +++ b/src/coil/segment.cpp @@ -1,13 +1,15 @@ -#include "segment.hpp" -#include "coil.hpp" -#include "glm/ext/matrix_float4x4.hpp" -#include "glm/ext/matrix_transform.hpp" -#include "glm/trigonometric.hpp" +#include +#include +#include #include #include #include #include +#include +#include +#include + // x, y, z, r, g, b #define FIELDS_IN_POINT 6 #define DAYS_IN_YEAR (isLeap? 366.0f : 365.0f) @@ -66,10 +68,6 @@ void CoilSegment::printVertices() { } } -double round_to_presicion( double value, int precision ) { - const int adjustment = pow(10,precision); - return floor( value*(adjustment) + 0.5 )/adjustment; -} double *CoilSegment::calculateSlice() { uint32_t size = (/*start and end of a slize*/2 + sliceDetalization) * FIELDS_IN_POINT * sizeof(double); @@ -129,7 +127,7 @@ void CoilSegment::constructSegment(double *slice) { transform = rotate( transform, - radians(daysDegree), + -radians(daysDegree), vec3( 0.0, 1.0, @@ -178,23 +176,12 @@ double *CoilSegment::getVertices() { return vertices; } -uint16_t CoilSegment::getVerticesLength() { +uint64_t CoilSegment::getVerticesLength() { return verticesLength; } -void CoilSegment::printSlice(double *slice) { - for (uint32_t i = 0; i < sliceDetalization+2; i ++) { - uint32_t offset = FIELDS_IN_POINT * i; - cout << "Point (" - << slice[offset + 0] << ", " - << slice[offset + 1] << ", " - << slice[offset + 2] << ", " - << ") rgb(" - << slice[offset + 3] << ", " - << slice[offset + 4] << ", " - << slice[offset + 5] << ")" - << endl; - } +void CoilSegment::render() { + } void CoilSegment::exportSliceToCSV(double *slice) { diff --git a/src/coil/segment.hpp b/src/coil/segment.hpp index a160223..9de3dba 100644 --- a/src/coil/segment.hpp +++ b/src/coil/segment.hpp @@ -14,7 +14,7 @@ class CoilSegment { uint32_t sliceDetalization; bool isLeap; double *vertices; - uint32_t verticesLength; + uint64_t verticesLength; void init(); double* calculateSlice(); @@ -25,10 +25,11 @@ class CoilSegment { void calculate(); void printVertices(); double *getVertices(); - uint16_t getVerticesLength(); + uint64_t getVerticesLength(); void printSlice(double *slice); void exportSliceToCSV(double *slice); void exportSegmentToCsv(); + void render(); }; #endif // COIL_SEGMENT_HPP \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index eb1d7b8..1e3b595 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,5 @@ #include #include -#include -#include #include #include #include @@ -21,32 +19,6 @@ void processInput(GLFWwindow *window) { } } -void renderGraphics(GLFWwindow *window) { - -} - -void gracefulExit(int code) { - glfwTerminate(); - exit(code); -} - -std::string readFile(std::string path) { - std::ifstream file(path); - if (!file.is_open()) - std::cerr << "File " << path << " was not found." << std::endl; - - std::string content = ""; - std::string buffer = ""; - - while(getline(file, buffer)) { - content += buffer + "\n"; - } - - content += '\0'; - file.close(); - return content; -} - void updateVertices(double (&vertices)[24]) { // if (RAND_0_1 < 0.99f) return; double a[] = { @@ -60,55 +32,6 @@ void updateVertices(double (&vertices)[24]) { memcpy(vertices, a, sizeof(a)); } -unsigned int prepareShaders() { - unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER); - unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); - - std::string vertexShaderSourceString = readFile("../shaders/shader.vert"); - std::string fragmentShaderSourceString = readFile("../shaders/shader.frag"); - - const char *vertexShaderSource = vertexShaderSourceString.c_str(); - const char *fragmentShaderSource = fragmentShaderSourceString.c_str(); - - glShaderSource(vertexShader, 1, &vertexShaderSource, NULL); - glCompileShader(vertexShader); - - int success; - char log[512]; - glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success); - if (!success) { - glGetShaderInfoLog(vertexShader, 512, NULL, log); - std::cerr << "Could not compile vertex shader: " << log << std::endl; - gracefulExit(-1); - } - glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL); - glCompileShader(fragmentShader); - - glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success); - if (!success) { - glGetShaderInfoLog(fragmentShader, 512, NULL, log); - std::cerr << "Could not compile fragment shader: " << log << std::endl; - gracefulExit(-1); - } - - unsigned int shaderProgram; - shaderProgram = glCreateProgram(); - glAttachShader(shaderProgram, vertexShader); - glAttachShader(shaderProgram, fragmentShader); - glLinkProgram(shaderProgram); - - glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success); - if(!success) { - glGetProgramInfoLog(shaderProgram, 512, NULL, log); - std::cerr << "Could not link program: " << log << std::endl; - gracefulExit(-1); - } - - glDeleteShader(vertexShader); - glDeleteShader(fragmentShader); - return shaderProgram; -} - int main () { Coil c = Coil(2025, 1); diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp new file mode 100644 index 0000000..8b0b629 --- /dev/null +++ b/src/utils/utils.cpp @@ -0,0 +1,82 @@ +#include +#include +#include +#include +#include +#include + +double round_to_presicion( double value, int precision ) { + const int adjustment = pow(10,precision); + return floor( value*(adjustment) + 0.5 )/adjustment; +} + +std::string readFile(std::string path) { + std::ifstream file(path); + if (!file.is_open()) + std::cerr << "File " << path << " was not found." << std::endl; + + std::string content = ""; + std::string buffer = ""; + + while(getline(file, buffer)) { + content += buffer + "\n"; + } + + content += '\0'; + file.close(); + return content; +} + +void gracefulExit(int code) { + glfwTerminate(); + exit(code); +} + +unsigned int prepareShaders() { + unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER); + unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); + + std::string vertexShaderSourceString = readFile("../shaders/shader.vert"); + std::string fragmentShaderSourceString = readFile("../shaders/shader.frag"); + + const char *vertexShaderSource = vertexShaderSourceString.c_str(); + const char *fragmentShaderSource = fragmentShaderSourceString.c_str(); + + glShaderSource(vertexShader, 1, &vertexShaderSource, NULL); + glCompileShader(vertexShader); + + int success; + char log[512]; + glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success); + if (!success) { + glGetShaderInfoLog(vertexShader, 512, NULL, log); + std::cerr << "Could not compile vertex shader: " << log << std::endl; + gracefulExit(-1); + } + glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL); + glCompileShader(fragmentShader); + + glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success); + if (!success) { + glGetShaderInfoLog(fragmentShader, 512, NULL, log); + std::cerr << "Could not compile fragment shader: " << log << std::endl; + gracefulExit(-1); + } + + unsigned int shaderProgram; + shaderProgram = glCreateProgram(); + glAttachShader(shaderProgram, vertexShader); + glAttachShader(shaderProgram, fragmentShader); + glLinkProgram(shaderProgram); + + glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success); + if(!success) { + glGetProgramInfoLog(shaderProgram, 512, NULL, log); + std::cerr << "Could not link program: " << log << std::endl; + gracefulExit(-1); + } + + glDeleteShader(vertexShader); + glDeleteShader(fragmentShader); + return shaderProgram; +} \ No newline at end of file diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp new file mode 100644 index 0000000..29f684d --- /dev/null +++ b/src/utils/utils.hpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +double round_to_presicion( double value, int precision ); + +std::string readFile(std::string path); + +void gracefulExit(int code); + +unsigned int prepareShaders(); \ No newline at end of file