------------------------------------------------------------------------------------------------ Extract a material from the PLY DOM
| 703 | // ------------------------------------------------------------------------------------------------ |
| 704 | // Extract a material from the PLY DOM |
| 705 | void PLYImporter::LoadMaterial(std::vector<aiMaterial *> *pvOut, std::string &defaultTexture, const bool pointsOnly) { |
| 706 | ai_assert(nullptr != pvOut); |
| 707 | |
| 708 | // diffuse[4], specular[4], ambient[4] |
| 709 | // rgba order |
| 710 | unsigned int aaiPositions[3][4] = { |
| 711 | { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }, |
| 712 | { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }, |
| 713 | { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }, |
| 714 | }; |
| 715 | |
| 716 | EDataType aaiTypes[3][4] = { |
| 717 | { EDT_Char, EDT_Char, EDT_Char, EDT_Char }, |
| 718 | { EDT_Char, EDT_Char, EDT_Char, EDT_Char }, |
| 719 | { EDT_Char, EDT_Char, EDT_Char, EDT_Char } |
| 720 | }; |
| 721 | ElementInstanceList *pcList = nullptr; |
| 722 | |
| 723 | unsigned int iPhong = 0xFFFFFFFF; |
| 724 | EDataType ePhong = EDT_Char; |
| 725 | |
| 726 | unsigned int iOpacity = 0xFFFFFFFF; |
| 727 | EDataType eOpacity = EDT_Char; |
| 728 | |
| 729 | // search in the DOM for a vertex entry |
| 730 | unsigned int _i = 0; |
| 731 | for (std::vector<Element>::const_iterator i = this->pcDOM->alElements.begin(); |
| 732 | i != this->pcDOM->alElements.end(); ++i, ++_i) { |
| 733 | if (EEST_Material == i->eSemantic) { |
| 734 | pcList = &this->pcDOM->alElementData[_i]; |
| 735 | |
| 736 | // now check whether which coordinate sets are available |
| 737 | unsigned int _a = 0; |
| 738 | for (std::vector<Property>::const_iterator a = i->alProperties.begin(); a != i->alProperties.end(); ++a, ++_a) { |
| 739 | if (a->bIsList) { |
| 740 | continue; |
| 741 | } |
| 742 | |
| 743 | // pohng specularity ----------------------------------- |
| 744 | if (EST_PhongPower == (*a).Semantic) { |
| 745 | iPhong = _a; |
| 746 | ePhong = (*a).eType; |
| 747 | } |
| 748 | |
| 749 | // general opacity ----------------------------------- |
| 750 | if (EST_Opacity == (*a).Semantic) { |
| 751 | iOpacity = _a; |
| 752 | eOpacity = (*a).eType; |
| 753 | } |
| 754 | |
| 755 | // diffuse color channels ----------------------------------- |
| 756 | if (EST_DiffuseRed == (*a).Semantic) { |
| 757 | aaiPositions[0][0] = _a; |
| 758 | aaiTypes[0][0] = (*a).eType; |
| 759 | } else if (EST_DiffuseGreen == (*a).Semantic) { |
| 760 | aaiPositions[0][1] = _a; |
| 761 | aaiTypes[0][1] = (*a).eType; |
| 762 | } else if (EST_DiffuseBlue == (*a).Semantic) { |
nothing calls this directly
no test coverage detected