Commit 9823b1e5 authored by Ken Martin's avatar Ken Martin
Browse files

Approximate VTK 2.2 release

The VTK 2.2 release tag in CVS was moved file-wise as fixes were made.
Therefore the true history of the 'branch' is gone.  This commit was
manufactured during conversion from CVS to represent the version as a
merge from all the commits whose files have the tag.
......@@ -44,8 +44,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// (major, minor, build).
// .SECTION Caveats
// This file will change frequently to update the VTKVersionID which timestamps
// a particular source release.
// The cxx file for this class will change frequently.
#ifndef __vtkVersion_h
......@@ -58,7 +57,6 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#define VTK_MAJOR_VERSION 2
#define VTK_MINOR_VERSION 2
#define VTK_BUILD_VERSION 2
#define VTK_SOURCE_VERSION "vtk source version $Revision: 1.6 $, $Date: 1998-11-18 15:07:09 $ "
class VTK_EXPORT vtkVersion : public vtkObject {
......@@ -68,13 +66,11 @@ class VTK_EXPORT vtkVersion : public vtkObject {
// Description:
// Return the version of vtk this object is a part of.
// A variety of methods are included. GetVTKVersionID returns a string
// with an identifier which timestamps a particular source tree.
// A variety of methods are included.
static const char *GetVTKVersion() { return VTK_VERSION; };
static int GetVTKMajorVersion() { return VTK_MAJOR_VERSION; };
static int GetVTKMinorVersion() { return VTK_MINOR_VERSION; };
static int GetVTKBuildVersion() { return VTK_BUILD_VERSION; };
static const char *GetVTKSourceVersion() { return VTK_SOURCE_VERSION; };
protected:
......
......@@ -57,10 +57,6 @@ proc TestKit {kit} {
proc TestObject {kit objectClass} {
global DEBUG
if {$objectClass == "vtkIndent" || $objectClass == "vtkTimeStamp"} {
return
}
if {$DEBUG == 1} {puts " ----------------Object: $objectClass"}
# just return if this object is not in the kit
......
......@@ -194,7 +194,6 @@ vtkPolyDataWriter \
vtkProbeFilter \
vtkProgrammableAttributeDataFilter \
vtkProgrammableFilter \
vtkProgrammableGlyphFilter \
vtkProgrammableSource \
vtkProjectedPolyDataRayBounder \
vtkProperty \
......
......@@ -29,10 +29,7 @@ planeActor SetTexture atext
vtkImageViewer view
view SetInput [pnmReader GetOutput]
view SetColorWindow 255
view SetColorLevel 127.5
view Render
view Render;
# Add the actors to the renderer, set the background and size
ren1 AddActor planeActor
......
This diff is collapsed.
......@@ -339,24 +339,6 @@ private:
vtkVertexArray *V;
vtkTriArray *T;
// Use to be static variables used by object
vtkPolyData *Mesh; //operate on this data structure
float Pt[3]; //least squares plane point
float Normal[3]; //least squares plane normal
float LoopArea; //the total area of all triangles in a loop
float CosAngle; //Cosine of dihedral angle
float Tolerance; //Intersection tolerance
float X[3]; //coordinates of current point
int NumCollapses; //Number of times edge collapses occur
int NumMerges; //Number of times vertex merges occur
int Split; //Controls whether and when vertex splitting occurs
int VertexDegree; //Maximum number of triangles that can use a vertex
int NumberOfRemainingTris; //Number of triangles left in the mesh
float TheSplitAngle; //Split angle
int SplitState; //State of the splitting process
float Error; //Maximum allowable surface error
};
#endif
......
......@@ -215,12 +215,6 @@ void vtkGlyph3D::Execute()
for (ptIncr=0, inPtId=0; inPtId < numPts; inPtId++, ptIncr += numSourcePts)
{
if ( ! (inPtId % 10000) )
{
this->UpdateProgress ((float)inPtId/numPts);
if (this->GetAbortExecute()) break;
}
// Get the scalar and vector data
if ( inScalars )
{
......
......@@ -184,7 +184,14 @@ void vtkOpenGLCamera::Render(vtkRenderer *ren)
if ((ren->GetRenderWindow())->GetErase())
{
ren->Clear();
glClearColor( ((GLclampf)(bg_color[0])),
((GLclampf)(bg_color[1])),
((GLclampf)(bg_color[2])),
((GLclampf)(1.0)) );
glClearDepth( (GLclampd)( 1.0 ) );
vtkDebugMacro(<< "glClear\n");
glClear((GLbitfield)(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
}
// if we have a stereo renderer, draw other eye next time
......
......@@ -1985,14 +1985,26 @@ void vtkOpenGLPolyDataMapper::Draw(vtkRenderer *aren, vtkActor *act)
// do verts
aPrim = prims[0];
aGlFunction = glFunction[0];
// For verts or lines that have no normals, disable shading.
// This will fall back on the color set in the glColor4fv()
// call in vtkOpenGLProperty::Render() - the color returned
// by vtkProperty::GetColor() with alpha set to 1.0.
if (!n)
{
glDisable( GL_LIGHTING);
if (!c)
{
float *bg_color;
// if a line is being drawn without normals and with the
// ambient intensity set to zero, then lets pretend that
// the ambient intensity is 1.0 because otherwise the line
// would either not show up or be screwed up
// get the color from the property and set it
bg_color = prop->GetColor();
fclr[0] = bg_color[0];
fclr[1] = bg_color[1];
fclr[2] = bg_color[2];
fclr[3] = tran;
glBegin( GL_POINTS );
glColor4fv(fclr);
glEnd();
}
}
// draw all the elements
......
......@@ -51,7 +51,6 @@ void vtkOpenGLProperty::Render(vtkActor *vtkNotUsed(anActor),
GLenum method;
float Info[4];
GLenum Face;
float color[4];
// unbind any textures for starters
glDisable(GL_TEXTURE_2D);
......@@ -116,15 +115,6 @@ void vtkOpenGLProperty::Render(vtkActor *vtkNotUsed(anActor),
}
glShadeModel(method);
// The material properties set above are used if shading is
// enabled. This color set here is used if shading is
// disabled. Shading is disabled in the
// vtkOpenGLPolyDataMapper::Draw() method if points or lines
// are encountered without normals.
this->GetColor( color );
color[3] = 1.0;
glColor4fv( color );
}
// Implement base class method.
......
......@@ -443,16 +443,3 @@ int vtkOpenGLRenderer::IsInViewport(int x,int y)
return 0;
}
void vtkOpenGLRenderer::Clear(void)
{
glClearColor( ((GLclampf)(this->Background[0])),
((GLclampf)(this->Background[1])),
((GLclampf)(this->Background[2])),
((GLclampf)(1.0)) );
glClearDepth( (GLclampd)( 1.0 ) );
vtkDebugMacro(<< "glClear\n");
glClear((GLbitfield)(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
}
......@@ -69,8 +69,6 @@ public:
// into graphics pipeline.
void ClearLights(void);
void Clear(void);
// Description:
// Ask lights to load themselves into graphics pipeline.
int UpdateLights(void);
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkProgrammableGlyphFilter.cxx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files. This copyright specifically does
not apply to the related textbook "The Visualization Toolkit" ISBN
013199837-4 published by Prentice Hall which is covered by its own copyright.
The authors hereby grant permission to use, copy, and distribute this
software and its documentation for any purpose, provided that existing
copyright notices are retained in all copies and that this notice is included
verbatim in any distributions. Additionally, the authors grant permission to
modify this software and its documentation for any purpose, provided that
such modifications are not distributed without the explicit consent of the
authors and that existing copyright notices are retained in all copies. Some
of the algorithms implemented by this software are patented, observe all
applicable patent law.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
"AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
#include "vtkProgrammableGlyphFilter.h"
#include "vtkTransform.h"
#include "vtkVectors.h"
#include "vtkNormals.h"
#include "vtkMath.h"
// Construct object with scaling on, scaling mode is by scalar value,
// scale factor = 1.0, the range is (0,1), orient geometry is on, and
// orientation is by vector. Clamping and indexing are turned off. No
// initial sources are defined.
vtkProgrammableGlyphFilter::vtkProgrammableGlyphFilter()
{
this->Source = NULL;
this->GlyphMethod = NULL;
this->GlyphMethodArgDelete = NULL;
this->GlyphMethodArg = NULL;
this->Point[0] = this->Point[1] = this->Point[2] = 0.0;
this->PointId = -1;
this->PointData = NULL;
this->ColorMode = VTK_COLOR_BY_INPUT;
}
vtkProgrammableGlyphFilter::~vtkProgrammableGlyphFilter()
{
if ((this->GlyphMethodArg)&&(this->GlyphMethodArgDelete))
{
(*this->GlyphMethodArgDelete)(this->GlyphMethodArg);
}
this->SetSource(NULL);
}
void vtkProgrammableGlyphFilter::Execute()
{
vtkDataSet *input = this->GetInput();
vtkPointData *inputPD = input->GetPointData();
vtkCellData *inputCD = input->GetCellData();
vtkPolyData *output = this->GetOutput();
vtkPointData *outputPD = output->GetPointData();
vtkCellData *outputCD = output->GetCellData();
vtkPoints *newPts, *sourcePts;
vtkScalars *ptScalars=NULL, *cellScalars=NULL;
vtkScalars *inPtScalars, *inCellScalars;
int numPts = input->GetNumberOfPoints();
vtkPointData *sourcePD;
vtkCellData *sourceCD;
int numSourcePts, numSourceCells, ptOffset=0, scalarOffset;
int cellId, ptId, id, i, idx, npts;
vtkIdList *pts=vtkIdList::New();
vtkIdList *cellPts;
pts->Allocate(VTK_CELL_SIZE);
vtkCell *cell;
// Initialize
vtkDebugMacro(<<"Generating programmable glyphs!");
if ( numPts < 1 )
{
vtkErrorMacro(<<"No input points to glyph");
}
sourcePD = this->Source->GetPointData();
sourceCD = this->Source->GetCellData();
numSourcePts = this->Source->GetNumberOfPoints();
numSourceCells = this->Source->GetNumberOfCells();
outputPD->CopyScalarsOff(); //'cause we control the coloring process
outputCD->CopyScalarsOff();
output->Allocate(numSourceCells*numPts,numSourceCells*numPts);
outputPD->CopyAllocate(sourcePD, numSourcePts*numPts, numSourcePts*numPts);
outputCD->CopyAllocate(sourceCD, numSourceCells*numPts, numSourceCells*numPts);
newPts = vtkPoints::New();
newPts->Allocate(numSourcePts*numPts);
// figure out how to color the data and setup
if ( this->ColorMode == VTK_COLOR_BY_INPUT )
{
if ( (inPtScalars = inputPD->GetScalars()) )
{
ptScalars = vtkScalars::New();
ptScalars->Allocate(numSourcePts*numPts);
}
if ( (inCellScalars = inputCD->GetScalars()) )
{
cellScalars = vtkScalars::New();
cellScalars->Allocate(numSourcePts*numPts);
}
}
else // VTK_COLOR_BY_SOURCE
{
if ( (inPtScalars = sourcePD->GetScalars()) )
{
ptScalars = vtkScalars::New();
ptScalars->Allocate(numSourcePts*numPts);
}
if ( (inCellScalars = sourceCD->GetScalars()) )
{
cellScalars = vtkScalars::New();
cellScalars->Allocate(numSourcePts*numPts);
}
}
// Loop over all points, invoking glyph method and Update(), then append output
// of source to output of this filter.
//
this->Updating = 1; // to prevent infinite recursion
this->PointData = input->GetPointData();
for (this->PointId=0; this->PointId < numPts; this->PointId++)
{
if ( ! (this->PointId % 10000) )
{
this->UpdateProgress ((float)this->PointId/numPts);
if (this->GetAbortExecute()) break;
}
input->GetPoint(this->PointId, this->Point);
if ( this->GlyphMethod )
{
(*this->GlyphMethod)(this->GlyphMethodArg);
}
if ( this->Source )
{
this->Source->Update();
sourcePts = this->Source->GetPoints();
numSourcePts = this->Source->GetNumberOfPoints();
numSourceCells = this->Source->GetNumberOfCells();
sourcePD = this->Source->GetPointData();
sourceCD = this->Source->GetCellData();
// Copy all data from source to output.
for (ptId=0; ptId < numSourcePts; ptId++)
{
id = newPts->InsertNextPoint(sourcePts->GetPoint(ptId));
outputPD->CopyData(sourcePD, ptId, id);
}
for (cellId=0; cellId < numSourceCells; cellId++)
{
cell = this->Source->GetCell(cellId);
cellPts = cell->GetPointIds();
npts = cellPts->GetNumberOfIds();
for (pts->Reset(), i=0; i < npts; i++)
{
pts->InsertId(i,cellPts->GetId(i) + ptOffset);
}
id = output->InsertNextCell(cell->GetCellType(),pts);
outputCD->CopyData(sourceCD, cellId, id);
}
// If we're coloring the output with scalars, do that now
if ( ptScalars )
{
for (ptId=0; ptId < numSourcePts; ptId++)
{
idx = (this->ColorMode == VTK_COLOR_BY_INPUT ? this->PointId : ptId);
ptScalars->InsertNextScalar(inPtScalars->GetScalar(idx));
}
}
else if ( cellScalars )
{
for (cellId=0; cellId < numSourceCells; cellId++)
{
idx = (this->ColorMode == VTK_COLOR_BY_INPUT ? this->PointId : cellId);
cellScalars->InsertNextScalar(inCellScalars->GetScalar(idx));
}
}
ptOffset += numSourcePts;
}//if a source is available
} //for all input points
this->Updating = 0;
pts->Delete();
output->SetPoints(newPts);
newPts->Delete();
if ( ptScalars )
{
outputPD->SetScalars(ptScalars);
ptScalars->Delete();
}
if ( cellScalars )
{
outputCD->SetScalars(cellScalars);
cellScalars->Delete();
}
output->Squeeze();
}
// Override update method because execution can branch two ways (via Input
// and Source).
void vtkProgrammableGlyphFilter::Update()
{
// make sure input is available
if ( this->Input == NULL || this->Source == NULL )
{
vtkErrorMacro(<< "No input or source...can't execute!");
return;
}
// prevent chasing our tail
if (this->Updating) return;
this->Updating = 1;
this->Input->Update();
if ( this->Source ) this->Source->Update();
this->Updating = 0;
if (this->Input->GetMTime() > this->ExecuteTime ||
(this->Source && this->Source->GetMTime() > this->ExecuteTime) ||
this->GetMTime() > this->ExecuteTime )
{
if ( this->Input->GetDataReleased() ) this->Input->ForceUpdate();
if ( this->Source && this->Source->GetDataReleased() )
this->Source->ForceUpdate();
if ( this->StartMethod ) (*this->StartMethod)(this->StartMethodArg);
this->Output->Initialize(); //clear output
// reset AbortExecute flag and Progress
this->AbortExecute = 0;
this->Progress = 0.0;
this->Execute();
this->ExecuteTime.Modified();
if ( !this->AbortExecute ) this->UpdateProgress(1.0);
this->SetDataReleased(0);
if ( this->EndMethod ) (*this->EndMethod)(this->EndMethodArg);
}
if ( this->Input->ShouldIReleaseData() ) this->Input->ReleaseData();
if ( this->Source && this->Source->ShouldIReleaseData() )
this->Source->ReleaseData();
}
// Specify function to be called before object executes.
void vtkProgrammableGlyphFilter::SetGlyphMethod(void (*f)(void *), void *arg)
{
if ( f != this->GlyphMethod || arg != this->GlyphMethodArg )
{
// delete the current arg if there is one and a delete meth
if ((this->GlyphMethodArg)&&(this->GlyphMethodArgDelete))
{
(*this->GlyphMethodArgDelete)(this->GlyphMethodArg);
}
this->GlyphMethod = f;
this->GlyphMethodArg = arg;
this->Modified();
}
}
// Set the arg delete method. This is used to free user memory.
void vtkProgrammableGlyphFilter::SetGlyphMethodArgDelete(void (*f)(void *))
{
if ( f != this->GlyphMethodArgDelete)
{
this->GlyphMethodArgDelete = f;
this->Modified();
}
}
// Description:
// Return the method of coloring as a descriptive character string.
char *vtkProgrammableGlyphFilter::GetColorModeAsString(void)
{
if ( this->ColorMode == VTK_COLOR_BY_INPUT )
{
return "ColorByInput";
}
else
{
return "ColorBySource";
}
}
void vtkProgrammableGlyphFilter::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDataSetToPolyDataFilter::PrintSelf(os,indent);
os << indent << "Source: " << (void *)this->Source << "\n";
os << indent << "Color Mode: " << this->GetColorModeAsString() << endl;
os << indent << "Point Id: " << this->PointId << "\n";
os << indent << "Point: " << this->Point[0]
<< ", " << this->Point[1]
<< ", " << this->Point[2] << "\n";
if (this->PointData)
{
os << indent << "PointData: " << this->PointData << "\n";
}
else
{
os << indent << "PointData: (not defined)\n";
}
if ( this->GlyphMethod )
{
os << indent << "Glyph Method defined\n";
}
else
{
os << indent << "No Glyph Method\n";
}
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkProgrammableGlyphFilter.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files. This copyright specifically does
not apply to the related textbook "The Visualization Toolkit" ISBN
013199837-4 published by Prentice Hall which is covered by its own copyright.
The authors hereby grant permission to use, copy, and distribute this
software and its documentation for any purpose, provided that existing
copyright notices are retained in all copies and that this notice is included
verbatim in any distributions. Additionally, the authors grant permission to
modify this software and its documentation for any purpose, provided that
such modifications are not distributed without the explicit consent of the
authors and that existing copyright notices are retained in all copies. Some
of the algorithms implemented by this software are patented, observe all
applicable patent law.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
"AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME vtkProgrammableGlyphFilter - control the generation and placement of glyphs at input points
// .SECTION Description
// vtkProgrammableGlyphFilter is a filter that allows you to place a glyph at
// each input point in the dataset. In addition, the filter is programmable
// which means the user has control over the generation of the glyph. The
// glyphs can be controlled via the point data attributes (e.g., scalars, vectors,