void wxPoint2DDouble::SetVectorAngle( wxDouble degrees ) { wxDouble length = GetVectorLength(); m_x = length * cos( degrees / 180 * M_PI ); m_y = length * sin( degrees / 180 * M_PI ); }
void TScene::DrawRadarLabel(Vector pos) { // Draw Radar Slots glMatrixMode(GL_MODELVIEW); Vector col(0.25f,0.25f,0); // DrawLine2D(0.3f,0,0.7f,0,Vector(1,1,0)); DrawLine2D(0.7f,0,0.7f,0.3f,col); DrawLine2D(0.7f,0.3f,0.3f,0.3f,col); DrawLine2D(0.3f,0.3f,0.3f,0,col); DrawLine2D(0.3f,1,0.3f,0.7f,col); DrawLine2D(0.3f,0.7f,0.7f,0.7f,col); DrawLine2D(0.7f,0.7f,0.7f,1,col); Vector lskPos(0,0,0),lskPos2(0,0,0),tmpV(0,0,0); float tmp=0; OGLMath_VectorMatrixMultiply( lskPos, pos, Camera->CameraMatrix); lskPos2=lskPos; /* float mmodel[16]={0}; gluLookAt(0,0,0,dir.x,dir.y,dir.z,up.x,up.y,up.z); // glPushMatrix(); glGetFloatv(GL_MODELVIEW_MATRIX, mmodel); // glPopMatrix(); glLoadIdentity(); glTranslatef(pos.x, pos.y, pos.z); glMultTransposeMatrixf(mmodel);*/ //Camera->Apply(); float l=2000.0f-GetVectorLength(Camera->GetPosition()-pos); lskPos.x=lskPos.x/(3000.0f-l)+0.5f+0.35f; lskPos.y=lskPos.y/(3000.0f-l);//+0.5f; lskPos.z=-lskPos.z/(3000.0f-l)+0.5f-0.35f; if (lskPos.y>0.3f) lskPos.y=0.3f; if (lskPos.y<-0.3f) lskPos.y=-0.3f; DrawLine2D(lskPos.x, lskPos.z, lskPos.x, lskPos.z+lskPos.y, Vector(1,1,1)); DrawLine2D(lskPos.x, lskPos.z+lskPos.y, lskPos.x+0.01f, lskPos.z+lskPos.y, Vector(1,1,1)); DrawLine2D(0.85-0.01f,0.15,0.85+0.01f,0.15,Vector(1,1,1)); DrawLine2D(0.85,0.15-0.01f,0.85,0.15+0.01f,Vector(1,1,1)); // Draw Label of Sphere Radar float mmodel[16]={0}; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0,0,10,0,2.3f,1,0,1,0); glGetFloatv(GL_MODELVIEW_MATRIX, mmodel); lskPos2=NormalizeVector(lskPos2)*1.2f; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMultMatrixf(ProjectionMatrix); glMultMatrixf(mmodel); glMatrixMode(GL_MODELVIEW); // tmpV=Camera->GetPosition(); // DrawLine(Vector(tmpV.x,tmpV.y,tmpV.z-1.0f),Vector(tmpV.x+50.0f,tmpV.y+50.0f,tmpV.z-100.0f), Vector(1,1,1)); // DrawLine(Vector(0,0,0),Vector(100,100,-100),Vector(1,1,1)); DrawLine(Vector(0,0,0),lskPos2,Vector(1,1,1)); // glBlendFunc(GL_SRC_ALPHA,GL_NONE); // Select The Type Of Blending // glEnable(GL_COLOR_MATERIAL); // glDisable(GL_LIGHTING); // glDisable(GL_LIGHT0); RenderPlanet(0.25f,Vector(0,0,0),6); // glEnable(GL_LIGHTING); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMultMatrixf(ProjectionMatrix); glMultMatrixf(Camera->CameraMatrix); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }
void wxPoint2DInt::SetVectorAngle( wxDouble degrees ) { wxDouble length = GetVectorLength(); m_x = (int)(length * cos( degrees / 180 * M_PI )); m_y = (int)(length * sin( degrees / 180 * M_PI )); }
void SetUnitVector(float* result) { float length = GetVectorLength(result); ScaleVector(1.0/length, result); }