From ae5e4941a2a192127a568ab744bbabb04d05f42b Mon Sep 17 00:00:00 2001 From: Ilshat Safiullin Date: Fri, 15 Jun 2018 19:00:10 +0500 Subject: [PATCH] Cleanup lines100500.json --- main.cpp | 38 +++++++++++++++++--------------------- resources/lines100500.json | 20 -------------------- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/main.cpp b/main.cpp index 36dbf22..1715d13 100644 --- a/main.cpp +++ b/main.cpp @@ -138,7 +138,7 @@ int main() noexcept(false) { setWindowTitle("parsing lines.json"); boost::property_tree::ptree root; - boost::property_tree::read_json("../resources/line.json", root); + boost::property_tree::read_json("../resources/lines100500.json", root); size_t linesCount = 0; for(const auto& line: root.get_child("lines")) { @@ -162,22 +162,20 @@ int main() noexcept(false) { color.push_back(value.second.get_value()); } - if(startPosition[0] != endPosition[0] || startPosition[1] != endPosition[1]) { - bufferVertices( - verticesBuffer, - glm::vec3( - static_cast(startPosition[0]) / 2.0f, - static_cast(startPosition[1]) / 2.0f, - lineIndex * 0.0025f - ), - glm::vec3( - static_cast(endPosition[0]) / 2.0f, - static_cast(endPosition[1]) / 2.0f, - lineIndex * 0.0025f - ), - glm::vec3(color[0], color[1], color[2]) - ); - } + bufferVertices( + verticesBuffer, + glm::vec3( + static_cast(startPosition[0]) / 2.0f, + static_cast(startPosition[1]) / 2.0f, + lineIndex * 0.0025f + ), + glm::vec3( + static_cast(endPosition[0]) / 2.0f, + static_cast(endPosition[1]) / 2.0f, + lineIndex * 0.0025f + ), + glm::vec3(color[0], color[1], color[2]) + ); lineIndex++; std::stringstream progressString; @@ -185,10 +183,8 @@ int main() noexcept(false) { setWindowTitle(progressString.str().c_str()); } - GLuint threadVAO; - glGenVertexArrays(1, &threadVAO); - GLuint threadVBO; - glGenBuffers(1, &threadVBO); + GLuint threadVAO; glGenVertexArrays(1, &threadVAO); + GLuint threadVBO; glGenBuffers(1, &threadVBO); glBindVertexArray(threadVAO); glBindBuffer(GL_ARRAY_BUFFER, threadVBO); diff --git a/resources/lines100500.json b/resources/lines100500.json index 32eba0f..1157da6 100644 --- a/resources/lines100500.json +++ b/resources/lines100500.json @@ -1,7 +1,5 @@ { "lines": [ - {"start": [-110, 2020], "end": [-110, 2020], "color": [1.0, 0.0, 0.0]}, - {"start": [-40, 1910], "end": [-40, 1910], "color": [1.0, 0.0, 0.0]}, {"start": [-40, 1910], "end": [50, 1880], "color": [1.0, 0.0, 0.0]}, {"start": [50, 1880], "end": [40, 1660], "color": [1.0, 0.0, 0.0]}, {"start": [40, 1660], "end": [60, 1470], "color": [1.0, 0.0, 0.0]}, @@ -234,7 +232,6 @@ {"start": [720, -1560], "end": [750, -1280], "color": [1.0, 0.0, 0.0]}, {"start": [750, -1280], "end": [770, -960], "color": [1.0, 0.0, 0.0]}, {"start": [770, -960], "end": [770, -1220], "color": [1.0, 0.0, 0.0]}, - {"start": [770, -1220], "end": [770, -1220], "color": [1.0, 0.5, 0.0]}, {"start": [880, -810], "end": [970, -420], "color": [1.0, 0.5, 0.0]}, {"start": [970, -420], "end": [740, -190], "color": [1.0, 0.5, 0.0]}, {"start": [740, -190], "end": [550, -50], "color": [1.0, 0.5, 0.0]}, @@ -1819,7 +1816,6 @@ {"start": [-620, -120], "end": [-540, -70], "color": [1.0, 0.5, 0.0]}, {"start": [-540, -70], "end": [-490, -50], "color": [1.0, 0.5, 0.0]}, {"start": [-490, -50], "end": [-570, -140], "color": [1.0, 0.5, 0.0]}, - {"start": [-570, -140], "end": [-570, -140], "color": [1.0, 1.0, 1.0]}, {"start": [-590, -110], "end": [-720, -170], "color": [1.0, 1.0, 1.0]}, {"start": [-720, -170], "end": [-860, -230], "color": [1.0, 1.0, 1.0]}, {"start": [-860, -230], "end": [-970, -220], "color": [1.0, 1.0, 1.0]}, @@ -4099,7 +4095,6 @@ {"start": [-1600, -470], "end": [-1640, -370], "color": [1.0, 1.0, 1.0]}, {"start": [-1640, -370], "end": [-1680, -270], "color": [1.0, 1.0, 1.0]}, {"start": [-1680, -270], "end": [-1740, -190], "color": [1.0, 1.0, 1.0]}, - {"start": [-1740, -190], "end": [-1740, -190], "color": [0.0, 0.1, 0.1]}, {"start": [-1810, -30], "end": [-1880, 150], "color": [0.0, 0.1, 0.1]}, {"start": [-1880, 150], "end": [-1940, 320], "color": [0.0, 0.1, 0.1]}, {"start": [-1940, 320], "end": [-1980, 500], "color": [0.0, 0.1, 0.1]}, @@ -6646,8 +6641,6 @@ {"start": [70, -830], "end": [10, -1040], "color": [0.0, 0.1, 0.1]}, {"start": [10, -1040], "end": [20, -750], "color": [0.0, 0.1, 0.1]}, {"start": [20, -750], "end": [50, -1020], "color": [0.0, 0.1, 0.1]}, - {"start": [-110, 2020], "end": [-110, 2020], "color": [1.0, 0.0, 0.0]}, - {"start": [-40, 1910], "end": [-40, 1910], "color": [1.0, 0.0, 0.0]}, {"start": [-40, 1910], "end": [50, 1880], "color": [1.0, 0.0, 0.0]}, {"start": [50, 1880], "end": [40, 1660], "color": [1.0, 0.0, 0.0]}, {"start": [40, 1660], "end": [60, 1470], "color": [1.0, 0.0, 0.0]}, @@ -6880,7 +6873,6 @@ {"start": [720, -1560], "end": [750, -1280], "color": [1.0, 0.0, 0.0]}, {"start": [750, -1280], "end": [770, -960], "color": [1.0, 0.0, 0.0]}, {"start": [770, -960], "end": [770, -1220], "color": [1.0, 0.0, 0.0]}, - {"start": [770, -1220], "end": [770, -1220], "color": [1.0, 0.5, 0.0]}, {"start": [880, -810], "end": [970, -420], "color": [1.0, 0.5, 0.0]}, {"start": [970, -420], "end": [740, -190], "color": [1.0, 0.5, 0.0]}, {"start": [740, -190], "end": [550, -50], "color": [1.0, 0.5, 0.0]}, @@ -8465,7 +8457,6 @@ {"start": [-620, -120], "end": [-540, -70], "color": [1.0, 0.5, 0.0]}, {"start": [-540, -70], "end": [-490, -50], "color": [1.0, 0.5, 0.0]}, {"start": [-490, -50], "end": [-570, -140], "color": [1.0, 0.5, 0.0]}, - {"start": [-570, -140], "end": [-570, -140], "color": [1.0, 1.0, 1.0]}, {"start": [-590, -110], "end": [-720, -170], "color": [1.0, 1.0, 1.0]}, {"start": [-720, -170], "end": [-860, -230], "color": [1.0, 1.0, 1.0]}, {"start": [-860, -230], "end": [-970, -220], "color": [1.0, 1.0, 1.0]}, @@ -10745,7 +10736,6 @@ {"start": [-1600, -470], "end": [-1640, -370], "color": [1.0, 1.0, 1.0]}, {"start": [-1640, -370], "end": [-1680, -270], "color": [1.0, 1.0, 1.0]}, {"start": [-1680, -270], "end": [-1740, -190], "color": [1.0, 1.0, 1.0]}, - {"start": [-1740, -190], "end": [-1740, -190], "color": [0.0, 0.1, 0.1]}, {"start": [-1810, -30], "end": [-1880, 150], "color": [0.0, 0.1, 0.1]}, {"start": [-1880, 150], "end": [-1940, 320], "color": [0.0, 0.1, 0.1]}, {"start": [-1940, 320], "end": [-1980, 500], "color": [0.0, 0.1, 0.1]}, @@ -13292,8 +13282,6 @@ {"start": [70, -830], "end": [10, -1040], "color": [0.0, 0.1, 0.1]}, {"start": [10, -1040], "end": [20, -750], "color": [0.0, 0.1, 0.1]}, {"start": [20, -750], "end": [50, -1020], "color": [0.0, 0.1, 0.1]}, - {"start": [-110, 2080], "end": [-110, 2080], "color": [1.0, 0.0, 0.0]}, - {"start": [-40, 1970], "end": [-40, 1970], "color": [1.0, 0.0, 0.0]}, {"start": [-40, 1970], "end": [40, 1940], "color": [1.0, 0.0, 0.0]}, {"start": [40, 1940], "end": [30, 1720], "color": [1.0, 0.0, 0.0]}, {"start": [30, 1720], "end": [50, 1530], "color": [1.0, 0.0, 0.0]}, @@ -13526,7 +13514,6 @@ {"start": [710, -1500], "end": [740, -1220], "color": [1.0, 0.0, 0.0]}, {"start": [740, -1220], "end": [760, -900], "color": [1.0, 0.0, 0.0]}, {"start": [760, -900], "end": [760, -1160], "color": [1.0, 0.0, 0.0]}, - {"start": [760, -1160], "end": [760, -1160], "color": [1.0, 0.5, 0.0]}, {"start": [870, -750], "end": [960, -360], "color": [1.0, 0.5, 0.0]}, {"start": [960, -360], "end": [730, -130], "color": [1.0, 0.5, 0.0]}, {"start": [730, -130], "end": [540, 10], "color": [1.0, 0.5, 0.0]}, @@ -15111,7 +15098,6 @@ {"start": [-620, -60], "end": [-540, -10], "color": [1.0, 0.5, 0.0]}, {"start": [-540, -10], "end": [-490, 10], "color": [1.0, 0.5, 0.0]}, {"start": [-490, 10], "end": [-570, -80], "color": [1.0, 0.5, 0.0]}, - {"start": [-570, -80], "end": [-570, -80], "color": [1.0, 1.0, 1.0]}, {"start": [-590, -50], "end": [-720, -110], "color": [1.0, 1.0, 1.0]}, {"start": [-720, -110], "end": [-860, -170], "color": [1.0, 1.0, 1.0]}, {"start": [-860, -170], "end": [-970, -160], "color": [1.0, 1.0, 1.0]}, @@ -17391,7 +17377,6 @@ {"start": [-1600, -410], "end": [-1640, -310], "color": [1.0, 1.0, 1.0]}, {"start": [-1640, -310], "end": [-1680, -210], "color": [1.0, 1.0, 1.0]}, {"start": [-1680, -210], "end": [-1740, -130], "color": [1.0, 1.0, 1.0]}, - {"start": [-1740, -130], "end": [-1740, -130], "color": [0.0, 0.1, 0.1]}, {"start": [-1810, 30], "end": [-1880, 210], "color": [0.0, 0.1, 0.1]}, {"start": [-1880, 210], "end": [-1940, 380], "color": [0.0, 0.1, 0.1]}, {"start": [-1940, 380], "end": [-1980, 560], "color": [0.0, 0.1, 0.1]}, @@ -19938,8 +19923,6 @@ {"start": [60, -770], "end": [0, -980], "color": [0.0, 0.1, 0.1]}, {"start": [0, -980], "end": [10, -690], "color": [0.0, 0.1, 0.1]}, {"start": [10, -690], "end": [40, -960], "color": [0.0, 0.1, 0.1]}, - {"start": [-110, 2080], "end": [-110, 2080], "color": [1.0, 0.0, 0.0]}, - {"start": [-40, 1970], "end": [-40, 1970], "color": [1.0, 0.0, 0.0]}, {"start": [-40, 1970], "end": [40, 1940], "color": [1.0, 0.0, 0.0]}, {"start": [40, 1940], "end": [30, 1720], "color": [1.0, 0.0, 0.0]}, {"start": [30, 1720], "end": [50, 1530], "color": [1.0, 0.0, 0.0]}, @@ -20172,7 +20155,6 @@ {"start": [710, -1500], "end": [740, -1220], "color": [1.0, 0.0, 0.0]}, {"start": [740, -1220], "end": [760, -900], "color": [1.0, 0.0, 0.0]}, {"start": [760, -900], "end": [760, -1160], "color": [1.0, 0.0, 0.0]}, - {"start": [760, -1160], "end": [760, -1160], "color": [1.0, 0.5, 0.0]}, {"start": [870, -750], "end": [960, -360], "color": [1.0, 0.5, 0.0]}, {"start": [960, -360], "end": [730, -130], "color": [1.0, 0.5, 0.0]}, {"start": [730, -130], "end": [540, 10], "color": [1.0, 0.5, 0.0]}, @@ -21757,7 +21739,6 @@ {"start": [-620, -60], "end": [-540, -10], "color": [1.0, 0.5, 0.0]}, {"start": [-540, -10], "end": [-490, 10], "color": [1.0, 0.5, 0.0]}, {"start": [-490, 10], "end": [-570, -80], "color": [1.0, 0.5, 0.0]}, - {"start": [-570, -80], "end": [-570, -80], "color": [1.0, 1.0, 1.0]}, {"start": [-590, -50], "end": [-720, -110], "color": [1.0, 1.0, 1.0]}, {"start": [-720, -110], "end": [-860, -170], "color": [1.0, 1.0, 1.0]}, {"start": [-860, -170], "end": [-970, -160], "color": [1.0, 1.0, 1.0]}, @@ -24037,7 +24018,6 @@ {"start": [-1600, -410], "end": [-1640, -310], "color": [1.0, 1.0, 1.0]}, {"start": [-1640, -310], "end": [-1680, -210], "color": [1.0, 1.0, 1.0]}, {"start": [-1680, -210], "end": [-1740, -130], "color": [1.0, 1.0, 1.0]}, - {"start": [-1740, -130], "end": [-1740, -130], "color": [0.0, 0.1, 0.1]}, {"start": [-1810, 30], "end": [-1880, 210], "color": [0.0, 0.1, 0.1]}, {"start": [-1880, 210], "end": [-1940, 380], "color": [0.0, 0.1, 0.1]}, {"start": [-1940, 380], "end": [-1980, 560], "color": [0.0, 0.1, 0.1]},