Vector3 GetNodePositionOnScreen(TSONode node) { Vector3 p1 = node.GetWorldPosition(); Vector3 p2 = WorldToScreen(p1); return(p2); }
bool HiddenNode(TSONode node) { Vector3 position = node.GetWorldPosition(); Vector3 view_position = Vector3.TransformCoordinate(position, Transform_View); return(view_position.Z > 0.0f); }
void DrawNodeAxis(TSONode node) { Vector3 p1 = GetNodePositionOnScreen(node); p1.Z = 0.0f; Vector3 position = node.GetWorldPosition(); Matrix m = node.GetWorldCoordinate(); Vector3 dirx = GetMatrixDirX(ref m); Vector3 diry = GetMatrixDirY(ref m); Vector3 dirz = GetMatrixDirZ(ref m); Vector3 view_position_dirx = Vector3.TransformCoordinate(position + dirx, Transform_View); Vector3 view_position_diry = Vector3.TransformCoordinate(position + diry, Transform_View); Vector3 view_position_dirz = Vector3.TransformCoordinate(position + dirz, Transform_View); bool hidden_dirx = view_position_dirx.Z > 0.0f; bool hidden_diry = view_position_diry.Z > 0.0f; bool hidden_dirz = view_position_dirz.Z > 0.0f; Line line = new Line(device); line.Width = 3; Vector2[] vertices = new Vector2[2]; vertices[0] = new Vector2(p1.X, p1.Y); if (!hidden_dirx) { Vector3 px = WorldToScreen(position + dirx); vertices[1] = new Vector2(px.X, px.Y); line.Draw(vertices, Color.FromArgb(255, 0, 0));//R } if (!hidden_diry) { Vector3 py = WorldToScreen(position + diry); vertices[1] = new Vector2(py.X, py.Y); line.Draw(vertices, Color.FromArgb(0, 255, 0));//G } if (!hidden_dirz) { Vector3 pz = WorldToScreen(position + dirz); vertices[1] = new Vector2(pz.X, pz.Y); line.Draw(vertices, Color.FromArgb(0, 0, 255));//B } line.Dispose(); line = null; }