Permalink
Browse files

Switched the order of the camera and renderer parameters in the Viewe…

…r constructor.

Updated all the examples as well.
  • Loading branch information...
1 parent c7eb906 commit e087d6e91fb8df928fad395e0034f33d86fa3c67 @vilya committed Aug 19, 2010
Showing with 21 additions and 21 deletions.
  1. +2 −2 example/arcball.cpp
  2. +3 −3 example/basic.cpp
  3. +3 −3 example/example.cpp
  4. +3 −3 example/imageview.cpp
  5. +3 −3 example/styled.cpp
  6. +5 −5 src/vgl_viewer.cpp
  7. +2 −2 src/vgl_viewer.h
View
@@ -31,11 +31,11 @@ int main(int argc, char** argv)
const int kWidth = 800;
const int kHeight = 600;
+ ArcballRenderer renderer;
vgl::ArcballCamera camera(
vgl::Vec3f(0, 0, 5), vgl::Vec3f(0, 0, 0), vgl::Vec3f(0, 1, 0),
-1, 1, -1, 1, 30, kWidth, kHeight);
- ArcballRenderer renderer;
- vgl::Viewer viewer("Arcball Test", kWidth, kHeight, &camera, &renderer);
+ vgl::Viewer viewer("Arcball Test", kWidth, kHeight, &renderer, &camera);
viewer.run();
return 0;
}
View
@@ -19,11 +19,11 @@ class ExampleRenderer : public vgl::Renderer
int main(int argc, char** argv)
{
- vgl::Camera* camera = new vgl::BaseCamera(
+ ExampleRenderer renderer;
+ vgl::BaseCamera camera(
vgl::Vec3f(0, 0, 5), vgl::Vec3f(0, 0, 0), vgl::Vec3f(0, 1, 0),
-1, 1, -1, 1, 30, 800, 600);
- ExampleRenderer* renderer = new ExampleRenderer();
- vgl::Viewer viewer("Example Viewer", 800, 600, camera, renderer);
+ vgl::Viewer viewer("Example Viewer", 800, 600, &renderer, &camera);
viewer.run();
}
View
@@ -122,13 +122,13 @@ int main(int argc, char** argv)
MeshBuilder* builder = new MeshBuilder(mesh);
vgl::loadModel(builder, argv[1]);
- vgl::Camera* camera = new vgl::BaseCamera(
+ ExampleRenderer renderer(mesh);
+ vgl::BaseCamera camera(
vgl::Vec3f(0, 0, 5), vgl::Vec3f(0, 0, 0), vgl::Vec3f(0, 1, 0),
-1, 1, -1, 1, 30, 800, 600);
- ExampleRenderer* renderer = new ExampleRenderer(mesh);
- vgl::Viewer viewer("Example Viewer", 800, 600, camera, renderer);
+ vgl::Viewer viewer("Example Viewer", 800, 600, &renderer, &camera);
viewer.run();
}
View
@@ -76,10 +76,10 @@ int main(int argc, char** argv)
}
vgl::RawImage* img = new vgl::RawImage(argv[1]);
- vgl::Camera* camera = new vgl::OrthoCamera(img->getWidth(), img->getHeight());
- ImageViewRenderer* renderer = new ImageViewRenderer(img);
+ ImageViewRenderer renderer(img);
+ vgl::OrthoCamera camera(img->getWidth(), img->getHeight());
vgl::Viewer viewer("VGL Image Viewer",
- img->getWidth(), img->getHeight(), camera, renderer);
+ img->getWidth(), img->getHeight(), &renderer, &camera);
viewer.run();
}
View
@@ -49,11 +49,11 @@ class ExampleRenderer : public vgl::Renderer
int main(int argc, char** argv)
{
- vgl::Camera* camera = new vgl::BaseCamera(
+ ExampleRenderer renderer;
+ vgl::BaseCamera camera(
vgl::Vec3f(0, 0, 5), vgl::Vec3f(0, 0, 0), vgl::Vec3f(0, 1, 0),
-1, 1, -1, 1, 30, 800, 600);
- ExampleRenderer* renderer = new ExampleRenderer();
- vgl::Viewer viewer("Example Viewer", 800, 600, camera, renderer);
+ vgl::Viewer viewer("Example Viewer", 800, 600, &renderer, &camera);
viewer.run();
}
View
@@ -70,8 +70,8 @@ Viewer::Viewer(
const char* title,
int width,
int height,
- Camera* camera,
- Renderer* renderer) :
+ Renderer* renderer,
+ Camera* camera) :
_windowWidth(width),
_windowHeight(height),
_width(width),
@@ -87,8 +87,8 @@ Viewer::Viewer(
_altDown(false),
_ctrlDown(false),
_fullscreen(false),
- _camera(camera),
- _renderer(renderer)
+ _renderer(renderer),
+ _camera(camera)
{
int argc = 0;
char* argv[] = { NULL };
@@ -118,8 +118,8 @@ Viewer::Viewer(
Viewer::~Viewer()
{
- delete _camera;
delete _renderer;
+ delete _camera;
}
View
@@ -40,7 +40,7 @@ class Viewer {
};
public:
- Viewer(const char* title, int width, int height, Camera* camera, Renderer* renderer);
+ Viewer(const char* title, int width, int height, Renderer* renderer, Camera* camera);
virtual ~Viewer();
virtual void render();
@@ -79,8 +79,8 @@ class Viewer {
bool _shiftDown, _altDown, _ctrlDown;
bool _fullscreen;
- Camera* _camera;
Renderer* _renderer;
+ Camera* _camera;
};

0 comments on commit e087d6e

Please sign in to comment.