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

Function SetMaterialColorProperty

code/AssetLib/glTF/glTFImporter.cpp:81–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79namespace {
80
81 void SetMaterialColorProperty(const std::vector<int> &embeddedTexIdxs, Asset &, TexProperty prop, aiMaterial *mat,
82 aiTextureType texType, const char *pKey, unsigned int type, unsigned int idx) {
83 if (prop.texture) {
84 if (prop.texture->source) {
85 aiString uri(prop.texture->source->uri);
86
87 if (const int texIdx = embeddedTexIdxs[prop.texture->source.GetIndex()]; texIdx != -1) { // embedded
88 // setup texture reference string (copied from ColladaLoader::FindFilenameForEffectTexture)
89 uri.data[0] = '*';
90 uri.length = 1 + ASSIMP_itoa10(uri.data + 1, AI_MAXLEN - 1, texIdx);
91 }
92
93 mat->AddProperty(&uri, _AI_MATKEY_TEXTURE_BASE, texType, 0);
94 }
95 return;
96 }
97
98 aiColor4D col;
99 CopyValue(prop.color, col);
100 mat->AddProperty(&col, 1, pKey, type, idx);
101 }
102
103 void SetFace(aiFace &face, int a) {
104 face.mNumIndices = 1;

Callers 1

ImportMaterialsMethod · 0.70

Calls 4

ASSIMP_itoa10Function · 0.85
GetIndexMethod · 0.80
CopyValueFunction · 0.70
AddPropertyMethod · 0.45

Tested by

no test coverage detected