Rev 190 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 168 | chris | 1 | package com.gebauz.Bauzoid.graphics.model; |
| 2 | |||
| 185 | chris | 3 | import com.gebauz.Bauzoid.graphics.Graphics; |
| 4 | import com.gebauz.Bauzoid.graphics.GraphicsObject; |
||
| 168 | chris | 5 | import com.gebauz.Bauzoid.math.BoundingBox; |
| 6 | |||
| 7 | /** Mesh class implementing the SUX Mesh format - acts in cooperation with the Model class. */ |
||
| 185 | chris | 8 | public class Mesh extends GraphicsObject |
| 168 | chris | 9 | { |
| 10 | private String mName; |
||
| 11 | private BoundingBox mBoundingBox; |
||
| 12 | |||
| 176 | chris | 13 | private Geometry mGeometry = null; |
| 14 | |||
| 190 | chris | 15 | private MeshGroup[] mGroups = null; |
| 177 | chris | 16 | |
| 168 | chris | 17 | /** Constructor. */ |
| 185 | chris | 18 | public Mesh(Graphics graphics, String name) |
| 168 | chris | 19 | { |
| 185 | chris | 20 | super(graphics); |
| 168 | chris | 21 | mName = name; |
| 22 | } |
||
| 23 | |||
| 179 | chris | 24 | /** Update the mesh. */ |
| 25 | public void update(float deltaTime) |
||
| 26 | { |
||
| 27 | |||
| 28 | } |
||
| 29 | |||
| 30 | /** Render the mesh. */ |
||
| 31 | public void render() |
||
| 32 | { |
||
| 33 | mGeometry.activate(); |
||
| 181 | chris | 34 | |
| 35 | // enable shader/effect for group |
||
| 36 | |||
| 179 | chris | 37 | for (int i = 0; i < mGroups.length; i++) |
| 38 | { |
||
| 39 | mGroups[i].render(); |
||
| 40 | } |
||
| 41 | |||
| 42 | mGeometry.deactivate(); |
||
| 43 | } |
||
| 44 | |||
| 168 | chris | 45 | /** Get the mesh name. */ |
| 46 | public final String getName() |
||
| 47 | { |
||
| 48 | return mName; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** Get the bounding box. */ |
||
| 52 | public BoundingBox getBoundingBox() |
||
| 53 | { |
||
| 54 | return mBoundingBox; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** Set the bounding box. */ |
||
| 58 | public void setBoundingBox(BoundingBox box) |
||
| 59 | { |
||
| 60 | mBoundingBox = box; |
||
| 61 | } |
||
| 176 | chris | 62 | |
| 63 | |||
| 64 | /** Get the Geometry object. */ |
||
| 65 | public final Geometry getGeometry() |
||
| 66 | { |
||
| 67 | return mGeometry; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** Set the Geometry object. */ |
||
| 71 | public final void setGeometry(Geometry geometry) |
||
| 72 | { |
||
| 73 | mGeometry = geometry; |
||
| 74 | } |
||
| 177 | chris | 75 | |
| 76 | /** Get a group. */ |
||
| 190 | chris | 77 | public final MeshGroup getGroup(int i) |
| 177 | chris | 78 | { |
| 79 | return mGroups[i]; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** Get the number of groups. */ |
||
| 83 | public final int getGroupCount() |
||
| 84 | { |
||
| 85 | return mGroups.length; |
||
| 86 | } |
||
| 87 | |||
| 88 | /** Set the groups. */ |
||
| 190 | chris | 89 | public final void setGroups(MeshGroup[] groups) |
| 177 | chris | 90 | { |
| 91 | mGroups = groups; |
||
| 92 | } |
||
| 190 | chris | 93 | |
| 168 | chris | 94 | } |