Commit d86ce5df authored by Ken Martin's avatar Ken Martin

Remove internal header file

ShadowMapping was using an internal header file for defining
two vectors. No reason not to just use std::vector directly
now.
parent 41f5902e
......@@ -17,29 +17,27 @@
// -I => run in interactive mode; unless this is used, the program will
// not allow interaction and exit
#include "vtkCamera.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkActor.h"
#include "vtkCamera.h"
#include "vtkCellArray.h"
#include "vtkPointData.h"
#include "vtkPolyDataMapper.h"
#include "vtkPLYReader.h"
#include "vtkNew.h"
#include "vtkProperty.h"
#include "vtkLightKit.h"
#include "vtkTimerLog.h"
#include "vtkNew.h"
#include "vtkOpenGLRenderer.h"
#include "vtkPlaneSource.h"
#include "vtkOpenGLTexture.h"
#include "vtkShadowMapBakerPass.h"
#include "vtkShadowMapPassInternal.h"
#include "vtkPLYReader.h"
#include "vtkPlaneSource.h"
#include "vtkPointData.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkShadowMapBakerPass.h"
#include "vtkTestUtilities.h"
#include "vtkTextureObject.h"
#include "vtkTimerLog.h"
#include "vtkRenderWindowInteractor.h"
//----------------------------------------------------------------------------
int TestShadowMapBakerPass(int argc, char *argv[])
......@@ -93,7 +91,7 @@ int TestShadowMapBakerPass(int argc, char *argv[])
cerr << "baking time: " << firstRender << endl;
// get a shadow map
vtkTextureObject *to = bakerPass->GetShadowMaps()->Vector[2];
vtkTextureObject *to = (*bakerPass->GetShadowMaps())[2];
// by default the textures have depth comparison on
// but for simple display we need to turn it off
to->SetDepthTextureCompare(false);
......
......@@ -38,7 +38,6 @@
#include "vtkSequencePass.h"
#include "vtkShadowMapBakerPass.h"
#include "vtkShadowMapPass.h"
#include "vtkShadowMapPassInternal.h"
#include "vtkTestUtilities.h"
#include "vtkTimerLog.h"
......
......@@ -39,9 +39,6 @@
#include <cassert>
#include "vtkStdString.h"
// For vtkShadowMapBakerPassTextures, vtkShadowMapBakerPassLightCameras
#include "vtkShadowMapPassInternal.h"
// debugging
#include "vtkTimerLog.h"
......@@ -220,13 +217,13 @@ bool vtkShadowMapBakerPass::LightCreatesShadow(vtkLight *l)
}
// ----------------------------------------------------------------------------
vtkShadowMapBakerPassTextures *vtkShadowMapBakerPass::GetShadowMaps()
std::vector<vtkSmartPointer<vtkTextureObject> > *vtkShadowMapBakerPass::GetShadowMaps()
{
return this->ShadowMaps;
}
// ----------------------------------------------------------------------------
vtkShadowMapBakerPassLightCameras *vtkShadowMapBakerPass::GetLightCameras()
std::vector<vtkSmartPointer<vtkCamera> > *vtkShadowMapBakerPass::GetLightCameras()
{
return this->LightCameras;
}
......@@ -402,7 +399,7 @@ void vtkShadowMapBakerPass::Render(const vtkRenderState *s)
}
if(this->ShadowMaps!=0 &&
this->ShadowMaps->Vector.size()!=numberOfShadowLights)
this->ShadowMaps->size()!=numberOfShadowLights)
{
delete this->ShadowMaps;
this->ShadowMaps=0;
......@@ -410,12 +407,12 @@ void vtkShadowMapBakerPass::Render(const vtkRenderState *s)
if(this->ShadowMaps==0)
{
this->ShadowMaps=new vtkShadowMapBakerPassTextures;
this->ShadowMaps->Vector.resize(numberOfShadowLights);
this->ShadowMaps = new std::vector<vtkSmartPointer<vtkTextureObject> >();
this->ShadowMaps->resize(numberOfShadowLights);
}
if(this->LightCameras!=0 &&
this->LightCameras->Vector.size()!=numberOfShadowLights)
this->LightCameras->size()!=numberOfShadowLights)
{
delete this->LightCameras;
this->LightCameras=0;
......@@ -423,8 +420,8 @@ void vtkShadowMapBakerPass::Render(const vtkRenderState *s)
if(this->LightCameras==0)
{
this->LightCameras=new vtkShadowMapBakerPassLightCameras;
this->LightCameras->Vector.resize(numberOfShadowLights);
this->LightCameras = new std::vector<vtkSmartPointer<vtkCamera> >();
this->LightCameras->resize(numberOfShadowLights);
}
r->SetAutomaticLightCreation(false);
......@@ -468,11 +465,11 @@ void vtkShadowMapBakerPass::Render(const vtkRenderState *s)
{
if(l->GetSwitch() && this->LightCreatesShadow(l))
{
vtkTextureObject *map=this->ShadowMaps->Vector[lightIndex];
vtkTextureObject *map = (*this->ShadowMaps)[lightIndex];
if(map==0)
{
map=vtkTextureObject::New();
this->ShadowMaps->Vector[lightIndex]=map;
(*this->ShadowMaps)[lightIndex]=map;
map->Delete();
}
......@@ -502,11 +499,11 @@ void vtkShadowMapBakerPass::Render(const vtkRenderState *s)
static_cast<int>(this->Resolution),
static_cast<int>(this->Resolution),false);
vtkCamera *lightCamera=this->LightCameras->Vector[lightIndex];
vtkCamera *lightCamera = (*this->LightCameras)[lightIndex];
if(lightCamera==0)
{
lightCamera=vtkCamera::New();
this->LightCameras->Vector[lightIndex]=lightCamera;
(*this->LightCameras)[lightIndex] = lightCamera;
lightCamera->Delete();
}
......
......@@ -39,6 +39,7 @@
#define vtkShadowMapBakerPass_h
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkSmartPointer.h" // for ivars
#include "vtkRenderPass.h"
class vtkOpenGLRenderWindow;
......@@ -46,8 +47,6 @@ class vtkInformationIntegerKey;
class vtkCamera;
class vtkLight;
class vtkFrameBufferObject;
class vtkShadowMapBakerPassTextures; // internal
class vtkShadowMapBakerPassLightCameras; // internal
class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapBakerPass : public vtkRenderPass
{
......@@ -116,14 +115,14 @@ public:
// Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
//
// Give access to the baked shadow maps.
vtkShadowMapBakerPassTextures *GetShadowMaps();
std::vector<vtkSmartPointer<vtkTextureObject> > *GetShadowMaps();
// Description:
// INTERNAL USE ONLY.
// Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
//
// Give access the cameras builds from the ligths.
vtkShadowMapBakerPassLightCameras *GetLightCameras();
std::vector<vtkSmartPointer<vtkCamera> > *GetLightCameras();
//ETX
// Description:
......@@ -202,8 +201,8 @@ public:
// Graphics resources.
vtkFrameBufferObject *FrameBufferObject;
vtkShadowMapBakerPassTextures *ShadowMaps;
vtkShadowMapBakerPassLightCameras *LightCameras;
std::vector<vtkSmartPointer<vtkTextureObject> > *ShadowMaps;
std::vector<vtkSmartPointer<vtkCamera> > *LightCameras;
vtkTimeStamp LastRenderTime;
......
......@@ -44,8 +44,6 @@
#include "vtkSampleFunction.h"
#include "vtkSequencePass.h"
#include "vtkShadowMapBakerPass.h"
// For vtkShadowMapBakerPassTextures, vtkShadowMapBakerPassLightCameras
#include "vtkShadowMapPassInternal.h"
#include "vtkTextureObject.h"
#include "vtkTextureUnitManager.h"
#include "vtkTransform.h"
......@@ -216,7 +214,7 @@ void vtkShadowMapPass::Render(const vtkRenderState *s)
this->ShadowMapBakerPass->LightCreatesShadow(light) )
{
vtkTextureObject *map=
this->ShadowMapBakerPass->GetShadowMaps()->Vector[
(*this->ShadowMapBakerPass->GetShadowMaps())[
static_cast<size_t>(shadowingLightIndex)];
// activate the texture map
map->Activate();
......@@ -258,7 +256,7 @@ void vtkShadowMapPass::Render(const vtkRenderState *s)
if (shadowTextureUnits[lightIndex] >= 0)
{
vtkCamera *lightCamera=
this->ShadowMapBakerPass->GetLightCameras()->Vector[
(*this->ShadowMapBakerPass->GetLightCameras())[
static_cast<size_t>(shadowingLightIndex)];
transform->Push();
transform->Concatenate(
......@@ -315,7 +313,7 @@ void vtkShadowMapPass::Render(const vtkRenderState *s)
this->ShadowMapBakerPass->LightCreatesShadow(light) )
{
vtkTextureObject *map=
this->ShadowMapBakerPass->GetShadowMaps()->Vector[
(*this->ShadowMapBakerPass->GetShadowMaps())[
static_cast<size_t>(shadowingLightIndex)];
// activate the texture map
map->Deactivate();
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkShadowMapPass.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// These internal classes are shared by vtkShadowMapBakerPass and
// vtkShadowMapPass.
#ifndef vtkShadowMapPassInternal_h
#define vtkShadowMapPassInternal_h
#include "vtkCamera.h"
#include "vtkTextureObject.h"
class vtkShadowMapBakerPassTextures
{
public:
std::vector<vtkSmartPointer<vtkTextureObject> > Vector;
};
class vtkShadowMapBakerPassLightCameras
{
public:
std::vector<vtkSmartPointer<vtkCamera> > Vector;
};
#endif
// VTK-HeaderTest-Exclude: vtkShadowMapPassInternal.h
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