]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/ModelRegistry.cxx
Add preliminary spot light animation
[simgear.git] / simgear / scene / model / ModelRegistry.cxx
index 9d8df4324c2dc79230785e800eb53e66ffab08b6..f1199f689398995cf1be5decda9eb39b63f569e4 100644 (file)
@@ -193,7 +193,7 @@ public:
 } // namespace
 
 Node* DefaultProcessPolicy::process(Node* node, const string& filename,
-                                    const ReaderWriter::Options* opt)
+                                    const Options* opt)
 {
     TextureNameVisitor nameVisitor;
     node->accept(nameVisitor);
@@ -202,7 +202,7 @@ Node* DefaultProcessPolicy::process(Node* node, const string& filename,
 
 ReaderWriter::ReadResult
 ModelRegistry::readImage(const string& fileName,
-                         const ReaderWriter::Options* opt)
+                         const Options* opt)
 {
     CallbackMap::iterator iter
         = imageCallbackMap.find(getFileExtension(fileName));
@@ -236,36 +236,58 @@ ModelRegistry::readImage(const string& fileName,
 
             // GL_EXT_texture_compression_s3tc
             // patented, no way to decompress these
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT   0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  0x83F1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT  0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  0x83F3
+#endif
         case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
         case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
         case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
         case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-
+            
             // GL_EXT_texture_sRGB
             // patented, no way to decompress these
+#ifndef GL_EXT_texture_sRGB
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT  0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif
         case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
         case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
         case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
         case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-
+            
             // GL_TDFX_texture_compression_FXT1
             // can decompress these in software but
             // no code present in simgear.
+#ifndef GL_3DFX_texture_compression_FXT1
+#define GL_COMPRESSED_RGB_FXT1_3DFX       0x86B0
+#define GL_COMPRESSED_RGBA_FXT1_3DFX      0x86B1
+#endif
         case GL_COMPRESSED_RGB_FXT1_3DFX:
         case GL_COMPRESSED_RGBA_FXT1_3DFX:
-
+            
             // GL_EXT_texture_compression_rgtc
             // can decompress these in software but
             // no code present in simgear.
+#ifndef GL_EXT_texture_compression_rgtc
+#define GL_COMPRESSED_RED_RGTC1_EXT       0x8DBB
+#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
+#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
+#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
+#endif
         case GL_COMPRESSED_RED_RGTC1_EXT:
         case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT:
         case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
         case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
 
-            SG_LOG(SG_IO, SG_ALERT, "Image \"" << res.getImage()->getFileName()
-                   << "\" contains non portable compressed textures.\n"
-                   "Usage of these textures depend on an extension that"
-                   " is not guaranteed to be present.");
+            SG_LOG(SG_IO, SG_ALERT, "Image \"" << fileName << "\"\n"
+                   "uses compressed textures which cannot be supported on "
+                   "some systems.\n"
+                   "Please decompress this texture for improved portability.");
             break;
 
         default:
@@ -278,7 +300,7 @@ ModelRegistry::readImage(const string& fileName,
 
 
 osg::Node* DefaultCachePolicy::find(const string& fileName,
-                                    const ReaderWriter::Options* opt)
+                                    const Options* opt)
 {
     Registry* registry = Registry::instance();
     osg::Node* cached
@@ -320,7 +342,7 @@ OptimizeModelPolicy::OptimizeModelPolicy(const string& extension) :
 
 osg::Node* OptimizeModelPolicy::optimize(osg::Node* node,
                                          const string& fileName,
-                                         const osgDB::ReaderWriter::Options* opt)
+                                         const osgDB::Options* opt)
 {
     osgUtil::Optimizer optimizer;
     optimizer.optimize(node, _osgOptions);
@@ -336,7 +358,7 @@ osg::Node* OptimizeModelPolicy::optimize(osg::Node* node,
 }
 
 string OSGSubstitutePolicy::substitute(const string& name,
-                                       const ReaderWriter::Options* opt)
+                                       const Options* opt)
 {
     string fileSansExtension = getNameLessExtension(name);
     string osgFileName = fileSansExtension + ".osg";
@@ -391,7 +413,7 @@ ModelRegistry::addNodeCallbackForExtension(const string& extension,
 
 ReaderWriter::ReadResult
 ModelRegistry::readNode(const string& fileName,
-                        const ReaderWriter::Options* opt)
+                        const Options* opt)
 {
     ReaderWriter::ReadResult res;
     CallbackMap::iterator iter
@@ -414,10 +436,10 @@ public:
     Referenced::setThreadSafeReferenceCounting(true);
 
     Registry* registry = Registry::instance();
-    ReaderWriter::Options* options = new ReaderWriter::Options;
-    int cacheOptions = ReaderWriter::Options::CACHE_ALL;
+    Options* options = new Options;
+    int cacheOptions = Options::CACHE_ALL;
     options->
-      setObjectCacheHint((ReaderWriter::Options::CacheHintOptions)cacheOptions);
+      setObjectCacheHint((Options::CacheHintOptions)cacheOptions);
     registry->setOptions(options);
     registry->getOrCreateSharedStateManager()->
       setShareMode(SharedStateManager::SHARE_STATESETS);
@@ -435,7 +457,7 @@ struct ACOptimizePolicy : public OptimizeModelPolicy {
         _osgOptions &= ~Optimizer::TRISTRIP_GEOMETRY;
     }
     Node* optimize(Node* node, const string& fileName,
-                   const ReaderWriter::Options* opt)
+                   const Options* opt)
     {
         ref_ptr<Node> optimized
             = OptimizeModelPolicy::optimize(node, fileName, opt);
@@ -462,7 +484,7 @@ struct ACOptimizePolicy : public OptimizeModelPolicy {
 struct ACProcessPolicy {
     ACProcessPolicy(const string& extension) {}
     Node* process(Node* node, const string& filename,
-                  const ReaderWriter::Options* opt)
+                  const Options* opt)
     {
         Matrix m(1, 0, 0, 0,
                  0, 0, 1, 0,