Commit 329eea9e authored by hrchilds's avatar hrchilds

Update from November 2, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@353 18c085ea-50e0-402c-830e-de6fd14e8384
parent 94b1e710
......@@ -233,6 +233,37 @@ avtMatrix::CreateView(const avtVector &from,
return M;
}
void
avtMatrix::MakeRotation(const avtVector &from,
const avtVector &at,
const avtVector &world_up)
{
avtVector new_z = (from - at).normalized();
avtVector new_x = (world_up % new_z).normalized();
avtVector new_y = (new_z % new_x).normalized();
MakeIdentity();
m[0][0] = new_x.x;
m[0][1] = new_y.x;
m[0][2] = new_z.x;
m[1][0] = new_x.y;
m[1][1] = new_y.y;
m[1][2] = new_z.y;
m[2][0] = new_x.z;
m[2][1] = new_y.z;
m[2][2] = new_z.z;
}
avtMatrix
avtMatrix::CreateRotation(const avtVector &from,
const avtVector &at,
const avtVector &world_up)
{
avtMatrix M;
M.MakeRotation(from, at, world_up);
return M;
}
void
avtMatrix::MakeRBT(const avtVector &from,
const avtVector &at,
......
......@@ -25,6 +25,10 @@ class avtVector;
// Added the optional argument lhs (left handed coordinate system) to
// MakeTrackball and CreateTrackball.
//
// Hank Childs, Mon Nov 1 11:17:25 PST 2004
// I added [Make|Create]Rotation, which were originally coded by Jeremy
// Meredith for me to help with shadows (and I am checking in).
//
// ****************************************************************************
class MATH_API avtMatrix
......@@ -59,6 +63,7 @@ class MATH_API avtMatrix
void MakeTranslate(double, double, double);
void MakeTranslate(const avtVector&);
void MakeRBT(const avtVector&, const avtVector&, const avtVector&);
void MakeRotation(const avtVector&, const avtVector&, const avtVector&);
void MakeScale(double,double,double);
void MakeScale(double);
void MakePerspectiveProjection(double,double, double, double);
......@@ -79,6 +84,7 @@ class MATH_API avtMatrix
static avtMatrix CreateTranslate(double, double, double);
static avtMatrix CreateTranslate(const avtVector&);
static avtMatrix CreateRBT(const avtVector&, const avtVector&, const avtVector&);
static avtMatrix CreateRotation(const avtVector&, const avtVector&, const avtVector&);
static avtMatrix CreateScale(double,double,double);
static avtMatrix CreateScale(double);
static avtMatrix CreatePerspectiveProjection(double,double, double, double);
......
......@@ -1392,6 +1392,9 @@ avtDataAttributes::GetVariableDimension(const char *varname) const
// Kathleen Bonnell, Wed Mar 31 08:03:47 PST 2004
// Added a reason to the exception.
//
// Hank Childs, Fri Oct 22 13:57:58 PDT 2004
// Make sure varname is non-NULL, or we'll crash.
//
// ****************************************************************************
void
......@@ -1404,8 +1407,10 @@ avtDataAttributes::SetCentering(avtCentering cen, const char *varname)
// We were asked to set the variable dimension of a non-existent
// variable.
//
const char *varname_to_print = (varname != NULL ? varname
: "<null>");
string reason = "Attempting to set centering of non-existent";
reason = reason + " variable: " + varname + ".\n";
reason = reason + " variable: " + varname_to_print + ".\n";
EXCEPTION1(ImproperUseException, reason);
}
......@@ -1426,6 +1431,9 @@ avtDataAttributes::SetCentering(avtCentering cen, const char *varname)
// Kathleen Bonnell, Wed Mar 31 08:03:47 PST 2004
// Added a reason to the exception.
//
// Hank Childs, Fri Oct 22 13:57:58 PDT 2004
// Make sure varname is non-NULL, or we'll crash.
//
// ****************************************************************************
avtCentering
......@@ -1438,8 +1446,10 @@ avtDataAttributes::GetCentering(const char *varname) const
// We were asked to set the variable dimension of a non-existent
// variable.
//
const char *varname_to_print = (varname != NULL ? varname
: "<null>");
string reason = "Attempting to retrieve centering of non-existent";
reason = reason + " variable: " + varname + ".\n";
reason = reason + " variable: " + varname_to_print + ".\n";
EXCEPTION1(ImproperUseException, reason);
}
......@@ -2215,6 +2225,9 @@ avtDataAttributes::GetLabels(vector<string> &l)
// Kathleen Bonnell, Wed Mar 31 08:03:47 PST 2004
// Added a reason to the exception.
//
// Hank Childs, Fri Oct 22 13:57:58 PDT 2004
// Make sure varname is non-NULL, or we'll crash.
//
// ****************************************************************************
bool
......@@ -2227,8 +2240,10 @@ avtDataAttributes::GetCurrentDataExtents(double *buff, const char *varname)
// We were asked to set the variable dimension of a non-existent
// variable.
//
const char *varname_to_print = (varname != NULL ? varname
: "<null>");
string reason = "Attempting to retrieve data extents of non-existent";
reason = reason + " variable: " + varname + ".\n";
reason = reason + " variable: " + varname_to_print + ".\n";
EXCEPTION1(ImproperUseException, reason);
}
......
......@@ -79,6 +79,9 @@
// Mark C. Miller, Mon Aug 23 20:24:31 PDT 2004
// Added cellCountMultiplierForSRThreshold
//
// Kathleen Bonnell, Tue Nov 2 10:18:16 PST 2004
// Initialize meshType.
//
// ****************************************************************************
avtPlot::avtPlot()
......@@ -98,6 +101,7 @@ avtPlot::avtPlot()
index = -1;
intermediateDataObject = NULL;
cellCountMultiplierForSRThreshold = 0.0; // an invalid value
meshType = AVT_UNKNOWN_MESH;
}
......@@ -1165,3 +1169,27 @@ avtPlot::GetCellCountMultiplierForSRThreshold() const
return cellCountMultiplierForSRThreshold;
}
// ****************************************************************************
// Method: avtPlot::SetMeshType
//
// Purpose:
// Sets the mesh type for the plot.
//
// Arguments:
// mt The mesh type of the plot.
//
// Programmer: Kathleen Bonnell
// Creation: November 2, 2004
//
// Modifications:
//
// ****************************************************************************
void
avtPlot::SetMeshType(const avtMeshType mt)
{
meshType = mt;
}
......@@ -152,6 +152,10 @@ class AttributeSubject;
// Kathleen Bonnell, Tue Aug 24 16:12:03 PDT 2004
// Added avtMeshType arg to SetOpaqueMeshIsAppropriate.
//
// Kathleen Bonnell, Tue Nov 2 10:18:16 PST 2004
// Added meshType as a member of this class, removed MeshType arg from
// SetOpaqueMeshIsAppropriate.
//
// ****************************************************************************
class PLOTTER_API avtPlot
......@@ -183,6 +187,7 @@ class PLOTTER_API avtPlot
void SetVarName(const char *name);
void SetVarUnits(const char *units);
void SetMeshType(const avtMeshType);
bool NeedsRecalculation(void);
......@@ -204,7 +209,7 @@ class PLOTTER_API avtPlot
virtual avtMapper *GetMapper(void) = 0;
virtual bool CanCacheWriterExternally(void) { return true; }
virtual const AttributeSubject
*SetOpaqueMeshIsAppropriate(bool, avtMeshType)
*SetOpaqueMeshIsAppropriate(bool)
{ return NULL; };
float GetCellCountMultiplierForSRThreshold() const;
......@@ -223,6 +228,7 @@ class PLOTTER_API avtPlot
avtSILRestriction_p silr;
char *varname;
char *varunits;
avtMeshType meshType;
vector<double> dataExtents;
float cellCountMultiplierForSRThreshold;
......
......@@ -94,13 +94,48 @@ avtPointGlyphMapper::~avtPointGlyphMapper()
// Creation: August 19, 2004
//
// Modifications:
// Kathleen Bonnell, Tue Nov 2 10:18:16 PST 2004
// avtVariableMapper::CustomizeMappers assumes a valid scalar variable
// for determining data extents, so don't call it when we aren't coloring
// by a scalar. Copied non-data-extents related code from parent class
// to here.
//
// ****************************************************************************
void
avtPointGlyphMapper::CustomizeMappers(void)
{
avtVariableMapper::CustomizeMappers();
if (colorByScalar)
{
avtVariableMapper::CustomizeMappers();
}
else
{
if (lighting)
{
TurnLightingOn();
}
else
{
TurnLightingOff();
}
SetOpacity(opacity);
for (int i = 0; i < nMappers; i++)
{
if (mappers[i] != NULL)
{
mappers[i]->SetLookupTable(lut);
}
if (actors[i] != NULL)
{
vtkProperty *prop = actors[i]->GetProperty();
prop->SetLineStipplePattern(LineStyle2StipplePattern(lineStyle));
prop->SetLineWidth(LineWidth2Int(lineWidth));
}
}
}
if (glyphFilter != NULL)
{
......@@ -732,10 +767,14 @@ avtPointGlyphMapper::ColorByScalarOn(const string &sn)
// Programmer: Kathleen Bonnell
// Creation: August 19, 2004
//
// Modifications:
// Kathleen Bonnell, Tue Nov 2 10:18:16 PST 2004
// Change argument type from unsigned char to float.
//
// ****************************************************************************
void
avtPointGlyphMapper::ColorByScalarOff(const unsigned char col[3])
avtPointGlyphMapper::ColorByScalarOff(const float col[3])
{
glyphColor[0] = col[0];
glyphColor[1] = col[1];
......@@ -749,10 +788,7 @@ avtPointGlyphMapper::ColorByScalarOff(const unsigned char col[3])
if (actors[i] != NULL)
{
vtkProperty *prop = actors[i]->GetProperty();
float r = ((float) glyphColor[0]) / 255.;
float g = ((float) glyphColor[1]) / 255.;
float b = ((float) glyphColor[2]) / 255.;
prop->SetColor(r, g, b);
prop->SetColor(glyphColor);
}
}
}
......@@ -769,3 +805,53 @@ avtPointGlyphMapper::ColorByScalarOff(const unsigned char col[3])
}
}
// ****************************************************************************
// Method: avtPointGlyphMapper::ColorByScalarOff
//
// Purpose:
// Tells the glyph mapper to color all of the glyphs the same color.
//
// Arguments:
// col The new color.
//
// Programmer: Kathleen Bonnell
// Creation: November 2, 2004
//
// ****************************************************************************
void
avtPointGlyphMapper::ColorByScalarOff(const unsigned char col[3])
{
float fc[3];
fc[0] = (float)col[0] / 255.;
fc[1] = (float)col[1] / 255.;
fc[2] = (float)col[2] / 255.;
ColorByScalarOff(fc);
}
// ****************************************************************************
// Method: avtPointGlyphMapper::ColorByScalarOff
//
// Purpose:
// Tells the glyph mapper to color all of the glyphs the same color.
//
// Arguments:
// col The new color.
//
// Programmer: Kathleen Bonnell
// Creation: November 2, 2004
//
// ****************************************************************************
void
avtPointGlyphMapper::ColorByScalarOff(const double col[3])
{
float fc[3];
fc[0] = (float)col[0];
fc[1] = (float)col[1];
fc[2] = (float)col[2];
ColorByScalarOff(fc);
}
......@@ -25,6 +25,8 @@ class vtkVisItPolyDataNormals;
// Creation: August 19, 2004
//
// Modifications:
// Kathleen Bonnell, Tue Nov 2 10:18:16 PST 2004
// Added more flavors of ColorByScalarOff.
//
// ****************************************************************************
......@@ -41,6 +43,8 @@ class PLOTTER_API avtPointGlyphMapper : public avtVariableMapper
void ColorByScalarOn(const std::string &);
void ColorByScalarOff(const unsigned char [3]);
void ColorByScalarOff(const double [3]);
void ColorByScalarOff(const float [3]);
protected:
vtkPolyData *glyph2D;
......@@ -51,7 +55,7 @@ class PLOTTER_API avtPointGlyphMapper : public avtVariableMapper
int glyphType;
bool dataScaling;
bool colorByScalar;
unsigned char glyphColor[3];
float glyphColor[3];
vtkVisItGlyph3D **glyphFilter;
vtkVisItPolyDataNormals **normalsFilter;
......
......@@ -10,6 +10,7 @@
#include <LightAttributes.h>
#include <avtMatrix.h>
#include <avtViewInfo.h>
#include <avtView3D.h>
......@@ -262,6 +263,11 @@ static float CalculateShadow_Soft(int l_width, int l_height,
// Programmer: Hank Childs
// Creation: October 24, 2004
//
// Modifications:
//
// Hank Childs, Mon Nov 1 11:17:25 PST 2004
// Make use of new avtMatrix functions to calculate correct camera lights.
//
// ****************************************************************************
bool
......@@ -277,23 +283,28 @@ avtSoftwareShader::GetLightDirection(const LightAttributes &la,
}
else if (la.GetType() == LightAttributes::Camera)
{
light_dir[0] = la.GetDirection()[0];
light_dir[1] = la.GetDirection()[1];
light_dir[2] = la.GetDirection()[2];
vtkCamera *cam = vtkCamera::New();
avtViewInfo ccvi;
cur_view.SetViewInfoFromView(ccvi);
ccvi.SetCameraFromView(cam);
vtkMatrix4x4 *lt = cam->GetCameraLightTransformMatrix();
vtkLight *light = vtkLight::New();
light->SetTransformMatrix(lt);
float ld[3];
ld[0] = la.GetDirection()[0];
ld[1] = la.GetDirection()[1];
ld[2] = la.GetDirection()[2];
light->SetPosition(ld);
light->GetTransformedPosition(ld);
light_dir[0] = -ld[0];
light_dir[1] = -ld[1];
light_dir[2] = -ld[2];
light->Delete();
float pos[3];
cam->GetPosition(pos);
float focus[3];
cam->GetFocalPoint(focus);
float up[3];
cam->GetViewUp(up);
avtMatrix mat;
mat.MakeRotation(pos, focus, up);
avtVector v = mat * (avtVector(light_dir));
light_dir[0] = -v.x;
light_dir[1] = -v.y;
light_dir[2] = -v.z;
cam->Delete();
}
else
......
......@@ -1142,12 +1142,21 @@ avtSurfaceAndWireframeRenderer::LUTColorsChanged(const bool val)
//
// Modifications:
//
// Hank Childs, Fri Oct 29 10:30:22 PDT 2004
// Do not turn on specular lighting if lighting is off.
//
// ****************************************************************************
void
avtSurfaceAndWireframeRenderer::SetSpecularProperties(bool flag, float coeff,
float power, const ColorAttribute &color)
{
if (ignoreLighting)
{
if (prop != NULL)
prop->SetSpecular(0);
return;
}
if (prop != NULL && (drawSurfaceStrips || drawSurfacePolys ||
prop->GetRepresentation() == VTK_SURFACE))
{
......
......@@ -5464,6 +5464,8 @@ VisWindow::ResumeTranslucentGeometry()
// Creation: October 11, 2004
//
// Modifications:
// Kathleen Bonnell, Tue Nov 2 10:18:16 PST 2004
// Added support for full-frame mode.
//
// ****************************************************************************
......@@ -5481,8 +5483,17 @@ VisWindow::GlyphPick(const float *rp1, const float *rp2, int &dom,
int i, cell = -1;
float *bnds = NULL;
float dir[3];
float r1[3] = {rp1[0], rp1[1], rp1[2]};
float r2[3] = {rp2[0], rp2[1], rp2[2]};
if (GetFullFrameMode())
{
int *size = rendering->GetFirstRenderer()->GetSize();
double scale = view2D.GetScaleFactor(size);
r1[1] /= scale;
r2[1] /= scale;
}
for (i = 0; i < 3; i++)
dir[i] = rp2[i] - rp1[i];
dir[i] = r2[i] - r1[i];
float dummy1[3], dummy2;
vtkActorCollection *actors = GetCanvas()->GetActors();
vtkActor *actor = NULL;
......@@ -5503,8 +5514,7 @@ VisWindow::GlyphPick(const float *rp1, const float *rp2, int &dom,
continue;
}
bnds = ds->GetBounds();
if (vtkBox::IntersectBox(bnds, const_cast<float*>(rp1),
dir, dummy1, dummy2))
if (vtkBox::IntersectBox(bnds, r1, dir, dummy1, dummy2))
{
if (ds->GetNumberOfPoints() == 0)
continue;
......@@ -5517,12 +5527,12 @@ VisWindow::GlyphPick(const float *rp1, const float *rp2, int &dom,
float isect[3] = {0., 0., 0.};
int subId = 0, success = 0;
vtkIdType foundCell;
if (rp1[0] == rp2[0] &&
rp1[1] == rp2[1] &&
rp1[2] == rp2[2])
if (r1[0] == r2[0] &&
r1[1] == r2[1] &&
r1[2] == r2[2])
{ /* WORLD COORD LOCATE */
cellLocator->FindClosestPoint(const_cast<float*>(rp1),
ptLine, foundCell, subId, dist);
cellLocator->FindClosestPoint(r1, ptLine, foundCell,
subId, dist);
if (foundCell >= 0 && dist >= 0)
{
success = 1;
......@@ -5530,9 +5540,7 @@ VisWindow::GlyphPick(const float *rp1, const float *rp2, int &dom,
}
else
{ /* RAY-INTERSECT LOCATE */
success = cellLocator->IntersectWithLine(
const_cast<float*>(rp1),
const_cast<float*>(rp2),
success = cellLocator->IntersectWithLine(r1, r2,
dist, isect, pcoords, subId, foundCell);
}
cellLocator->Delete();
......
......@@ -542,6 +542,10 @@ avtBOVFileFormat::GetVar(int dom, const char *var)
// Hank Childs, Sun May 9 08:43:33 PDT 2004
// Do not assume that we have valid data extents.
//
// Hank Childs, Fri Oct 22 11:52:37 PDT 2004
// Do not throw an exception if the variable name is foreign to us -- it
// is probably an expression.
//
// ****************************************************************************
void *
......@@ -560,7 +564,7 @@ avtBOVFileFormat::GetAuxiliaryData(const char *var, int domain,
{
if (strcmp(var, varname) != 0)
{
EXCEPTION1(InvalidVariableException, var);
return NULL;
}
if (var_brick_min != NULL && var_brick_max != NULL)
{
......
......@@ -2298,6 +2298,9 @@ NetworkManager::StopPickMode(void)
// Kathleen Bonnell, Thu Oct 21 15:55:46 PDT 2004
// Added support for picking on glyphed data.
//
// Kathleen Bonnell, Tue Nov 2 10:18:16 PST 2004
// Enusure that GlyphPick is sending the correct domain to Pick query.
//
// ****************************************************************************
void
......@@ -2336,6 +2339,7 @@ NetworkManager::Pick(const int id, PickAttributes *pa)
EXCEPTION0(NoInputException);
}
avtDataAttributes &queryInputAtts = queryInput->GetInfo().GetAttributes();
if (pa->GetRequiresGlyphPick())
{
if (networkCache[id]->ActorIsNull())
......@@ -2360,7 +2364,7 @@ NetworkManager::Pick(const int id, PickAttributes *pa)
// VisWindow.
//
viswin->GlyphPick(pa->GetRayPoint1(), pa->GetRayPoint2(), d, e, fc, false);
domElFC.push_back(d);
domElFC.push_back(d + queryInputAtts.GetBlockOrigin());
domElFC.push_back(e);
domElFC.push_back((int)fc);
}
......@@ -2385,7 +2389,6 @@ NetworkManager::Pick(const int id, PickAttributes *pa)
}
}
avtDataAttributes &queryInputAtts = queryInput->GetInfo().GetAttributes();
avtDataValidity &queryInputVal = queryInput->GetInfo().GetValidity();
bool skipLocate = queryInputAtts.GetTopologicalDimension() == 1 &&
queryInputAtts.GetSpatialDimension() == 2;
......
......@@ -154,6 +154,9 @@
# Jeremy Meredith, Fri Sep 3 09:47:23 PDT 2004
# Added project operator.
#
# Hank Childs, Tue Nov 2 09:52:49 PST 2004
# Added SubdivideQuads operator.
#
##############################################################################
@SET_MAKE@
......@@ -162,7 +165,8 @@ all: message
for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $@) || exit 1; done
OPTIONAL=Context ConnCompReduce Decimate ExternalSurface \
MetricThreshold RemoveCells Revolve SiloDump SurfCompPrep Tube
MetricThreshold RemoveCells Revolve SiloDump SubdivideQuads \
SurfCompPrep Tube
REQUIRED=Box Clip Cone Cylinder Displace IndexSelect InverseGhostZone \
Isosurface Isovolume Lineout OnionPeel Project Reflect Slice \
......
This diff is collapsed.
#ifndef PY_SUBDIVIDEQUADSATTRIBUTES_H
#define PY_SUBDIVIDEQUADSATTRIBUTES_H
#include <Python.h>
#include <SubdivideQuadsAttributes.h>
//
// Functions exposed to the VisIt module.
//
void PySubdivideQuadsAttributes_StartUp(SubdivideQuadsAttributes *subj, FILE *logFile);
void PySubdivideQuadsAttributes_CloseDown();
PyMethodDef *PySubdivideQuadsAttributes_GetMethodTable(int *nMethods);
bool PySubdivideQuadsAttributes_Check(PyObject *obj);
SubdivideQuadsAttributes *PySubdivideQuadsAttributes_FromPyObject(PyObject *obj);
PyObject *PySubdivideQuadsAttributes_NewPyObject();
PyObject *PySubdivideQuadsAttributes_WrapPyObject(const SubdivideQuadsAttributes *attr);
void PySubdivideQuadsAttributes_SetLogging(bool val);
void PySubdivideQuadsAttributes_SetDefaults(const SubdivideQuadsAttributes *atts);
PyObject *PySubdivideQuadsAttributes_StringRepresentation(const SubdivideQuadsAttributes *atts);
#endif
#include "QvisSubdivideQuadsWindow.h"
#include <SubdivideQuadsAttributes.h>
#include <ViewerProxy.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qvbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <QvisColorTableButton.h>
#include <QvisOpacitySlider.h>
#include <QvisColorButton.h>
#include <QvisLineStyleWidget.h>
#include <QvisLineWidthWidget.h>
#include <stdio.h>
#include <string>
using std::string;
// ****************************************************************************
// Method: QvisSubdivideQuadsWindow::QvisSubdivideQuadsWindow
//
// Purpose:
// Constructor
//
// Programmer: xml2window
// Creation: Tue Nov 2 06:28:41 PDT 2004
//
// Modifications:
//
// ****************************************************************************
QvisSubdivideQuadsWindow::QvisSubdivideQuadsWindow(const int type,
SubdivideQuadsAttributes *subj,
const char *caption,
const char *shortName,
QvisNotepadArea *notepad)
: QvisOperatorWindow(type,subj, caption, shortName, notepad)
{
atts = subj;
}
// ****************************************************************************
// Method: QvisSubdivideQuadsWindow::~QvisSubdivideQuadsWindow
//
// Purpose:
// Destructor
//
// Programmer: xml2window
// Creation: Tue Nov 2 06:28:41 PDT 2004
//
// Modifications:
//
// ****************************************************************************
QvisSubdivideQuadsWindow::~QvisSubdivideQuadsWindow()
{
}
// ****************************************************************************
// Method: QvisSubdivideQuadsWindow::CreateWindowContents
//
// Purpose:
// Creates the widgets for the window.
//
// Programmer: xml2window
// Creation: Tue Nov 2 06:28:41 PDT 2004
//
// Modifications:
//
// ****************************************************************************
void
QvisSubdivideQuadsWindow::CreateWindowContents()
{
QGridLayout *mainLayout = new QGridLayout(topLayout, 5,2, 10, "mainLayout");
thresholdLabel = new QLabel("Biggest change allowed in a zone?", central, "thresholdLabel");
mainLayout->addWidget(thresholdLabel,0,0);
threshold = new QLineEdit(central, "threshold");
connect(threshold, SIGNAL(returnPressed()),
this, SLOT(thresholdProcessText()));
mainLayout->addWidget(threshold, 0,1);