Commit 07fcc618 authored by Charles Law's avatar Charles Law
Browse files

Texture for color option.

parent 00579dc7
......@@ -50,7 +50,7 @@
#include "vtkPVRenderModule.h"
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVColorMap);
vtkCxxRevisionMacro(vtkPVColorMap, "1.92");
vtkCxxRevisionMacro(vtkPVColorMap, "1.93");
int vtkPVColorMapCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -848,9 +848,19 @@ void vtkPVColorMap::CreateParallelTclObjects(vtkPVApplication *pvApp)
pm->SendStream(vtkProcessModule::CLIENT|vtkProcessModule::RENDER_SERVER);
this->LookupTable =
vtkLookupTable::SafeDownCast(pm->GetObjectFromID(this->LookupTableID));
pm->GetStream() << vtkClientServerStream::Invoke
<< this->LookupTableID << "SetVectorModeToMagnitude"
<< vtkClientServerStream::End;
if (this->NumberOfVectorComponents > 1)
{
pm->GetStream() << vtkClientServerStream::Invoke
<< this->LookupTableID << "SetVectorModeToMagnitude"
<< vtkClientServerStream::End;
}
else
{
pm->GetStream() << vtkClientServerStream::Invoke
<< this->LookupTableID << "SetVectorModeToComponent"
<< vtkClientServerStream::End;
}
this->ScalarBar = vtkScalarBarWidget::New();
this->ScalarBar->SetCurrentRenderer(pvApp->GetRenderModule()->GetRenderer2D());
......
......@@ -83,7 +83,7 @@
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVData);
vtkCxxRevisionMacro(vtkPVData, "1.287");
vtkCxxRevisionMacro(vtkPVData, "1.288");
int vtkPVDataCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -138,6 +138,7 @@ vtkPVData::vtkPVData()
this->ColorMenu = vtkKWOptionMenu::New();
this->MapScalarsCheck = vtkKWCheckButton::New();
this->InterpolateColorsCheck = vtkKWCheckButton::New();
this->EditColorMapButton = vtkKWPushButton::New();
this->ColorButton = vtkKWChangeColorButton::New();
......@@ -261,6 +262,9 @@ vtkPVData::~vtkPVData()
this->MapScalarsCheck->Delete();
this->MapScalarsCheck = NULL;
this->InterpolateColorsCheck->Delete();
this->InterpolateColorsCheck = NULL;
this->ColorButton->Delete();
this->ColorButton = NULL;
......@@ -615,7 +619,6 @@ void vtkPVData::CreateProperties()
this->ColorButton->SetBalloonHelpString(
"Edit the constant color for the geometry.");
this->MapScalarsCheck->SetParent(this->ColorFrame->GetFrame());
this->MapScalarsCheck->Create(this->GetApplication(), "-text {Map Scalars}");
this->MapScalarsCheck->SetState(0);
......@@ -625,6 +628,16 @@ void vtkPVData::CreateProperties()
"%s configure -command {%s MapScalarsCheckCallback}",
this->MapScalarsCheck->GetWidgetName(),
this->GetTclName());
this->InterpolateColorsCheck->SetParent(this->ColorFrame->GetFrame());
this->InterpolateColorsCheck->Create(this->GetApplication(), "-text {Interpolate Colors}");
this->InterpolateColorsCheck->SetState(1);
this->InterpolateColorsCheck->SetBalloonHelpString(
"Interpolate colors after mapping.");
this->GetApplication()->Script(
"%s configure -command {%s InterpolateColorsCheckCallback}",
this->InterpolateColorsCheck->GetWidgetName(),
this->GetTclName());
this->EditColorMapButton->SetParent(this->ColorFrame->GetFrame());
this->EditColorMapButton->Create(this->GetApplication(), "");
......@@ -637,20 +650,21 @@ void vtkPVData::CreateProperties()
this->Script("grid %s %s -sticky wns",
this->ColorMenuLabel->GetWidgetName(),
this->ColorMenu->GetWidgetName());
this->Script("grid %s -sticky news -padx %d -pady %d",
this->ColorMenu->GetWidgetName(),
col_1_padx, button_pady);
this->Script("grid %s %s -sticky wns",
this->MapScalarsCheck->GetWidgetName(),
this->ColorButton->GetWidgetName());
this->Script("grid %s -column 1 -sticky news -padx %d -pady %d",
this->ColorButton->GetWidgetName(),
col_1_padx, button_pady);
this->ColorButtonVisible = 0;
this->Script("grid %s %s -sticky wns",
this->MapScalarsCheck->GetWidgetName(),
this->InterpolateColorsCheck->GetWidgetName(),
this->EditColorMapButton->GetWidgetName());
this->Script("grid %s -sticky news -padx %d -pady %d",
this->EditColorMapButton->GetWidgetName(),
col_1_padx, button_pady);
......@@ -2707,6 +2721,33 @@ void vtkPVData::SetMapScalarsFlag(int val)
}
}
//----------------------------------------------------------------------------
void vtkPVData::InterpolateColorsCheckCallback()
{
this->SetInterpolateColorsFlag(this->InterpolateColorsCheck->GetState());
if ( this->GetPVRenderView() )
{
this->GetPVRenderView()->EventuallyRender();
}
}
//----------------------------------------------------------------------------
void vtkPVData::SetInterpolateColorsFlag(int val)
{
if (this->InterpolateColorsCheck->GetState() != val)
{
this->AddTraceEntry("$kw(%s) SetInterpolateColorsFlag %d", this->GetTclName(), val);
this->InterpolateColorsCheck->SetState(val);
}
int num, idx;
num = this->PVSource->GetNumberOfParts();
for (idx = 0; idx < num; ++idx)
{
this->PVSource->GetPart(idx)->GetPartDisplay()->SetInterpolateColorsFlag(val);
}
}
//----------------------------------------------------------------------------
void vtkPVData::SetPointSize(int size)
{
......
......@@ -287,7 +287,6 @@ public:
// and to determine whether the scalar bar should be visible.
void SetVisibilityCheckState(int v);
// Description:
// This determines whether to map array values through a color
// map or use arrays values as colors directly. The direct option
......@@ -295,6 +294,15 @@ public:
void SetMapScalarsFlag(int val);
void MapScalarsCheckCallback();
// Description:
// This determines whether we will interpolate before or after
// scalrs are mapped. Interpolate after is the standard VTK
// OpenGL vertex coloring. It gives smooth coloring, but
// may generate colors not in the map Interpolating before
// mapping uses a 1d texture map.
void SetInterpolateColorsFlag(int val);
void InterpolateColorsCheckCallback();
vtkGetMacro(ColorSetByUser, int);
vtkGetMacro(ArraySetByUser, int);
......@@ -399,6 +407,7 @@ protected:
vtkKWCheckButton *ScalarBarCheck;
vtkKWCheckButton *MapScalarsCheck;
vtkKWCheckButton *InterpolateColorsCheck;
// For translating actor
vtkKWLabeledFrame* ActorControlFrame;
......
......@@ -41,7 +41,7 @@
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVLODPartDisplay);
vtkCxxRevisionMacro(vtkPVLODPartDisplay, "1.24");
vtkCxxRevisionMacro(vtkPVLODPartDisplay, "1.25");
//----------------------------------------------------------------------------
......@@ -488,6 +488,34 @@ void vtkPVLODPartDisplay::SetDirectColorFlag(int val)
}
}
//----------------------------------------------------------------------------
void vtkPVLODPartDisplay::SetInterpolateColorsFlag(int val)
{
if (val)
{
val = 1;
}
if (val == this->InterpolateColorsFlag)
{
return;
}
vtkPVApplication* pvApp = this->GetPVApplication();
vtkPVProcessModule* pm = pvApp->GetProcessModule();
this->InterpolateColorsFlag = val;
pm->GetStream()
<< vtkClientServerStream::Invoke
<< this->MapperID
<< "SetInterpolateScalarsBeforeMapping" << (!val)
<< vtkClientServerStream::End;
pm->GetStream()
<< vtkClientServerStream::Invoke
<< this->LODMapperID
<< "SetInterpolateScalarsBeforeMapping" << (!val)
<< vtkClientServerStream::End;
pm->SendStream(vtkProcessModule::CLIENT|vtkProcessModule::RENDER_SERVER);
}
//----------------------------------------------------------------------------
void vtkPVLODPartDisplay::SetPointLabelVisibility(int val)
{
......
......@@ -56,6 +56,10 @@ public:
virtual void SetScalarVisibility(int val);
virtual void ColorByArray(vtkPVColorMap *colorMap, int field);
// Description:
// Option to use a 1d texture map for the attribute color.
virtual void SetInterpolateColorsFlag(int val);
// Description:
// This method updates the piece that has been assigned to this process.
// It also gathers the data information.
......
......@@ -48,7 +48,7 @@
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVPartDisplay);
vtkCxxRevisionMacro(vtkPVPartDisplay, "1.36");
vtkCxxRevisionMacro(vtkPVPartDisplay, "1.37");
//----------------------------------------------------------------------------
......@@ -57,6 +57,7 @@ vtkPVPartDisplay::vtkPVPartDisplay()
this->PVApplication = NULL;
this->DirectColorFlag = 1;
this->InterpolateColorsFlag = 1;
this->Visibility = 1;
this->Part = NULL;
......@@ -570,6 +571,29 @@ void vtkPVPartDisplay::SetDirectColorFlag(int val)
pm->SendStream(vtkProcessModule::CLIENT|vtkProcessModule::RENDER_SERVER);
}
//----------------------------------------------------------------------------
void vtkPVPartDisplay::SetInterpolateColorsFlag(int val)
{
if (val)
{
val = 1;
}
if (val == this->InterpolateColorsFlag)
{
return;
}
vtkPVApplication* pvApp = this->GetPVApplication();
vtkPVProcessModule *pm = pvApp->GetProcessModule();
vtkClientServerStream& stream = pm->GetStream();
this->InterpolateColorsFlag = val;
stream << vtkClientServerStream::Invoke << this->MapperID
<< "SetInterpolateScalarsBeforeMapping" << (!val)
<< vtkClientServerStream::End;
pm->SendStream(vtkProcessModule::CLIENT|vtkProcessModule::RENDER_SERVER);
}
//----------------------------------------------------------------------------
void vtkPVPartDisplay::ColorByArray(vtkPVColorMap *colorMap,
int field)
......@@ -754,6 +778,7 @@ void vtkPVPartDisplay::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "PVApplication: " << this->PVApplication << endl;
os << indent << "DirectColorFlag: " << this->DirectColorFlag << endl;
os << indent << "InterpolateColorsFlag: " << this->InterpolateColorsFlag << endl;
os << indent << "UpdateSuppressor: " << this->UpdateSuppressorID.ID << endl;
os << indent << "VolumeID: " << this->VolumeID.ID << endl;
......
......@@ -68,6 +68,11 @@ public:
virtual void SetScalarVisibility(int val);
virtual void ColorByArray(vtkPVColorMap *colorMap, int field);
// Description:
// Option to use a 1d texture map for the attribute color.
virtual void SetInterpolateColorsFlag(int val);
vtkGetMacro(InterpolateColorsFlag, int);
// Description:
// This just sets the color of the property.
// you also have to set scalar visiblity to off.
......@@ -181,6 +186,7 @@ protected:
vtkPVApplication *PVApplication;
int DirectColorFlag;
int InterpolateColorsFlag;
int Visibility;
// Problems with vtkLODActor led me to use these.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment