]> git.tdb.fi Git - libs/gl.git/blobdiff - source/objectpass.cpp
Use DevIL for loading images
[libs/gl.git] / source / objectpass.cpp
diff --git a/source/objectpass.cpp b/source/objectpass.cpp
new file mode 100644 (file)
index 0000000..57e7b27
--- /dev/null
@@ -0,0 +1,50 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#include "objectpass.h"
+#include "program.h"
+#include "programdata.h"
+
+using namespace std;
+
+namespace Msp {
+namespace GL {
+
+ObjectPass::ObjectPass():
+       shprog(0),
+       shdata(0)
+{ }
+
+ObjectPass::~ObjectPass()
+{
+}
+
+
+ObjectPass::Loader::Loader(ObjectPass &p, Collection &c):
+       pass(p),
+       coll(c)
+{
+       add("shader", &Loader::shader);
+}
+
+void ObjectPass::Loader::shader(const string &n)
+{
+       Program *shprog=&coll.get<Program>(n);
+       if(shprog)  // Allow for unsupported shaders
+       {
+               RefPtr<ProgramData> shdata=new ProgramData;
+               load_sub(*shdata, *shprog);
+
+               pass.shprog=shprog;
+               if(pass.shdata)
+                       delete pass.shdata;
+               pass.shdata=shdata.release();
+       }
+}
+
+} // namespace GL
+} // namespace Msp