[osg-users] StateSet question

Trajce Nikolov NICK trajce.nikolov.nick at gmail.com
Sat Aug 29 14:24:36 PDT 2015


Hi Aaron,

I would do this with texture atlas - all roofs in one large texture and map
them separately. This is sort of common in database development

On Sat, Aug 29, 2015 at 11:14 PM, Aaron Andersen <aaron at fosslib.net> wrote:

> 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
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150829/0b52cbd7/attachment-0002.htm>


More information about the osg-users mailing list