Last change
on this file since 65 was
65,
checked in by Maciej Komosinski, 13 years ago
|
added sources of the 3D client for the Framsticks server
|
File size:
920 bytes
|
Rev | Line | |
---|
[65] | 1 | package pl.vorg.mowa.core.graphics;
|
---|
| 2 |
|
---|
| 3 | import java.util.ArrayList;
|
---|
| 4 |
|
---|
| 5 | import javax.media.opengl.GL;
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * A 3d model, containing many 3d shapes.
|
---|
| 9 | *
|
---|
| 10 | * @author vorg
|
---|
| 11 | */
|
---|
| 12 | public class GeometryGroup {
|
---|
| 13 | private ArrayList<Geometry> children = new ArrayList<Geometry>();
|
---|
| 14 | private BoundingBox boundingBox = new BoundingBox();
|
---|
| 15 |
|
---|
| 16 | public ArrayList<Geometry> getChildren() {
|
---|
| 17 | return children;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public void setChildren(ArrayList<Geometry> value) {
|
---|
| 21 | this.children = value;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | public BoundingBox getBoundingBox() {
|
---|
| 25 | return boundingBox;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | public void display(GL gl) {
|
---|
| 29 | for(Geometry geometry : children) {
|
---|
| 30 | geometry.display(gl);
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | public void updateBoundingBox() {
|
---|
| 35 | boundingBox.empty();
|
---|
| 36 | for(Geometry geometry : children) {
|
---|
| 37 | if (geometry.getBoundingBox().isEmpty()) {
|
---|
| 38 | geometry.updateBoundingBox();
|
---|
| 39 | }
|
---|
| 40 | boundingBox.add(geometry.getBoundingBox());
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.