22 #ifndef FIFE_VIEW_CAMERA_H
23 #define FIFE_VIEW_CAMERA_H
79 Camera(
const std::string&
id,
Abstract interface for all the renderbackends.
void setZToY(double zToY)
Sets zToY value for the camera and enables their use.
int32_t getOverlayImage()
Returns the pool id of the overlay image.
std::list< RendererBase * > m_pipeline
DoublePoint getLogicalCellDimensions(Layer *layer)
Gets logical cell image dimensions for given layer.
RenderBackend * m_renderbackend
DoubleMatrix m_vs_inverse_matrix
std::vector< RenderItem * > RenderList
void setOverlayImage(int32_t id, bool fill=false)
Sets a image as overlay, if fill is true the image gets the viewport size.
uint32_t m_screen_cell_height
void updateMatrices()
Updates the camera transformation matrix T with requested values.
void resetUpdates()
Resets temporary values from last update round, like warped flag.
DoubleMatrix m_inverse_matrix
Instance * getAttached() const
Returns instance where camera is attached.
void setOverlayColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
Sets a color as overlay.
RenderList & getRenderListRef(Layer *layer)
Returns reference to RenderList.
bool isZToYEnabled() const
Gets if z to y manipulation is enabled / disabled.
DoublePoint3D toVirtualScreenCoordinates(const ExactModelCoordinate &map_coords)
Transforms given point from map coordinates to virtual screen coordinates.
void resetLightingColor()
Resets lighting color.
void setZToYEnabled(bool enabled)
Sets z to y manipulation enabled / disabled.
void resetRenderers()
resets active layer information on all renderers.
void setTilt(double tilt)
Sets tilt for the camera.
void resetOverlayAnimation()
Resets the animation overlay.
Interface to class owning the renderers Used to get correct subclass of renderer in scripting side (v...
void setId(const std::string &id)
Sets the identifier for this camera.
void attach(Instance *instance)
Attaches the camera to an instance.
double getTilt() const
Gets camera tilt.
Point3D getZOffset(Layer *layer)
Gets a point that contain the visual z(z=1) difference, based on the given layer. ...
DoubleMatrix m_screen_2_vscreen
std::vector< uint8_t > getOverlayColor()
Returns a vector that contain the overlay color.
void setRotation(double rotation)
Sets rotation for the camera.
void resetOverlayColor()
Resets the color overlay.
void onRendererEnabledChanged(RendererBase *renderer)
Renderer is enabled / disabled.
Camera(const std::string &id, Layer *layer, const Rect &viewport, RenderBackend *renderbackend)
Constructor Camera needs to be added to the view.
bool isEnabled()
Gets if camera is enabled / disabled.
Camera describes properties of a view port shown in the main screen Main screen can have multiple cam...
RendererBase * getRenderer(const std::string &name)
Gets renderer with given name.
std::map< std::string, RendererBase * > m_renderers
void addRenderer(RendererBase *renderer)
Adds new renderer on the view.
double getOriginalZToY() const
Gets original zToY transformation value.
std::map< Layer *, LayerCache * > m_cache
const Rect & getViewPort() const
Gets the viewport for camera in pixel coordinates.
void onRendererPipelinePositionChanged(RendererBase *renderer)
Renderer's pipeline position has been changed.
void setLocation(const Location &location)
Sets the location for camera.
Base class for all view renderers View renderer renders one aspect of the view shown on screen...
t_layer_to_instances m_layer_to_instances
void removeLayer(Layer *layer)
double getZoom() const
Gets camera zoom.
void setLightingColor(float red, float green, float blue)
Sets lighting color.
Location & getLocationRef()
Gets a reference to the camera location.
void resetOverlayImage()
Resets the image overlay.
std::map< Layer *, RenderList > t_layer_to_instances
void detach()
Detaches the camera from an instance.
void renderOverlay()
Renders the overlay(color, image, animation) for the camera.
const Rect & getMapViewPort()
Gets the viewport for camera in map coordinates.
RendererListener allows reaction to changes in renderer Having this implemented via callback mechanis...
void addLayer(Layer *layer)
AnimationPtr getOverlayAnimation()
Returns an AnimationPtr to the overlay animation.
virtual ~Camera()
Destructor.
const std::string & getId() const
Gets the identifier for this camera.
void refresh()
Refreshes camera view in case e.g.
void updateReferenceScale()
Updates camera reference scale Reference scale is in a sense an internal zooming factor, which adjusts cell dimensions in logical space to ones shown on screen.
Point getCellImageDimensions()
Gets screen cell image dimensions.
bool isUpdated()
Returns true if camera view has been updated, otherwise false.
ScreenPoint toScreenCoordinates(const ExactModelCoordinate &map_coords)
Transforms given point from map coordinates to screen coordinates.
std::map< Layer *, Point > m_image_dimensions
bool m_mapViewPortUpdated
void getMatchingInstances(ScreenPoint screen_coords, Layer &layer, std::list< Instance * > &instances, uint8_t alpha=0)
Returns instances that match given screen coordinate.
Location getLocation() const
Gets the location camera is rendering.
void calculateZValue(ScreenPoint &screen_coords)
calculates z-value for given screenpoint
ExactModelCoordinate toMapCoordinates(ScreenPoint screen_coords, bool z_calculated=true)
Transforms given point from screen coordinates to map coordinates.
double getReferenceScale() const
Gets reference scale for cell image dimensions.
void setOverlayAnimation(AnimationPtr anim, bool fill=false)
Sets a animation as overlay, if fill is true the animation gets the viewport size.
void renderStaticLayer(Layer *layer, bool update)
Renders the layer part that is on screen as one image.
DoubleMatrix m_vscreen_2_screen
Point3D getOrigin() const
Gets screen point for the camera location.
void update()
General update routine.
std::vector< float > m_light_colors
void setCellImageDimensions(uint32_t width, uint32_t height)
Sets screen cell image dimensions.
void setViewPort(const Rect &viewport)
Sets the viewport for camera viewport is rectangle inside the view where camera renders.
MapObserver * m_map_observer
DoublePoint3D screenToVirtualScreen(const ScreenPoint &p)
void setEnabled(bool enabled)
Sets camera enabled / disabled.
SDL_Color m_overlay_color
double getZToY() const
Gets zToY value.
void render()
Renders camera.
An Instance is an "instantiation" of an Object at a Location.
void updateRenderLists()
Updates camera RenderLists.
ScreenPoint virtualScreenToScreen(const DoublePoint3D &p)
std::vector< float > getLightingColor()
Returns a vector that contain the light color.
uint32_t m_screen_cell_width
double getRotation() const
Gets camera rotation.
Point getRealCellDimensions(Layer *layer)
Gets real cell image dimensions for given layer.
Rect getLayerViewPort(Layer *layer)
Gets the viewport for camera in layer coordinates.
void setZoom(double zoom)
Sets zoom for the camera.