//
// This simple example shows how to do basic rendering and pipeline
// creation using C++.
//
#include "vtk3DSImporter.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  if(argc < 2){
      fprintf(stderr, "Less param then required\n");
      exit(3);
  }

  // Create the graphics structure. The renderer renders into the 
  // render window. The render window interactor captures mouse events
  // and will perform appropriate camera or actor manipulation
  // depending on the nature of the events.
  //
  vtkRenderer *ren1 = vtkRenderer::New();
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer(ren1);
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renWin);

  ren1->SetBackground(0.1, 0.2, 0.4);
  renWin->SetSize(600, 400);

  // Import 3D Studio Max file
  //
  vtk3DSImporter* Importer = vtk3DSImporter::New();
  Importer->SetRenderWindow(renWin);
  Importer->SetFileName(argv[1]);
  Importer->ComputeNormalsOn();
  Importer->Read();
    
  // This starts the event loop and as a side effect causes an initial render.
  iren->Start();

  // Exiting from here, we have to delete all the instances that
  // have been created.
  Importer->Delete();
  ren1->Delete();
  renWin->Delete();
  iren->Delete();

  return 0;
}
