void MoveHood::Draw(ST_Axis selectedAxis, ST_Axis mouseOverAxis, TextDrawSystem *textDrawSystem) { DAVA::Color colorSBlend(colorS.r, colorS.g, colorS.b, 0.3f); DAVA::Vector3 curPos = axisX->curPos; // x if(selectedAxis & ST_AXIS_X) DAVA::RenderManager::Instance()->SetColor(colorS); else DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->DrawLine(axisX->curFrom, axisX->curTo, 1.0f, hoodDrawState); // y if(selectedAxis & ST_AXIS_Y) DAVA::RenderManager::Instance()->SetColor(colorS); else DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->DrawLine(axisY->curFrom, axisY->curTo, 1.0f, hoodDrawState); // z if(selectedAxis & ST_AXIS_Z) DAVA::RenderManager::Instance()->SetColor(colorS); else DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->DrawLine(axisZ->curFrom, axisZ->curTo, 1.0f, hoodDrawState); // arrow length DAVA::float32 arrowLen = axisX->curScale * baseSize / 4; // arrow x DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->FillArrow(axisX->curFrom, axisX->curTo, arrowLen, 0, hoodDrawState); // arrow y DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->FillArrow(axisY->curFrom, axisY->curTo, arrowLen, 0, hoodDrawState); // arrow z DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->FillArrow(axisZ->curFrom, axisZ->curTo, arrowLen, 0, hoodDrawState); // xy if(selectedAxis == ST_AXIS_XY) { DAVA::RenderManager::Instance()->SetColor(colorS); DAVA::RenderHelper::Instance()->DrawLine(axisXY1->curFrom, axisXY1->curTo, 1.0f, hoodDrawState); DAVA::RenderHelper::Instance()->DrawLine(axisXY2->curFrom, axisXY2->curTo, 1.0f, hoodDrawState); DAVA::Polygon3 poly; poly.AddPoint(curPos); poly.AddPoint(axisXY1->curFrom); poly.AddPoint(axisXY1->curTo); poly.AddPoint(axisXY2->curFrom); DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::RenderHelper::Instance()->FillPolygon(poly, hoodDrawState); } else { DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->DrawLine(axisXY1->curFrom, axisXY1->curTo, 1.0f, hoodDrawState); DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->DrawLine(axisXY2->curFrom, axisXY2->curTo, 1.0f, hoodDrawState); } // xz if(selectedAxis == ST_AXIS_XZ) { DAVA::RenderManager::Instance()->SetColor(colorS); DAVA::RenderHelper::Instance()->DrawLine(axisXZ1->curFrom, axisXZ1->curTo, 1.0f, hoodDrawState); DAVA::RenderHelper::Instance()->DrawLine(axisXZ2->curFrom, axisXZ2->curTo, 1.0f, hoodDrawState); DAVA::Polygon3 poly; poly.AddPoint(curPos); poly.AddPoint(axisXZ1->curFrom); poly.AddPoint(axisXZ1->curTo); poly.AddPoint(axisXZ2->curFrom); DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::RenderHelper::Instance()->FillPolygon(poly, hoodDrawState); } else { DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->DrawLine(axisXZ1->curFrom, axisXZ1->curTo, 1.0f, hoodDrawState); DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->DrawLine(axisXZ2->curFrom, axisXZ2->curTo, 1.0f, hoodDrawState); } // yz if(selectedAxis == ST_AXIS_YZ) { DAVA::RenderManager::Instance()->SetColor(colorS); DAVA::RenderHelper::Instance()->DrawLine(axisYZ1->curFrom, axisYZ1->curTo, 1.0f, hoodDrawState); DAVA::RenderHelper::Instance()->DrawLine(axisYZ2->curFrom, axisYZ2->curTo, 1.0f, hoodDrawState); DAVA::Polygon3 poly; poly.AddPoint(curPos); poly.AddPoint(axisYZ1->curFrom); poly.AddPoint(axisYZ1->curTo); poly.AddPoint(axisYZ2->curFrom); DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::RenderHelper::Instance()->FillPolygon(poly, hoodDrawState); } else { DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->DrawLine(axisYZ1->curFrom, axisYZ1->curTo, 1.0f, hoodDrawState); DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->DrawLine(axisYZ2->curFrom, axisYZ2->curTo, 1.0f, hoodDrawState); } DAVA::Rect r = DrawAxisText(textDrawSystem, axisX, axisY, axisZ); if(!modifOffset.IsZero()) { char tmp[255]; DAVA::Vector2 topPos = DAVA::Vector2((r.x + r.dx)/2, r.y - 20); sprintf(tmp, "[%.2f, %.2f, %.2f]", modifOffset.x, modifOffset.y, modifOffset.z); textDrawSystem->DrawText(topPos, tmp, DAVA::Color(255, 255, 0, 255)); } //DAVA::RenderManager::Instance()->SetBlendMode(oldBlendSrc, oldBlendDst); //DAVA::RenderManager::Instance()->SetState(oldState); }
void RotateHood::Draw(ST_Axis selectedAxis, ST_Axis mouseOverAxis) { int oldState = DAVA::RenderManager::Instance()->GetState(); DAVA::eBlendMode oldBlendSrc = DAVA::RenderManager::Instance()->GetSrcBlend(); DAVA::eBlendMode oldBlendDst = DAVA::RenderManager::Instance()->GetDestBlend(); DAVA::RenderManager::Instance()->SetBlendMode(DAVA::BLEND_SRC_ALPHA, DAVA::BLEND_ONE_MINUS_SRC_ALPHA); DAVA::RenderManager::Instance()->SetState(DAVA::RenderState::STATE_BLEND | DAVA::RenderState::STATE_COLORMASK_ALL); DAVA::Color colorSBlend(colorS.r, colorS.g, colorS.b, 0.3f); DAVA::Vector3 curPos = axisX->curPos; // x if(selectedAxis == ST_AXIS_X || selectedAxis == ST_AXIS_YZ) { DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::Polygon3 poly; poly.AddPoint(curPos); for(int i = 0; i < ROTATE_HOOD_CIRCLE_PARTS_COUNT; ++i) { poly.AddPoint(axisXc[i]->curFrom); } poly.AddPoint(axisXc[ROTATE_HOOD_CIRCLE_PARTS_COUNT - 1]->curTo); DAVA::RenderHelper::Instance()->FillPolygon(poly); DAVA::RenderManager::Instance()->SetColor(colorS); } else DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->DrawLine(axisX->curFrom, axisX->curTo); for(int i = 0; i < ROTATE_HOOD_CIRCLE_PARTS_COUNT; ++i) { DAVA::RenderHelper::Instance()->DrawLine(axisXc[i]->curFrom, axisXc[i]->curTo); } // y if(selectedAxis == ST_AXIS_Y || selectedAxis == ST_AXIS_XZ) { DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::Polygon3 poly; poly.AddPoint(curPos); for(int i = 0; i < ROTATE_HOOD_CIRCLE_PARTS_COUNT; ++i) { poly.AddPoint(axisYc[i]->curFrom); } poly.AddPoint(axisYc[ROTATE_HOOD_CIRCLE_PARTS_COUNT - 1]->curTo); DAVA::RenderHelper::Instance()->FillPolygon(poly); DAVA::RenderManager::Instance()->SetColor(colorS); } else DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->DrawLine(axisY->curFrom, axisY->curTo); for(int i = 0; i < ROTATE_HOOD_CIRCLE_PARTS_COUNT; ++i) { DAVA::RenderHelper::Instance()->DrawLine(axisYc[i]->curFrom, axisYc[i]->curTo); } // z if(selectedAxis == ST_AXIS_Z || selectedAxis == ST_AXIS_XY) { DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::Polygon3 poly; poly.AddPoint(curPos); for(int i = 0; i < ROTATE_HOOD_CIRCLE_PARTS_COUNT; ++i) { poly.AddPoint(axisZc[i]->curFrom); } poly.AddPoint(axisZc[ROTATE_HOOD_CIRCLE_PARTS_COUNT - 1]->curTo); DAVA::RenderHelper::Instance()->FillPolygon(poly); DAVA::RenderManager::Instance()->SetColor(colorS); } else DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->DrawLine(axisZ->curFrom, axisZ->curTo); for(int i = 0; i < ROTATE_HOOD_CIRCLE_PARTS_COUNT; ++i) { DAVA::RenderHelper::Instance()->DrawLine(axisZc[i]->curFrom, axisZc[i]->curTo); } // draw axis spheres DAVA::float32 radius = axisX->curScale * baseSize / 12; DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->FillDodecahedron(axisX->curTo, radius); DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->FillDodecahedron(axisY->curTo, radius); DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->FillDodecahedron(axisZ->curTo, radius); DAVA::RenderManager::Instance()->SetBlendMode(oldBlendSrc, oldBlendDst); DAVA::RenderManager::Instance()->SetState(oldState); }
void MoveHood::Draw(ST_Axis selectedAxis, ST_Axis mouseOverAxis) { int oldState = DAVA::RenderManager::Instance()->GetState(); DAVA::eBlendMode oldBlendSrc = DAVA::RenderManager::Instance()->GetSrcBlend(); DAVA::eBlendMode oldBlendDst = DAVA::RenderManager::Instance()->GetDestBlend(); DAVA::RenderManager::Instance()->SetState(DAVA::RenderState::STATE_BLEND | DAVA::RenderState::STATE_COLORMASK_ALL | DAVA::RenderState::STATE_DEPTH_WRITE); DAVA::RenderManager::Instance()->SetBlendMode(DAVA::BLEND_SRC_ALPHA, DAVA::BLEND_ONE_MINUS_SRC_ALPHA); DAVA::Color colorSBlend(colorS.r, colorS.g, colorS.b, 0.3f); DAVA::Vector3 curPos = axisX->curPos; // x if(selectedAxis & ST_AXIS_X) DAVA::RenderManager::Instance()->SetColor(colorS); else DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->DrawLine(axisX->curFrom, axisX->curTo); // y if(selectedAxis & ST_AXIS_Y) DAVA::RenderManager::Instance()->SetColor(colorS); else DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->DrawLine(axisY->curFrom, axisY->curTo); // z if(selectedAxis & ST_AXIS_Z) DAVA::RenderManager::Instance()->SetColor(colorS); else DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->DrawLine(axisZ->curFrom, axisZ->curTo); // arrow length DAVA::float32 arrowLen = axisX->curScale * baseSize / 4; // arrow x DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->FillArrow(axisX->curFrom, axisX->curTo, arrowLen, 0); // arrow y DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->FillArrow(axisY->curFrom, axisY->curTo, arrowLen, 0); // arrow z DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->FillArrow(axisZ->curFrom, axisZ->curTo, arrowLen, 0); // xy if(selectedAxis == ST_AXIS_XY) { DAVA::RenderManager::Instance()->SetColor(colorS); DAVA::RenderHelper::Instance()->DrawLine(axisXY1->curFrom, axisXY1->curTo); DAVA::RenderHelper::Instance()->DrawLine(axisXY2->curFrom, axisXY2->curTo); DAVA::Polygon3 poly; poly.AddPoint(curPos); poly.AddPoint(axisXY1->curFrom); poly.AddPoint(axisXY1->curTo); poly.AddPoint(axisXY2->curFrom); DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::RenderHelper::Instance()->FillPolygon(poly); } else { DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->DrawLine(axisXY1->curFrom, axisXY1->curTo); DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->DrawLine(axisXY2->curFrom, axisXY2->curTo); } // xz if(selectedAxis == ST_AXIS_XZ) { DAVA::RenderManager::Instance()->SetColor(colorS); DAVA::RenderHelper::Instance()->DrawLine(axisXZ1->curFrom, axisXZ1->curTo); DAVA::RenderHelper::Instance()->DrawLine(axisXZ2->curFrom, axisXZ2->curTo); DAVA::Polygon3 poly; poly.AddPoint(curPos); poly.AddPoint(axisXZ1->curFrom); poly.AddPoint(axisXZ1->curTo); poly.AddPoint(axisXZ2->curFrom); DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::RenderHelper::Instance()->FillPolygon(poly); } else { DAVA::RenderManager::Instance()->SetColor(colorX); DAVA::RenderHelper::Instance()->DrawLine(axisXZ1->curFrom, axisXZ1->curTo); DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->DrawLine(axisXZ2->curFrom, axisXZ2->curTo); } // yz if(selectedAxis == ST_AXIS_YZ) { DAVA::RenderManager::Instance()->SetColor(colorS); DAVA::RenderHelper::Instance()->DrawLine(axisYZ1->curFrom, axisYZ1->curTo); DAVA::RenderHelper::Instance()->DrawLine(axisYZ2->curFrom, axisYZ2->curTo); DAVA::Polygon3 poly; poly.AddPoint(curPos); poly.AddPoint(axisYZ1->curFrom); poly.AddPoint(axisYZ1->curTo); poly.AddPoint(axisYZ2->curFrom); DAVA::RenderManager::Instance()->SetColor(colorSBlend); DAVA::RenderHelper::Instance()->FillPolygon(poly); } else { DAVA::RenderManager::Instance()->SetColor(colorY); DAVA::RenderHelper::Instance()->DrawLine(axisYZ1->curFrom, axisYZ1->curTo); DAVA::RenderManager::Instance()->SetColor(colorZ); DAVA::RenderHelper::Instance()->DrawLine(axisYZ2->curFrom, axisYZ2->curTo); } DAVA::RenderManager::Instance()->SetBlendMode(oldBlendSrc, oldBlendDst); DAVA::RenderManager::Instance()->SetState(oldState); }