void CGizmoTransformRender::DrawCircleHalf(const tvector3 &orig,float r,float g,float b,const tvector3 &vtx, const tvector3 &vty, tplane &camPlan) { #ifdef WIN32 InitDecl(); int inc = 0; PSM_LVERTEX svVts[51]; for (int i = 0; i < 30 ; i++) { tvector3 vt; vt = vtx * cos((ZPI/30)*i); vt += vty * sin((ZPI/30)*i); vt +=orig; if (camPlan.DotNormal(vt)) { svVts[inc].diffuse = 0xFF000000 + (int(r*255.0f) << 16) + (int(g*255.0f) << 8) + (int(b*255.0f)); svVts[inc].x = vt.x; svVts[inc].y = vt.y; svVts[inc].z = vt.z; inc ++; } } IDirect3DDevice9 *pDev = GDD->GetD3D9Device(); GDD->GetD3D9Device()->SetVertexDeclaration(GGizmoVertDecl); GDD->GetD3D9Device()->DrawPrimitiveUP(D3DPT_LINESTRIP , inc-1, svVts, sizeof(PSM_LVERTEX)); GDD->GetD3D9Device()->SetRenderState(D3DRS_ZENABLE , D3DZB_TRUE); #endif }
void CGizmoTransformRender::DrawCircleHalf(const tvector3 &orig, const tvector3 &color, const tvector3 &vtx, const tvector3 &vty, tplane &camPlan) { static const int size = 30; tvector3 vertices[size]; int j = 0; for (int i = 0; i < size; i++) { tvector3 vt; vt = vtx * cos((ZPI / size) * i); vt += vty * sin((ZPI / size) * i); vt += orig; if (camPlan.DotNormal(vt)) { vertices[j++] = vt; } } glDisable(GL_DEPTH_TEST); ActivateProgram(); glUniform4f(m_ColorUniform, color.x, color.y, color.z, 1); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), vertices); glDrawArrays(GL_LINE_STRIP, 0, j); DeactivateProgram(); glEnable(GL_DEPTH_TEST); }