Commit 831e59dc authored by Ken Martin's avatar Ken Martin
Browse files

Initial revision

parent 378d7609
/*=========================================================================
Program: OSCAR
Module: RenderC.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
- Ken Martin
=========================================================================*/
#ifndef __vlRendererCollection_hh
#define __vlRendererColleciton_hh
#include "Renderer.hh"
class vlRendererListElement
{
public:
vlRenderer *Renderer;
vlRendererListElement *Next;
};
class vlRendererCollection : public vlObject
{
public:
int NumberOfItems;
private:
vlRendererListElement *Top;
vlRendererListElement *Bottom;
public:
void Render();
virtual char *GetClassName() {return "vlRendererCollection";};
vlRendererCollection();
void AddMember(vlRenderer *);
int GetNumberOfMembers();
vlRenderer *GetMember(int num);
};
#endif
/*=========================================================================
Program: OSCAR
Module: RenderC.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the vis library
- Ken Martin
=========================================================================*/
#include <stdlib.h>
#include <iostream.h>
#include "RenderC.hh"
vlRendererCollection::vlRendererCollection()
{
this->NumberOfItems = 0;
this->Top = NULL;
this->Bottom = NULL;
}
void vlRendererCollection::AddMember(vlRenderer *Renderer)
{
vlRendererListElement *elem;
elem = new vlRendererListElement;
if (!this->Top)
{
this->Top = elem;
}
else
{
this->Bottom->Next = elem;
}
this->Bottom = elem;
elem->Renderer = Renderer;
elem->Next = NULL;
this->NumberOfItems++;
}
int vlRendererCollection::GetNumberOfMembers()
{
return this->NumberOfItems;
}
vlRenderer *vlRendererCollection::GetMember(int num)
{
int i;
vlRendererListElement *elem;
if (num > this->NumberOfItems)
{
cerr << "Renderer: Requesting illegal index\n";
return this->Top->Renderer;
}
elem = this->Top;
for (i = 1; i < num; i++)
{
elem = elem->Next;
}
return (elem->Renderer);
}
void vlRendererCollection::Render()
{
int i;
vlRendererListElement *elem;
elem = this->Top;
for (i = 0; i < this->NumberOfItems; i++)
{
elem->Renderer->Render();
elem = elem->Next;
}
}
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