i have followed this nice tutorial :
http://blog.goltergaul.de/2009/06/assignment-6-tank-simulation-keyboard-events/
that worked like a charm
the i tried to import my own plane as athe ground made quickely in blender
but i have only a big green plane
this is a beginner question for sure
i have replaced this function that create the ground
> Geode* createPlane(int size, int texSize) {
> // vertex array
> Vec3Array *vertexArray = new Vec3Array();
> vertexArray->push_back(Vec3(-size/2,-size/2,0));
> vertexArray->push_back(Vec3(-size/2,size/2,0));
> vertexArray->push_back(Vec3(size/2,size/2,0));
> vertexArray->push_back(Vec3(size/2,-size/2,0));
>
> // face array
> // give indices of vertices in counter-clockwise order
> DrawElementsUInt *faceArray = new DrawElementsUInt(
> PrimitiveSet::QUADS, 0
> );
> faceArray->push_back(0);
> faceArray->push_back(1);
> faceArray->push_back(2);
> faceArray->push_back(3);
>
> // normal array
> // give the normals on the cube's faces
> Vec3Array *normalArray = new Vec3Array();
> normalArray->push_back(Vec3(0, 0, +1));
>
> // normal index
> // assign each vertex a normal (similar to assigning colors)
> TemplateIndexArray<unsigned int, Array::UIntArrayType, 24, 4>
> *normalIndexArray;
> normalIndexArray = new TemplateIndexArray<
> unsigned int, Array::UIntArrayType, 24, 4
> >();
> normalIndexArray->push_back(0);
> normalIndexArray->push_back(0);
> normalIndexArray->push_back(0);
> normalIndexArray->push_back(0);
>
> // texture coordinates
> osg::Vec2Array *texCoords = new osg::Vec2Array();
> texCoords->push_back(Vec2(0.0, 1.0));
> texCoords->push_back(Vec2(0.0, 0.0));
> texCoords->push_back(Vec2(1.0, 0.0));
> texCoords->push_back(Vec2(1.0, 1.0));
>
> Geometry *geometry = new Geometry();
> geometry->setVertexArray(vertexArray);
> geometry->addPrimitiveSet(faceArray);
> geometry->setNormalArray(normalArray);
> geometry->setNormalIndices(normalIndexArray);
> geometry->setNormalBinding(Geometry::BIND_PER_VERTEX);
> geometry->setTexCoordArray(0, texCoords);
>
> Geode *face = new Geode();
> face->addDrawable(geometry);
>
> return face;
> }
>
by a simple osgDB::ReadNodeFile from the blender plane
any help is welcome
thanks and good day
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38643#38643
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org