20 #include "../geometry.h"
21 #include "../bitmap/bitmap_access.h"
22 #include "../bitmap/interpolation.h"
23 #include "../bitmap/internal_bitmap.h"
24 #include "../bitmap/tools.h"
25 #include "../exception.h"
26 #include "../gpu/pipeline.h"
122 if (
scene ==
nullptr)
238 outputMapping(FIT_WIDTH_TO_TOP),
240 outputPixelsFetching(false),
241 eventListener(nullptr)
A very basic class for any image.
const ImageResolution getSize() const
Returns the bitmap resolution within ImageResolution object.
2x3 affine mapping containing a 2x2 matrix and a 2D point
void setCenterPosition(const Point &newPos)
Adjusts the mapping origin so that the center of the axes box matches a given point.
AffineMapping getInverse() const
Returns inverse mapping.
void unlock(AbstractBitmap *bitmap)
Drops a lock to the bitmap.
void writeLock(GraphicPipeline *gpu, AbstractBitmap *bitmap, ProcessingTarget target)
Locks content of a bitmap for writing using a specific processing target device.
void unlockAll()
Unlocks all the locked bitmaps unconditionally.
void scale(numeric factor)
void paveBackground(GraphicPipeline *gpu, TextureHandler &content, GL::TextureHandler *output)
Fills background with a repeated texture taking 1 pixel of this texture per 1 pixel of the output.
Internal low-level GPU control API.
void switchMode(Mode mode)
Switches GPU mode.
const ImageResolution & getDisplayResolution() const
void pullPixels(AbstractBitmap &bitmap)
Transfers bitmap pixels from GPU to CPU.
void bindOutput(AbstractBitmap &bitmap)
Binds a bitmap to the pipeline output.
@ RENDERING
Textures are images to be blended together to produce another image.
void unbindOutput()
Unbinds a bitmap from output and switches to screen.
GL::RenderingPrograms & getRenderingPrograms()
unsigned int getWidth() const
float getAspectRatio() const
unsigned int getHeight() const
float getInvAspectRatio() const
virtual void onRenderingStart()=0
Stores the rendering context: current program, current mapping in the scene space,...
void setMapping(const AffineMapping &mapping)
void lockBitmap(AbstractBitmap *bitmap)
bool getOutputPixelsFetching() const
Reports whether the output bitmap pixels are automatically offloaded from GPU to CPU memory every tim...
bool process(TaskThread &thread)
Executes the task on CPU within a given thread.
RenderingContext::EventListener * eventListener
void setScene(Scene *scene)
AffineMapping outputCoords
the actual output mapping used during the last rendering
OutputMapping
Scene coordinates to output (screen or bitmap) pixel coordinates mapping.
@ STRETCH
output viewport covers entirely the scene axis span, aspect ratio is not preserved in general
@ FIT_HEIGHT
height is covered entirely, width is resized to keep aspect ratio, point (0.5, 0.5) is mapped to the ...
@ FIT_WIDTH
width is covered entirely, height is resized to keep aspect ratio, point (0.5, 0.5) is mapped to the ...
@ FIT_WIDTH_TO_TOP
width is covered entirely, height is resized to keep aspect ratio, the top borders are aligned
int referenceWidth
value overriding output width for elements that have their size in pixels, in order to render a resol...
void resetOutput()
Removes a bitmap from the renderer output, if any, and switches to on-screen rendering.
void setOutputPixelsFetching(bool fetch)
Specifies whether the output image data is pulled from GPU to CPU memory every time the rendering is ...
void setOutputMapping(const OutputMapping mapping)
Specifies the output mapping specifying how the scene coordinates [0,1]² are mapped to the output (sc...
ImageResolution resolution
last rendered resolution
AbstractBitmap * output
output bitmap
bool processOnGPU(GraphicPipeline &gpu, TaskThread &thread)
Executes the task on GPU.
Scene * scene
content to render
void setRenderingEventListener(RenderingContext::EventListener *eventListener)
bool outputPixelsFetching
if true, the output bitmap data is fetched from GPU to CPU RAM every time the rendering is done
static const unsigned int MAX_RECURSION_LEVEL
void setOutput(AbstractBitmap *bitmap)
Attaches a bitmap to the renderer output.
const Scene * getScene() const
void setBackgroundImage(AbstractBitmap *)
Sets an image to pave the background.
Scene::Layer * pickLayer(float x, float y, bool inPixels) const
Retrieves a scene layer visible at a given point, if any.
OutputMapping outputMapping
specifies how the scene coordinates [0,1] are mapped to the output (screen or bitmap)
void beforeProcessing(ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu)
Instruction called before the task is executed.
void renderLayer(RenderingContext &context, TaskThread &thread, Scene::Layer &layer, const AffineMapping &base, unsigned int recursionLevel=0)
GL::TextureHandler * cameraFrame
last got camera frame; set to NULL before rendering, then asked from outside through eventListener
OutputMapping getOutputMapping() const
Retrieves the output mapping specifying how the scene coordinates [0,1]² are mapped to the output (sc...
int getOutputReferenceWidth() const
bool doRender(GraphicPipeline &gpu, TaskThread &thread)
AbstractBitmap * background
used to pave the screen before rendering
AbstractBitmap * getOutput() const
void setOutputReferenceWidth(int newWidth)
Sets a value overriding output width for elements that have their size in pixels, in order to render ...
Abstract scene layer having name, type, geometry and some content to display.
@ SceneLayer
layer containing a scene
bool isVisible() const
Returns layer visibility flag.
virtual void render(RenderingContext &context)
AffineMapping & getMapping()
LayerType & castTo() const
Layer containing an entire scene.
An ordered set of layers representing a renderable content.
Layer * getLayer(const char *name) const
Retrieves a layer by its name or null if not found.
int getLayerCount() const
Returns total number of layers in the scene.
virtual bool isTaskAborted() const =0
Returns true if the task is asked to stop from outside.
unsigned char ThreadIndex
number of threads / thread index
CustomPoint< float > Point
JNIEnv jlong jint background
jobject jlong jint jint y
Beatmup::InternalBitmap * bitmap
Beatmup::Scene::Layer * layer
Beatmup::IntPoint p((int) x,(int) y)
return $pool getJavaReference & scene(index)