Commit 09289849 authored by Ken Martin's avatar Ken Martin
Browse files

Added Copyright and print methods

parent 345ad2aa
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Actor.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#ifndef __vlActor_hh
......@@ -47,6 +47,7 @@ class vlActor : public vlObject
vlMapper *GetMapper();
vlProperty *Property;
char *GetClassName() {return "vlActor";};
void PrintSelf(ostream& os, vlIndent indent);
protected:
vlMapper *Mapper;
......
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: ActorC.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#ifndef __vlActorC_hh
......@@ -40,6 +40,8 @@ class vlActorCollection : public vlObject
void AddMember(vlActor *);
int GetNumberOfMembers();
vlActor *GetMember(int num);
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlActorCollection";};
};
#endif
......
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Light.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#ifndef __vlLight_hh
......@@ -33,6 +33,7 @@ protected:
public:
vlLight();
char *GetClassName() {return "vlLight";};
void PrintSelf(ostream& os, vlIndent indent);
virtual void Render(vlRenderer *ren,int light_index) = 0;
vlSetVector3Macro(Color,float);
......
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: RenderC.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#ifndef __vlRendererCollection_hh
......@@ -38,6 +38,7 @@ class vlRendererCollection : public vlObject
public:
void Render();
char *GetClassName() {return "vlRendererCollection";};
void PrintSelf(ostream& os, vlIndent indent);
vlRendererCollection();
void AddMember(vlRenderer *);
int GetNumberOfMembers();
......
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: RenderW.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#ifndef __vlRenderWindow_hh
......@@ -35,6 +35,7 @@ public:
public:
vlRenderWindow();
char *GetClassName() {return "vlRenderWindow";};
void PrintSelf(ostream& os, vlIndent indent);
void AddRenderers(vlRenderer *);
virtual void Render();
virtual void Frame() = 0;
......
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Renderer.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#ifndef __vlRenderer_hh
......@@ -44,6 +44,8 @@ protected:
public:
vlRenderer();
char *GetClassName() {return "vlRenderer";};
void PrintSelf(ostream& os, vlIndent indent);
void AddLights(vlLight *);
void AddActors(vlActor *);
void SetActiveCamera(vlCamera *);
......
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Actor.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <stdlib.h>
#include <iostream.h>
#include <math.h>
......@@ -84,3 +85,42 @@ vlMapper *vlActor::GetMapper()
return this->Mapper;
}
void vlActor::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlActor::GetClassName()))
{
vlObject::PrintSelf(os,indent);
os << indent << "Dragable: " << (this->Dragable ? "On\n" : "Off\n");
if ( this->Mapper )
{
os << indent << "Mapper:\n";
this->Mapper->PrintSelf(os,indent.GetNextIndent());
}
else
{
os << indent << "Mapper: (none)\n";
}
os << indent << "Orientation: (" << this->Orientation[0] << ", "
<< this->Orientation[1] << ", " << this->Orientation[2] << ")\n";
os << indent << "Origin: (" << this->Origin[0] << ", "
<< this->Origin[1] << ", " << this->Origin[2] << ")\n";
os << indent << "Pickable: " << (this->Pickable ? "On\n" : "Off\n");
os << indent << "Position: (" << this->Position[0] << ", "
<< this->Position[1] << ", " << this->Position[2] << ")\n";
if ( this->Property )
{
os << indent << "Property:\n";
this->Property->PrintSelf(os,indent.GetNextIndent());
}
else
{
os << indent << "Property: (none)\n";
}
os << indent << "Scale: (" << this->Scale[0] << ", "
<< this->Scale[1] << ", " << this->Scale[2] << ")\n";
os << indent << "Visibility: " << (this->Visibility ? "On\n" : "Off\n");
}
}
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Camera.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <math.h>
......@@ -114,39 +114,34 @@ float vlCamera::GetTwist()
vup = this->ViewUp;
vn = this->GetViewPlaneNormal();
/*
* compute: vn X ( vup X vn)
* and: vn X ( y-axis X vn)
* then find the angle between the two projected vectors
*/
// compute: vn X ( vup X vn)
// and: vn X ( y-axis X vn)
// then find the angle between the two projected vectors
//
y_axis[0] = y_axis[2] = 0.0; y_axis[1] = 1.0;
/*
* bump the view normal if it is parallel to the y-axis
*/
// bump the view normal if it is parallel to the y-axis
//
if ((vn[0] == 0.0) && (vn[2] == 0.0))
vn[2] = 0.01*vn[1];
/*
* first project the view_up onto the view_plane
*/
// first project the view_up onto the view_plane
//
cross(vup, vn, v1);
cross(vn, v1, v1);
/*
* then project the y-axis onto the view plane
*/
// then project the y-axis onto the view plane
//
cross(y_axis, vn, v2);
cross(vn, v2, v2);
/*
* then find the angle between the two projected vectors
*/
// then find the angle between the two projected vectors
//
dot = v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
mag = sqrt((double)(v1[0]*v1[0] + v1[1]*v1[1] + v1[2]*v1[2]));
mag *= sqrt((double)(v2[0]*v2[0] + v2[1]*v2[1] + v2[2]*v2[2]));
/* make sure we dont divide by 0 */
// make sure we dont divide by 0
if (mag != 0.0)
{
cosang = dot / mag;
......@@ -157,9 +152,8 @@ float vlCamera::GetTwist()
else
theta = 0.0;
/*
* now see if the angle is positive or negative
*/
// now see if the angle is positive or negative
//
cross(v1, v2, v1);
dot = v1[0]*vn[0] + v1[1]*vn[1] + v1[2]*vn[2];
......@@ -176,9 +170,8 @@ float *vlCamera::GetViewPlaneNormal()
float distance;
float vpn[3];
/*
* view plane normal is calculated from position and focal point
*/
// view plane normal is calculated from position and focal point
//
dx = this->Position[0] - this->FocalPoint[0];
dy = this->Position[1] - this->FocalPoint[1];
dz = this->Position[2] - this->FocalPoint[2];
......@@ -197,3 +190,25 @@ float *vlCamera::GetViewPlaneNormal()
return vpn;
}
void vlCamera::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlCamera::GetClassName()))
{
vlObject::PrintSelf(os,indent);
os << indent << "Clipping Range: (" << this->ClippingRange[0] << ", "
<< this->ClippingRange[2] << ")\n";
os << indent << "Eye Angle: " << this->EyeAngle << "\n";
os << indent << "Focal Point: (" << this->FocalPoint[0] << ", "
<< this->FocalPoint[1] << ", " << this->FocalPoint[2] << ")\n";
os << indent << "Left Eye: " << this->LeftEye << "\n";
os << indent << "Position: (" << this->Position[0] << ", "
<< this->Position[1] << ", " << this->Position[2] << ")\n";
os << indent << "Switch: " << (this->Switch ? "On\n" : "Off\n");
os << indent << "Twist: " << this->GetTwist() << "\n";
os << indent << "View Angle: " << this->ViewAngle << "\n";
os << indent << "View Up: (" << this->ViewUp[0] << ", "
<< this->ViewUp[1] << ", " << this->ViewUp[2] << ")\n";
}
}
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Light.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <stdlib.h>
......@@ -37,4 +37,23 @@ vlLight::vlLight()
}
void vlLight::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlLight::GetClassName()))
{
vlObject::PrintSelf(os,indent);
os << indent << "Color: (" << this->Color[0] << ", "
<< this->Color[1] << ", " << this->Color[2] << ")\n";
os << indent << "Focal Point: (" << this->FocalPoint[0] << ", "
<< this->FocalPoint[1] << ", " << this->FocalPoint[2] << ")\n";
os << indent << "Intensity: " << this->Intensity << "\n";
os << indent << "Position: (" << this->Position[0] << ", "
<< this->Position[1] << ", " << this->Position[2] << ")\n";
os << indent << "Switch: " << (this->Switch ? "On\n" : "Off\n");
}
}
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Property.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <stdlib.h>
......@@ -53,32 +53,32 @@ vlProperty::vlProperty()
void vlProperty::SetFlat (void)
{
this->Interpolation= FLAT;
this->Interpolation= VL_FLAT;
}
void vlProperty::SetGouraud (void)
{
this->Interpolation = GOURAUD;
this->Interpolation = VL_GOURAUD;
}
void vlProperty::SetPhong (void)
{
this->Interpolation = PHONG;
this->Interpolation = VL_PHONG;
}
void vlProperty::SetPoints (void)
{
this->Interpolation = POINTS;
this->Interpolation = VL_POINTS;
}
void vlProperty::SetWireframe (void)
{
this->Representation = WIREFRAME;
this->Representation = VL_WIREFRAME;
}
void vlProperty::SetSurface (void)
{
this->Representation = SURFACE;
this->Representation = VL_SURFACE;
}
/* this is a standard vector set method except that it sets the */
......@@ -102,4 +102,49 @@ void vlProperty::SetColor(float R,float G,float B)
this->SpecularColor[2] = B;
}
void vlProperty::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlProperty::GetClassName()))
{
vlObject::PrintSelf(os,indent);
os << indent << "Ambient: " << this->Ambient << "\n";
os << indent << "Ambient Color: (" << this->AmbientColor[0] << ", "
<< this->AmbientColor[1] << ", " << this->AmbientColor[2] << ")\n";
os << indent << "Backface: " << (this->Backface ? "On\n" : "Off\n");
os << indent << "Color: (" << this->Color[0] << ", "
<< this->Color[1] << ", " << this->Color[2] << ")\n";
os << indent << "Diffuse: " << this->Diffuse << "\n";
os << indent << "Diffuse Color: (" << this->DiffuseColor[0] << ", "
<< this->DiffuseColor[1] << ", " << this->DiffuseColor[2] << ")\n";
os << indent << "Edge Color: (" << this->EdgeColor[0] << ", "
<< this->EdgeColor[1] << ", " << this->EdgeColor[2] << ")\n";
os << indent << "Edge Visibility: "
<< (this->EdgeVisibility ? "On\n" : "Off\n");
os << indent << "Interpolation: ";
switch (this->Interpolation)
{
case 0: os << "VL_FLAT\n"; break;
case 1: os << "VL_GOURAUD\n"; break;
case 2: os << "VL_PHONG\n"; break;
default: os << "unknown\n";
}
os << indent << "Representation: ";
switch (this->Representation)
{
case 0: os << "VL_POINTS\n"; break;
case 1: os << "VL_WIREFRAME\n"; break;
case 2: os << "VL_SURFACE\n"; break;
default: os << "unknown\n";
}
os << indent << "Specular: " << this->Specular << "\n";
os << indent << "Specular Color: (" << this->SpecularColor[0] << ", "
<< this->SpecularColor[1] << ", " << this->SpecularColor[2] << ")\n";
os << indent << "Specular Power: " << this->SpecularPower << "\n";
os << indent << "Subdivide: " << (this->Subdivide ? "On\n" : "Off\n");
os << indent << "Transparency: " << this->Transparency << "\n";
}
}
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: RenderC.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <stdlib.h>
......@@ -84,3 +84,14 @@ void vlRendererCollection::Render()
}
}
void vlRendererCollection::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlRendererCollection::GetClassName()))
{
vlObject::PrintSelf(os,indent);
os << indent << "Number Of Members: " << this->NumberOfItems << "\n";
}
}
/*=========================================================================
Program: OSCAR
Program: Visualization Library
Module: Renderer.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
- Ken Martin
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <stdlib.h>
......@@ -142,3 +142,36 @@ void vlRenderer::ViewToDisplay()
this->SetDisplayPoint(dx,dy,this->ViewPoint[2]);
}
void vlRenderer::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlRenderer::GetClassName()))
{
this->vlObject::PrintSelf(os,indent);
os << indent << "Actors:\n";
this->Actors.PrintSelf(os,indent.GetNextIndent());
os << indent << "Ambient: (" << this->Ambient[0] << ", "
<< this->Ambient[1] << ", " << this->Ambient[2] << ")\n";
os << indent << "Aspect: (" << this->Aspect[0] << ", "
<< this->Aspect[1] << ")\n";
os << indent << "Background: (" << this->Background[0] << ", "
<< this->Background[1] << ", " << this->Background[2] << ")\n";
os << indent << "Back Light: " << (this->BackLight ? "On\n" : "Off\n");
os << indent << "DisplayPoint: (" << this->DisplayPoint[0] << ", "
<< this->DisplayPoint[1] << ", " << this->DisplayPoint[2] << ")\n";
os << indent << "Erase: " << (this->Erase ? "On\n" : "Off\n");
os << indent << "Lights:\n";
this->Lights.PrintSelf(os,indent.GetNextIndent());
os << indent << "Stereo Render: "
<< (this->StereoRender ? "On\n":"Off\n");
os << indent << "ViewPoint: (" << this->ViewPoint[0] << ", "
<< this->ViewPoint[1] << ", " << this->ViewPoint[2] << ")\n";
os << indent << "Viewport: (" << this->Viewport[0] << ", "
<< this->Viewport[1] << ", " << this->Viewport[2] << ", "
<< this->Viewport[3] << ")\n";
}
}