Commit 0e815dd9 authored by hrchilds's avatar hrchilds
Browse files

Update from May 12, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@241 18c085ea-50e0-402c-830e-de6fd14e8384
parent c357aab0
#include <RenderingAttributes.h>
#include <DataNode.h>
const int RenderingAttributes::DEFAULT_SCALABLE_THRESHOLD = 2000000;
const int RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD = 2000000;
const int RenderingAttributes::DEFAULT_SCALABLE_ACTIVATION_MODE = Auto;
//
// Enum conversion methods for RenderingAttributes::GeometryRepresentation
......@@ -80,37 +82,37 @@ RenderingAttributes::StereoTypes_FromString(const std::string &s, RenderingAttri
}
//
// Enum conversion methods for RenderingAttributes::DisplayListMode
// Enum conversion methods for RenderingAttributes::TriStateMode
//
static const char *DisplayListMode_strings[] = {
static const char *TriStateMode_strings[] = {
"Never", "Always", "Auto"
};
std::string
RenderingAttributes::DisplayListMode_ToString(RenderingAttributes::DisplayListMode t)
RenderingAttributes::TriStateMode_ToString(RenderingAttributes::TriStateMode t)
{
int index = int(t);
if(index < 0 || index >= 3) index = 0;
return DisplayListMode_strings[index];
return TriStateMode_strings[index];
}
std::string
RenderingAttributes::DisplayListMode_ToString(int t)
RenderingAttributes::TriStateMode_ToString(int t)
{
int index = (t < 0 || t >= 3) ? 0 : t;
return DisplayListMode_strings[index];
return TriStateMode_strings[index];
}
bool
RenderingAttributes::DisplayListMode_FromString(const std::string &s, RenderingAttributes::DisplayListMode &val)
RenderingAttributes::TriStateMode_FromString(const std::string &s, RenderingAttributes::TriStateMode &val)
{
val = RenderingAttributes::Never;
for(int i = 0; i < 3; ++i)
{
if(s == DisplayListMode_strings[i])
if(s == TriStateMode_strings[i])
{
val = (DisplayListMode)i;
val = (TriStateMode)i;
return true;
}
}
......@@ -126,13 +128,13 @@ RenderingAttributes::DisplayListMode_FromString(const std::string &s, RenderingA
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
// ****************************************************************************
RenderingAttributes::RenderingAttributes() : AttributeSubject("biibibbibffa"),
RenderingAttributes::RenderingAttributes() : AttributeSubject("biibibiibffa"),
specularColor(255, 255, 255)
{
antialiasing = false;
......@@ -141,8 +143,8 @@ RenderingAttributes::RenderingAttributes() : AttributeSubject("biibibbibffa"),
stereoRendering = false;
stereoType = CrystalEyes;
notifyForEachRender = false;
scalableRendering = false;
scalableThreshold = 2000000;
scalableActivationMode = Auto;
scalableAutoThreshold = 2000000;
specularFlag = false;
specularCoeff = 0.6;
specularPower = 10;
......@@ -157,13 +159,13 @@ RenderingAttributes::RenderingAttributes() : AttributeSubject("biibibbibffa"),
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
// ****************************************************************************
RenderingAttributes::RenderingAttributes(const RenderingAttributes &obj) : AttributeSubject("biibibbibffa")
RenderingAttributes::RenderingAttributes(const RenderingAttributes &obj) : AttributeSubject("biibibiibffa")
{
antialiasing = obj.antialiasing;
geometryRepresentation = obj.geometryRepresentation;
......@@ -171,8 +173,8 @@ RenderingAttributes::RenderingAttributes(const RenderingAttributes &obj) : Attri
stereoRendering = obj.stereoRendering;
stereoType = obj.stereoType;
notifyForEachRender = obj.notifyForEachRender;
scalableRendering = obj.scalableRendering;
scalableThreshold = obj.scalableThreshold;
scalableActivationMode = obj.scalableActivationMode;
scalableAutoThreshold = obj.scalableAutoThreshold;
specularFlag = obj.specularFlag;
specularCoeff = obj.specularCoeff;
specularPower = obj.specularPower;
......@@ -190,7 +192,7 @@ RenderingAttributes::RenderingAttributes(const RenderingAttributes &obj) : Attri
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -210,7 +212,7 @@ RenderingAttributes::~RenderingAttributes()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -225,8 +227,8 @@ RenderingAttributes::operator = (const RenderingAttributes &obj)
stereoRendering = obj.stereoRendering;
stereoType = obj.stereoType;
notifyForEachRender = obj.notifyForEachRender;
scalableRendering = obj.scalableRendering;
scalableThreshold = obj.scalableThreshold;
scalableActivationMode = obj.scalableActivationMode;
scalableAutoThreshold = obj.scalableAutoThreshold;
specularFlag = obj.specularFlag;
specularCoeff = obj.specularCoeff;
specularPower = obj.specularPower;
......@@ -244,7 +246,7 @@ RenderingAttributes::operator = (const RenderingAttributes &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -260,8 +262,8 @@ RenderingAttributes::operator == (const RenderingAttributes &obj) const
(stereoRendering == obj.stereoRendering) &&
(stereoType == obj.stereoType) &&
(notifyForEachRender == obj.notifyForEachRender) &&
(scalableRendering == obj.scalableRendering) &&
(scalableThreshold == obj.scalableThreshold) &&
(scalableActivationMode == obj.scalableActivationMode) &&
(scalableAutoThreshold == obj.scalableAutoThreshold) &&
(specularFlag == obj.specularFlag) &&
(specularCoeff == obj.specularCoeff) &&
(specularPower == obj.specularPower) &&
......@@ -277,7 +279,7 @@ RenderingAttributes::operator == (const RenderingAttributes &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -298,7 +300,7 @@ RenderingAttributes::operator != (const RenderingAttributes &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -319,7 +321,7 @@ RenderingAttributes::TypeName() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -347,7 +349,7 @@ RenderingAttributes::CopyAttributes(const AttributeGroup *atts)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -373,7 +375,7 @@ RenderingAttributes::CreateCompatible(const std::string &tname) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -400,7 +402,7 @@ RenderingAttributes::NewInstance(bool copy) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -415,8 +417,8 @@ RenderingAttributes::SelectAll()
Select(3, (void *)&stereoRendering);
Select(4, (void *)&stereoType);
Select(5, (void *)&notifyForEachRender);
Select(6, (void *)&scalableRendering);
Select(7, (void *)&scalableThreshold);
Select(6, (void *)&scalableActivationMode);
Select(7, (void *)&scalableAutoThreshold);
Select(8, (void *)&specularFlag);
Select(9, (void *)&specularCoeff);
Select(10, (void *)&specularPower);
......@@ -436,7 +438,7 @@ RenderingAttributes::SelectAll()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -468,7 +470,7 @@ RenderingAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool fo
if(completeSave || !FieldsEqual(2, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("displayListMode", DisplayListMode_ToString(displayListMode)));
node->AddNode(new DataNode("displayListMode", TriStateMode_ToString(displayListMode)));
}
if(completeSave || !FieldsEqual(3, &defaultObject))
......@@ -492,13 +494,13 @@ RenderingAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool fo
if(completeSave || !FieldsEqual(6, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("scalableRendering", scalableRendering));
node->AddNode(new DataNode("scalableActivationMode", TriStateMode_ToString(scalableActivationMode)));
}
if(completeSave || !FieldsEqual(7, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("scalableThreshold", scalableThreshold));
node->AddNode(new DataNode("scalableAutoThreshold", scalableAutoThreshold));
}
if(completeSave || !FieldsEqual(8, &defaultObject))
......@@ -546,7 +548,7 @@ RenderingAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool fo
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -589,12 +591,12 @@ RenderingAttributes::SetFromNode(DataNode *parentNode)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 3)
SetDisplayListMode(DisplayListMode(ival));
SetDisplayListMode(TriStateMode(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
DisplayListMode value;
if(DisplayListMode_FromString(node->AsString(), value))
TriStateMode value;
if(TriStateMode_FromString(node->AsString(), value))
SetDisplayListMode(value);
}
}
......@@ -618,10 +620,24 @@ RenderingAttributes::SetFromNode(DataNode *parentNode)
}
if((node = searchNode->GetNode("notifyForEachRender")) != 0)
SetNotifyForEachRender(node->AsBool());
if((node = searchNode->GetNode("scalableRendering")) != 0)
SetScalableRendering(node->AsBool());
if((node = searchNode->GetNode("scalableThreshold")) != 0)
SetScalableThreshold(node->AsInt());
if((node = searchNode->GetNode("scalableActivationMode")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 3)
SetScalableActivationMode(TriStateMode(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
TriStateMode value;
if(TriStateMode_FromString(node->AsString(), value))
SetScalableActivationMode(value);
}
}
if((node = searchNode->GetNode("scalableAutoThreshold")) != 0)
SetScalableAutoThreshold(node->AsInt());
if((node = searchNode->GetNode("specularFlag")) != 0)
SetSpecularFlag(node->AsBool());
if((node = searchNode->GetNode("specularCoeff")) != 0)
......@@ -651,7 +667,7 @@ RenderingAttributes::SetGeometryRepresentation(RenderingAttributes::GeometryRepr
}
void
RenderingAttributes::SetDisplayListMode(RenderingAttributes::DisplayListMode displayListMode_)
RenderingAttributes::SetDisplayListMode(RenderingAttributes::TriStateMode displayListMode_)
{
displayListMode = displayListMode_;
Select(2, (void *)&displayListMode);
......@@ -679,17 +695,17 @@ RenderingAttributes::SetNotifyForEachRender(bool notifyForEachRender_)
}
void
RenderingAttributes::SetScalableRendering(bool scalableRendering_)
RenderingAttributes::SetScalableActivationMode(RenderingAttributes::TriStateMode scalableActivationMode_)
{
scalableRendering = scalableRendering_;
Select(6, (void *)&scalableRendering);
scalableActivationMode = scalableActivationMode_;
Select(6, (void *)&scalableActivationMode);
}
void
RenderingAttributes::SetScalableThreshold(int scalableThreshold_)
RenderingAttributes::SetScalableAutoThreshold(int scalableAutoThreshold_)
{
scalableThreshold = scalableThreshold_;
Select(7, (void *)&scalableThreshold);
scalableAutoThreshold = scalableAutoThreshold_;
Select(7, (void *)&scalableAutoThreshold);
}
void
......@@ -736,10 +752,10 @@ RenderingAttributes::GetGeometryRepresentation() const
return GeometryRepresentation(geometryRepresentation);
}
RenderingAttributes::DisplayListMode
RenderingAttributes::TriStateMode
RenderingAttributes::GetDisplayListMode() const
{
return DisplayListMode(displayListMode);
return TriStateMode(displayListMode);
}
bool
......@@ -760,16 +776,16 @@ RenderingAttributes::GetNotifyForEachRender() const
return notifyForEachRender;
}
bool
RenderingAttributes::GetScalableRendering() const
RenderingAttributes::TriStateMode
RenderingAttributes::GetScalableActivationMode() const
{
return scalableRendering;
return TriStateMode(scalableActivationMode);
}
int
RenderingAttributes::GetScalableThreshold() const
RenderingAttributes::GetScalableAutoThreshold() const
{
return scalableThreshold;
return scalableAutoThreshold;
}
bool
......@@ -825,7 +841,7 @@ RenderingAttributes::SelectSpecularColor()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -842,8 +858,8 @@ RenderingAttributes::GetFieldName(int index) const
case 3: return "stereoRendering";
case 4: return "stereoType";
case 5: return "notifyForEachRender";
case 6: return "scalableRendering";
case 7: return "scalableThreshold";
case 6: return "scalableActivationMode";
case 7: return "scalableAutoThreshold";
case 8: return "specularFlag";
case 9: return "specularCoeff";
case 10: return "specularPower";
......@@ -861,7 +877,7 @@ RenderingAttributes::GetFieldName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -878,7 +894,7 @@ RenderingAttributes::GetFieldType(int index) const
case 3: return FieldType_bool;
case 4: return FieldType_enum;
case 5: return FieldType_bool;
case 6: return FieldType_bool;
case 6: return FieldType_enum;
case 7: return FieldType_int;
case 8: return FieldType_bool;
case 9: return FieldType_float;
......@@ -897,7 +913,7 @@ RenderingAttributes::GetFieldType(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -914,7 +930,7 @@ RenderingAttributes::GetFieldTypeName(int index) const
case 3: return "bool";
case 4: return "enum";
case 5: return "bool";
case 6: return "bool";
case 6: return "enum";
case 7: return "int";
case 8: return "bool";
case 9: return "float";
......@@ -933,7 +949,7 @@ RenderingAttributes::GetFieldTypeName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -978,12 +994,12 @@ RenderingAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
break;
case 6:
{ // new scope
retval = (scalableRendering == obj.scalableRendering);
retval = (scalableActivationMode == obj.scalableActivationMode);
}
break;
case 7:
{ // new scope
retval = (scalableThreshold == obj.scalableThreshold);
retval = (scalableAutoThreshold == obj.scalableAutoThreshold);
}
break;
case 8:
......@@ -1016,3 +1032,15 @@ RenderingAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////
int RenderingAttributes::GetEffectiveScalableThreshold(TriStateMode mode, int autoThreshold)
{
if (mode == Never)
return INT_MAX;
else if (mode == Always)
return 0;
else if (mode == Auto)
return autoThreshold;
else
return -1;
}
Constant: DEFAULT_SCALABLE_THRESHOLD
Declaration: static const int DEFAULT_SCALABLE_THRESHOLD;
Definition: const int RenderingAttributes::DEFAULT_SCALABLE_THRESHOLD = 2000000;
Constant: DEFAULT_SCALABLE_AUTO_THRESHOLD
Declaration: static const int DEFAULT_SCALABLE_AUTO_THRESHOLD;
Definition: const int RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD = 2000000;
Constant: DEFAULT_SCALABLE_ACTIVATION_MODE
Declaration: static const int DEFAULT_SCALABLE_ACTIVATION_MODE;
Definition: const int RenderingAttributes::DEFAULT_SCALABLE_ACTIVATION_MODE = Auto;
Function: GetEffectiveScalableThreshold
Declaration: static int GetEffectiveScalableThreshold(TriStateMode mode, int autoThreshold);
Definition:
int RenderingAttributes::GetEffectiveScalableThreshold(TriStateMode mode, int autoThreshold)
{
if (mode == Never)
return INT_MAX;
else if (mode == Always)
return 0;
else if (mode == Auto)
return autoThreshold;
else
return -1;
}
Constant: ModeToThreshold
Declaration: static int ModeToThreshold[3];
Definition: int RenderingAttributes::ModeToThreshold[3] = {DEFAULT_SCALABLE_THRESHOLD, 0, (1<<30)};
......@@ -4,6 +4,7 @@
#include <string>
#include <AttributeSubject.h>
#include <ColorAttribute.h>
#include <float.h>
// ****************************************************************************
// Class: RenderingAttributes
......@@ -14,7 +15,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Sun May 9 16:06:31 PST 2004
// Creation: Wed May 12 07:29:22 PDT 2004
//
// Modifications:
//
......@@ -35,13 +36,14 @@ public:
Interlaced,
CrystalEyes
};
enum DisplayListMode
enum TriStateMode
{
Never,
Always,
Auto
};
static const int DEFAULT_SCALABLE_THRESHOLD;
static const int DEFAULT_SCALABLE_AUTO_THRESHOLD;
static const int DEFAULT_SCALABLE_ACTIVATION_MODE;
RenderingAttributes();
RenderingAttributes(const RenderingAttributes &obj);
......@@ -63,12 +65,12 @@ public:
// Property setting methods
void SetAntialiasing(bool antialiasing_);
void SetGeometryRepresentation(GeometryRepresentation geometryRepresentation_);
void SetDisplayListMode(DisplayListMode displayListMode_);
void SetDisplayListMode(TriStateMode displayListMode_);
void SetStereoRendering(bool stereoRendering_);
void SetStereoType(StereoTypes stereoType_);
void SetNotifyForEachRender(bool notifyForEachRender_);
void SetScalableRendering(bool scalableRendering_);
void SetScalableThreshold(int scalableThreshold_);
void SetScalableActivationMode(TriStateMode scalableActivationMode_);
void SetScalableAutoThreshold(int scalableAutoThreshold_);
void SetSpecularFlag(bool specularFlag_);
void SetSpecularCoeff(float specularCoeff_);
void SetSpecularPower(float specularPower_);
......@@ -77,12 +79,12 @@ public:
// Property getting methods
bool GetAntialiasing() const;
GeometryRepresentation GetGeometryRepresentation() const;
DisplayListMode GetDisplayListMode() const;
TriStateMode GetDisplayListMode() const;
bool GetStereoRendering() const;
StereoTypes GetStereoType() const;
bool GetNotifyForEachRender() const;
bool GetScalableRendering() const;
int GetScalableThreshold() const;
TriStateMode GetScalableActivationMode() const;
int GetScalableAutoThreshold() const;
bool GetSpecularFlag() const;
float GetSpecularCoeff() const;
float GetSpecularPower() const;
......@@ -104,10 +106,10 @@ public:
protected:
static std::string StereoTypes_ToString(int);
public:
static std::string DisplayListMode_ToString(DisplayListMode);
static bool DisplayListMode_FromString(const std::string &, DisplayListMode &);
static std::string TriStateMode_ToString(TriStateMode);
static bool TriStateMode_FromString(const std::string &, TriStateMode &);
protected:
static std::string DisplayListMode_ToString(int);
static std::string TriStateMode_ToString(int);
public:
// Keyframing methods
......@@ -116,6 +118,8 @@ public:
virtual std::string GetFieldTypeName(int index) const;
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
// User-defined methods
static int GetEffectiveScalableThreshold(TriStateMode mode, int autoThreshold);
private:
bool antialiasing;
int geometryRepresentation;
......@@ -123,8 +127,8 @@ private:
bool stereoRendering;
int stereoType;
bool notifyForEachRender;
bool scalableRendering;
int scalableThreshold;
int scalableActivationMode;
int scalableAutoThreshold;
bool specularFlag;
float specularCoeff;
float specularPower;
......
......@@ -10,7 +10,7 @@
Interlaced
CrystalEyes
</Enum>
<Enum name="DisplayListMode">
<Enum name="TriStateMode">
Never
Always
Auto
......@@ -21,7 +21,7 @@
<Field name="geometryRepresentation" label="geometryRepresentation" type="enum" subtype="GeometryRepresentation">
Surfaces
</Field>
<Field name="displayListMode" label="displayListMode" type="enum" subtype="DisplayListMode">
<Field name="displayListMode" label="displayListMode" type="enum" subtype="TriStateMode">
Auto
</Field>
<Field name="stereoRendering" label="stereoRendering" type="bool">
......@@ -33,10 +33,10 @@
<Field name="notifyForEachRender" label="notifyForEachRender" type="bool">
false
</Field>
<Field name="scalableRendering" label="scalableRendering" type="bool">
false
<Field name="scalableActivationMode" label="scalableActivationMode" type="enum" subtype="TriStateMode">
Auto
</Field>
<Field name="scalableThreshold" label="scalableThreshold" type="int">
<Field name="scalableAutoThreshold" label="scalableAutoThreshold" type="int">
2000000