1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| public void buildErreurGPSServ(DynamicDiscreteNode dDN, float errGps){
//mise à jour du noeud
int nbrChild=m_oErrorNode.getQuantity();
if(nbrChild!=0){
for(int cptChild = 0;cptChild < nbrChild; cptChild ++){
if(m_oErrorNode.getChild(cptChild).getName().equals("DiskError"+dDN.getName())){
// m_oErrorNode.detachChildAt(cptChild);
m_oErrorNode.detachChild(m_oErrorNode.getChild("DiskError"+dDN.getName()));
m_oErrorNode.detachChild(m_oErrorNode.getChild("DiskErrorCenter"+dDN.getName()));
break;
}
}
}
Vector3f posVehicule = dDN.getLocalTranslation();
Vector3f posDisk = new Vector3f(posVehicule.x,posVehicule.y+10f,posVehicule.z);
//création de la vizu de l'erreur:
TriMesh l_oDiskError = new Disk("DiskError"+dDN.getName(), 2, 8, (float)(errGps));
//Centre du cercle d'erreur
//calcul d'une taille visible mais pas plus grande que le cercle d'erreur
float pointCentral = 0f;
if((float)(errGps/2.0) < 1)
pointCentral = (float)(errGps/4.0);
else
pointCentral = 0.5f;
//création du centre
TriMesh l_oDiskErrorCenter = new Disk("DiskErrorCenter"+dDN.getName(), 6, 60, pointCentral);
//test de la pertinence du point
if(!posVehicule.equals(Vector3f.ZERO)){
//Positionnement du cercle
l_oDiskError.setLocalTranslation(posDisk);
l_oDiskErrorCenter.setLocalTranslation(posDisk);
//Orientation du cercle
Quaternion q = new Quaternion();
q.fromAngleAxis(-FastMath.PI/2f, Vector3f.UNIT_X);
l_oDiskError.setLocalRotation(q);
l_oDiskErrorCenter.setLocalRotation(q);
//texture du cercle
l_oDiskError.setRenderState(m_oErrorMs);
l_oDiskErrorCenter.setDefaultColor(ColorRGBA.black);
//ajout du disk dans le graphe des rendu
m_oErrorNode.attachChild(l_oDiskError);
m_oErrorNode.attachChild(l_oDiskErrorCenter);
//afficher le rendu total
m_oErrorNode.updateGeometricState(0.0f, false);
m_oErrorNode.updateRenderState();
}
} |
Partager