| 1051 | } |
| 1052 | |
| 1053 | GFXTextureObject *GFXTextureManager::createCompositeTexture(const Torque::Path &pathR, const Torque::Path &pathG, const Torque::Path &pathB, const Torque::Path &pathA, U32 inputKey[4], |
| 1054 | GFXTextureProfile *profile) |
| 1055 | { |
| 1056 | PROFILE_SCOPE(GFXTextureManager_createCompositeTexture); |
| 1057 | |
| 1058 | String inputKeyStr = String::ToString("%d%d%d%d", inputKey[0], inputKey[1], inputKey[2], inputKey[3]); |
| 1059 | |
| 1060 | String resourceTag = pathR.getFileName() + pathG.getFileName() + pathB.getFileName() + pathA.getFileName() + inputKeyStr; //associate texture object with a key combo |
| 1061 | |
| 1062 | GFXTextureObject *cacheHit = _lookupTexture(resourceTag, profile); |
| 1063 | if (cacheHit != NULL) return cacheHit; |
| 1064 | |
| 1065 | Torque::Path lastValidPath = ""; |
| 1066 | GBitmap*bitmap[4]; |
| 1067 | |
| 1068 | if (!pathR.isEmpty()) |
| 1069 | { |
| 1070 | bitmap[0] = loadUncompressedTexture(pathR, profile); |
| 1071 | lastValidPath = pathR; |
| 1072 | } |
| 1073 | else |
| 1074 | bitmap[0] = NULL; |
| 1075 | |
| 1076 | if (!pathG.isEmpty()) |
| 1077 | { |
| 1078 | bitmap[1] = loadUncompressedTexture(pathG, profile); |
| 1079 | lastValidPath = pathG; |
| 1080 | } |
| 1081 | else |
| 1082 | bitmap[1] = NULL; |
| 1083 | |
| 1084 | if (!pathB.isEmpty()) |
| 1085 | { |
| 1086 | bitmap[2] = loadUncompressedTexture(pathB, profile); |
| 1087 | lastValidPath = pathB; |
| 1088 | } |
| 1089 | else |
| 1090 | bitmap[2] = NULL; |
| 1091 | |
| 1092 | if (!pathA.isEmpty()) |
| 1093 | { |
| 1094 | bitmap[3] = loadUncompressedTexture(pathA, profile); |
| 1095 | lastValidPath = pathA; |
| 1096 | } |
| 1097 | else |
| 1098 | bitmap[3] = NULL; |
| 1099 | |
| 1100 | |
| 1101 | Path realPath; |
| 1102 | GFXTextureObject *retTexObj = NULL; |
| 1103 | realPath = validatePath(lastValidPath); //associate path with last valid channel texture in. |
| 1104 | |
| 1105 | retTexObj = createCompositeTexture(bitmap, inputKey, resourceTag, profile, false); |
| 1106 | |
| 1107 | if (retTexObj) |
| 1108 | { |
| 1109 | // Store the path for later use. |
| 1110 | retTexObj->mPath = resourceTag; |
no test coverage detected