MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / saveCompositeTexture

Method saveCompositeTexture

Engine/source/gfx/gfxTextureManager.cpp:1128–1187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1126}
1127
1128void GFXTextureManager::saveCompositeTexture(const Torque::Path &pathR, const Torque::Path &pathG, const Torque::Path &pathB, const Torque::Path &pathA, U32 inputKey[4],
1129 const Torque::Path &saveAs,GFXTextureProfile *profile)
1130{
1131 PROFILE_SCOPE(GFXTextureManager_saveCompositeTexture);
1132
1133 String inputKeyStr = String::ToString("%d%d%d%d", inputKey[0], inputKey[1], inputKey[2], inputKey[3]);
1134
1135 String resourceTag = pathR.getFileName() + pathG.getFileName() + pathB.getFileName() + pathA.getFileName() + inputKeyStr; //associate texture object with a key combo
1136
1137 GFXTextureObject *cacheHit = _lookupTexture(resourceTag, profile);
1138 if (cacheHit != NULL)
1139 {
1140 cacheHit->dumpToDisk("png", saveAs.getFullPath());
1141 return;
1142 }
1143
1144 Torque::Path lastValidPath = "";
1145 GBitmap* bitmap[4];
1146
1147 if (!pathR.isEmpty())
1148 {
1149 bitmap[0] = loadUncompressedTexture(pathR, profile);
1150 lastValidPath = pathR;
1151 }
1152 else
1153 bitmap[0] = NULL;
1154
1155 if (!pathG.isEmpty())
1156 {
1157 bitmap[1] = loadUncompressedTexture(pathG, profile);
1158 lastValidPath = pathG;
1159 }
1160 else
1161 bitmap[1] = NULL;
1162
1163 if (!pathB.isEmpty())
1164 {
1165 bitmap[2] = loadUncompressedTexture(pathB, profile);
1166 lastValidPath = pathB;
1167 }
1168 else
1169 bitmap[2] = NULL;
1170
1171 if (!pathA.isEmpty())
1172 {
1173 bitmap[3] = loadUncompressedTexture(pathA, profile);
1174 lastValidPath = pathA;
1175 }
1176 else
1177 bitmap[3] = NULL;
1178
1179 Path realPath;
1180 GFXTextureObject *retTexObj = NULL;
1181 realPath = validatePath(lastValidPath); //associate path with last valid channel texture in.
1182
1183 retTexObj = createCompositeTexture(bitmap, inputKey, resourceTag, profile, false);
1184 if (retTexObj != NULL)
1185 retTexObj->dumpToDisk("png", saveAs.getFullPath());

Callers 2

importMaterialAssetMethod · 0.80

Calls 3

getFileNameMethod · 0.80
dumpToDiskMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected