PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Landschaften in Coin3d/openInventor erzeugen



computerpinguin
19-04-2005, 15:23
Hallo!

Kennt sich jemand zufällig mit Coin3d bzw. OpenInventor aus?
Zur Zeit muss ich mit dieser Grafikbibliothek unter C++ eine 3D-Landschaft erzeugen.
Dafür habe ich Höhenprofile und entsprechende Texturen gegeben.
Leider bekomme ich es nicht hin, dass die Textur auf das Höhenprofil abgebildet wird bzw. werden die durch den SoTransform-Knoten angegebenen
Koordinaten nicht richtig benutzt.
Der entsprechende source-Auschnitt:


SoSeparator* LandscapeView::createLandscape()
{
SoSeparator* root = new SoSeparator;
SoSeparator* map = new SoSeparator;
SoSeparator* position= new SoSeparator;

SoTransform* moveMap = new SoTransform;
moveMap->translation.setValue( _height, 10.0f, _width);
position->addChild(moveMap);

SoTexture2* vrmlfile = new SoTexture2;
vrmlfile->filename = "ressources\\welt.wrl";
map->addChild(vrmlfile);

SoVRMLElevationGrid* coordinate = new SoVRMLElevationGrid;
coordinate->xDimension=5;
coordinate->zDimension=5;
coordinate->xSpacing=1.0;
coordinate->zSpacing=1.0;
coordinate->height.set1Value(0, 0.0);
coordinate->height.set1Value(1, 0.0);
coordinate->height.set1Value(2, 10.0);
coordinate->height.set1Value(3, 1.0);
coordinate->height.set1Value(4, 9.0);
coordinate->height.set1Value(5, 8.0);
coordinate->height.set1Value(6, 1.0);
coordinate->height.set1Value(7, 1.0);
coordinate->height.set1Value(8, 2.0);
coordinate->height.set1Value(9, 3.0);
coordinate->height.set1Value(10, 1.5);
coordinate->height.set1Value(11, 0.0);
coordinate->height.set1Value(12, 0.0);
coordinate->height.set1Value(13, 0.0);
coordinate->height.set1Value(14, 1.5);
coordinate->height.set1Value(15, 0.0);
coordinate->height.set1Value(16, 12.0);
coordinate->height.set1Value(17, 1.0);
coordinate->height.set1Value(18, 0.0);
coordinate->height.set1Value(19, 1.5);
coordinate->height.set1Value(20, 0.0);
coordinate->height.set1Value(21, 1.1);
coordinate->height.set1Value(22, 0.0);
coordinate->height.set1Value(23, 0.0);
coordinate->height.set1Value(24, 0.0);

map->addChild(coordinate);
position->addChild(map);
root->addChild( position);
return root;

}


Habe ich vielleicht die Knoten falsch angeordnet? :confused:

Vielen Dank für jegliche Hilfe.