1 module armos.graphics.bufferbundle;
2 
3 import armos.graphics.vao;
4 import armos.graphics.mesh;
5 import armos.graphics.buffer;
6 import armos.math;
7 
8 /++
9 +/
10 class BufferBundle {
11     public{
12         ///
13         this(){
14             _vao    = new armos.graphics.Vao;
15         }
16         
17         ///
18         ~this(){}
19         
20         ///
21         Vao vao(){return _vao;}
22         
23         ///
24         auto attr(in string name, Buffer buffer){
25             attrs[name] = buffer;
26             return this;
27         }
28 
29         ///
30         auto attr(T)(in string name, T[] vectorArray,
31                      in BufferUsageFrequency freq   = BufferUsageFrequency.Dynamic,
32                      in BufferUsageNature    nature = BufferUsageNature.Draw)
33         if(isVector!T){
34             attrs[name].array(vectorArray, freq, nature);
35             return this;
36         }
37 
38         ///
39         auto attr(V)(in string name, V[] array, in size_t numDimentions = 1,
40                      in BufferUsageFrequency freq   = BufferUsageFrequency.Dynamic,
41                      in BufferUsageNature    nature = BufferUsageNature.Draw)
42         if(__traits(isArithmetic, V)){
43             attrs[name].array(array, numDimentions, freq, nature);
44             return this;
45         }
46 
47         ///
48         auto attr(in string name){
49             return attrs[name];
50         }
51 
52         // alias attrs this;
53         Buffer[string] attrs;
54 
55         ///
56         auto begin(){
57             _vao.begin;
58             return this;
59         }
60 
61         ///
62         auto end(){
63             _vao.end;
64             return this;
65         }
66     }//public
67 
68     private{
69         Vao _vao;
70     }//private
71 }//class BufferBundle