Hi,
Here some tests about the ground textures for photo scenery.
Terragear build BTG. Each BTG contains several 3D objects with a
material property (city, wood...)
Is it possible that terragear cuts a texture for these 3D objets...
In fact, my proposition is very simple. In the function SGLoadBTG, I
replace :
osg::Node* node = tileGeometryBin.getSurfaceGeometry(matlib);
By :
cout << path; // sample : Terrain/w010n40/w005n48/2876058.btg
phototexture = path;
phototexture =~ s/btg$/dds/; // or PNG, JPG...
if (phototexture found) {
osg::Node* node = tileGeometryBin.loadPhotoScenery(matlib);
if (node)
terrainGroup->addChild(node);
}
else {
osg::Node* node = tileGeometryBin.getSurfaceGeometry(matlib);
if (node)
terrainGroup->addChild(node);
}
And loadPhotoScenery(...) {
int n;
char buffer[128];
if (materialTriangleMap.empty())
return 0;
osg::Group* groupe = new osg::Group;
osg::Geode* geode = new osg::Geode;
SGMaterialTriangleMap::const_iterator i;
for (n=0, i = materialTriangleMap.begin(); i !=
materialTriangleMap.end(); ++i, n++) {
snprintf(buffer, 128, "Textures/PhotoScenery/%d.dds", n);
osg::Texture2D* FaceTexture = new osg::Texture2D;
FaceTexture->setDataVariance(osg::Object::DYNAMIC);
osg::Image* Face = osgDB::readImageFile(buffer);
FaceTexture->setImage(Face);
osg::Geometry* geometry = i->second.buildGeometry();
osg::StateSet* stateOne = new osg::StateSet();
stateOne->setTextureAttributeAndModes(0,FaceTexture,osg::StateAttribute::ON);
geometry->setStateSet(stateOne);
geode->addDrawable(geometry);
}
groupe->addChild(geode);
return geode;
}
With this solution, my issue is : How can I generate photo texture with
terragear ? Is it possible ?
Regards,
Nicolas
Le mardi 23 septembre 2008 à 13:16 +0200, Tim Moore a écrit :
> Frederic Bouvier wrote:
> > Hi Tim,
> >
> > Tim Moore wrote :
> >> This code did survive the OSG port, but was removed in a later
> >> reorganization of the tile loading code. It's easy enough
> >> to put this back in, but the old code would add the local
> >> material permanently to the material library; is that really
> >> desired? I would think the local material should get deleted
> >> when the tile is deleted.
> >
> > I tried to restore that code this past weekend but I experienced
> > random access violation when loading the texture. I was wondering
> > if loading textures in the pager thread was legal.
>
> It is legal to load textures from the pager thread, but there might now be a
> problem with adding a material to the material library in the pager thread.
> Is
> the access violation really "random?"
>
> Tim
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Flightgear-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel