16 #include "config_awesomium.h"
17 #include "WebBrowserTexture.h"
34 _aw_web_view = copy._aw_web_view;
35 _update_active = copy._update_active;
36 _flip_texture_active = copy._flip_texture_active;
45 WebBrowserTexture::WebBrowserTexture(
const string &name,
AwWebView* aw_web_view):
48 _flip_texture_active(false)
74 bool WebBrowserTexture::get_keep_ram_image()
const {
84 void WebBrowserTexture::do_reload_ram_image() {
114 _aw_web_view = aw_web_view;
137 _update_active = active_flag;
148 return _update_active;
166 _flip_texture_active = active_flag;
176 return _flip_texture_active;
190 if( !_update_active )
return true;
191 if( _aw_web_view == NULL )
return true;
194 if( !_aw_web_view->is_dirty() )
return true;
205 ((
WebBrowserTexture*)
this)->setup_2d_texture( _aw_web_view->get_width(), _aw_web_view->get_height(), T_unsigned_byte, F_rgba );
211 unsigned char* cp_data = ram_image.
p();
213 _aw_web_view->render((
void*)cp_data,
get_x_size()*4, 4);
215 if(_flip_texture_active){
220 for(
size_t i=0; i < height/2; i++){
221 for(
size_t j=0; j < width; j++){
222 unsigned char tmp[4];
223 size_t a_pos = j+width*i;
224 size_t b_pos = j + width*(height-i-1);
225 memcpy(tmp,&cp_data[4*a_pos], 4);
226 memcpy(&cp_data[4*a_pos], &cp_data[4*b_pos], 4);
227 memcpy(&cp_data[4*b_pos], tmp, 4);
void set_flip_texture_active(bool active_flag)
This toggles on/off automatic flipping of the of the texture at a source level.
const Element * p() const
Function p() is similar to the function from ConstPointerTo.
virtual ~WebBrowserTexture()
Standard destructor...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
bool get_update_active() const
Gets whether or not this texture is updating itself every time it is rendered.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
virtual bool has_cull_callback() const
Should be overridden by derived classes to return true if cull_callback() has been defined...
void set_update_active(bool active_flag)
Gives the ability to toggle updating this texture or not.
void set_magfilter(FilterType filter)
Sets the filtering method that should be used when viewing the texture up close.
void set_web_view(AwWebView *aw_web_view)
Sets the internal AwWebView of this texture.
AwWebView * get_web_view() const
Gets the current internal AwWebView of this texture.
TextureType get_texture_type() const
Returns the overall interpretation of the texture.
Thin bindings, wraps a WebView * returned from WebCore.createWebView.
void set_minfilter(FilterType filter)
Sets the filtering method that should be used when viewing the texture from a distance.
bool get_flip_texture_active() const
Returns whether automatic texture flipping is enabled.
TypeHandle is the identifier used to differentiate C++ class types.
int get_y_size() const
Returns the height of the texture image in texels.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
int get_x_size() const
Returns the width of the texture image in texels.
A Wrapper class for Awesomium webview.
virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const
This function will be called during the cull traversal to update the WebBrowserTexture.