Commit a543d607 authored by hrchilds's avatar hrchilds

Update from November 14, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@121 18c085ea-50e0-402c-830e-de6fd14e8384
parent afcaefe3
This diff is collapsed.
......@@ -3,6 +3,7 @@
#include <state_exports.h>
#include <string>
#include <AttributeSubject.h>
#include <ColorAttribute.h>
// ****************************************************************************
// Class: RenderingAttributes
......@@ -13,7 +14,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Wed Nov 5 09:24:54 PDT 2003
// Creation: Fri Nov 14 17:59:48 PST 2003
//
// Modifications:
//
......@@ -51,6 +52,7 @@ public:
// Property selection methods
virtual void SelectAll();
void SelectSpecularColor();
// Property setting methods
void SetAntialiasing(bool antialiasing_);
......@@ -61,16 +63,25 @@ public:
void SetNotifyForEachRender(bool notifyForEachRender_);
void SetScalableRendering(bool scalableRendering_);
void SetScalableThreshold(int scalableThreshold_);
void SetSpecularFlag(bool specularFlag_);
void SetSpecularCoeff(float specularCoeff_);
void SetSpecularPower(float specularPower_);
void SetSpecularColor(const ColorAttribute &specularColor_);
// Property getting methods
bool GetAntialiasing() const;
bool GetAntialiasing() const;
GeometryRepresentation GetGeometryRepresentation() const;
bool GetDisplayLists() const;
bool GetStereoRendering() const;
StereoTypes GetStereoType() const;
bool GetNotifyForEachRender() const;
bool GetScalableRendering() const;
int GetScalableThreshold() const;
bool GetDisplayLists() const;
bool GetStereoRendering() const;
StereoTypes GetStereoType() const;
bool GetNotifyForEachRender() const;
bool GetScalableRendering() const;
int GetScalableThreshold() const;
bool GetSpecularFlag() const;
float GetSpecularCoeff() const;
float GetSpecularPower() const;
const ColorAttribute &GetSpecularColor() const;
ColorAttribute &GetSpecularColor();
// Persistence methods
virtual bool CreateNode(DataNode *node, bool forceAdd);
......@@ -95,14 +106,18 @@ public:
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
private:
bool antialiasing;
int geometryRepresentation;
bool displayLists;
bool stereoRendering;
int stereoType;
bool notifyForEachRender;
bool scalableRendering;
int scalableThreshold;
bool antialiasing;
int geometryRepresentation;
bool displayLists;
bool stereoRendering;
int stereoType;
bool notifyForEachRender;
bool scalableRendering;
int scalableThreshold;
bool specularFlag;
float specularCoeff;
float specularPower;
ColorAttribute specularColor;
};
#endif
......@@ -19,4 +19,8 @@
<Field name="notifyForEachRender" type="bool">false</Field>
<Field name="scalableRendering" type="bool">false</Field>
<Field name="scalableThreshold" type="int">2000000</Field>
<Field name="specularFlag" type="bool">false</Field>
<Field name="specularCoeff" type="float">0.6</Field>
<Field name="specularPower" type="float">10.0</Field>
<Field name="specularColor" type="color">255 255 255 255</Field>
</Attribute>
......@@ -408,11 +408,17 @@ avtSILMatrix::GetMaterialList(int index, MaterialList &matlist,
// Programmer: Hank Childs
// Creation: December 4, 2002
//
// Modifications:
//
// Hank Childs, Thu Nov 13 16:47:18 PST 2003
// Added forLoadBalance argument. This was causing a serious AMR bug
// with respect to properly ghosting out coarser zones in parallel.
//
// ****************************************************************************
void
avtSILMatrix::TurnSet(vector<unsigned char> &useSet, int index,
SetState val) const
SetState val, bool forLoadBalance) const
{
int set1size = set1.size();
int set2size = set2.size();
......@@ -423,7 +429,11 @@ avtSILMatrix::TurnSet(vector<unsigned char> &useSet, int index,
for (int i = 0 ; i < set2size ; i++)
{
int set = setsStartAt + row*set2size + i;
useSet[set] = val;
if (forLoadBalance && (val==NoneUsed) &&
((useSet[set]==AllUsed) || (useSet[set]==AllUsedOtherProc)))
useSet[set] = AllUsedOtherProc;
else
useSet[set] = val;
}
}
else
......@@ -432,7 +442,11 @@ avtSILMatrix::TurnSet(vector<unsigned char> &useSet, int index,
for (int i = 0 ; i < set1size ; i++)
{
int set = setsStartAt + i*set2size + column;
useSet[set] = val;
if (forLoadBalance && (val==NoneUsed) &&
((useSet[set]==AllUsed) || (useSet[set]==AllUsedOtherProc)))
useSet[set] = AllUsedOtherProc;
else
useSet[set] = val;
}
}
}
......
......@@ -34,6 +34,12 @@ class SILMatrixAttributes;
// Programmer: Hank Childs
// Creation: November 14, 2002
//
// Modifications:
//
// Hank Childs, Thu Nov 13 16:47:18 PST 2003
// Added argument forLoadBalance to TurnSet. This was causing a serious
// bug with AMR.
//
// ****************************************************************************
class DBATTS_API avtSILMatrix
......@@ -64,7 +70,7 @@ class DBATTS_API avtSILMatrix
bool GetMaterialList(int, MaterialList &,
const std::vector<unsigned char> &) const;
void TurnSet(std::vector<unsigned char> &, int,
SetState) const;
SetState, bool forLoadBalance) const;
SILMatrixAttributes *MakeAttributes(void) const;
......
......@@ -16,7 +16,7 @@
#include <IncompatibleDomainListsException.h>
#include <TimingsManager.h>
#define STATE_INDEX(S) (((S)==SomeUsed)?1:(((S)==AllUsed)?2:0))
#define STATE_INDEX(S) (((S)==SomeUsed)?1:(((S)==AllUsed)?2:((S)==AllUsedOtherProc?3:0)))
using std::string;
using std::vector;
......@@ -489,7 +489,7 @@ avtSILRestriction::EnsureRestrictionCorrectness(int setId)
// Set the state based the results of the children.
useSet[setId] = retval;
}
return retval;
}
......@@ -715,6 +715,11 @@ avtSILRestriction::Intersect(avtSILRestriction_p silr)
// Programmer: Hank Childs
// Creation: December 4, 2002
//
// Modifications:
//
// Hank Childs, Fri Nov 14 08:13:58 PST 2003
// Account for AllUsedOnOtherProc designation.
//
// ****************************************************************************
void
......@@ -731,14 +736,16 @@ avtSILRestriction::FastIntersect(avtSILRestriction_p silr)
// determine most values. We then call EnsureRestrictionCorrectness to
// figure out the cases that we're not sure about.
//
SetState states[] = {NoneUsed, NoneUsed, NoneUsed,
NoneUsed, SomeUsed, SomeUsed,
NoneUsed, SomeUsed, AllUsed};
SetState states[] = {NoneUsed, NoneUsed, NoneUsed, NoneUsed,
NoneUsed, SomeUsed, SomeUsed, AllUsedOtherProc,
NoneUsed, SomeUsed, AllUsed, AllUsedOtherProc,
NoneUsed, AllUsedOtherProc, AllUsedOtherProc,
AllUsedOtherProc };
const int nsets = useSet.size();
for (int i = 0 ; i < nsets ; i++)
{
int index = (STATE_INDEX(useSet[i]) * 3) +
int index = (STATE_INDEX(useSet[i]) * 4) +
STATE_INDEX(silr->useSet[i]);
useSet[i] = states[index];
}
......@@ -767,6 +774,9 @@ avtSILRestriction::FastIntersect(avtSILRestriction_p silr)
// Hank Childs, Thu Feb 7 16:19:11 PST 2002
// Accounted for new style of suspending correctness inspections.
//
// Hank Childs, Fri Nov 14 08:13:58 PST 2003
// Account for AllUsedOnOtherProc designation.
//
// ****************************************************************************
void
......@@ -783,13 +793,15 @@ avtSILRestriction::Union(avtSILRestriction_p silr)
// determine most values. We then call EnsureRestrictionCorrectness to
// figure out the cases that we're not sure about.
//
SetState states[] = {SomeUsed, SomeUsed, AllUsed,
SomeUsed, NoneUsed, AllUsed,
AllUsed, AllUsed, AllUsed};
SetState states[] = {NoneUsed, SomeUsed, AllUsed, AllUsedOtherProc,
SomeUsed, SomeUsed, AllUsed, SomeUsed /* ? */,
AllUsed, AllUsed, AllUsed, AllUsed,
AllUsedOtherProc, SomeUsed, AllUsed,
AllUsedOtherProc };
for (int i = 0 ; i < useSet.size() ; i++)
{
int index = (STATE_INDEX(useSet[i]) * 3) +
int index = (STATE_INDEX(useSet[i]) * 4) +
STATE_INDEX(silr->useSet[i]);
useSet[i] = states[index];
}
......@@ -871,6 +883,9 @@ avtSILRestriction::RestrictDomainsForLoadBalance(const vector<int> &domains)
// Mark C. Miller, Wed Oct 15 16:24:13 PDT 2003
// Made private, added bool for special behavior if for load balancing
//
// Hank Childs, Thu Nov 13 16:52:23 PST 2003
// Pass 'forLoadBalance' argument on to SIL matrix 'TurnSet' call.
//
// ****************************************************************************
void
......@@ -962,7 +977,7 @@ avtSILRestriction::RestrictDomains(const vector<int> &domains,
{
if (forLoadBalance)
{
if (useSet[setsToTurnOff[j]] == AllUsed)
if (useSet[setsToTurnOff[j]] != NoneUsed)
useSet[setsToTurnOff[j]] = AllUsedOtherProc;
else
useSet[setsToTurnOff[j]] = NoneUsed;
......@@ -989,7 +1004,8 @@ avtSILRestriction::RestrictDomains(const vector<int> &domains,
avtSILMatrix_p mat;
int newCollIndex = 0;
TranslateCollectionInfo(mapsOut[k], mat, newCollIndex);
mat->TurnSet(useSet, newCollIndex, NoneUsed);
mat->TurnSet(useSet, newCollIndex, NoneUsed,
forLoadBalance);
}
}
}
......
......@@ -9,6 +9,7 @@
#include <avtTransparencyActor.h>
#include <NoInputException.h>
#include <ColorAttribute.h>
// ****************************************************************************
......@@ -762,3 +763,32 @@ avtActor::SetImmediateModeRendering(bool val)
}
}
// ****************************************************************************
// Method: avtActor::SetSpecularProperties
//
// Purpose:
// Tells the drawable to set its specular properties.
//
// Arguments:
// coeff : the new specular coefficient
// power : the new specular power
// color : the new specular color
//
// Programmer: Jeremy Meredith
// Creation: November 14, 2003
//
// ****************************************************************************
void
avtActor::SetSpecularProperties(bool flag, float coeff, float power,
const ColorAttribute &color)
{
if (*(drawable) != NULL)
{
if (GetWindowMode() == WINMODE_3D)
drawable->SetSpecularProperties(flag,coeff,power,color);
else
drawable->SetSpecularProperties(false,0,0,ColorAttribute(0,0,0));
}
}
......@@ -67,6 +67,9 @@ class avtTransparencyActor;
// Kathleen Bonnell, Mon Sep 29 13:44:01 PDT 2003
// Added bool arg to GetRenderOrder.
//
// Jeremy Meredith, Fri Nov 14 11:10:53 PST 2003
// Added a method to set the specular properties.
//
// ****************************************************************************
class PLOTTER_API avtActor
......@@ -108,6 +111,9 @@ class PLOTTER_API avtActor
void SetSurfaceRepresentation(int rep);
void SetImmediateModeRendering(bool val);
void SetSpecularProperties(bool,float,float,
const ColorAttribute&);
avtDataObject_p GetDataObject(void);
protected:
......
......@@ -13,7 +13,7 @@
class vtkRenderer;
class ColorAttribute;
class avtExternallyRenderedImagesActor;
class avtTransparencyActor;
......@@ -53,6 +53,9 @@ class avtTransparencyActor;
// Added a method to support changing surface representations. I added
// another method to set the drawable's immediate rendering mode.
//
// Jeremy Meredith, Fri Nov 14 11:10:53 PST 2003
// Added a method to set the specular properties.
//
// ****************************************************************************
class PLOTTER_API avtDrawable
......@@ -83,6 +86,9 @@ class PLOTTER_API avtDrawable
virtual void SetSurfaceRepresentation(int rep) {;};
virtual void SetImmediateModeRendering(bool val) {;};
virtual void SetSpecularProperties(bool,float,float,
const ColorAttribute&) {;}
virtual avtDataObject_p GetDataObject(void) = 0;
};
......
......@@ -12,6 +12,8 @@
#include <avtMapper.h>
#include <avtTransparencyActor.h>
#include <ColorAttribute.h>
#include <ImproperUseException.h>
......@@ -526,6 +528,49 @@ avtGeometryDrawable::SetSurfaceRepresentation(int rep)
}
}
// ****************************************************************************
// Method: avtGeometryDrawable::SetSpecularProperties
//
// Purpose:
// Sets the drawable's surface representation.
//
// Arguments:
// flag : true to enable specular, false otherwise
// coeff : the new specular coefficient
// power : the new specular power
// color : the new specular color
//
// Programmer: Jeremy Meredith
// Creation: November 14, 2003
//
// Modifications:
//
// ****************************************************************************
void
avtGeometryDrawable::SetSpecularProperties(bool flag, float coeff, float power,
const ColorAttribute &color)
{
for (int i = 0 ; i < nActors ; i++)
{
if (actors[i] != NULL)
{
vtkProperty *prop = actors[i]->GetProperty();
if(prop != NULL)
{
prop->SetSpecular(flag ? coeff : 0);
prop->SetSpecularPower(power);
int r = color.Red();
int g = color.Green();
int b = color.Blue();
prop->SetSpecularColor(float(r)/255.,
float(g)/255.,
float(b)/255.);
}
}
}
}
// ****************************************************************************
// Method: avtGeometryDrawable::SetImmediateModeRendering
//
......
......@@ -15,6 +15,7 @@ class vtkDataObjectCollection;
class avtMapper;
class ColorAttribute;
// ****************************************************************************
// Class: avtGeometryDrawable
......@@ -50,6 +51,9 @@ class avtMapper;
// Added a method to set the surface representation. I added another method
// for setting the drawable's immediate mode rendering flag.
//
// Jeremy Meredith, Fri Nov 14 11:10:53 PST 2003
// Added a method to set the specular properties.
//
// ****************************************************************************
class PLOTTER_API avtGeometryDrawable : public avtDrawable
......@@ -82,6 +86,9 @@ class PLOTTER_API avtGeometryDrawable : public avtDrawable
virtual void SetSurfaceRepresentation(int rep);
virtual void SetImmediateModeRendering(bool val);
virtual void SetSpecularProperties(bool,float,float,
const ColorAttribute&);
virtual avtDataObject_p GetDataObject(void);
protected:
......
......@@ -12,7 +12,7 @@
#include <avtActor.h>
class VisWindowColleagueProxy;
class ColorAttribute;
// ****************************************************************************
// Class: VisWinColleague
......@@ -58,6 +58,9 @@ class VisWindowColleagueProxy;
// Kathleen Bonnell, Fri Jun 6 08:57:33 PDT 2003
// Added virtual methods FullFrameOn, FullFrameOff.
//
// Jeremy Meredith, Fri Nov 14 17:13:53 PST 2003
// Added specular properties.
//
// ****************************************************************************
class VISWINDOW_API VisWinColleague
......@@ -95,6 +98,9 @@ class VISWINDOW_API VisWinColleague
virtual void SetSurfaceRepresentation(int) {;};
virtual void SetImmediateModeRendering(bool) {;};
virtual void SetSpecularProperties(bool,float,float,
const ColorAttribute&) {;};
virtual void UpdateView(void) {;};
virtual void UpdatePlotList(std::vector<avtActor_p> &) {;};
......
......@@ -207,6 +207,9 @@ VisWinPlots::~VisWinPlots()
// Kathleen Bonnell, Mon Sep 29 13:21:12 PDT 2003
// Send the antialiasing flag to OrderPlots method.
//
// Jeremy Meredith, Fri Nov 14 17:56:24 PST 2003
// Added specular properties.
//
// ****************************************************************************
void
......@@ -307,6 +310,21 @@ VisWinPlots::AddPlot(avtActor_p &p)
mediator.UpdatePlotList(plots);
//
// Ensure that the new plot has the right immediate mode rendering flag.
//
if (p->GetWindowMode() == WINMODE_3D)
{
p->SetSpecularProperties(mediator.GetSpecularFlag(),
mediator.GetSpecularCoeff(),
mediator.GetSpecularPower(),
mediator.GetSpecularColor());
}
else
{
p->SetSpecularProperties(false, 0, 0, ColorAttribute());
}
//
// Must do explicit render if we want the changes to show up.
//
......@@ -1549,6 +1567,29 @@ VisWinPlots::SetImmediateModeRendering(bool immediateMode)
}
// ****************************************************************************
// Method: VisWinPlots::SetSpecularProperties
//
// Purpose:
// Set specular properties on actors.
//
// Programmer: Jeremy Meredith
// Creation: November 14, 2003
//
// ****************************************************************************
void
VisWinPlots::SetSpecularProperties(bool flag, float coeff, float power,
const ColorAttribute &color)
{
std::vector< avtActor_p >::iterator it;
for (it = plots.begin() ; it != plots.end() ; it++)
{
(*it)->SetSpecularProperties(flag, coeff,power,color);
}
}
// ****************************************************************************
// Method: VisWinPlots::SetExternalRenderCallback
//
......
......@@ -117,6 +117,9 @@ class avtTransparencyActor;
// Kathleen Bonnell, Mon Sep 29 13:21:12 PDT 2003
// Added bool arg to OrderPlots.
//
// Jeremy Meredith, Fri Nov 14 17:15:21 PST 2003
// Added specular properties.
//
// ****************************************************************************
class VISWINDOW_API VisWinPlots : public VisWinColleague
......@@ -164,6 +167,9 @@ class VISWINDOW_API VisWinPlots : public VisWinColleague
virtual void SetSurfaceRepresentation(int rep);
virtual void SetImmediateModeRendering(bool val);
virtual void SetSpecularProperties(bool,float,float,
const ColorAttribute&);
void SetExternalRenderCallback(
VisCallbackWithDob *cb, void *data);
bool EnableExternalRenderRequests(void);
......
......@@ -79,6 +79,9 @@ bool VisWinRendering::stereoEnabled = false;
// Set scalableThreshold to be default value obtiained from
// RenderingAttributes.
//
// Jeremy Meredith, Fri Nov 14 11:29:05 PST 2003
// Added specular properties.
//
// ****************************************************************************
VisWinRendering::VisWinRendering(VisWindowColleagueProxy &p)
......@@ -95,6 +98,10 @@ VisWinRendering::VisWinRendering(VisWindowColleagueProxy &p)
stereoType = 2;
immediateMode = false;
surfaceRepresentation = 0;
specularFlag = false;
specularCoeff = .6;
specularPower = 10.0;
specularColor = ColorAttribute(255,255,255,255);
renderInfo = 0;
renderInfoData = 0;
notifyForEachRender = false;
......@@ -1245,6 +1252,35 @@ VisWinRendering::SetSurfaceRepresentation(int rep)
surfaceRepresentation = rep;
}
// ****************************************************************************
// Method: VisWinRendering::SetSpecularProperties
//
// Purpose:
// Sets the specular properties for all of the actors in the canvas
// renderer.
//
// Arguments:
// coeff: the new coefficient
// power: the new power
// color: the new color
//
// Programmer: Jeremy Meredith
// Creation: November 14, 2003
//
// Modifications:
//
// ****************************************************************************
void
VisWinRendering::SetSpecularProperties(bool flag, float coeff, float power,
const ColorAttribute &color)
{
specularFlag = flag;
specularCoeff = coeff;
specularPower = power;
specularColor = color;
}
// ****************************************************************************
// Method: VisWinRendering::GetNumTriangles
//
......@@ -1325,13 +1361,14 @@ VisWinRendering::GetNumTriangles() const
bool
VisWinRendering::SetScalableRendering(bool mode)
{ bool oldMode = scalableRendering;
scalableRendering = mode;
if (scalableRendering)
mediator.EnableExternalRenderRequests();
else
mediator.DisableExternalRenderRequests();
return oldMode;
{
bool oldMode = scalableRendering;
scalableRendering = mode;
if (scalableRendering)
mediator.EnableExternalRenderRequests();
else
mediator.DisableExternalRenderRequests();
return oldMode;
}
// ****************************************************************************
......@@ -1353,7 +1390,8 @@ VisWinRendering::SetScalableRendering(bool mode)
int
VisWinRendering::SetScalableThreshold(int threshold)
{ int oldVal = scalableThreshold;
scalableThreshold = threshold;
return oldVal;
{
int oldVal = scalableThreshold;
scalableThreshold = threshold;
return oldVal;
}
......@@ -9,6 +9,7 @@
#include <VisWinColleague.h>
#include <avtImage.h>
#include <ColorAttribute.h>
class vtkInteractorStyle;
......@@ -96,9 +97,12 @@ class VisWindowColleagueProxy;
// Brad Whitlock, Wed May 21 12:03:46 PDT 2003
// I made GetSize be virtual.
//
// Mark C. Miller, 07Jul03
// Mark C. Miller, Mon Jul 7 01:23:45 PDT 2003
// I made GetSize non-virtual and added new virtual GetWindowSize method
//
// Jeremy Meredith, Fri Nov 14 11:27:19 PST 2003
// Allowed specular lighting.
//
// ****************************************************************************
class VISWINDOW_API VisWinRendering : public VisWinColleague
......@@ -170,6 +174,16 @@ class VISWINDOW_API VisWinRendering : public VisWinColleague
virtual void SetSurfaceRepresentation(int rep);
int GetSurfaceRepresentation() const
{ return surfaceRepresentation; };
virtual void SetSpecularProperties(bool,float,float,
const ColorAttribute&);
bool GetSpecularFlag() const
{ return specularFlag; };
float GetSpecularCoeff() const
{ return specularCoeff; };
float GetSpecularPower() const
{ return specularPower; };
const ColorAttribute &GetSpecularColor() const
{ return specularColor; };
int GetNumTriangles() const;
void SetNotifyForEachRender(bool val)
{ notifyForEachRender = val; };
......@@ -199,6 +213,10 @@ class VISWINDOW_API VisWinRendering : public VisWinColleague
int stereoType;
bool immediateMode;
int surfaceRepresentation;
bool specularFlag;
float specularCoeff;
float specularPower;
ColorAttribute specularColor;
void(*renderInfo)(void *);
void *renderInfoData;
bool notifyForEachRender;
......
......@@ -62,6 +62,9 @@
// Eric Brugger, Wed Aug 20 10:03:43 PDT 2003
// Removed GetTypeIsCurve and SetTypeIsCurve.
//
// Jeremy Meredith, Fri Nov 14 13:54:29 PST 2003
// Added specular coefficients.
//
// ****************************************************************************
class VISWINDOW_API VisWindowColleagueProxy : public VisWindowProtectionProxy
......@@ -148,6 +151,18 @@ class VISWINDOW_API VisWindowColleagueProxy : public VisWindowProtectionProxy
bool GetFullFrameMode()
{ return ProxiedGetFullFrameMode(); };
bool GetSpecularFlag()
{ return ProxiedGetSpecularFlag(); };
float GetSpecularCoeff()
{ return ProxiedGetSpecularCoeff(); };