Commit 2090d66f authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Changed collection interface.

parent a1aa5f5f
......@@ -33,7 +33,7 @@ class vlActorCollection : public vlCollection
void AddItem(vlActor *a);
void RemoveItem(vlActor *a);
int IsItemPresent(vlActor *a);
vlActor *GetItem(int num);
vlActor *GetNextItem();
};
// Description:
......@@ -59,10 +59,10 @@ inline int vlActorCollection::IsItemPresent(vlActor *a)
}
// Description:
// Get an actor in the list at a particular location (1<=num<=number items).
inline vlActor *vlActorCollection::GetItem(int num)
// Get the next actor in the list.
inline vlActor *vlActorCollection::GetNextItem()
{
return (vlActor *)(this->vlCollection::GetItem(num));
return (vlActor *)(this->vlCollection::GetNextItem());
}
#endif
......
......@@ -33,7 +33,7 @@ class vlLightCollection : public vlCollection
void AddItem(vlLight *a);
void RemoveItem(vlLight *a);
int IsItemPresent(vlLight *a);
vlLight *GetItem(int num);
vlLight *GetNextItem();
};
// Description:
......@@ -59,10 +59,10 @@ inline int vlLightCollection::IsItemPresent(vlLight *a)
}
// Description:
// Get an light in the list at a particular location (1<=num<=number items).
inline vlLight *vlLightCollection::GetItem(int num)
// Get the next light in the list.
inline vlLight *vlLightCollection::GetNextItem()
{
return (vlLight *)(this->vlCollection::GetItem(num));
return (vlLight *)(this->vlCollection::GetNextItem());
}
#endif
......
......@@ -33,7 +33,7 @@ class vlRendererCollection : public vlCollection
void AddItem(vlRenderer *a);
void RemoveItem(vlRenderer *a);
int IsItemPresent(vlRenderer *a);
vlRenderer *GetItem(int num);
vlRenderer *GetNextItem();
void Render();
};
......@@ -60,10 +60,10 @@ inline int vlRendererCollection::IsItemPresent(vlRenderer *a)
}
// Description:
// Get an renderer in the list at a particular location (1<=num<=number items).
inline vlRenderer *vlRendererCollection::GetItem(int num)
// Get the next renderer in the list.
inline vlRenderer *vlRendererCollection::GetNextItem()
{
return (vlRenderer *)(this->vlCollection::GetItem(num));
return (vlRenderer *)(this->vlCollection::GetNextItem());
}
#endif
......@@ -42,17 +42,14 @@ int vlGlrRenderer::UpdateActors()
vlActor *anActor;
float visibility;
vlMatrix4x4 matrix;
int num;
int count = 0;
// set matrix mode for actors
mmode(MVIEWING);
// loop through actors
for (num = 1; num <= this->Actors.GetNumberOfItems(); num++)
for ( this->Actors.InitTraversal(); anActor = this->Actors.GetNextItem(); )
{
anActor = this->Actors.GetItem(num);
// if it's invisible, we can skip the rest
visibility = anActor->GetVisibility();
......@@ -121,7 +118,6 @@ int vlGlrRenderer::UpdateLights ()
vlLight *light;
short cur_light;
float status;
int i;
int count = 0;
cur_light= this->NumberOfLightsBound + LIGHT0;
......@@ -130,9 +126,8 @@ int vlGlrRenderer::UpdateLights ()
mmode(MVIEWING);
pushmatrix();
for (i = 1; i <= this->Lights.GetNumberOfItems(); i++)
for ( this->Lights.InitTraversal(); light = this->Lights.GetNextItem(); )
{
light = this->Lights.GetItem(i);
status = light->GetSwitch();
......
......@@ -14,20 +14,17 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <stdlib.h>
#include <iostream.h>
#include "RenderC.hh"
// Description:
// Forward the Render() method to each renderer in the list.
void vlRendererCollection::Render()
{
int i;
vlRenderer *elem;
vlRenderer *ren;
for (i = 1; i <= this->GetNumberOfItems(); i++)
for ( this->InitTraversal(); ren = GetNextItem(); )
{
elem = this->GetItem(i);
elem->Render();
ren->Render();
}
}
......@@ -149,7 +149,6 @@ void vlRenderer::DoActors()
void vlRenderer::ResetCamera()
{
vlActor *anActor;
int num;
float *bounds;
float allBounds[6];
int nothingVisible=1;
......@@ -158,10 +157,8 @@ void vlRenderer::ResetCamera()
allBounds[1] = allBounds[3] = allBounds[5] = -LARGE_FLOAT;
// loop through actors
for (num = 1; num <= this->Actors.GetNumberOfItems(); num++)
for ( this->Actors.InitTraversal(); anActor = this->Actors.GetNextItem(); )
{
anActor = this->Actors.GetItem(num);
// if it's invisible, we can skip the rest
if ( anActor->GetVisibility() )
{
......
......@@ -50,14 +50,11 @@ int vlSbrRenderer::UpdateActors()
vlActor *anActor;
float visibility;
vlMatrix4x4 matrix;
int num;
int count = 0;
// loop through actors
for (num = 1; num <= this->Actors.GetNumberOfItems(); num++)
for ( this->Actors.InitTraversal(); anActor = this->Actors.GetNextItem(); )
{
anActor = this->Actors.GetItem(num);
// if it's invisible, we can skip the rest
visibility = anActor->GetVisibility();
......@@ -119,14 +116,12 @@ int vlSbrRenderer::UpdateLights ()
vlLight *light;
short cur_light;
float status;
int i;
int count = 0;
cur_light= this->NumberOfLightsBound;
for (i = 1; i <= this->Lights.GetNumberOfItems(); i++)
for ( this->Lights.InitTraversal(); light = this->Lights.GetNextItem(); )
{
light = this->Lights.GetItem(i);
status = light->GetSwitch();
......
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