Bonjour,
J'ai un pointeur null sur la dernière ligne tout en bas, je ne comprends pas pourquoi. Je suis plutot habitué au c++ et là je suis un peu perdu. Pourriez vous m'aider ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 public class Vertex { public float x, y, z; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 public class ObjectData { public Vertex [] vertices ; public Vertex [] indices ; public ObjectData(/*int nbVertex*/) { //vertices = new Vertex[nbVertex]; //indices = new Vertex[nbVertex] ; } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 objectData [] objectData = new ObjectData[2]; //trouver le nombre d'objets exact SceneGraph sg = new SceneGraph(); if(true == sg.load("piranha3_2b.wrl")) System.out.println("returns true"); CoordinateNode coordinateNode = sg.findCoordinateNode(); for(int i=0 ; i < 2 ; i++) { objectData[i] = new ObjectData(); objectData[i].vertices = new Vertex[coordinateNode.getNPoints()]; } //objectData[0].vertex = new float[coordinateNode.getNPoints()]; for(int i=0 ; i < coordinateNode.getNPoints(); i++) { float [] tmpVertex = coordinateNode.getPoint(i); objectData[0].vertices[i].x = tmpVertex[0]; }
Partager