Hello,

Consider if I have a mesh file constructed from 2 geometries: a cube, and a pyramid on top of the cube, representing a simple house. When I load this house it is pulled into OSG as a single Geode composed of 2 Geometry instances.

I have 2 image files for this house: a brown brick house texture and a black shingle texture which can be applied to the 2 geometries of the house mesh. Now consider if I have 2 more textures: a dark grey vinyl siding texture, and a dark green metal roof texture. If I keep producing more image files you can imagine all the different possibilities I might have in constructing a home.

Now consider if I want to make a row of 25 houses:

osg::Group * rootOfScene = new osg::Group;

osg::Node * houseGeode = osgDB::readNodeFile("house-mesh.ext");

for (int i = 0; i < 25; i++)
{
osg::PositionAttitudeTransform * transform = new osg::PositionAttitudeTransform;

    transform->setPosition(osg::Vec3d(i * 20.f, 0, 0));
    transform->addChild(houseGeode);

    rootOfScene->addChild(transform);
}

What is the most efficient way to apply these different texture sets so that I can have a row of houses, each with different textures being applied to the cube mesh and the pyramid mesh?

Any help is greatly appreciated.

Thank you,
Aaron
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to