00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00023
00024 #ifndef SPK_IRRLINERENDERER
00025 #define SPK_IRRLINERENDERER
00026
00027 #include "RenderingAPIs/Irrlicht/SPK_IRRRenderer.h"
00028 #include "Extensions/Renderers/SPK_LineRendererInterface.h"
00029
00030 namespace SPK
00031 {
00032 namespace IRR
00033 {
00051 class SPK_IRR_PREFIX IRRLineRenderer : public IRRRenderer,public LineRendererInterface
00052 {
00053 SPK_IMPLEMENT_REGISTERABLE(IRRLineRenderer)
00054
00055 public :
00056
00058
00060
00067 IRRLineRenderer(irr::IrrlichtDevice* d,float length = 1.0f,float width = 1.0f);
00068
00076 static IRRLineRenderer* create(irr::IrrlichtDevice* d,float length = 1.0f,float width = 1.0f);
00077
00079
00081
00082 virtual void setWidth(float width);
00083
00085
00087
00088 virtual void render(const Group& group);
00089
00090 void createBuffers(const Group& group);
00091
00092 private :
00093
00094 static const size_t NB_INDICES_PER_QUAD = 2;
00095 static const size_t NB_VERTICES_PER_QUAD = 2;
00096
00097
00098 static const std::string IRR_BUFFER_NAME;
00099
00100 virtual const std::string& getBufferName() const;
00101 };
00102
00103
00104 inline IRRLineRenderer* IRRLineRenderer::create(irr::IrrlichtDevice* d,float length,float width)
00105 {
00106 IRRLineRenderer* obj = new IRRLineRenderer(d,length,width);
00107 registerObject(obj);
00108 return obj;
00109 }
00110
00111 inline void IRRLineRenderer::setWidth(float width)
00112 {
00113 material.Thickness = this->width = width;
00114 }
00115
00116 inline const std::string& IRRLineRenderer::getBufferName() const
00117 {
00118 return IRR_BUFFER_NAME;
00119 }
00120 }}
00121
00122 #endif