Mercurial > fife-parpg
diff engine/core/view/camera.cpp @ 605:d242e6ce6f9f
Fixed a few compiler warning messages. Also removed a bunch of extra whitespace.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 13 Sep 2010 19:00:12 +0000 |
parents | b2feacaed53c |
children | 356634098bd9 |
line wrap: on
line diff
--- a/engine/core/view/camera.cpp Mon Sep 13 17:22:24 2010 +0000 +++ b/engine/core/view/camera.cpp Mon Sep 13 19:00:12 2010 +0000 @@ -58,22 +58,22 @@ class MapObserver : public MapChangeListener { Camera* m_camera; - public: + public: MapObserver(Camera* camera) { m_camera = camera; - } + } virtual ~MapObserver() {} - virtual void onMapChanged(Map* map, std::vector<Layer*>& changedLayers) { - } + virtual void onMapChanged(Map* map, std::vector<Layer*>& changedLayers) { + } - virtual void onLayerCreate(Map* map, Layer* layer) { - m_camera->addLayer(layer); - } + virtual void onLayerCreate(Map* map, Layer* layer) { + m_camera->addLayer(layer); + } - virtual void onLayerDelete(Map* map, Layer* layer) { - m_camera->removeLayer(layer); - } + virtual void onLayerDelete(Map* map, Layer* layer) { + m_camera->removeLayer(layer); + } }; Camera::Camera(const std::string& id, @@ -207,7 +207,7 @@ // need to calculate screen-coordinates // which depend on m_location. updateMap(location.getMap()); - + m_cur_origo = toScreenCoordinates(ExactModelCoordinate(0,0,0)); } @@ -278,11 +278,11 @@ bool Camera::isEnabled() { return m_enabled; } - + Point3D Camera::getOrigin() const { return m_cur_origo; } - + void Camera::updateMatrices() { double scale = m_reference_scale; m_matrix.loadScale(scale, scale, scale); @@ -320,7 +320,7 @@ } m_vscreen_2_screen[2*N + 2] = 1; m_screen_2_vscreen = m_vscreen_2_screen.inverse(); - + // FL_WARN(_log, LMsg("matrix: ") << m_matrix << " 1: " << m_matrix.inverse().mult4by4(m_matrix)); // FL_WARN(_log, LMsg("vs2s matrix: ") << m_vscreen_2_screen << " s2vs matrix: " << m_screen_2_vscreen); } @@ -348,7 +348,7 @@ DoublePoint3D pt = (m_vs_matrix * p); return pt; } - + ScreenPoint Camera::virtualScreenToScreen(const DoublePoint3D& p) { return doublePt2intPt(m_vscreen_2_screen * p); } @@ -371,7 +371,12 @@ DoubleMatrix mtx; mtx.loadRotate(m_rotation, 0.0, 0.0, 1.0); mtx.applyRotate(m_tilt, 1.0, 0.0, 0.0); - double x1, x2, y1, y2; + + double x1 = 0; + double x2 = 0; + double y1 = 0; + double y2 = 0; + for (unsigned int i = 0; i < vertices.size(); i++) { vertices[i] = cg->toMapCoordinates(vertices[i]); vertices[i] = mtx * vertices[i];