Conversation
Owner
JBenda
commented
Oct 23, 2021
- support for .mtl files
- triangulates ploygones with more then 3 vertices (ear cut)
- support for materials and sub objects
- grouping informations are accessible
* support for .mtl files * triangulates ploygones with more then 3 vertices (ear cut) * support for materials and sub objects * grouping informations are accessible
Thanduriel
reviewed
Oct 26, 2021
Collaborator
Thanduriel
left a comment
There was a problem hiding this comment.
- add documentation
- adjust naming convention
- (remove extra scopes?)
Thanduriel
reviewed
Nov 1, 2021
Comment on lines
+208
to
+223
| void MtlParser::parseIllumination(const std::string_view& _line) { | ||
| int i = static_cast<int>(parseFloat(_line.data(), _line.data() + _line.size())); | ||
| if(i < 0 || i >= utils::MeshData::MaterialData::USED_LIGHT::END) { | ||
| spdlog::warn("unsupported illumination model for object, use FULL instead!"); | ||
| i = 2; | ||
| } | ||
| m_pNewMtl->illumination = static_cast<utils::MeshData::MaterialData::USED_LIGHT>(i); | ||
| } | ||
| void MtlParser::parse() { | ||
| std::string_view suffix(m_filename); | ||
| auto pos = suffix.find_last_of('.'); | ||
| suffix.remove_prefix(pos); | ||
| if(suffix == ".mtl") { | ||
| std::string filename = m_tmp.directory + m_filename.data(); | ||
| std::ifstream file(filename); | ||
| if(file) { |
Collaborator
There was a problem hiding this comment.
curly brackets go on new lines
| } | ||
| } /// namespace utils | ||
|
|
||
| std::vector<int> EarCutTriangulation::operator()() { |
Comment on lines
+91
to
+103
| void slide(auto data, auto fun) | ||
| { | ||
| auto itr = data.begin(); | ||
| fun(itr - data.begin(), *data.back(), *itr[0], *itr[1]); | ||
| ++itr; | ||
| for(;itr != data.end() - 1; ++itr) { | ||
| fun(itr - data.begin(), *itr[-1], *itr[0], *itr[1]); | ||
| } | ||
| fun(itr - data.begin(), *data.end()[-2], *data.back(), *data.front()); | ||
| } | ||
|
|
||
| /// calculate primary orientation of polygone | ||
| Orientation determineMainOrientation(auto data) { |
| /** \param mainOrientation primary orientation of polygone (needed to determined inside for classification of reflex and convex */ | ||
| void classifyVertices(Orientation mainOrientation); | ||
|
|
||
| const std::vector<glm::vec3>& m_polygone; |
| return res; | ||
| } | ||
| } | ||
| /// triangulate a polygone with the earcut algorithm |
Collaborator
There was a problem hiding this comment.
reference for the algorithm
| @@ -0,0 +1,269 @@ | |||
| #include "./triangulation.hpp" | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.