MCPcopy Create free account
hub / github.com/assimp/assimp / GetMaterialColor

Function GetMaterialColor

code/AssetLib/Ply/PlyLoader.cpp:139–167  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Get a RGBA color in [0...1] range

Source from the content-addressed store, hash-verified

137 // ------------------------------------------------------------------------------------------------
138 // Get a RGBA color in [0...1] range
139 void GetMaterialColor(const std::vector<PLY::PropertyInstance> &avList, unsigned int positions[4], EDataType types[4],
140 aiColor4D *clrOut) {
141 ai_assert(nullptr != clrOut);
142
143 if (NotSet == positions[0]) {
144 clrOut->r = 0.0f;
145 } else {
146 clrOut->r = NormalizeColorValue(GetProperty(avList, positions[0]).avList.front(), types[0]);
147 }
148
149 if (NotSet == positions[1]) {
150 clrOut->g = 0.0f;
151 } else {
152 clrOut->g = NormalizeColorValue(GetProperty(avList, positions[1]).avList.front(), types[1]);
153 }
154
155 if (NotSet == positions[2]) {
156 clrOut->b = 0.0f;
157 } else {
158 clrOut->b = NormalizeColorValue(GetProperty(avList, positions[2]).avList.front(), types[2]);
159 }
160
161 // assume 1.0 for the alpha channel ifit is not set
162 if (NotSet == positions[3]) {
163 clrOut->a = 1.0f;
164 } else {
165 clrOut->a = NormalizeColorValue(GetProperty(avList, positions[3]).avList.front(), types[3]);
166 }
167 }
168
169 } // namespace
170

Callers 1

LoadMaterialMethod · 0.85

Calls 2

NormalizeColorValueFunction · 0.85
frontMethod · 0.45

Tested by

no test coverage detected