Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1051 chris 1
package com.gebauz.bauzoid.graphics.model;
2
 
3
import com.gebauz.bauzoid.graphics.Graphics;
4
import com.gebauz.bauzoid.graphics.GraphicsObject;
5
import com.gebauz.bauzoid.math.BoundingBox;
6
 
7
/** Mesh class implementing the SUX Mesh format - acts in cooperation with the Model class. */
8
public class Mesh extends GraphicsObject
9
{
10
        private String mName;
11
        private BoundingBox mBoundingBox;
12
 
13
        private Geometry mGeometry = null;
14
 
15
        private MeshGroup[] mGroups = null;
16
 
17
        /** Constructor. */
18
        public Mesh(Graphics graphics, String name)
19
        {
20
                super(graphics);
21
                mName = name;          
22
        }
23
 
24
        /** Destroy internal data. */
25
        public void dispose()
26
        {
27
                if (mGeometry != null)
28
                {
29
 
30
                }              
31
        }
32
 
33
        /** Destroy internal Geometry. */
34
        public void destroyGeometry()
35
        {
36
                if (mGeometry != null)
37
                {
38
                        mGeometry.dispose();
39
                        mGeometry = null;
40
                }
41
        }
42
 
43
        /** Destroy groups. */
44
        public void destroyGroups()
45
        {
46
                if (mGroups != null)
47
                {
48
                        //for (int i = 0; i < mGroups.length; i++)
49
                        for (MeshGroup group : mGroups)
50
                                group.dispose();                               
51
 
52
                        mGroups = null;
53
                }
54
        }
55
 
56
        /** Update the mesh. */
57
        public void update(float deltaTime)
58
        {
59
 
60
        }
61
 
62
        /** Render the mesh. */
63
        public void render()
64
        {
65
                mGeometry.activate();
66
 
67
                // enable shader/effect for group
68
 
69
                for (int i = 0; i < mGroups.length; i++)
70
                {
71
                        mGroups[i].render();
72
                }
73
 
74
                mGeometry.deactivate();
75
        }
76
 
77
        /** Get the mesh name. */
78
        public final String getName()
79
        {
80
                return mName;
81
        }
82
 
83
        /** Get the bounding box. */
84
        public BoundingBox getBoundingBox()
85
        {
86
                return mBoundingBox;
87
        }
88
 
89
        /** Set the bounding box. */
90
        public void setBoundingBox(BoundingBox box)
91
        {
92
                mBoundingBox = box;
93
        }
94
 
95
 
96
        /** Get the Geometry object. */
97
        public final Geometry getGeometry()
98
        {
99
                return mGeometry;
100
        }
101
 
102
        /** Set the Geometry object. */
103
        public final void setGeometry(Geometry geometry)
104
        {
105
                mGeometry = geometry;
106
        }
107
 
108
        /** Get a group. */
109
        public final MeshGroup getGroup(int i)
110
        {
111
                return mGroups[i];
112
        }
113
 
114
        /** Get the number of groups. */
115
        public final int getGroupCount()
116
        {
117
                return mGroups.length;
118
        }
119
 
120
        /** Set the groups. */
121
        public final void setGroups(MeshGroup[] groups)
122
        {
123
                mGroups = groups;
124
        }
125
 
126
}