1 | package pl.vorg.mowa.core.graphics;
|
---|
2 |
|
---|
3 | import java.util.ArrayList;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * A stream of vertex. Eeach vertex may be described by many different
|
---|
7 | * attributes (position, color, texture coordinates, etc.) contained in buffers.
|
---|
8 | *
|
---|
9 | * Za to jak kolejno ukladaja sie wiercholki odpowiada indexBuffer.
|
---|
10 | *
|
---|
11 | * Np trojkat o wierzcholkach (0,0,0) (1,0,0) (0,1,0) o kolorach czerwonym,
|
---|
12 | * zielonym i niebieskim ze wspolrzednymi tekstury (0,0) (1,0) (0,1)
|
---|
13 | *
|
---|
14 | * wygladalby tak FloatVertexAttrib "pos" : [0, 0, 0, 1, 0, 0, 0, 1, 0]
|
---|
15 | * FloatVertexAttrib "color" : [1, 0, 0, 0, 1, 0, 0, 0, 1] FloatVertexAttrib
|
---|
16 | * "texCoord0" : [0, 0, 1, 0, 0, 1] IndexBuffer : [0, 1, 2]
|
---|
17 | *
|
---|
18 | * @author vorg
|
---|
19 | */
|
---|
20 | public class VertexStream {
|
---|
21 | private ArrayList<VertexAttrib> attribs = new ArrayList<VertexAttrib>();
|
---|
22 | private IndexBuffer indexBuffer;
|
---|
23 |
|
---|
24 | public ArrayList<VertexAttrib> getAttribs() {
|
---|
25 | return attribs;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public VertexAttrib getAttribByName(String name) {
|
---|
29 | for (VertexAttrib attrib : attribs) {
|
---|
30 | if (attrib.getName().equals(name)) {
|
---|
31 | return attrib;
|
---|
32 | }
|
---|
33 | }
|
---|
34 | return null;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public void addAttrib(VertexAttrib attrib) {
|
---|
38 | attribs.add(attrib);
|
---|
39 | }
|
---|
40 |
|
---|
41 | public IndexBuffer getIndexBuffer() {
|
---|
42 | return indexBuffer;
|
---|
43 | }
|
---|
44 |
|
---|
45 | public void setIndexBuffer(IndexBuffer indexBuffer) {
|
---|
46 | this.indexBuffer = indexBuffer;
|
---|
47 | }
|
---|
48 | }
|
---|