Renderer for drawing the World with OpenGL. More...
Classes | |
interface | FpsUpdatable |
interface | GLSnapshotCallback |
Callback to get notified when the snapshot of the OpenGL view is taken. More... | |
Public Member Functions | |
ARRenderer () | |
ARRenderer constructor. | |
void | rotateView (int surfaceRotation) |
Set the rotation of the device: Surface.ROTATION_0 Surface.ROTATION_90 Surface.ROTATION_180 Surface.ROTATION_270 More... | |
void | setWorld (World world) |
Define the world where the objects are stored. More... | |
World | getWorld () |
Get the World used for by the ARRenderer. More... | |
void | setCameraPosition (Point3 newCameraPos) |
Change the camera position. More... | |
void | restoreCameraPosition () |
Restore the camera position. | |
Point3 | getCameraPosition () |
Get the camera position. More... | |
void | onDrawFrame (GL10 gl) |
void | setPullCloserDistance (float maxDistanceSize) |
When a GeoObject is rendered according to its position it could look very small if it is far away. More... | |
float | getPullCloserDistance () |
Get the max distance which a GeoObject will be rendered. More... | |
void | setPushAwayDistance (float minDistanceSize) |
When a GeoObject is rendered according to its position it could look very big if it is too close. More... | |
float | getPushAwayDistance () |
Get the minimum distance which a GeoObject will be rendered. More... | |
void | setFpsUpdatable (FpsUpdatable fpsUpdatable) |
Set the FpsUpdatable to get notified about the frames per seconds. More... | |
void | setOnBeyondarObjectRenderedListener (OnBeyondarObjectRenderedListener rendererTracker) |
void | fillBeyondarObjectScreenPositions (BeyondarObject beyondarObject) |
Use this method to fill all the screen positions of the BeyondarObject. More... | |
void | tackePicture (GLSnapshotCallback callBack) |
Take an snapshot of the view. More... | |
void | onSurfaceChanged (GL10 gl, int width, int height) |
void | onSurfaceCreated (GL10 gl, EGLConfig config) |
void | loadBeyondarObjectTexture (GL10 gl, BeyondarObject geoObject) |
Load the textures of the specified geoObject. More... | |
Texture | loadBitmapTexture (GL10 gl, Bitmap btm, String uri) |
Load the Texture from a Bitmap. More... | |
boolean | isTextureLoaded (Bitmap bitmap) |
Check if the bitmap texture object is loaded. More... | |
boolean | isTextureObjectLoaded (String uri) |
Check if the image URI has been loaded as a texture. More... | |
Texture | getTexture (String uri) |
Get a copy of the texture pointer for the specified URI. More... | |
Texture | load2DTexture (GL10 gl, Bitmap bitmap) |
Create the texture for the specified Bitmap. More... | |
void | onSensorChanged (float[] filteredValues, SensorEvent event) |
void | getViewRay (float x, float y, Ray ray) |
Get a view Ray for the screen position (x,y). More... | |
void | getScreenCoordinates (Point3 position, Point3 outPoint) |
Get the screen position of a given Point3. More... | |
void | getScreenCoordinates (Point3 position, Point3 outPoint, float[] eye) |
Get the screen position of a given Point3. More... | |
void | getScreenCoordinates (float x, float y, float z, Point3 outPoint, float[] eye) |
Get the screen position of a given Point3. More... | |
void | setRendering (boolean render) |
Specify if the ARRenderer should render the world. More... | |
boolean | isRendering () |
Get known if the ARRenderer is rendering the world. More... | |
void | onExternalBitmapLoaded (BitmapCache cache, String url, Bitmap btm) |
This method is called when an external image (such as a network image) is loaded and stored in the cache. More... | |
void | forceFillBeyondarObjectPositions (boolean fill) |
Use this method to fill all the screen positions of the BeyondarObject when a object is rendered. More... | |
void | addPlugin (GLPlugin plugin) |
boolean | removePlugin (GLPlugin plugin) |
void | removeAllPlugins () |
GLPlugin | getFirstPlugin (Class<?extends GLPlugin > pluginClass) |
boolean | containsAnyPlugin (Class<?extends GLPlugin > pluginClass) |
boolean | containsPlugin (GLPlugin plugin) |
List< GLPlugin > | getAllPlugins (Class<?extends GLPlugin > pluginClass, List< GLPlugin > result) |
List< GLPlugin > | getAllPugins (Class<?extends GLPlugin > pluginClass) |
List< GLPlugin > | getAllPlugins () |
void | onPause () |
Called when the application is paused. | |
void | onResume () |
Called when the application is resumed. | |
void | setMaxDistanceToRender (float meters) |
Set the distance (in meters) which the app will draw the objects. More... | |
float | getMaxDistanceToRender () |
Get the distance (in meters) which the AR view will draw the objects. More... | |
void | setDistanceFactor (float factor) |
Set the distance factor for rendering all the objects. More... | |
float | getDistanceFactor () |
Get the distance factor. More... | |
Static Public Attributes | |
static final float | DEFAULT_MAX_AR_VIEW_DISTANCE = 100 |
The default maximum distance that the object will be displayed (meters) in the AR view. | |
static final float | DEFAULT_DISTANCE_FACTOR = 2 |
static float | Z_FAR = 400.0f |
Specifies the distance from the viewer to the far clipping plane. More... | |
static final double | TIMEOUT_LOAD_TEXTURE = 1500 |
Protected Member Functions | |
Bitmap | savePixels (GL10 gl) |
Generate a new bitmap from the gl. More... | |
void | convertGPStoPoint3 (GeoObject geoObject, Point3 out) |
Convert the geolocation to gl points representation. More... | |
void | renderWorld (GL10 gl, long time) |
Render the World. More... | |
void | renderList (GL10 gl, BeyondarObjectList list, long time) |
Render a specific list. More... | |
void | renderBeyondarObject (GL10 gl, BeyondarObject beyondarObject, Texture defaultTexture, long time) |
Render a specific BeyondarObject. More... | |
void | loadAdditionalTextures (GL10 gl) |
Override this method to load additional textures. More... | |
Protected Attributes | |
List< GLPlugin > | plugins |
List of loaded plugins. More... | |
Object | lockPlugins = new Object() |
Lock to synchronize the access to the plugins. More... | |
Renderer for drawing the World with OpenGL.
|
protected |
Convert the geolocation to gl points representation.
geoObject | The GeoObject to be processed. |
out | Where the results be stored. |
void com.beyondar.android.opengl.renderer.ARRenderer.fillBeyondarObjectScreenPositions | ( | BeyondarObject | beyondarObject | ) |
Use this method to fill all the screen positions of the BeyondarObject.
After this method is called you can use the following:
BeyondarObject.getScreenPositionBottomLeft()
BeyondarObject.getScreenPositionBottomRight()
BeyondarObject.getScreenPositionTopLeft()
BeyondarObject.getScreenPositionTopRight()
beyondarObject | The BeyondarObject to compute |
void com.beyondar.android.opengl.renderer.ARRenderer.forceFillBeyondarObjectPositions | ( | boolean | fill | ) |
Use this method to fill all the screen positions of the BeyondarObject when a object is rendered.
Remember that the information is filled when the object is rendered, so it is asynchronous.
After this method is called you can use the following:
BeyondarObject.getScreenPositionBottomLeft()
BeyondarObject.getScreenPositionBottomRight()
BeyondarObject.getScreenPositionTopLeft()
BeyondarObject.getScreenPositionTopRight()
Important Enabling this feature will reduce the FPS, use only when is needed.
fill | Enable or disable this feature. |
Point3 com.beyondar.android.opengl.renderer.ARRenderer.getCameraPosition | ( | ) |
Get the camera position.
float com.beyondar.android.opengl.renderer.ARRenderer.getDistanceFactor | ( | ) |
Get the distance factor.
float com.beyondar.android.opengl.renderer.ARRenderer.getMaxDistanceToRender | ( | ) |
Get the distance (in meters) which the AR view will draw the objects.
float com.beyondar.android.opengl.renderer.ARRenderer.getPullCloserDistance | ( | ) |
Get the max distance which a GeoObject will be rendered.
float com.beyondar.android.opengl.renderer.ARRenderer.getPushAwayDistance | ( | ) |
Get the minimum distance which a GeoObject will be rendered.
void com.beyondar.android.opengl.renderer.ARRenderer.getScreenCoordinates | ( | Point3 | position, |
Point3 | outPoint | ||
) |
Get the screen position of a given Point3.
position | The 3D position to transform to a screen coordinates. |
outPoint | The object where the result will be stored. |
void com.beyondar.android.opengl.renderer.ARRenderer.getScreenCoordinates | ( | Point3 | position, |
Point3 | outPoint, | ||
float[] | eye | ||
) |
Get the screen position of a given Point3.
position | The 3D position to transform to a screen coordinates. |
outPoint | The object where the result will be stored. |
eye | Array where the eye position will be stored to do the calculations. |
void com.beyondar.android.opengl.renderer.ARRenderer.getScreenCoordinates | ( | float | x, |
float | y, | ||
float | z, | ||
Point3 | outPoint, | ||
float[] | eye | ||
) |
Get the screen position of a given Point3.
x | The 3D position (x) to transform to a screen coordinates. |
y | The 3D position (y) to transform to a screen coordinates. |
z | The 3D position (z) to transform to a screen coordinates. |
outPoint | The object where the result will be stored. |
eye | Array where the eye position will be stored to do the calculations. |
Texture com.beyondar.android.opengl.renderer.ARRenderer.getTexture | ( | String | uri | ) |
Get a copy of the texture pointer for the specified URI.
uri |
void com.beyondar.android.opengl.renderer.ARRenderer.getViewRay | ( | float | x, |
float | y, | ||
Ray | ray | ||
) |
World com.beyondar.android.opengl.renderer.ARRenderer.getWorld | ( | ) |
Get the World used for by the ARRenderer.
boolean com.beyondar.android.opengl.renderer.ARRenderer.isRendering | ( | ) |
Get known if the ARRenderer is rendering the world.
boolean com.beyondar.android.opengl.renderer.ARRenderer.isTextureLoaded | ( | Bitmap | bitmap | ) |
Check if the bitmap texture object is loaded.
To check if the Texture has been loaded with a pointer, use Texture.isLoaded()
bitmap |
boolean com.beyondar.android.opengl.renderer.ARRenderer.isTextureObjectLoaded | ( | String | uri | ) |
Check if the image URI has been loaded as a texture.
To check if the Texture has any GL texture pointer use Texture.isLoaded()
uri |
Texture com.beyondar.android.opengl.renderer.ARRenderer.load2DTexture | ( | GL10 | gl, |
Bitmap | bitmap | ||
) |
Create the texture for the specified Bitmap.
Important The method will recycle the bitmap after being used.
gl | |
bitmap |
|
protected |
Override this method to load additional textures.
Use the following code to help you:
loadTexture(gl, yourBitmap)
This method is called when the surface is created.
gl |
void com.beyondar.android.opengl.renderer.ARRenderer.loadBeyondarObjectTexture | ( | GL10 | gl, |
BeyondarObject | geoObject | ||
) |
Load the textures of the specified geoObject.
gl | |
geoObject | The object to load the textures. |
Texture com.beyondar.android.opengl.renderer.ARRenderer.loadBitmapTexture | ( | GL10 | gl, |
Bitmap | btm, | ||
String | uri | ||
) |
void com.beyondar.android.opengl.renderer.ARRenderer.onExternalBitmapLoaded | ( | BitmapCache | cache, |
String | url, | ||
Bitmap | btm | ||
) |
This method is called when an external image (such as a network image) is loaded and stored in the cache.
cache | The cache that contains this bitmap. |
url | The URL that identify the bitmap |
btm | The Bitmap loaded |
Implements com.beyondar.android.util.cache.BitmapCache.OnExternalBitmapLoadedCacheListener.
|
protected |
Render a specific BeyondarObject.
gl | |
beyondarObject | BeyondarObject to render. |
defaultTexture | If the texture from the BeyondarObject is not available the defaultTexure will be used. |
|
protected |
Render a specific list.
gl | |
list | List to render. |
time | Time mark to be used for drawing the frame. |
|
protected |
Render the World.
gl | |
time | Time mark to be used for drawing the frame. |
void com.beyondar.android.opengl.renderer.ARRenderer.rotateView | ( | int | surfaceRotation | ) |
Set the rotation of the device:
Surface.ROTATION_0
Surface.ROTATION_90
Surface.ROTATION_180
Surface.ROTATION_270
surfaceRotation |
|
protected |
Generate a new bitmap from the gl.
gl |
void com.beyondar.android.opengl.renderer.ARRenderer.setCameraPosition | ( | Point3 | newCameraPos | ) |
Change the camera position.
It is independent to the GPS position.
newCameraPos | The new camera position |
void com.beyondar.android.opengl.renderer.ARRenderer.setDistanceFactor | ( | float | factor | ) |
Set the distance factor for rendering all the objects.
As bigger the factor the closer the objects.
factor | number bigger than 0. |
void com.beyondar.android.opengl.renderer.ARRenderer.setFpsUpdatable | ( | FpsUpdatable | fpsUpdatable | ) |
Set the FpsUpdatable to get notified about the frames per seconds.
fpsUpdatable | The event listener. Use null to remove the FpsUpdatable |
void com.beyondar.android.opengl.renderer.ARRenderer.setMaxDistanceToRender | ( | float | meters | ) |
Set the distance (in meters) which the app will draw the objects.
meters |
void com.beyondar.android.opengl.renderer.ARRenderer.setPullCloserDistance | ( | float | maxDistanceSize | ) |
When a GeoObject is rendered according to its position it could look very small if it is far away.
Use this method to render far objects as if there were closer.
For instance if there is an object at 100 meters and we want to have everything at least at 25 meters, we could use this method for that purpose.
To set it to the default behavior just set it to 0
maxDistanceSize | The top far distance (in meters) which we want to draw a GeoObject , 0 to set again the default behavior |
void com.beyondar.android.opengl.renderer.ARRenderer.setPushAwayDistance | ( | float | minDistanceSize | ) |
When a GeoObject is rendered according to its position it could look very big if it is too close.
Use this method to render near objects as if there were farther.
For instance if there is an object at 1 meters and we want to have everything at least at 10 meters, we could use this method for that purpose.
To set it to the default behavior just set it to 0
minDistanceSize | The top near distance (in meters) which we want to draw a GeoObject , 0 to set again the default behavior |
void com.beyondar.android.opengl.renderer.ARRenderer.setRendering | ( | boolean | render | ) |
Specify if the ARRenderer should render the world.
render |
void com.beyondar.android.opengl.renderer.ARRenderer.setWorld | ( | World | world | ) |
Define the world where the objects are stored.
world |
void com.beyondar.android.opengl.renderer.ARRenderer.tackePicture | ( | GLSnapshotCallback | callBack | ) |
Take an snapshot of the view.
The callback will be notified when the picture is ready.
callBack |
|
protected |
Lock to synchronize the access to the plugins.
Use it to modify the loaded plugins.
|
protected |
List of loaded plugins.
|
static |
Specifies the distance from the viewer to the far clipping plane.
Used for the GLU.gluPerspective