indexing description: "Objects that ..." author: "" date: "$Date$" revision: "$Revision$" class EM_2D_PROC_TEXTURE_GENERATOR inherit EM_2D_PROC_FIELD_GENERATOR rename set_field_dimension as set_texture_dimension, generate_field as generate_texture, start_generating_field as start_generating_texture, continue_generating_field as continue_generating_texture, last_field as last_texture, field_internal as texture_internal, store_field_value as store_texture_value, field_dimension as texture_dimension redefine last_texture, texture_internal end EM_SHARED_BITMAP_FACTORY create make feature -- Access last_texture: EM3D_TEXTURE_2D[EMGL_FORMAT_RGBA] is -- return the last created texture do Result := texture_internal end feature {NONE} -- Implementation -- Currently a bitmap is generated and then a texture from that -- TODO: generate a texture directly (will be necessary for 3d textures too) store_texture_value(pos: EM_VECTOR2I; value: DOUBLE) is -- store 'value' at (x, y) in the bitmap using the color mapper do color_mapper.compute_color (value) if (color_mapper.is_last_color_grayscale) then bitmap_internal.set_pixel_value (pos.x, pos.y, color_mapper.last_grayscale) else bitmap_internal.set_pixel(pos.x, pos.y, color_mapper.last_color) end end on_start is do bitmap_factory.create_empty_bitmap (texture_dimension.x, texture_dimension.y) bitmap_internal := bitmap_factory.last_bitmap bitmap_internal.lock end on_finish is do bitmap_internal.unlock create texture_internal.make_from_surface (bitmap_internal) end bitmap_internal: EM_BITMAP texture_internal: EM3D_TEXTURE_2D[EMGL_FORMAT_RGBA] end