00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #ifndef VRS_OPENGL_PRIMITIVEQUADTREEGL_H
00062 #define VRS_OPENGL_PRIMITIVEQUADTREEGL_H
00063
00064 #include <vrs/monoattribute.h>
00065 #include <vrs/bounds.h>
00066 #include <vector>
00067
00068 namespace VRS {
00069
00070 class MappedVertexAttributeDataGL;
00071 class MappedVertexAttributeShapeGL;
00072 class PolygonSet;
00073 template <typename T> class Iterator;
00074 template <typename T> class StaticArray;
00075 template <unsigned int DIM> class SpaceTreePath;
00076 class BaseVertexAttributeBufferObjectGL;
00077
00078 class PrimitiveQuadTreeAreaPainterGL;
00079 class PrimitiveQuadTreeDistancePainterGL;
00080 class PrimitiveQuadTreeAreaRayIntersectorGL;
00081
00088 class VRS_CORE_API PrimitiveQuadTreeGL : public MonoAttribute {
00089
00090 public:
00091 PrimitiveQuadTreeGL(
00092 unsigned int depth,
00093 const SO<PolygonSet>& poly,
00094 const Bounds& area = Bounds(),
00095 bool duplicateTrianglesForIntersectedNodes = false
00096 );
00113 PrimitiveQuadTreeGL(
00114 unsigned int depth,
00115 const SO<MappedVertexAttributeDataGL>& vertexData,
00116 const Bounds& bbox,
00117 const std::vector<unsigned int>& indices = std::vector<unsigned int>(),
00118 bool duplicateDataForIntersectedNodes = false
00119 );
00120
00121 PrimitiveQuadTreeGL(
00122 unsigned int depth,
00123 const SO<MappedVertexAttributeShapeGL>& shape,
00124 const Bounds& bbox = Bounds(),
00125 bool duplicateDataForIntersectedNodes = false
00126 );
00130 unsigned int depth() const;
00133 Bounds boundingBox() const;
00136 SO<MappedVertexAttributeDataGL> mappedVertexAttributeData() const;
00139 SO<BaseVertexAttributeBufferObjectGL> indexBufferObject() const;
00142 SO<Iterator<unsigned int> > nodeFirstIndex() const;
00144 SO<Iterator<Bounds> > nodeBounds() const;
00147 VRS_TYPEINFO(PrimitiveQuadTreeGL, MonoAttribute);
00148 VRS_SERIALIZABLE(PrimitiveQuadTreeGL);
00149
00150 protected:
00151 PrimitiveQuadTreeGL();
00152
00153 private:
00154 void init(
00155 unsigned int depth,
00156 const SO<MappedVertexAttributeDataGL>& vertexData,
00157 const Bounds& bbox,
00158 const std::vector<unsigned int>& indices,
00159 bool duplicateDataForIntersectedNodes
00160 );
00161
00162 SO<MappedVertexAttributeDataGL> vaData_;
00163 SO<StaticArray<unsigned int> > nodeFirstIndex_;
00164 SO<StaticArray<Bounds> > nodeBounds_;
00165 SO<BaseVertexAttributeBufferObjectGL> indices_;
00166 unsigned int depth_;
00167 Bounds bounds_;
00168
00169 friend class PrimitiveQuadTreeAreaPainterGL;
00170 friend class PrimitiveQuadTreeDistancePainterGL;
00171 friend class PrimitiveQuadTreeAreaRayIntersectorGL;
00172 friend class PrimitiveQuadTreeDistanceRayIntersectorGL;
00173 typedef VertexData<3, float> Vertex3f;
00174 std::vector<Vertex3f> m_verticesForRayIntersection;
00175 std::vector<unsigned int> m_indicesForRayIntersection;
00176 };
00177
00178 }
00179
00180 #endif // VRS_OPENGL_PRIMITIVEQUADTREEGL_H