|
FIFE
|
Camera describes properties of a view port shown in the main screen Main screen can have multiple cameras active simultanously Different cameras can have different properties, like location to shoot, zoom or tilt. More...
#include <camera.h>
Inheritance diagram for FIFE::Camera:
Collaboration diagram for FIFE::Camera:Public Types | |
| enum | TransformType { NoneTransform = 0x00, TiltTransform = 0x01, RotationTransform = 0x02, ZoomTransform = 0x04, PositionTransform = 0x08, ZTransform = 0x10 } |
| typedef uint32_t | Transform |
Public Member Functions | |
| Camera (const std::string &id, Layer *layer, const Rect &viewport, RenderBackend *renderbackend) | |
| Constructor Camera needs to be added to the view. More... | |
| virtual | ~Camera () |
| Destructor. More... | |
| const std::string & | getId () const |
| Gets the identifier for this camera. More... | |
| void | setId (const std::string &id) |
| Sets the identifier for this camera. More... | |
| void | setTilt (double tilt) |
| Sets tilt for the camera. More... | |
| double | getTilt () const |
| Gets camera tilt. More... | |
| void | setRotation (double rotation) |
| Sets rotation for the camera. More... | |
| double | getRotation () const |
| Gets camera rotation. More... | |
| void | setZoom (double zoom) |
| Sets zoom for the camera. More... | |
| double | getZoom () const |
| Gets camera zoom. More... | |
| double | getOriginalZToY () const |
| Gets original zToY transformation value. More... | |
| void | setZToY (double zToY) |
| Sets zToY value for the camera and enables their use. More... | |
| double | getZToY () const |
| Gets zToY value. More... | |
| void | setZToYEnabled (bool enabled) |
| Sets z to y manipulation enabled / disabled. More... | |
| bool | isZToYEnabled () const |
| Gets if z to y manipulation is enabled / disabled. More... | |
| void | setCellImageDimensions (uint32_t width, uint32_t height) |
| Sets screen cell image dimensions. More... | |
| Point | getCellImageDimensions () |
| Gets screen cell image dimensions. More... | |
| Point | getCellImageDimensions (Layer *layer) |
| Gets screen cell image dimensions for given layer. More... | |
| double | getReferenceScaleX () const |
| Gets x reference scale for cell image dimensions. More... | |
| double | getReferenceScaleY () const |
| Gets y reference scale for cell image dimensions. More... | |
| Point3D | getZOffset (Layer *layer) |
| Gets a point that contain the visual z(z=1) difference, based on the given layer. More... | |
| void | setLocation (const Location &location) |
| Sets the location for camera. More... | |
| Location | getLocation () const |
| Gets the location camera is rendering. More... | |
| Point3D | getOrigin () const |
| Gets screen point for the camera location. More... | |
| Location & | getLocationRef () |
| Gets a reference to the camera location. More... | |
| void | attach (Instance *instance) |
| Attaches the camera to an instance. More... | |
| void | detach () |
| Detaches the camera from an instance. More... | |
| Instance * | getAttached () const |
| Returns instance where camera is attached. More... | |
| void | setViewPort (const Rect &viewport) |
| Sets the viewport for camera viewport is rectangle inside the view where camera renders. More... | |
| const Rect & | getViewPort () const |
| Gets the viewport for camera in pixel coordinates. More... | |
| const Rect & | getMapViewPort () |
| Gets the viewport for camera in map coordinates. More... | |
| Rect | getLayerViewPort (Layer *layer) |
| Gets the viewport for camera in layer coordinates. More... | |
| ExactModelCoordinate | toMapCoordinates (ScreenPoint screen_coords, bool z_calculated=true) |
| Transforms given point from screen coordinates to map coordinates. More... | |
| ScreenPoint | toScreenCoordinates (const ExactModelCoordinate &map_coords) |
| Transforms given point from map coordinates to screen coordinates. More... | |
| DoublePoint3D | toVirtualScreenCoordinates (const ExactModelCoordinate &map_coords) |
| Transforms given point from map coordinates to virtual screen coordinates. More... | |
| ScreenPoint | virtualScreenToScreen (const DoublePoint3D &p) |
| Transforms given point from virtual screen coordinates to screen coordinates. More... | |
| DoublePoint3D | screenToVirtualScreen (const ScreenPoint &p) |
| Transforms given point from screen coordinates to virtual screen coordinates. More... | |
| void | setEnabled (bool enabled) |
| Sets camera enabled / disabled. More... | |
| bool | isEnabled () |
| Gets if camera is enabled / disabled. More... | |
| RenderList & | getRenderListRef (Layer *layer) |
| Returns reference to RenderList. More... | |
| void | getMatchingInstances (ScreenPoint screen_coords, Layer &layer, std::list< Instance * > &instances, uint8_t alpha=0) |
| Returns instances that match given screen coordinate. More... | |
| void | getMatchingInstances (Rect screen_rect, Layer &layer, std::list< Instance * > &instances, uint8_t alpha=0) |
| Returns instances that match given screen coordinate. More... | |
| void | getMatchingInstances (Location &loc, std::list< Instance * > &instances, bool use_exactcoordinates=false) |
| Returns instances that match given location. More... | |
| void | update () |
| General update routine. More... | |
| void | refresh () |
| Refreshes camera view in case e.g. More... | |
| void | resetUpdates () |
| Resets temporary values from last update round, like warped flag. More... | |
| bool | isUpdated () |
| Returns true if camera view has been updated, otherwise false. More... | |
| void | addRenderer (RendererBase *renderer) |
| Adds new renderer on the view. More... | |
| RendererBase * | getRenderer (const std::string &name) |
| Gets renderer with given name. More... | |
| void | resetRenderers () |
| resets active layer information on all renderers. More... | |
| void | calculateZValue (ScreenPoint &screen_coords) |
| calculates z-value for given screenpoint More... | |
| void | onRendererPipelinePositionChanged (RendererBase *renderer) |
| Renderer's pipeline position has been changed. More... | |
| void | onRendererEnabledChanged (RendererBase *renderer) |
| Renderer is enabled / disabled. More... | |
| void | setLightingColor (float red, float green, float blue) |
| Sets lighting color. More... | |
| void | resetLightingColor () |
| Resets lighting color. More... | |
| std::vector< float > | getLightingColor () |
| Returns a vector that contain the light color. More... | |
| void | setOverlayColor (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) |
| Sets a color as overlay. More... | |
| std::vector< uint8_t > | getOverlayColor () |
| Returns a vector that contain the overlay color. More... | |
| void | resetOverlayColor () |
| Resets the color overlay. More... | |
| void | setOverlayImage (int32_t id, bool fill=false) |
| Sets a image as overlay, if fill is true the image gets the viewport size. More... | |
| int32_t | getOverlayImage () |
| Returns the pool id of the overlay image. More... | |
| void | resetOverlayImage () |
| Resets the image overlay. More... | |
| void | setOverlayAnimation (AnimationPtr anim, bool fill=false) |
| Sets a animation as overlay, if fill is true the animation gets the viewport size. More... | |
| AnimationPtr | getOverlayAnimation () |
| Returns an AnimationPtr to the overlay animation. More... | |
| void | resetOverlayAnimation () |
| Resets the animation overlay. More... | |
| void | render () |
| Renders camera. More... | |
Public Member Functions inherited from FIFE::IRendererListener | |
| virtual | ~IRendererListener () |
Public Member Functions inherited from FIFE::IRendererContainer | |
| virtual | ~IRendererContainer () |
Private Member Functions | |
| void | addLayer (Layer *layer) |
| void | removeLayer (Layer *layer) |
| void | updateMap (Map *map) |
| void | updateMatrices () |
| Updates the camera transformation matrix T with requested values. More... | |
| 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. More... | |
| void | updateRenderLists () |
| Updates camera RenderLists. More... | |
| DoublePoint | getLogicalCellDimensions (Layer *layer) |
| Gets logical cell image dimensions for given layer. More... | |
| Point | getRealCellDimensions (Layer *layer) |
| Gets real cell image dimensions for given layer. More... | |
| void | renderOverlay () |
| Renders the overlay(color, image, animation) for the camera. More... | |
| void | renderStaticLayer (Layer *layer, bool update) |
| Renders the layer part that is on screen as one image. More... | |
Friends | |
| class | MapObserver |
Camera describes properties of a view port shown in the main screen Main screen can have multiple cameras active simultanously Different cameras can have different properties, like location to shoot, zoom or tilt.
| typedef uint32_t FIFE::Camera::Transform |
| FIFE::Camera::Camera | ( | const std::string & | id, |
| Layer * | layer, | ||
| const Rect & | viewport, | ||
| RenderBackend * | renderbackend | ||
| ) |
Constructor Camera needs to be added to the view.
If not done so, it is not rendered.
| id | identifier for the camera |
| layer | layer where camera is bound. Camera is bound to a layer for two reasons:
|
| viewport | used viewport for the camera. Viewport is measured in pixels in relation to game main screen |
| renderbackend | to use with rendering |
Definition at line 80 of file camera.cpp.
References m_map, m_map_observer, m_viewport, MapObserver, FIFE::Location::setLayer(), and setLocation().
|
virtual |
Destructor.
Definition at line 123 of file camera.cpp.
References m_map_observer, m_renderers, and updateMap().
|
private |
Definition at line 752 of file camera.cpp.
References m_cache, m_layerToInstances, and refresh().
Referenced by FIFE::MapObserver::onLayerCreate(), updateMap(), and updateRenderLists().
Here is the caller graph for this function:| void FIFE::Camera::addRenderer | ( | RendererBase * | renderer | ) |
Adds new renderer on the view.
Ownership is transferred to the camera.
Definition at line 717 of file camera.cpp.
References FIFE::RendererBase::getName(), FIFE::RendererBase::isEnabled(), m_pipeline, m_renderers, FIFE::pipelineSort(), and FIFE::RendererBase::setRendererListener().
Referenced by FIFE::Map::addCamera().
Here is the caller graph for this function:| void FIFE::Camera::attach | ( | Instance * | instance | ) |
Attaches the camera to an instance.
| instance | Instance to which the camera shall be attached |
Definition at line 672 of file camera.cpp.
References FIFE::_log, FL_WARN, FIFE::Layer::getId(), FIFE::Location::getLayer(), FIFE::Instance::getLocation(), m_attachedto, and m_location.
| void FIFE::Camera::calculateZValue | ( | ScreenPoint & | screen_coords | ) |
calculates z-value for given screenpoint
Definition at line 414 of file camera.cpp.
References FIFE::Location::getMapCoordinates(), m_location, m_tilt, FIFE::Math< T >::pi(), FIFE::Math< T >::Tan(), toScreenCoordinates(), FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by toMapCoordinates().
Here is the caller graph for this function:| void FIFE::Camera::detach | ( | ) |
Detaches the camera from an instance.
Definition at line 681 of file camera.cpp.
References m_attachedto.
|
inline |
Returns instance where camera is attached.
NULL if not attached
Definition at line 221 of file camera.h.
References m_attachedto.
| Point FIFE::Camera::getCellImageDimensions | ( | ) |
Gets screen cell image dimensions.
Definition at line 271 of file camera.cpp.
References FIFE::Location::getLayer(), and m_location.
Gets screen cell image dimensions for given layer.
Definition at line 275 of file camera.cpp.
References FIFE::Location::getLayer(), getLogicalCellDimensions(), m_image_dimensions, m_location, m_referenceScaleX, m_referenceScaleY, m_screen_cell_height, m_screen_cell_width, FIFE::PointType2D< T >::x, and FIFE::PointType2D< T >::y.
|
inline |
Gets the viewport for camera in layer coordinates.
| layer | A pointer to the layer whose geometry is used for the conversion |
Definition at line 340 of file camera.cpp.
References ABS, FIFE::Location::getLayerCoordinates(), getMapViewPort(), FIFE::RectType< T >::h, FIFE::Location::setMapCoordinates(), FIFE::RectType< T >::w, FIFE::RectType< T >::x, FIFE::PointType3D< T >::x, FIFE::RectType< T >::y, and FIFE::PointType3D< T >::y.
Referenced by FIFE::CellRenderer::render().
Here is the caller graph for this function:| std::vector< float > FIFE::Camera::getLightingColor | ( | ) |
Returns a vector that contain the light color.
Definition at line 774 of file camera.cpp.
References m_light_colors.
| Location FIFE::Camera::getLocation | ( | ) | const |
Gets the location camera is rendering.
Definition at line 291 of file camera.cpp.
References m_location.
| Location & FIFE::Camera::getLocationRef | ( | ) |
Gets a reference to the camera location.
Definition at line 295 of file camera.cpp.
References m_location.
|
private |
Gets logical cell image dimensions for given layer.
Definition at line 444 of file camera.cpp.
References FIFE::Matrix< T >::applyRotate(), FIFE::Layer::getCellGrid(), FIFE::CellGrid::getVertices(), FIFE::Matrix< T >::loadRotate(), m_rotation, m_tilt, and FIFE::CellGrid::toMapCoordinates().
Referenced by getCellImageDimensions(), and updateReferenceScale().
Here is the caller graph for this function:| const Rect & FIFE::Camera::getMapViewPort | ( | ) |
Gets the viewport for camera in map coordinates.
Definition at line 307 of file camera.cpp.
References ABS, FIFE::RectType< T >::h, m_mapViewPort, m_mapViewPortUpdated, m_viewport, toMapCoordinates(), FIFE::RectType< T >::w, FIFE::RectType< T >::x, FIFE::PointType3D< T >::x, FIFE::RectType< T >::y, and FIFE::PointType3D< T >::y.
Referenced by getLayerViewPort(), and FIFE::LayerCache::update().
Here is the caller graph for this function:| void FIFE::Camera::getMatchingInstances | ( | ScreenPoint | screen_coords, |
| Layer & | layer, | ||
| std::list< Instance * > & | instances, | ||
| uint8_t | alpha = 0 |
||
| ) |
Returns instances that match given screen coordinate.
| screen_coords | screen coordinates to be used for hit search |
| layer | layer to use for search |
| instances | list of instances that is filled based on hit test results |
| alpha | the alpha to use to filter the matching instances. Pixels that have an alpha value higher than what is specified here are considered a hit. |
Definition at line 530 of file camera.cpp.
References FIFE::RectType< T >::contains(), FIFE::RenderItem::dimensions, FIFE::Math< T >::Equal(), FIFE::Image::forceLoadInternal(), FIFE::RenderItem::getAnimationOverlay(), FIFE::Image::getHeight(), FIFE::Image::getPixelRGBA(), FIFE::Image::getWidth(), FIFE::RectType< T >::h, FIFE::RenderItem::image, FIFE::Image::isSharedImage(), m_layerToInstances, m_zoom, FIFE::RectType< T >::w, FIFE::RectType< T >::x, FIFE::PointType3D< T >::x, FIFE::RectType< T >::y, and FIFE::PointType3D< T >::y.
| void FIFE::Camera::getMatchingInstances | ( | Rect | screen_rect, |
| Layer & | layer, | ||
| std::list< Instance * > & | instances, | ||
| uint8_t | alpha = 0 |
||
| ) |
Returns instances that match given screen coordinate.
| screen_rect | rect that contains screen coordinates to be used for search |
| layer | layer to use for search |
| instances | list of instances that is filled based on hit test results |
| alpha | the alpha to use to filter the matching instances. Pixels that have an alpha value higher than what is specified here are considered a hit. |
Definition at line 585 of file camera.cpp.
References FIFE::RectType< T >::contains(), FIFE::RenderItem::dimensions, FIFE::Math< T >::Equal(), FIFE::Image::forceLoadInternal(), FIFE::RenderItem::getAnimationOverlay(), FIFE::Image::getHeight(), FIFE::Image::getPixelRGBA(), FIFE::Image::getWidth(), FIFE::RectType< T >::h, FIFE::RenderItem::image, FIFE::RectType< T >::intersects(), FIFE::Image::isSharedImage(), m_layerToInstances, m_zoom, FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.
| void FIFE::Camera::getMatchingInstances | ( | Location & | loc, |
| std::list< Instance * > & | instances, | ||
| bool | use_exactcoordinates = false |
||
| ) |
Returns instances that match given location.
Instances are sorted based on camera view, so that "topmost" instance is first in returned list
| loc | location where to fetch instances from |
| instances | list of instances that is filled based on hit test results |
| use_exactcoordinates | if true, comparison is done using exact coordinates. if not, cell coordinates are used |
Definition at line 648 of file camera.cpp.
References FIFE::Location::getExactLayerCoordinatesRef(), FIFE::Location::getLayer(), FIFE::Location::getLayerCoordinates(), FIFE::Instance::getLocationRef(), and m_layerToInstances.
| Point3D FIFE::Camera::getOrigin | ( | ) | const |
Gets screen point for the camera location.
Definition at line 364 of file camera.cpp.
References m_cur_origo.
| double FIFE::Camera::getOriginalZToY | ( | ) | const |
Gets original zToY transformation value.
Definition at line 176 of file camera.cpp.
References FIFE::Matrix< T >::applyRotate(), FIFE::Matrix< T >::applyTranslate(), FIFE::Layer::getCellGrid(), FIFE::Location::getLayer(), FIFE::Location::getMapCoordinates(), FIFE::Matrix< T >::loadScale(), FIFE::Matrix< T >::m9, m_location, m_referenceScaleX, m_referenceScaleY, m_rotation, m_tilt, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
| AnimationPtr FIFE::Camera::getOverlayAnimation | ( | ) |
Returns an AnimationPtr to the overlay animation.
Definition at line 841 of file camera.cpp.
References m_ani_ptr.
| std::vector< uint8_t > FIFE::Camera::getOverlayColor | ( | ) |
Returns a vector that contain the overlay color.
Definition at line 796 of file camera.cpp.
References m_col_overlay, and m_overlay_color.
| int32_t FIFE::Camera::getOverlayImage | ( | ) |
Returns the pool id of the overlay image.
Definition at line 821 of file camera.cpp.
References m_img_id, and m_img_overlay.
Gets real cell image dimensions for given layer.
Definition at line 478 of file camera.cpp.
References ABS, FIFE::Layer::getCellGrid(), toScreenCoordinates(), FIFE::PointType3D< T >::x, and FIFE::PointType3D< T >::y.
|
inline |
Gets x reference scale for cell image dimensions.
Definition at line 176 of file camera.h.
References m_referenceScaleX.
|
inline |
Gets y reference scale for cell image dimensions.
Definition at line 180 of file camera.h.
References m_referenceScaleY.
|
virtual |
Gets renderer with given name.
Implements FIFE::IRendererContainer.
Definition at line 741 of file camera.cpp.
References m_renderers.
Referenced by FIFE::InstanceRenderer::renderAlreadySorted(), and FIFE::InstanceRenderer::renderUnsorted().
Here is the caller graph for this function:| RenderList & FIFE::Camera::getRenderListRef | ( | Layer * | layer | ) |
Returns reference to RenderList.
Definition at line 526 of file camera.cpp.
References m_layerToInstances.
Referenced by FIFE::LayerCache::removeInstance().
Here is the caller graph for this function:| double FIFE::Camera::getRotation | ( | ) | const |
Gets camera rotation.
Definition at line 157 of file camera.cpp.
References m_rotation.
Referenced by FIFE::LayerCache::sortRenderList(), and FIFE::LayerCache::updateVisual().
Here is the caller graph for this function:| double FIFE::Camera::getTilt | ( | ) | const |
Gets camera tilt.
Definition at line 145 of file camera.cpp.
References m_tilt.
| const Rect & FIFE::Camera::getViewPort | ( | ) | const |
Gets the viewport for camera in pixel coordinates.
Definition at line 303 of file camera.cpp.
References m_viewport.
Referenced by FIFE::CellRenderer::createFowMap(), FIFE::GridRenderer::render(), FIFE::CoordinateRenderer::render(), FIFE::BlockingInfoRenderer::render(), FIFE::CellRenderer::render(), FIFE::LightRendererImageInfo::render(), FIFE::LightRendererAnimationInfo::render(), FIFE::GenericRendererImageInfo::render(), FIFE::GenericRendererAnimationInfo::render(), FIFE::LightRendererResizeInfo::render(), FIFE::GenericRendererTextInfo::render(), FIFE::GenericRendererResizeInfo::render(), render(), FIFE::LayerCache::update(), and FIFE::LayerCache::updateEntries().
Here is the caller graph for this function:Gets a point that contain the visual z(z=1) difference, based on the given layer.
Definition at line 499 of file camera.cpp.
References FIFE::Layer::getCellGrid(), toScreenCoordinates(), FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
| double FIFE::Camera::getZoom | ( | ) | const |
Gets camera zoom.
Definition at line 172 of file camera.cpp.
References m_zoom.
Referenced by FIFE::CellRenderer::addImageToMap(), FIFE::RendererNode::getCalculatedPoint(), FIFE::LayerCache::LayerCache(), FIFE::CoordinateRenderer::render(), FIFE::CellRenderer::render(), FIFE::LightRendererImageInfo::render(), FIFE::LightRendererAnimationInfo::render(), FIFE::LightRendererSimpleLightInfo::render(), FIFE::GenericRendererImageInfo::render(), FIFE::GenericRendererAnimationInfo::render(), FIFE::LightRendererResizeInfo::render(), FIFE::GenericRendererTextInfo::render(), FIFE::GenericRendererResizeInfo::render(), and FIFE::LayerCache::update().
Here is the caller graph for this function:| double FIFE::Camera::getZToY | ( | ) | const |
Gets zToY value.
Definition at line 200 of file camera.cpp.
References m_zToY.
| bool FIFE::Camera::isEnabled | ( | ) |
Gets if camera is enabled / disabled.
Definition at line 360 of file camera.cpp.
References m_enabled.
|
inline |
Returns true if camera view has been updated, otherwise false.
Definition at line 334 of file camera.h.
References m_updated.
Referenced by FIFE::CellRenderer::render().
Here is the caller graph for this function:| bool FIFE::Camera::isZToYEnabled | ( | ) | const |
Gets if z to y manipulation is enabled / disabled.
Definition at line 208 of file camera.cpp.
References m_enabledZToY.
|
virtual |
Renderer is enabled / disabled.
Implements FIFE::IRendererListener.
Definition at line 730 of file camera.cpp.
References FIFE::_log, FL_LOG, FIFE::RendererBase::getName(), FIFE::RendererBase::isEnabled(), m_pipeline, m_renderers, and FIFE::pipelineSort().
|
virtual |
Renderer's pipeline position has been changed.
Implements FIFE::IRendererListener.
Definition at line 726 of file camera.cpp.
References m_pipeline, and FIFE::pipelineSort().
| void FIFE::Camera::refresh | ( | ) |
Refreshes camera view in case e.g.
location is updated directly (not via setLocation)
Definition at line 699 of file camera.cpp.
References m_transform, RotationTransform, and updateMatrices().
Referenced by addLayer(), and removeLayer().
Here is the caller graph for this function:
|
private |
Definition at line 759 of file camera.cpp.
References m_cache, m_layerToInstances, and refresh().
Referenced by FIFE::MapObserver::onLayerDelete(), and updateMap().
Here is the caller graph for this function:| void FIFE::Camera::render | ( | ) |
Renders camera.
Definition at line 984 of file camera.cpp.
References FIFE::Map::getLayers(), FIFE::RenderBackend::getLightingModel(), FIFE::Location::getMap(), getViewPort(), m_cache, m_layerToInstances, m_light_colors, m_lighting, m_location, m_pipeline, m_renderbackend, m_updated, m_viewport, FIFE::MAX_BATCH_SIZE, FIFE::RenderBackend::popClipArea(), FIFE::RenderBackend::pushClipArea(), renderOverlay(), renderStaticLayer(), FIFE::RenderBackend::renderVertexArrays(), FIFE::RenderBackend::resetLighting(), FIFE::RenderBackend::resetStencilBuffer(), FIFE::RenderBackend::setLighting(), and updateRenderLists().
|
private |
Renders the overlay(color, image, animation) for the camera.
Definition at line 850 of file camera.cpp.
References FIFE::RenderBackend::fillRectangle(), FIFE::SharedPtr< T >::get(), FIFE::ImageManager::get(), FIFE::Animation::getDuration(), FIFE::Animation::getFrameByTimestamp(), FIFE::Image::getHeight(), FIFE::TimeManager::getTime(), FIFE::Image::getWidth(), FIFE::RectType< T >::h, FIFE::DynamicSingleton< ImageManager >::instance(), FIFE::DynamicSingleton< TimeManager >::instance(), m_ani_fill, m_ani_overlay, m_ani_ptr, m_col_overlay, m_img_fill, m_img_id, m_img_overlay, m_overlay_color, m_renderbackend, m_start_time, m_viewport, FIFE::Image::render(), FIFE::scaleTime(), FIFE::RectType< T >::w, FIFE::PointType2D< T >::x, FIFE::RectType< T >::x, FIFE::PointType2D< T >::y, and FIFE::RectType< T >::y.
Referenced by render().
Here is the caller graph for this function:
|
private |
Renders the layer part that is on screen as one image.
Definition at line 905 of file camera.cpp.
References FIFE::RenderBackend::attachRenderTarget(), FIFE::RenderBackend::detachRenderTarget(), FIFE::SharedPtr< T >::get(), FIFE::LayerCache::getCacheImage(), FIFE::RenderBackend::getHeight(), FIFE::Layer::getId(), FIFE::RenderBackend::getName(), FIFE::RectType< T >::h, FIFE::DynamicSingleton< ImageManager >::instance(), FIFE::ImageManager::loadBlank(), m_cache, m_id, m_layerToInstances, m_pipeline, m_renderbackend, m_viewport, FIFE::MAX_BATCH_SIZE, FIFE::RenderBackend::popClipArea(), FIFE::RenderBackend::pushClipArea(), FIFE::RenderBackend::renderVertexArrays(), FIFE::LayerCache::setCacheImage(), and FIFE::RectType< T >::w.
Referenced by render().
Here is the caller graph for this function:| void FIFE::Camera::resetLightingColor | ( | ) |
Resets lighting color.
Definition at line 783 of file camera.cpp.
References m_lighting, m_renderbackend, and FIFE::RenderBackend::resetLighting().
| void FIFE::Camera::resetOverlayAnimation | ( | ) |
Resets the animation overlay.
Definition at line 845 of file camera.cpp.
References m_ani_overlay, m_ani_ptr, and FIFE::SharedPtr< T >::reset().
| void FIFE::Camera::resetOverlayColor | ( | ) |
| void FIFE::Camera::resetOverlayImage | ( | ) |
Resets the image overlay.
Definition at line 829 of file camera.cpp.
References m_img_id, and m_img_overlay.
| void FIFE::Camera::resetRenderers | ( | ) |
resets active layer information on all renderers.
Definition at line 745 of file camera.cpp.
References m_renderers.
| void FIFE::Camera::resetUpdates | ( | ) |
Resets temporary values from last update round, like warped flag.
Definition at line 704 of file camera.cpp.
References m_transform, m_updated, and NoneTransform.
Referenced by updateRenderLists().
Here is the caller graph for this function:| DoublePoint3D FIFE::Camera::screenToVirtualScreen | ( | const ScreenPoint & | p | ) |
Transforms given point from screen coordinates to virtual screen coordinates.
Definition at line 440 of file camera.cpp.
References FIFE::intPt2doublePt(), and m_screen_2_vscreen.
Referenced by FIFE::LayerCache::update().
Here is the caller graph for this function:| void FIFE::Camera::setCellImageDimensions | ( | uint32_t | width, |
| uint32_t | height | ||
| ) |
Sets screen cell image dimensions.
Cell image dimension is basically width and height of a bitmap, that covers one cell in the layer where camera is bind
Definition at line 212 of file camera.cpp.
References m_screen_cell_height, m_screen_cell_width, m_transform, PositionTransform, updateMatrices(), and updateReferenceScale().
Referenced by FIFE::MapLoader::load().
Here is the caller graph for this function:| void FIFE::Camera::setEnabled | ( | bool | enabled | ) |
|
inline |
| void FIFE::Camera::setLightingColor | ( | float | red, |
| float | green, | ||
| float | blue | ||
| ) |
Sets lighting color.
Definition at line 766 of file camera.cpp.
References m_light_colors, and m_lighting.
| void FIFE::Camera::setLocation | ( | const Location & | location | ) |
Sets the location for camera.
| location | location (center point) to render |
Definition at line 220 of file camera.cpp.
References FIFE::Layer::getCellGrid(), FIFE::Location::getLayer(), FIFE::Location::getMap(), FIFE::Location::getMapCoordinates(), m_cur_origo, m_location, m_transform, PositionTransform, toScreenCoordinates(), updateMap(), and updateMatrices().
Referenced by Camera().
Here is the caller graph for this function:| void FIFE::Camera::setOverlayAnimation | ( | AnimationPtr | anim, |
| bool | fill = false |
||
| ) |
Sets a animation as overlay, if fill is true the animation gets the viewport size.
Definition at line 834 of file camera.cpp.
References m_ani_fill, m_ani_overlay, m_ani_ptr, and m_start_time.
| void FIFE::Camera::setOverlayColor | ( | uint8_t | red, |
| uint8_t | green, | ||
| uint8_t | blue, | ||
| uint8_t | alpha | ||
| ) |
Sets a color as overlay.
Definition at line 788 of file camera.cpp.
References m_col_overlay, and m_overlay_color.
| void FIFE::Camera::setOverlayImage | ( | int32_t | id, |
| bool | fill = false |
||
| ) |
Sets a image as overlay, if fill is true the image gets the viewport size.
Definition at line 815 of file camera.cpp.
References m_img_fill, m_img_id, and m_img_overlay.
| void FIFE::Camera::setRotation | ( | double | rotation | ) |
Sets rotation for the camera.
Rotation can be visualized by thinking camera that rotates around an object that it is rendering
| rotation | rotation for the camera |
Definition at line 149 of file camera.cpp.
References FIFE::Math< T >::Equal(), m_rotation, m_transform, RotationTransform, and updateMatrices().
Referenced by FIFE::MapLoader::load().
Here is the caller graph for this function:| void FIFE::Camera::setTilt | ( | double | tilt | ) |
Sets tilt for the camera.
e.g. overhead camera has tilt 0, while traditional isometric camera has tilt 45
| tilt | tilt for the camera |
Definition at line 136 of file camera.cpp.
References FIFE::Math< T >::Equal(), m_tilt, m_transform, TiltTransform, updateMatrices(), and updateReferenceScale().
Referenced by FIFE::MapLoader::load().
Here is the caller graph for this function:| void FIFE::Camera::setViewPort | ( | const Rect & | viewport | ) |
Sets the viewport for camera viewport is rectangle inside the view where camera renders.
| viewport | area for camera render |
Definition at line 299 of file camera.cpp.
References m_viewport.
| void FIFE::Camera::setZoom | ( | double | zoom | ) |
Sets zoom for the camera.
| zoom | zoom for the camera |
Definition at line 161 of file camera.cpp.
References FIFE::Math< T >::Equal(), m_transform, m_zoom, updateMatrices(), and ZoomTransform.
Referenced by FIFE::MapLoader::load().
Here is the caller graph for this function:| void FIFE::Camera::setZToY | ( | double | zToY | ) |
Sets zToY value for the camera and enables their use.
This means the factor which influenced the z to y transformation, so if you set zToY=32 then 1z corresponds to 32 pixels in y direction.
| zToY | influenced the z to y transformation of the camera. |
Definition at line 191 of file camera.cpp.
References FIFE::Math< T >::Equal(), m_enabledZToY, m_transform, m_zToY, updateMatrices(), and ZTransform.
Referenced by FIFE::MapLoader::load().
Here is the caller graph for this function:| void FIFE::Camera::setZToYEnabled | ( | bool | enabled | ) |
Sets z to y manipulation enabled / disabled.
| enabled | If true then the zToY value is used instead of the original matrix value. |
Definition at line 204 of file camera.cpp.
References m_enabledZToY.
| ExactModelCoordinate FIFE::Camera::toMapCoordinates | ( | ScreenPoint | screen_coords, |
| bool | z_calculated = true |
||
| ) |
Transforms given point from screen coordinates to map coordinates.
| screen_coords | screen coordinates to transform |
| z_calculated | if true, z-value (depth cut point) is pre-calculated. If false, camera calculates it |
Definition at line 419 of file camera.cpp.
References calculateZValue(), FIFE::intPt2doublePt(), and m_inverse_matrix.
Referenced by getMapViewPort(), and FIFE::CoordinateRenderer::render().
Here is the caller graph for this function:| ScreenPoint FIFE::Camera::toScreenCoordinates | ( | const ExactModelCoordinate & | map_coords | ) |
Transforms given point from map coordinates to screen coordinates.
Definition at line 426 of file camera.cpp.
References FIFE::doublePt2intPt(), and m_matrix.
Referenced by calculateZValue(), FIFE::RendererNode::getCalculatedPoint(), getRealCellDimensions(), getZOffset(), FIFE::GridRenderer::render(), FIFE::CoordinateRenderer::render(), FIFE::CellSelectionRenderer::render(), FIFE::BlockingInfoRenderer::render(), FIFE::CellRenderer::render(), FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::InstanceRenderer::renderUnsorted(), setLocation(), and FIFE::RenderVisitor::visit().
Here is the caller graph for this function:| DoublePoint3D FIFE::Camera::toVirtualScreenCoordinates | ( | const ExactModelCoordinate & | map_coords | ) |
Transforms given point from map coordinates to virtual screen coordinates.
Definition at line 431 of file camera.cpp.
References m_vs_matrix.
Referenced by FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::InstanceRenderer::renderUnsorted(), FIFE::LayerCache::update(), and FIFE::LayerCache::updatePosition().
Here is the caller graph for this function:| void FIFE::Camera::update | ( | ) |
General update routine.
In this function, the camera's position gets updated when its attached to another instance.
Definition at line 685 of file camera.cpp.
References FIFE::Math< T >::Equal(), FIFE::Location::getExactLayerCoordinates(), FIFE::Location::getExactLayerCoordinatesRef(), FIFE::Location::getLayer(), FIFE::Instance::getLocationRef(), m_attachedto, m_location, m_transform, PositionTransform, updateMatrices(), FIFE::PointType3D< T >::x, and FIFE::PointType3D< T >::y.
|
private |
Definition at line 250 of file camera.cpp.
References FIFE::Map::addChangeListener(), addLayer(), FIFE::Map::getLayers(), m_map, m_map_observer, FIFE::Map::removeChangeListener(), and removeLayer().
Referenced by setLocation(), and ~Camera().
Here is the caller graph for this function:
|
private |
Updates the camera transformation matrix T with requested values.
The requests are done using these functions :
Definition at line 368 of file camera.cpp.
References FIFE::Matrix< T >::applyRotate(), FIFE::Matrix< T >::applyScale(), FIFE::Matrix< T >::applyTranslate(), FIFE::Layer::getCellGrid(), FIFE::Location::getLayer(), FIFE::Location::getMapCoordinates(), FIFE::RectType< T >::h, FIFE::Matrix< T >::inverse(), FIFE::Matrix< T >::loadScale(), FIFE::Matrix< T >::m9, m_enabledZToY, m_inverse_matrix, m_location, m_mapViewPortUpdated, m_matrix, m_referenceScaleX, m_referenceScaleY, m_rotation, m_screen_2_vscreen, m_tilt, m_viewport, m_vs_inverse_matrix, m_vs_matrix, m_vscreen_2_screen, m_zoom, m_zToY, FIFE::Matrix< T >::mult4by4(), FIFE::RectType< T >::w, FIFE::RectType< T >::x, FIFE::PointType3D< T >::x, FIFE::RectType< T >::y, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by refresh(), setCellImageDimensions(), setLocation(), setRotation(), setTilt(), setZoom(), setZToY(), and update().
Here is the caller graph for this function:
|
private |
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.
Calculation is based on current camera properties (e.g. rotation)
Definition at line 513 of file camera.cpp.
References FIFE::_log, FL_DBG, FIFE::Location::getLayer(), getLogicalCellDimensions(), m_location, m_referenceScaleX, m_referenceScaleY, m_rotation, m_screen_cell_height, m_screen_cell_width, m_tilt, FIFE::PointType2D< T >::x, and FIFE::PointType2D< T >::y.
Referenced by setCellImageDimensions(), and setTilt().
Here is the caller graph for this function:
|
private |
Updates camera RenderLists.
Definition at line 959 of file camera.cpp.
References FIFE::_log, addLayer(), FL_ERR, FIFE::Map::getLayers(), FIFE::Location::getMap(), m_cache, m_layerToInstances, m_location, m_transform, NoneTransform, resetUpdates(), and FIFE::LayerCache::update().
Referenced by render().
Here is the caller graph for this function:| ScreenPoint FIFE::Camera::virtualScreenToScreen | ( | const DoublePoint3D & | p | ) |
Transforms given point from virtual screen coordinates to screen coordinates.
Definition at line 436 of file camera.cpp.
References FIFE::doublePt2intPt(), and m_vscreen_2_screen.
Referenced by FIFE::LayerCache::updateScreenCoordinate().
Here is the caller graph for this function:
|
friend |
|
private |
Definition at line 511 of file camera.h.
Referenced by renderOverlay(), and setOverlayAnimation().
|
private |
Definition at line 506 of file camera.h.
Referenced by renderOverlay(), resetOverlayAnimation(), and setOverlayAnimation().
|
private |
Definition at line 509 of file camera.h.
Referenced by getOverlayAnimation(), renderOverlay(), resetOverlayAnimation(), and setOverlayAnimation().
|
private |
|
private |
Definition at line 494 of file camera.h.
Referenced by addLayer(), removeLayer(), render(), renderStaticLayer(), and updateRenderLists().
|
private |
Definition at line 504 of file camera.h.
Referenced by getOverlayColor(), renderOverlay(), resetOverlayColor(), and setOverlayColor().
|
private |
Definition at line 468 of file camera.h.
Referenced by getOrigin(), and setLocation().
|
private |
Definition at line 476 of file camera.h.
Referenced by isEnabled(), and setEnabled().
|
private |
Definition at line 466 of file camera.h.
Referenced by isZToYEnabled(), setZToY(), setZToYEnabled(), and updateMatrices().
|
private |
Definition at line 415 of file camera.h.
Referenced by getId(), renderStaticLayer(), and setId().
Definition at line 479 of file camera.h.
Referenced by getCellImageDimensions().
|
private |
Definition at line 510 of file camera.h.
Referenced by renderOverlay(), and setOverlayImage().
|
private |
Definition at line 508 of file camera.h.
Referenced by getOverlayImage(), renderOverlay(), resetOverlayImage(), and setOverlayImage().
|
private |
Definition at line 505 of file camera.h.
Referenced by getOverlayImage(), renderOverlay(), resetOverlayImage(), and setOverlayImage().
|
private |
Definition at line 455 of file camera.h.
Referenced by toMapCoordinates(), and updateMatrices().
|
private |
Definition at line 492 of file camera.h.
Referenced by addLayer(), getMatchingInstances(), getRenderListRef(), removeLayer(), render(), renderStaticLayer(), and updateRenderLists().
|
private |
Definition at line 501 of file camera.h.
Referenced by getLightingColor(), render(), and setLightingColor().
|
private |
Definition at line 499 of file camera.h.
Referenced by render(), resetLightingColor(), and setLightingColor().
|
private |
Definition at line 467 of file camera.h.
Referenced by attach(), calculateZValue(), getCellImageDimensions(), getLocation(), getLocationRef(), getOriginalZToY(), render(), setLocation(), update(), updateMatrices(), updateReferenceScale(), and updateRenderLists().
|
private |
Definition at line 496 of file camera.h.
Referenced by Camera(), and updateMap().
|
private |
Definition at line 495 of file camera.h.
Referenced by Camera(), updateMap(), and ~Camera().
|
private |
Definition at line 470 of file camera.h.
Referenced by getMapViewPort().
|
private |
Definition at line 471 of file camera.h.
Referenced by getMapViewPort(), and updateMatrices().
|
private |
Definition at line 454 of file camera.h.
Referenced by toScreenCoordinates(), and updateMatrices().
|
private |
Definition at line 507 of file camera.h.
Referenced by getOverlayColor(), renderOverlay(), and setOverlayColor().
|
private |
Definition at line 485 of file camera.h.
Referenced by addRenderer(), onRendererEnabledChanged(), onRendererPipelinePositionChanged(), render(), and renderStaticLayer().
|
private |
Definition at line 474 of file camera.h.
Referenced by getCellImageDimensions(), getOriginalZToY(), getReferenceScaleX(), updateMatrices(), and updateReferenceScale().
|
private |
Definition at line 475 of file camera.h.
Referenced by getCellImageDimensions(), getOriginalZToY(), getReferenceScaleY(), updateMatrices(), and updateReferenceScale().
|
private |
Definition at line 489 of file camera.h.
Referenced by render(), renderOverlay(), renderStaticLayer(), and resetLightingColor().
|
private |
Definition at line 484 of file camera.h.
Referenced by addRenderer(), getRenderer(), onRendererEnabledChanged(), resetRenderers(), and ~Camera().
|
private |
Definition at line 463 of file camera.h.
Referenced by getLogicalCellDimensions(), getOriginalZToY(), getRotation(), setRotation(), updateMatrices(), and updateReferenceScale().
|
private |
Definition at line 460 of file camera.h.
Referenced by screenToVirtualScreen(), and updateMatrices().
|
private |
Definition at line 473 of file camera.h.
Referenced by getCellImageDimensions(), setCellImageDimensions(), and updateReferenceScale().
|
private |
Definition at line 472 of file camera.h.
Referenced by getCellImageDimensions(), setCellImageDimensions(), and updateReferenceScale().
|
private |
Definition at line 512 of file camera.h.
Referenced by renderOverlay(), and setOverlayAnimation().
|
private |
Definition at line 462 of file camera.h.
Referenced by calculateZValue(), getLogicalCellDimensions(), getOriginalZToY(), getTilt(), setTilt(), updateMatrices(), and updateReferenceScale().
|
private |
Definition at line 481 of file camera.h.
Referenced by refresh(), resetUpdates(), setCellImageDimensions(), setLocation(), setRotation(), setTilt(), setZoom(), setZToY(), update(), and updateRenderLists().
|
private |
Definition at line 487 of file camera.h.
Referenced by isUpdated(), render(), and resetUpdates().
|
private |
Definition at line 469 of file camera.h.
Referenced by Camera(), getMapViewPort(), getViewPort(), render(), renderOverlay(), renderStaticLayer(), setViewPort(), and updateMatrices().
|
private |
Definition at line 458 of file camera.h.
Referenced by updateMatrices().
|
private |
Definition at line 457 of file camera.h.
Referenced by toVirtualScreenCoordinates(), and updateMatrices().
|
private |
Definition at line 459 of file camera.h.
Referenced by updateMatrices(), and virtualScreenToScreen().
|
private |
Definition at line 464 of file camera.h.
Referenced by getMatchingInstances(), getZoom(), setZoom(), and updateMatrices().
|
private |
Definition at line 465 of file camera.h.
Referenced by getZToY(), setZToY(), and updateMatrices().