Commit c2773d7a authored by Will Schroeder's avatar Will Schroeder
Browse files

random check in

parent 3e2d1224
......@@ -50,7 +50,8 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// possibly a texture map.
// .SECTION See Also
// vtkProperty vtkTexture vtkMapper vtkFollower vtkLODActor
// vtkProperty vtkTexture vtkMapper vtkActorDevice vtkFollower vtkLODActor
// vtkAssembly
#ifndef __vtkActor_hh
#define __vtkActor_hh
......@@ -62,6 +63,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkTransform.hh"
class vtkRenderer;
class vtkActorDevice;
class vtkActor : public vtkObject
{
......@@ -193,6 +195,7 @@ protected:
float Bounds[6];
int SelfCreatedProperty;
float Center[3];
vtkActorDevice *Device;
};
#endif
......
......@@ -54,6 +54,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkObject.hh"
class vtkRenderer;
class vtkActor;
class vtkMapper;
class vtkActorDevice : public vtkObject
{
......@@ -62,7 +63,7 @@ public:
// Description:
// This is the only method that the subclasses must supply.
virtual void Render(vtkActor *actor, vtkRenderer *ren) = 0;
virtual void Render(vtkActor *actor, vtkRenderer *ren, vtkMapper *m) = 0;
};
......
......@@ -117,6 +117,7 @@ protected:
vtkActorCollection Parts;
int ApplyTransform;
int ApplyProperty;
vtkTimeStamp RenderTime;
};
......
......@@ -58,7 +58,6 @@ public:
char *GetClassName() {return "vtkGlrActor";};
void Render(vtkActor *a, vtkRenderer *ren, vtkMapper *mapper);
void Render(vtkActor *a, vtkGlrRenderer *ren, vtkMapper *mapper);
};
#endif
......
......@@ -68,6 +68,7 @@ public:
vtkRenderer *MakeRenderer();
vtkLightDevice *MakeLight();
vtkCameraDevice *MakeCamera();
vtkActorDevice *MakeActor();
vtkTextureDevice *MakeTexture();
vtkPropertyDevice *MakeProperty();
......
......@@ -57,8 +57,7 @@ protected:
public:
char *GetClassName() {return "vtkOglrActor";};
void Render(vtkActor *a, vtkRenderer *ren);
void Render(vtkActor *a, vtkOglrRenderer *ren);
void Render(vtkActor *a, vtkRenderer *ren, vtkMapper *mapper);
};
#endif
......
......@@ -68,6 +68,7 @@ public:
vtkRenderer *MakeRenderer();
vtkLightDevice *MakeLight();
vtkCameraDevice *MakeCamera();
vtkActorDevice *MakeActor();
vtkTextureDevice *MakeTexture();
vtkPropertyDevice *MakeProperty();
......
......@@ -67,6 +67,8 @@ public:
char *GetClassName() {return "vtkProperty";};
void PrintSelf(ostream& os, vtkIndent indent);
vtkProperty &operator=(const vtkProperty& p);
// Description:
// This method causes the property to set up whatever is required for
// its instance variables. This is actually handled by an instance of
......
......@@ -58,6 +58,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
class vtkRenderWindowInteractor;
class vtkLightDevice;
class vtkCameraDevice;
class vtkActorDevice;
class vtkTextureDevice;
class vtkPropertyDevice;
......@@ -113,6 +114,11 @@ public:
// the correct type of vtkCameraDevice.
virtual vtkCameraDevice *MakeCamera() = 0;
// Description:
// Create a device specific actor. This is used by vtkActor to create
// the correct type of vtkActorDevice.
virtual vtkActorDevice *MakeActor() = 0;
// Description:
// Create a device specific property. This is used by vtkProperty to create
// the correct type of vtkPropertyDevice.
......
......@@ -58,7 +58,6 @@ public:
char *GetClassName() {return "vtkSbrActor";};
void Render(vtkActor *a, vtkRenderer *ren, vtkMapper *mapper);
void Render(vtkActor *a, vtkSbrRenderer *ren, vtkMapper *mapper);
};
#endif
......
......@@ -64,6 +64,7 @@ public:
vtkRenderer *MakeRenderer();
vtkLightDevice *MakeLight();
vtkCameraDevice *MakeCamera();
vtkActorDevice *MakeActor();
vtkPropertyDevice *MakeProperty();
vtkTextureDevice *MakeTexture();
......
......@@ -58,7 +58,6 @@ public:
char *GetClassName() {return "vtkXglrActor";};
void Render(vtkActor *a, vtkRenderer *ren, vtkMapper *mapper);
void Render(vtkActor *a, vtkXglrRenderer *ren, vtkMapper *mapper);
};
#endif
......
......@@ -64,6 +64,7 @@ public:
vtkRenderer *MakeRenderer();
vtkLightDevice *MakeLight();
vtkCameraDevice *MakeCamera();
vtkActorDevice *MakeActor();
vtkPropertyDevice *MakeProperty();
vtkTextureDevice *MakeTexture();
......
......@@ -42,6 +42,8 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <math.h>
#include "vtkActor.hh"
#include "vtkActorDevice.hh"
#include "vtkRenderWindow.hh"
// Description:
// Creates an actor with the following defaults: origin(0,0,0)
......@@ -75,6 +77,7 @@ vtkActor::vtkActor()
this->Dragable = 1;
this->SelfCreatedProperty = 0;
this->Device = NULL;
}
vtkActor::~vtkActor()
......@@ -86,7 +89,8 @@ vtkActor::~vtkActor()
// Description:
// This causes the actor to be rendered. It in turn will render the actor's
// property, texture map and then mapper. If a property hasn't been
// assigned, then the actor will create one automatically.
// assigned, then the actor will create one automatically. Note that a
// side effect of this method is that the visualization network is updated.
void vtkActor::Render(vtkRenderer *ren)
{
// render the property
......@@ -100,11 +104,12 @@ void vtkActor::Render(vtkRenderer *ren)
// render the texture */
if (this->Texture) this->Texture->Render(ren);
// send a render to the mapper
if ( ! this->Mapper )
vtkWarningMacro(<<"No mapper defined for actor...can't render");
else
this->Mapper->Render(ren);
if (!this->Device)
{
this->Device = ren->GetRenderWindow()->MakeActor();
}
if ( this->Mapper ) this->Device->Render(this,ren,this->Mapper);
}
void vtkActor::SetProperty(vtkProperty *lut)
......
......@@ -72,31 +72,27 @@ void vtkAssembly::Render(vtkRenderer *ren)
{
vtkActor *part;
// render geometry and properties (if defined)
if ( this->Mapper )
{
if ( !this->Property )
{
this->Property->Render(ren);
}
vtkActor::Render(ren);
if ( this->Texture )
{
this->Texture->Render(ren);
}
if ( this->Parts.GetNumberOfItems() <= 0 ) return;
this->Mapper->Render(ren);
// propogate properties and/or transformation
if ( this->ApplyTransform && this->RenderTime < this->GetMTime() )
{
this->ApplyTransformation();
}
if ( this->Parts.GetNumberOfItems() > 0 ) return;
if (this->ApplyProperty) this->ApplyProperties();
if (this->ApplyTransform) this->ApplyTransformation();
if ( this->ApplyProperty && this->RenderTime < this->Property->GetMTime() )
{
this->ApplyProperties();
}
for (this->Parts.InitTraversal(); part = this->Parts.GetNextItem(); )
{
part->Render(ren);
if ( part->GetVisibility() ) part->Render(ren);
}
this->RenderTime.Modified();
}
// Description:
......@@ -104,8 +100,20 @@ void vtkAssembly::Render(vtkRenderer *ren)
// assembly.
void vtkAssembly::ApplyTransformation()
{
vtkActor *part;
vtkMatrix4x4 *matrix;
// traverse list of parts, setting parent matrix
for (this->Parts.InitTraversal(); part = this->Parts.GetNextItem(); )
{
if ( (matrix=part->GetUserMatrix()) == NULL )
{
matrix = new vtkMatrix4x4;
part->SetUserMatrix(matrix);
}
*matrix = this->GetMatrix();
}
}
// Description:
......@@ -113,16 +121,23 @@ void vtkAssembly::ApplyTransformation()
// assembly.
void vtkAssembly::ApplyProperties()
{
vtkActor *part;
vtkProperty *property, *thisProperty=this->GetProperty();
// traverse list of parts, setting properties
for (this->Parts.InitTraversal(); part = this->Parts.GetNextItem(); )
{
property = part->GetProperty();
*property = *thisProperty;
}
}
void vtkAssembly::PrintSelf(ostream& os, vtkIndent indent)
{
vtkActor::PrintSelf(os,indent);
os << indent << "There are: " << this->Parts.GetNumberOfItems()
<< " parts in this assembly";
<< " parts in this assembly\n";
os << indent << "Apply Transform: " << (this->ApplyTransform ? "On\n" : "Off\n");
os << indent << "Apply Property: " << (this->ApplyProperty ? "On\n" : "Off\n");
}
......
......@@ -46,14 +46,6 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// Description:
// Implement base class method.
void vtkGlrActor::Render(vtkActor *actor, vtkRenderer *ren, vtkMapper *mapper)
{
this->Render(actor, (vtkGlrRenderer *)ren, mapper);
}
// Description:
// Actual actor render method.
void vtkGlrActor::Render(vtkActor *actor, vtkGlrRenderer *ren,
vtkMapper *mapper)
{
static vtkMatrix4x4 matrix;
......@@ -68,9 +60,7 @@ void vtkGlrActor::Render(vtkActor *actor, vtkGlrRenderer *ren,
// send a render to the mapper; update pipeline
mapper->Render(ren);
popmatrix();
// pop transformation matrix
glPopMatrix();
popmatrix();
}
......@@ -46,6 +46,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkGlrTexture.hh"
#include "vtkGlrCamera.hh"
#include "vtkGlrLight.hh"
#include "vtkGlrActor.hh"
#include "gl/glws.h"
#include "gl/get.h"
......@@ -165,6 +166,16 @@ vtkLightDevice *vtkGlrRenderWindow::MakeLight()
return (vtkLightDevice *)light;
}
// Description:
// Create a gl specific actor.
vtkActorDevice *vtkGlrRenderWindow::MakeActor()
{
vtkGlrActor *actor;
actor = new vtkGlrActor;
return (vtkActorDevice *)actor;
}
// Description:
// Create a gl specific renderer.
vtkRenderer *vtkGlrRenderWindow::MakeRenderer()
......
......@@ -67,8 +67,6 @@ vtkGlrRenderer::vtkGlrRenderer()
int vtkGlrRenderer::UpdateActors()
{
vtkActor *anActor;
float visibility;
vtkMatrix4x4 matrix;
int count = 0;
// set matrix mode for actors
......@@ -78,22 +76,10 @@ int vtkGlrRenderer::UpdateActors()
for ( this->Actors.InitTraversal(); anActor = this->Actors.GetNextItem(); )
{
// if it's invisible, we can skip the rest
visibility = anActor->GetVisibility();
if (visibility == 1.0)
if (anActor->GetVisibility())
{
count++;
// build transformation
anActor->GetMatrix(matrix);
matrix.Transpose();
// insert model transformation
pushmatrix();
multmatrix((float (*)[4])(matrix[0]));
anActor->Render((vtkRenderer *)this);
popmatrix();
}
}
return count;
......
......@@ -46,17 +46,12 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkOglrRenderer.hh"
#include "vtkOglrActor.hh"
// Description:
// Implement base class method.
void vtkOglrActor::Render(vtkActor *actor, vtkRenderer *ren);
{
this->Render(actor, (vtkOglrRenderer *)ren,actor_index);
}
#include "vtkActor.hh"
// Description:
// Actual actor render method.
void vtkOglrActor::Render(vtkActor *actor, vtkOglrRenderer *ren)
void vtkOglrActor::Render(vtkActor *actor, vtkRenderer *ren,
vtkMapper *mapper)
{
static vtkMatrix4x4 matrix;
......@@ -68,19 +63,8 @@ void vtkOglrActor::Render(vtkActor *actor, vtkOglrRenderer *ren)
glPushMatrix();
glMultMatrixf(matrix[0]);
// render the property
if (!this->Property)
{
// force creation of a property
this->GetProperty();
}
this->Property->Render(ren);
// render the texture */
if (this->Texture) this->Texture->Render(ren);
// send a render to the mapper
if ( this->Mapper ) this->Mapper->Render(ren);
// send a render to the mapper; update pipeline
mapper->Render(ren);
// pop transformation matrix
glPopMatrix();
......
......@@ -47,6 +47,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkOglrTexture.hh"
#include "vtkOglrCamera.hh"
#include "vtkOglrLight.hh"
#include "vtkOglrActor.hh"
#include "GL/gl.h"
#include "GL/glu.h"
......@@ -254,6 +255,16 @@ vtkCameraDevice *vtkOglrRenderWindow::MakeCamera()
return (vtkCameraDevice *)camera;
}
// Description:
// Create a OpenGL specific actor.
vtkActorDevice *vtkOglrRenderWindow::MakeActor()
{
vtkOglrActor *actor;
actor = new vtkOglrActor;
return (vtkActorDevice *)actor;
}
// Description:
// Create a OpenGL specific property.
vtkPropertyDevice *vtkOglrRenderWindow::MakeProperty()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment