+ isResourceFoundUser = false;
+ }
+
+ } else
+ isResourceFoundUser = true;
+
+ if(!isResourceFound && !isResourceFoundUser){
+ INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString());
+ INFOS("No valid file \"ImportExport\" found in " << aUserResDir.ToCString() );
+ }
+
+ return ( myResMgr->Find("Import") || myResMgr->Find("Export") ||
+ myResMgrUser->Find("Import") || myResMgrUser->Find("Export"));
+}
+
+int GEOMImpl_IInsertOperations::LoadTexture(const TCollection_AsciiString& theTextureFile)
+{
+ SetErrorCode(KO);
+
+ if (theTextureFile.IsEmpty()) return 0;
+
+ Handle(TDataStd_HArray1OfByte) aTexture;
+
+ FILE* fp = fopen(theTextureFile.ToCString(), "r");
+ if (!fp) return 0;
+
+ std::list<std::string> lines;
+ char buffer[4096];
+ int maxlen = 0;
+ while (!feof(fp)) {
+ if ((fgets(buffer, 4096, fp)) == NULL) break;
+ int aLen = strlen(buffer);
+ if (buffer[aLen-1] == '\n') buffer[aLen-1] = '\0';
+ lines.push_back(buffer);
+ maxlen = std::max(maxlen, (int)strlen(buffer));
+ }
+
+ fclose(fp);
+
+ int lenbytes = maxlen/8;
+ if (maxlen%8) lenbytes++;
+
+ if (lenbytes == 0 || lines.empty())
+ return 0;
+
+ std::list<unsigned char> bytedata;
+ std::list<std::string>::const_iterator it;
+ for (it = lines.begin(); it != lines.end(); ++it) {
+ std::string line = *it;
+ int lenline = (line.size()/8 + (line.size()%8 ? 1 : 0)) * 8;
+ for (int i = 0; i < lenline/8; i++) {
+ unsigned char byte = 0;
+ for (int j = 0; j < 8; j++)
+ byte = (byte << 1) + ( i*8+j < line.size() && line[i*8+j] != '0' ? 1 : 0 );
+ bytedata.push_back(byte);