#include "ats_glboid.h" #include // 識別子が長すぎるワーニングを無効 #pragma warning (disable : 4786) using namespace ats; using namespace std; GLBoid::GLBoid(int max, int max2) : Boid(max,max2) { } GLBoid::~GLBoid() { } void GLBoid::Draw() { // 方向を足す Point3D tmp((m_muki.GetNormal() *0.1) + m_center); double color = 1.0; double step = color / m_tail_num; // とりあえず、ラインで描画する // 描画するのは位置から方向(速度は無視) glDisable(GL_LIGHTING); glBegin(GL_LINES); glColor3f(0,0,0); glVertex3d(tmp.X(), tmp.Y(), tmp.Z()); glColor3d(1, 1, 1); glVertex3d(m_center.X(), m_center.Y(), m_center.Z()); vector::iterator itr = m_tail_itr; for(int i=0; i < m_tail_num; i++){ if(++itr == m_tail.end()){ // イテレータを移動 itr = m_tail.begin(); } color -= step; glColor3f(color, color, color); glVertex3d(itr->X(), itr->Y(), itr->Z()); } glEnd(); glEnable(GL_LIGHTING); }