- ssgBranch *object = new ssgBranch();
- object->setName( (char *)name.c_str() );
-
- double width = name.length() / 3.0;
-
- string material = name;
-
- point_list nodes;
- point_list normals;
- point_list texcoords;
- int_list vertex_index;
- int_list normal_index;
- int_list tex_index;
-
- nodes.push_back( Point3D( -width, 0, 0.25 ) );
- nodes.push_back( Point3D( width + 1, 0, 0.25 ) );
- nodes.push_back( Point3D( -width, 0, 1.25 ) );
- nodes.push_back( Point3D( width + 1, 0, 1.25 ) );
-
- normals.push_back( Point3D( 0, -1, 0 ) );
-
- texcoords.push_back( Point3D( 0, 0, 0 ) );
- texcoords.push_back( Point3D( 1, 0, 0 ) );
- texcoords.push_back( Point3D( 0, 1, 0 ) );
- texcoords.push_back( Point3D( 1, 1, 0 ) );
-
- vertex_index.push_back( 0 );
- vertex_index.push_back( 1 );
- vertex_index.push_back( 2 );
- vertex_index.push_back( 3 );
-
- normal_index.push_back( 0 );
- normal_index.push_back( 0 );
- normal_index.push_back( 0 );
- normal_index.push_back( 0 );
-
- tex_index.push_back( 0 );
- tex_index.push_back( 1 );
- tex_index.push_back( 2 );
- tex_index.push_back( 3 );
-
- ssgLeaf *leaf = sgMakeLeaf( path, GL_TRIANGLE_STRIP, matlib, material,
- nodes, normals, texcoords,
- vertex_index, normal_index, tex_index,
- false, NULL );
-
- object->addKid( leaf );
+ float width = name.length() / 3.0;
+
+ osg::Vec3 corner(-width, 0, 0.25f);
+ osg::Vec3 widthVec(2*width + 1, 0, 0);
+ osg::Vec3 heightVec(0, 0, 1);
+ osg::Geometry* geometry;
+ geometry = osg::createTexturedQuadGeometry(corner, widthVec, heightVec);
+ EffectGeode* geode = new EffectGeode;
+ geode->setName(name);
+ geode->addDrawable(geometry);
+ SGMaterial *mat = matlib->find(name);
+ if (mat)
+ geode->setEffect(mat->get_effect());