22 #ifndef FIFE_VIEW_CAMERA_H 23 #define FIFE_VIEW_CAMERA_H
void setPosition(const ExactModelCoordinate &position)
Sets map point for the camera.
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
RenderBackend * m_renderbackend
DoubleMatrix m_vs_inverse_matrix
const std::string & getId() const
Gets the identifier for this camera.
Map * getMap()
Gets the map where camera is bound.
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.
void calculateZValue(DoublePoint3D &screen_coords)
calculates z-value for given screenpoint
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
void setOverlayColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
Sets a color as overlay.
uint32_t m_screenCellHeight
RenderList & getRenderListRef(Layer *layer)
Returns reference to RenderList.
DoublePoint3D toVirtualScreenCoordinates(const ExactModelCoordinate &map_coords)
Transforms given point from map coordinates to virtual screen coordinates.
double getZToY() const
Gets zToY value.
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.
Camera(const std::string &id, Map *map, const Rect &viewport, RenderBackend *renderbackend)
Constructor Camera needs to be added to the view.
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.
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.
t_layer_to_instances m_layerToInstances
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...
void getMatchingInstances(ScreenPoint screen_coords, Layer &layer, std::list< Instance *> &instances, uint8_t alpha=0)
Returns instances that match given screen coordinate.
RendererBase * getRenderer(const std::string &name)
Gets renderer with given name.
uint32_t m_screenCellWidth
std::map< std::string, RendererBase * > m_renderers
void addRenderer(RendererBase *renderer)
Adds new renderer on the view.
std::map< Layer *, LayerCache * > m_cache
double getReferenceScaleX() const
Gets x reference scale for cell image dimensions.
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...
void removeLayer(Layer *layer)
double getRotation() const
Gets camera rotation.
void setLightingColor(float red, float green, float blue)
Sets lighting color.
void resetOverlayImage()
Resets the image overlay.
double getOriginalZToY() const
Gets original zToY transformation value.
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.
double getZoom() const
Gets camera zoom.
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.
const Rect & getViewPort() const
Gets the viewport for camera in pixel coordinates.
virtual ~Camera()
Destructor.
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.
double getTilt() const
Gets camera tilt.
bool m_mapViewPortUpdated
ExactModelCoordinate m_position
ExactModelCoordinate toMapCoordinates(ScreenPoint screen_coords, bool z_calculated=true)
Transforms given point from screen coordinates to map coordinates.
double getReferenceScaleY() const
Gets y 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.
Location getLocation()
Gets the location camera is rendering.
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 of the camera.
void update()
General update routine.
Instance * getAttached() const
Returns instance where camera is attached.
std::vector< float > m_light_colors
DoublePoint getLogicalCellDimensions()
Gets logical cell image dimensions and ignores the layer and cellgrid.
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)
Transforms given point from screen coordinates to virtual screen coordinates.
void setEnabled(bool enabled)
Sets camera enabled / disabled.
SDL_Color m_overlay_color
ExactModelCoordinate getPosition() const
Gets map point of the camera.
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)
Transforms given point from virtual screen coordinates to screen coordinates.
std::vector< float > getLightingColor()
Returns a vector that contain the light color.
bool isZToYEnabled() const
Gets if z to y manipulation is enabled / disabled.
Rect getLayerViewPort(Layer *layer)
Gets the viewport for camera in layer coordinates.
void setZoom(double zoom)
Sets zoom for the camera.