00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "axis.h"
00023 #include "../openglserver/openglserver.h"
00024 #include <kerosin/openglserver/glbase.h>
00025
00026 using namespace kerosin;
00027
00028 Axis::Axis() : mSize(10.0f)
00029 {
00030 }
00031
00032 void Axis::RenderInternal()
00033 {
00034 RGBA colX(1,0,0,1);
00035 RGBA colY(0,1,0,1);
00036 RGBA colZ(0,0,1,1);
00037
00038
00039 glColor3fv(colX);
00040 glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,colX);
00041 glBegin(GL_LINE_LOOP);
00042 glVertex3f(0,0,0);
00043 glVertex3f(mSize,0,0);
00044 glEnd();
00045
00046
00047 glColor3fv(colY);
00048 glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,colY);
00049 glBegin(GL_LINE_LOOP);
00050 glVertex3f(0,0,0);
00051 glVertex3f(0,mSize,0);
00052 glEnd();
00053
00054
00055 glColor3fv(colZ);
00056 glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,colZ);
00057 glColor3f(0, 0, 1);
00058 glBegin(GL_LINE_LOOP);
00059 glVertex3f(0,0,0);
00060 glVertex3f(0,0,mSize);
00061 glEnd();
00062 }
00063
00064 float Axis::GetSize()
00065 {
00066 return mSize;
00067 }
00068
00069 void Axis::SetSize(float size)
00070 {
00071 mSize = std::max<float>(0.1f,size);
00072 }
00073