Hi,
I see that i didnt make it that clear what i was asking about.
firstly, the line
MS3D.setGeometry(Geometry gi);
is the one that is giving the error. But as u’ve explained, the gi is from GeometryInfo, and that isnt related to Geomtry
Well, u see, this is the part of my prog that i cant figure out, hence the poor explanation.
So basically i am asking, how do i need to specify Shape3D before i call the setGeometry method?
Or by extending Shape in my SetStripA() method will i be able to call setGeometry without a problem? Extending is not so clear in the java text books or notes i have, even though, its fairly fundamental java i suppose.
I could keep asking questions, but i feel i could have the total wrong end of the stick, and the questions just seem to be way off target from what i shud really be asking!
Thanks for being so patient dude…
Well i’ve also put the code from the class i attempted to write below. Maybe that might be clearer than my questions
public class SetStripA extends Geometry{
private static Color3f matColor = new Color3f(.9f,.7f,.2f);
//******************FIELDS*****************************//
/** The integer array to hold the height of the terrain at each point on the grid*/
int[][] m_nTerrainHeightArray;
/** Terrain grid width (x)*/
int m_nTerrainGridX = 0;
/** Terrain grid height/length (y)*/
int m_nTerrainGridY = 0;
int[] stripCounts;
// The number of vertices (or coordinates) is based on the
// number of horizontal strips (height - 1)(50) times the
// number of vertices per strip (width * 2)(102).
Point3d[] coords = new Point3d[5100];
TriangleStripArray tris = new TriangleStripArray(
coords.length,
GeometryArray.COORDINATES,
stripCounts );
//*********Constructors*****************
/** Creates a new instance of TriangleStripArrayClass */
public SetStripA(int vertexCount,
int[] stripVertexCounts,
int[] mystripCounts) {
//New instance of shape3d
Shape3D MS3D = new Shape3D();
vertexCount = 2601;
// The strip counts handling
this.stripCounts = new int[51];
for (int strip = 0; strip < 51; strip++) {
stripCounts[strip] = 10;
}
int[][] hf = GetTerrainValues();
// The height field
BranchGroup objRoot = new BranchGroup();
GeometryInfo gi =
new GeometryInfo(GeometryInfo.TRIANGLE_STRIP_ARRAY);
//
// Create a stripCount array showing the number of vertices in each
// strip
//
int[] stripCounts = new int[m_nTerrainGridX-1];
for(int strip = 0; strip < m_nTerrainGridX-1; strip++)
stripCounts[strip] = (m_nTerrainGridY)*2;
int ci = 0; // coordinate index
for (int m_nTerrainGridX = 0; m_nTerrainGridX < m_nTerrainHeightArray.length; m_nTerrainGridX++){
for (int m_nTerrainGridY = 0; m_nTerrainGridY < m_nTerrainHeightArray.length; m_nTerrainGridY++) {
// use compass bearings to id the corners
int sw = hf[m_nTerrainGridX][m_nTerrainGridY];
int nw = hf[m_nTerrainGridX + 1][m_nTerrainGridY];
coords[ci] = new Point3d(m_nTerrainGridY, nw, - (m_nTerrainGridX + 1));
coords[ci + 1] = new Point3d(m_nTerrainGridY, sw, -m_nTerrainGridX);
ci = ci + 2;
}
}
gi.setStripCounts(stripCounts);
gi.setCoordinates(coords);
NormalGenerator ng= new NormalGenerator();
ng.setCreaseAngle((float) Math.toRadians(30));
ng.generateNormals(gi);
//MS3D.setGeometry(Geometry gi); ********> This is where i get the ")" expected error*****
MS3D.setGeometry(tris);
}
}
There’s a couple of extra methods in my class, but this gives the basic gist, i’d say. I’ve taken a bit off the code u left in the other thread, but to be honest, i left out a fair bit that was unclear, and then tried to write it as best i cud figure out.
Cheers again