]> git.tdb.fi Git - libs/gl.git/blob - source/objectpass.cpp
Add Mesh::use_vertex_buffer
[libs/gl.git] / source / objectpass.cpp
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "objectpass.h"
9 #include "program.h"
10 #include "programdata.h"
11
12 using namespace std;
13
14 namespace Msp {
15 namespace GL {
16
17 ObjectPass::ObjectPass():
18         shprog(0),
19         shdata(0),
20         use_textures(true)
21 { }
22
23 ObjectPass::~ObjectPass()
24 {
25 }
26
27
28 ObjectPass::Loader::Loader(ObjectPass &p, Collection &c):
29         pass(p),
30         coll(c)
31 {
32         add("shader", &Loader::shader);
33         add("use_textures", &ObjectPass::use_textures);
34 }
35
36 void ObjectPass::Loader::shader(const string &n)
37 {
38         Program *shprog=coll.get<Program>(n);
39         if(shprog)  // Allow for unsupported shaders
40         {
41                 RefPtr<ProgramData> shdata=new ProgramData;
42                 load_sub(*shdata, *shprog);
43
44                 pass.shprog=shprog;
45                 if(pass.shdata)
46                         delete pass.shdata;
47                 pass.shdata=shdata.release();
48         }
49 }
50
51 } // namespace GL
52 } // namespace Msp