47 void LibRocketRenderInterface::RenderGeometry(Rocket::Core::Vertex* vertices,
int num_vertices,
int* indices,
int num_indices, Rocket::Core::TextureHandle texture,
const Rocket::Core::Vector2f& translation) {
51 geometryCallData.
vertices.reserve(num_vertices);
52 for(
int i = 0; i < num_vertices; i++) {
55 vertex.
position.
set(vertices[i].position.x, vertices[i].position.y);
56 vertex.
color.
set(vertices[i].colour.red, vertices[i].colour.green, vertices[i].colour.blue, vertices[i].colour.alpha);
57 vertex.
texCoords.
set(vertices[i].tex_coord.x, vertices[i].tex_coord.y);
59 geometryCallData.
vertices.push_back(vertex);
62 geometryCallData.
indices.reserve(num_indices);
63 for(
int i = 0; i < num_indices; i++) {
64 geometryCallData.
indices.push_back(indices[i]);
73 geometryCall.
callChain.push(geometryCallData);
78 geometryCall.
callChain.push(geometryCallData);
83 return (Rocket::Core::CompiledGeometryHandle) NULL;
128 std::string filename(source.CString());
134 texture_handle =
static_cast<Rocket::Core::TextureHandle
>(loadedTexture->getHandle());
135 texture_dimensions.x = loadedTexture->
getWidth();
136 texture_dimensions.y = loadedTexture->getHeight();
148 texture_handle =
static_cast<Rocket::Core::TextureHandle
>(generatedTexture->
getHandle());
196 for(; it != end; ++it) {
202 std::list<ResourceHandle> temp;
virtual bool GenerateTexture(Rocket::Core::TextureHandle &texture_handle, const Rocket::Core::byte *source, const Rocket::Core::Vector2i &source_dimensions)
Called by Rocket when a texture is required to be built from an internally-generated sequence of pixe...
Abstract interface for all the renderbackends.
RenderBackend * m_renderBackend
virtual bool exists(const std::string &name)
Checks to see if an Image exists.
virtual void ReleaseCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry)
Called by Rocket when it wants to release application-compiled geometry.
virtual void disableScissorTest()=0
Disables scissor test on the render backend.
virtual void renderGuiGeometry(const std::vector< GuiVertex > &vertices, const std::vector< int > &indices, const DoublePoint &translation, ImagePtr texture)=0
Renders geometry required by gui.
virtual ImagePtr get(const std::string &name)
Gets a shared pointer to the Image.
virtual void RenderCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry, const Rocket::Core::Vector2f &translation)
Called by Rocket when it wants to render application-compiled geometry.
virtual void ReleaseTexture(Rocket::Core::TextureHandle texture_handle)
Called by Rocket when a loaded texture is no longer required.
virtual void SetScissorRegion(int x, int y, int width, int height)
Called by Rocket when it wants to change the scissor region.
std::size_t ResourceHandle
std::list< ResourceHandle > m_freedTextures
void freeTextures()
Frees all textures that are no longer needed by librocket.
GeometryCallDataChain callChain
void set(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha)
Set all color channel values.
virtual Rocket::Core::CompiledGeometryHandle CompileGeometry(Rocket::Core::Vertex *vertices, int num_vertices, int *indices, int num_indices, Rocket::Core::TextureHandle texture)
Called by Rocket when it wants to compile geometry it believes will be static for the forseeable futu...
ImageManager * m_imageManager
void pushClipArea(const Rect &cliparea, bool clear=true)
Pushes clip area to clip stack Clip areas define which area is drawn on screen.
virtual void EnableScissorRegion(bool enable)
Called by Rocket when it wants to enable or disable scissoring to clip content.
std::vector< GuiVertex > vertices
virtual ~LibRocketRenderInterface()
Destructor.
std::queue< GeometryCall > m_geometryCalls
void popClipArea()
Pops clip area from clip stack.
virtual void enableScissorTest()=0
Enables scissor test on the render backend.
std::vector< int > indices
ResourceHandle textureHandle
virtual void setState(const ResourceState &state)
virtual bool LoadTexture(Rocket::Core::TextureHandle &texture_handle, Rocket::Core::Vector2i &texture_dimensions, const Rocket::Core::String &source)
Called by Rocket when a texture is required by the library.
virtual Image * createImage(IResourceLoader *loader=0)=0
virtual void RenderGeometry(Rocket::Core::Vertex *vertices, int num_vertices, int *indices, int num_indices, Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f &translation)
Called by Rocket when it wants to render geometry that it does not wish to optimise.
ResourceHandle getHandle()
void set(T _x, T _y)
Sets the x and y coordinate of the 2D point.
void render()
Renders librocket gui.
LibRocketRenderInterface()
Constructor.
uint32_t getWidth() const
virtual ImagePtr add(Image *res)
Add an Image to the manager.
virtual ImagePtr load(const std::string &name, IResourceLoader *loader=0)
Creates a blank resource and loads it from disk.