Subversion Repositories gelsvn

Rev

Rev 400 | Rev 492 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef __GLGRAPHICS_DRAW_H_
#define __GLGRAPHICS_DRAW_H_

#include "Geometry/TriMesh.h"
#include "Geometry/AABox.h"
#include "Geometry/OBox.h"
#include "Geometry/BoundingINode.h"
#include "Geometry/BoundingLNode.h"
#include "Geometry/BoundingTree.h"
#include "HMesh/Manifold.h"

#include "SinglePassWireframeRenderer.h"
#include "IDBufferWireFrameRenderer.h"

namespace GLGraphics
{
        /// Draw an indexed face set (just a triangle list) with normals computed on the fly.
        void draw(const Geometry::IndexedFaceSet& geometry);

        /// Draw a triangles mesh. Inefficient function that should be compiled into a display list.
        void draw(const Geometry::TriMesh& tm, bool per_vertex_norms=true);
        
        /// Draw a HMesh Manifold. Inefficient and should be compiled into display list
        void draw(HMesh::Manifold& m, bool per_vertex_norms=true);

        
        /// Draw an axis aligned bounding box
        void draw(const Geometry::AABox& box);
        
        /// Draw an oriented bounding box
        void draw(const Geometry::OBox& box);
        
        /// Draw an object of type T which contains only triangles as wireframe. In practice T = Manifold or TriMesh.
        template<typename T>
        inline void draw_triangles_in_wireframe(T& m, bool per_vertex_norms, const CGLA::Vec3f& line_color)
        {
                static SinglePassWireframeRenderer swr;
                swr.enable(line_color);
                draw(m, per_vertex_norms);
                swr.disable();
        }
        
        /// Draw an object of type T as wireframe.  In practice T = Manifold or TriMesh.
        template<class T>
        void draw_wireframe_oldfashioned(T& m, bool per_vertex_norms, const CGLA::Vec3f& line_color);
        
        
        
        template<class BoxType>
        void draw(const Geometry::BoundingINode<BoxType>& node, int level, int max_level);
        template<class BoxType>
    void draw(const Geometry::BoundingLNode<BoxType>& node, int level, int max_level);
        template<class BoxType>
    void draw(const Geometry::BoundingTree<BoxType>& tree, int max_level = 1e6);
        
}
#endif