| 548 | } |
| 549 | |
| 550 | glm::vec3 parseRGBString(const std::string &rgb_string) { |
| 551 | std::stringstream tempComponent; |
| 552 | uint8_t commaCount = 0; |
| 553 | glm::vec3 rgbValue; |
| 554 | |
| 555 | for (int char_Idx = 0; char_Idx < rgb_string.length(); ++char_Idx) { |
| 556 | if (rgb_string[char_Idx] == ',') { |
| 557 | switch (commaCount) { |
| 558 | case 0: |
| 559 | rgbValue.x = (float) stoi(tempComponent.str()); |
| 560 | break; |
| 561 | case 1: |
| 562 | rgbValue.y = (float) stoi(tempComponent.str()); |
| 563 | break; |
| 564 | case 2: |
| 565 | rgbValue.z = (float) stoi(tempComponent.str()); |
| 566 | break; |
| 567 | } |
| 568 | tempComponent.str(""); |
| 569 | if (++commaCount >= 3) break; |
| 570 | } else { |
| 571 | tempComponent << rgb_string[char_Idx]; |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | return rgbValue; |
| 576 | } |
| 577 | |
| 578 | glm::vec3 calculateQuadNormal(glm::vec3 p1, glm::vec3 p2, glm::vec3 p3, glm::vec3 p4){ |
| 579 | glm::vec3 triANormal = calculateNormal(p1, p2, p3); |