The following is a simple example on how to use “priority HSRA”.
HC_Open_Segment_By_Key(m_pHView->GetViewKey()); {
HC_Set_Rendering_Options("hsra = priority");
}HC_Close_Segment();
The “priority” hidden surface removal algorithm is primarily used for creating layers within 2D scenes and can cause undesired results when rendering non-planar objects, such as shells or meshes, that can have some parts overlapping others within the same primitive.
void CSolidHoopsView::OnExtraSlot1() {
HC_Open_Segment_By_Key(m_pHView->GetViewKey()); {
HC_Set_Rendering_Options("hsra = priority");
}HC_Close_Segment();
float points[12] = { -1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0 };
int face_lists[5] = { 4, 0, 1, 2, 3 };
HC_Open_Segment_By_Key(m_pHView->GetModelKey()); {
HC_Set_Visibility("faces=on,lines=on");
HC_Open_Segment("line");
HC_KEY lineKey = HC_Insert_Line(-2, -0.5f, 0, 2, -0.5f, 0);
HC_Close_Segment();
HC_Set_Priority(lineKey, 99);
HC_Open_Segment("line2");
HC_KEY lineKey2 = HC_Insert_Line(-2, 0.5f, 0, 2, 0.5, 0);
HC_Close_Segment();
HC_Set_Priority(lineKey2, 101);
HC_Open_Segment("shell");
HC_KEY shellKey = HC_Insert_Shell(4, points, 5, face_lists);
HC_Close_Segment();
HC_Set_Priority(shellKey, 100);
}
HC_Close_Segment();
m_pHView->Update();
}
Screenshot: