Hi,
I was trying to construct some GeomCylinders (ODE stuff) and they require a radius and a height. Both variables are in Cylinder class, but both are private. It would be nice to have getters and setters for this and set the actual variables to be public, just like Box’s extents.
Changes:
public float radius;
public float height;
Additions:
public void setHeight(float height) {
this.height = height;
// allocate vertices
int quantity = axisSamples * (radialSamples + 1);
vertex = new Vector3f[quantity];
normal = new Vector3f[quantity];
color = new ColorRGBA[quantity];
texture[0] = new Vector2f[quantity];
int triQuantity = 2 * (axisSamples - 1) * radialSamples;
indices = new int[3 * triQuantity];
setGeometryData();
setIndexData();
setVertices(vertex);
setNormals(normal);
setTextures(texture[0]);
setColorData();
}
public float getHeight() {
return height;
}
public void setRadius(float radius) {
this.radius = radius;
// allocate vertices
int quantity = axisSamples * (radialSamples + 1);
vertex = new Vector3f[quantity];
normal = new Vector3f[quantity];
color = new ColorRGBA[quantity];
texture[0] = new Vector2f[quantity];
int triQuantity = 2 * (axisSamples - 1) * radialSamples;
indices = new int[3 * triQuantity];
setGeometryData();
setIndexData();
setVertices(vertex);
setNormals(normal);
setTextures(texture[0]);
setColorData();
}
public float getRadius() {
return radius;
}
Thanks