Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

CAE Tutorial: Setting Contour Rendermodes

This step reviews how to use the various contour modes. The sample image below shows regular smooth shading, isolines, color index interpolation with smooth transitions between bands, and color index interpolation with discrete bands.

 

The HBaseView::SetColorIndexInterpolation and HBaseView::SetColorInterpolation methods allow control over contour rendermodes. They are essentially HOOPS/MVO's wrappers to the core HOOPS/3dGS color-index and color-interpolation capabilities, discussed in color interpolation section of the HOOPS/3dGS Programming Guide, and controlled by the 'color interpolation' and 'color index interpolation' options of ::Set_Rendering_Options.

The previous tutorial step called the methods to enable both color and color-index interpolation, and we'll explore a few more combinations here:

 

Isolines

Isoline rendering is supported by calling HBaseView::SetColorIndexInterpolation and passing in 'true' for the 2nd argument.

Let's first add a new boolean member to our GUI widget object called m_bDisplayIsolines and initialize it to false:

class CAnalysisView : public CHoopsView
{
protected:
...
public:
}
{
}

 

Now we'll add a new GUI button, and have it call HBaseView::SetColorIndexInterpolation based on how the state is toggled. The MFC example, included the OnUpdate GUI logic:

{
if (m_bDisplayIsolines == false)
{
((HAnalysisView *)m_pHView)->SetColorIndexInterpolation(true, true);
}
else
{
((HAnalysisView *)m_pHView)->SetColorIndexInterpolation(true, false);
}
}
{
pCmdUI->SetCheck (1);
else
pCmdUI->SetCheck (0);
}

Experiment with toggling isoline display.

Color Interpolation

When color values are applied at the indices of a HOOPS shell it's usually desirable to see at least 'color index interpolation' which, as previously reviewed, results in banding based on interpolating across colormap colors. However, the first step in the tutorial also turned on 'color interpolation', which smoothly interpolates between the hard/discrete bands across the object's surface. Let's experiment with toggling color interpolation as well to achieve a 'hard contour' visualization. This is achieved by calling HBaseView::SetColorInterpolation

Let's first add a new boolean member to our GUI widget object called m_bColorInterpolation and initialize it to true, which is consistent with the initial color interpolation state:

class CAnalysisView : public CHoopsView
{
protected:
...
public:
}
{
}

 

Now we'll add a new GUI button, and have it call HBaseView::SetColorInterpolation based on how the state is toggled. The MFC example, including the OnUpdate GUI logic:

{
if (m_bColorInterpolation == false)
{
((HAnalysisView *)m_pHView)->SetColorInterpolation(true);
}
else
{
((HAnalysisView *)m_pHView)->SetColorInterpolation(false);
}
}
{
pCmdUI->SetCheck (1);
else
pCmdUI->SetCheck (0);
}

Experiment with toggling color interpolation.

 

Exercise: Toggling Edge Display

Follow the same approach as the isolines display logic above and add a new GUI menu button which toggles display of HOOPS/3dGS 'edges'. Begin by adding a the following method to HAnalysisView and calling that from the GUI-specific edge-toggling logic:

{
HC_Open_Segment_By_Key (GetSceneKey());
if (on_off)
HC_Set_Visibility ("edges = on");
else
HC_Set_Visibility ("edges = off");
HC_Close_Segment ();
}

Note that it opens up the HOOPS/MVO 'scene key' which represents the key of the HOOPS/3dGS segment at the top of the scene hierarchy, and toggles 'edge' visibility.