Esempio n. 1
0
  /**
   * Notification that the construction phase of this node has finished. If the node would like to
   * do any internal processing, such as setting up geometry, then go for it now.
   */
  public void setupFinished() {
    if (!inSetup) return;

    super.setupFinished();

    SphereGenerator generator = new SphereGenerator(vfRadius, 32);
    GeometryData data = new GeometryData();

    data.geometryType = GeometryData.TRIANGLE_STRIPS;
    data.geometryComponents = GeometryData.NORMAL_DATA | GeometryData.TEXTURE_2D_DATA;

    generator.generate(data);

    impl = new TriangleStripArray(false, VertexGeometry.VBO_HINT_STATIC);
    impl.setVertices(TriangleStripArray.COORDINATE_3, data.coordinates, data.vertexCount);
    impl.setStripCount(data.stripCounts, data.numStrips);
    impl.setNormals(data.normals);

    // Make an array of objects for the texture setting
    float[][] textures = {data.textureCoordinates};
    int[] tex_type = {TriangleStripArray.TEXTURE_COORDINATE_2};
    impl.setTextureCoordinates(tex_type, textures, 1);

    // Setup 4 texture units
    int[] tex_maps = new int[4];

    for (int i = 0; i < 4; i++) tex_maps[i] = 0;

    impl.setTextureSetMap(tex_maps, 4);

    OGLUserData u_data = new OGLUserData();
    u_data.geometryData = data;

    impl.setUserData(u_data);
  }