8 #ifndef VTOSG_GEOMETRYUTILSH
9 #define VTOSG_GEOMETRYUTILSH
11 #include "vtlib/core/Structure3d.h"
16 namespace OSGGeomUtils {
18 osg::PrimitiveSet* MakeAPrimitiveSet(
const int VertexType,
19 const osg::PrimitiveSet::Type Type,
const osg::PrimitiveSet::Mode Mode);
25 osg::ref_ptr<osg::Vec3Array> m_Vertices;
26 osg::ref_ptr<osg::Vec3Array> m_Normals;
27 osg::ref_ptr<osg::Vec2Array> m_TexCoords;
33 DATriangles(
const int VertexType,
const osg::PrimitiveSet::Mode Mode);
39 DALLineStrip(
const int VertexType,
const osg::PrimitiveSet::Mode Mode);
45 DALTriangleFan(
const int VertexType,
const osg::PrimitiveSet::Mode Mode);
51 PrimSetCacheEntry(osg::PrimitiveSet* PrimitiveSet) : m_pPrimitiveSet(PrimitiveSet) {}
52 osg::ref_ptr<osg::PrimitiveSet> m_pPrimitiveSet;
57 class PrimSetCache :
public std::vector<osg::ref_ptr<PrimSetCacheEntry> >,
58 public osg::Referenced
61 osg::PrimitiveSet* FindOrCreatePrimitive(
const int VertexType,
62 const vtMaterial* pMaterial,
const osg::PrimitiveSet::Type Type,
63 const osg::PrimitiveSet::Mode Mode);
75 osg::StateSet& m_StateSet;
76 osg::ref_ptr<PrimSetCache> m_pPrimSetCache;
81 class StateSetCache :
public std::vector<osg::ref_ptr<StateSetCacheEntry> >,
82 public osg::Referenced
85 osg::PrimitiveSet* FindOrCreatePrimitive(
const int VertexType,
86 vtMaterial* pMaterial,
const osg::PrimitiveSet::Type Type,
87 const osg::PrimitiveSet::Mode Mode);
100 osg::ref_ptr<StateSetCache> m_pStateSetCache;
106 public osg::Referenced
109 DATriangles* FindOrCreateDATriangles(
const int VertexType,
113 osg::PrimitiveSet* FindOrCreatePrimitive(
const int VertexType,
vtMaterial* pMaterial,
114 const osg::PrimitiveSet::Type Type,
const osg::PrimitiveSet::Mode Mode);
115 vtGeode* Realise(
bool bUseVertexBufferObjects =
false)
const;
128 void CreateUniformLevel(
int iLevel,
float fHeight,
int iHighlightEdge);
129 bool MakeFacade(
vtEdge *pEdge,
FLine3 &quad,
int stories);
132 const FLine3 &quad,
float vf1,
float vf2,
float hf1 = -1.0f);
138 const FPolygon3 &polygon2,
int iEdge,
bool bShowEdge);
145 osg::ref_ptr<PrimitiveCache> m_pPrimitiveCache;
148 osg::Node *GetContained(
void) {
return NULL; }
150 bool IsCreated(
void) {
return false; }
151 void DeleteNode(
void) {}
154 class osg::Geometry* FindOrCreateGeometryObject(osg::Geode *pGeode,
155 vtMaterial& Material,
const int ArraysRequired);
156 class osg::PrimitiveSet* FindOrCreatePrimitiveSet(osg::Geometry* pGeometry,
157 const osg::PrimitiveSet::Mode Mode,
const osg::PrimitiveSet::Type Type);
161 #endif // VTOSG_GEOMETRYUTILSH