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

*** empty log message ***

parent bd062742
......@@ -31,10 +31,12 @@ public:
char *GetClassName() {return "vlDataSetMapper";};
void PrintSelf(ostream& os, vlIndent indent);
void Render(vlRenderer *ren);
float *GetBounds();
virtual void SetInput(vlDataSet *in);
virtual vlDataSet* GetInput();
protected:
int CreateMapper();
vlDataSet *Input;
vlMapper *Mapper;
};
......
......@@ -32,6 +32,7 @@ public:
void PrintSelf(ostream& os, vlIndent indent);
void Render(vlRenderer *ren);
float *GetBounds();
virtual void SetInput(vlPolyData *in);
virtual vlPolyData* GetInput();
......
......@@ -51,27 +51,52 @@ vlDataSet* vlDataSetMapper::GetInput()
return this->Input;
}
//
// Return bounding box of data
//
float *vlDataSetMapper::GetBounds()
{
static float bounds[] = {-1.0,1.0, -1.0,1.0, -1.0,1.0};
if ( ! this->Input )
return bounds;
else
{
this->Input->Update();
return this->Input->GetBounds();
}
}
//
// Receives from Actor -> maps data to primitives
//
void vlDataSetMapper::Render(vlRenderer *ren)
{
vlMapper *mapper;
//
// make sure that we've been properly initialized
//
if ( !this->Input )
{
vlErrorMacro(<< ": No input!\n");
vlErrorMacro(<< "No input!\n");
return;
}
else
{
//
// Now can create appropriate mapper
//
if ( this->CreateMapper() )
this->Mapper->Render(ren);
}
}
int vlDataSetMapper::CreateMapper()
{
vlMapper *mapper;
if ( !(mapper = this->Input->MakeMapper()) )
{
vlErrorMacro(<< ": Cannot map type: " << this->Input->GetClassName() <<"\n");
return;
vlErrorMacro(<< "Cannot map type: " << this->Input->GetClassName() <<"\n");
return 0;
}
if ( mapper != this->Mapper )
{
......@@ -80,9 +105,8 @@ void vlDataSetMapper::Render(vlRenderer *ren)
this->Mapper = mapper;
this->Mapper->Register((void *)this);
}
this->Mapper->Render(ren);
}
return 1;
}
void vlDataSetMapper::PrintSelf(ostream& os, vlIndent indent)
{
......
......@@ -52,6 +52,21 @@ vlPolyData* vlPolyMapper::GetInput()
{
return this->Input;
}
//
// Return bounding box of data
//
float *vlPolyMapper::GetBounds()
{
static float bounds[] = {-1.0,1.0, -1.0,1.0, -1.0,1.0};
if ( ! this->Input )
return bounds;
else
{
this->Input->Update();
return this->Input->GetBounds();
}
}
//
// Receives from Actor -> maps data to primitives
......@@ -67,7 +82,10 @@ void vlPolyMapper::Render(vlRenderer *ren)
// make sure that we've been properly initialized
//
if ( ! this->Input )
{
vlErrorMacro(<< "No input!\n");
return;
}
else
this->Input->Update();
......
Supports Markdown
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