+
+ /* check if it is a cubemap */
+ return load_cubemap(fname);
+}
+
+bool Texture::load_cubemap(const char *fname)
+{
+ const char *suffixes[] = {
+ "_px", "_py", "_pz",
+ "_nx", "_ny", "_nz"
+ };
+
+ for(int i=0; i<6; i++) {
+ char *buf = new char[strlen(fname) + 3 + 1];
+ strcpy(buf, fname);
+ char *suffix = strrchr(buf, '.');
+
+ if(suffix) {
+ memmove(suffix + 3, suffix, strlen(suffix) + 1);
+ memcpy(suffix, suffixes[i], 3);
+ } else {
+ strcat(buf, suffixes[i]);
+ }
+
+ Image img;
+ if(!img.load(buf)) {
+ images.clear();
+ return false;
+ }
+ images.push_back(img);
+ }
+