Need bump map example for libgdx - android

I'm trying to figure out how to use a bump map. I can add one to a model but nothing happens, probably need to turn on some config option. Please point me to a working example.
I only got this far:
matPlaceholder = new Material(ColorAttribute.createDiffuse(com.badlogic.gdx.graphics.Color.RED), new TextureAttribute(TextureAttribute.Bump, texBump);

You can add it, but the default shader doesn't do Bump Mapping yet.
There are plans of having a composite shader that does that and more. But as far as I know, it isn't ready. You need to write your own shader for that.
There is some good shaders here. Like Normal Mapping. You can give them a try.

Related

Changing SymbolLayer properties on click when using a VectorSource

I've been following this guide provided by Mapbox to familiarize myself with SymbolLayers and how to manipulate their properties on the map.
https://blog.mapbox.com/a-guide-to-the-android-symbollayer-api-5daac7b66f2c
The key step I'm having issues with is Step 5 where they update the iconSize property onMapClick. After they add a property to the selected Feature, the guide says to call source.setGeoJson(featureCollection); in order to reset the source of the layer.
The project I'm working with uses a VectorSource as the source of data for the SampleLayer, not a GeoJsonSource like the example uses. The problem is that VectorSource doesn't provide a method like setGeoJson so I'm not able to reset the layer source after I change the property.
What can I do to work around this without having to change all of our source data?
for (Feature feature : featureCollection.getFeatures() {
if (feature.getStringProperty("title").equals(selectedFeature.getStringProperty("title"))) {
feature.getProperties().addProperty("selected", true);
}
}
source.setGeoJson(featureCollection);
The full source of that example can be found here: https://github.com/mapbox/mapbox-android-demo/blob/286f33d848c9fea48de908b144682081961b986b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/labs/SymbolLayerMapillaryActivity.java
For anyone coming across this issue in the future, the only possible approach here would be to remove and add layer again, with the updated source. This is however an ineffective solution, so it would really be better for you to use GeoJson source instead.

Android ArCore Sceneform API. How to change textures in runtime?

The server has more than 3000 models and each of them has several colors of material. I need to load separately models and textures and set textures depending on the user's choice. How to change baseColorMap, normalMap, metallicMap, roughnessMap in runtime?
after
modelRenderable.getMaterial().setTexture("normalMap", normalMap.get());
nothing happens
I'm doing something wrong. There is no information in documentation for that.
thank you for posting this question.
setTexture() appears to not work: Unfortunately this part of our API is still a little rough; it works but is very easy to get wrong. We're working on a sample to illustrate how to modify material parameters (including textures) at runtime and will improve our error reporting in the next release.
Thousands of models w/ multiple permutations how?: The plan here has two parts:
The binaries used by the Android Studio plugin will be made available for use in build scripts on server platforms. This will allow you to do a server-side conversion of your assets to .sfb. We'll be releasing a blog post soon on how to do this.
The .sfa will get the ability to contain loose textures and materials not explicitly associated with geometry, and .sfa's will be able to declare data dependencies on other .sfa's. This will mean that you can author (and deliver) .sfb's that contain textures/materials (but no geometry) and .sfb's that contain geometry (but no textures/materials), and if they're both available at instantiation time it will just work.
use this code`
CompletableFuture<Texture> futureTexture = Texture.builder()
.setSource(this, R.drawable.shoes)
.build();
and replace with
/*.thenAccept(renderable -> andyRenderable = renderable)*/
.thenAcceptBoth(futureTexture, (renderable, texture) -> {
andyRenderable = renderable;
andyRenderable.getMaterial().setTexture("baseColor", texture);
})
would work.

Android TeeChart Line Chart Touch Sensitivity

I realized that the Line Chart Drag Point is not really sensitive and it is difficult to select a point to drag. Aside from that, occasionally might trigger the wrong point. I wanted to ask is there workaround can solve this issue? I checked the example code the DragPoint basically selects the entire Line but not the point (I guess?). Other than that, TeeChart is a great library for charts! Any comments and answers will be highly appreciated.
Line seriesLine;
seriesLine = new Line(chart.getChart());
seriesLine.fillSampleValues(5);
SeriesPointer tmpPointer = seriesLine.getPointer();
tmpPointer.setInflateMargins(true);
tmpPointer.setVisible(true);
tmpPointer.setVertSize(10);
tmpPointer.setHorizSize(10);
DragPoint toolDragPoint;
toolDragPoint = new DragPoint(seriesLine);
toolDragPoint.setStyle(DragPointStyle.BOTH);
You are right. It seems the pointer isn't clickable&draggable.
I've found the fix for the problem here also fixes this. So I've applied the same fix for the Java version.
This will be available with the next maintenance release.

AndEngine astar pathfinding

Could anyone give me an example of source code which uses astar pathfinding algorithm with AndEngine on the TMXTiledMap. I am using AndEngine downloaded from https://github.com/nicolasgramlich/AndEngine.
Any suggestion would be appreciated. Thanks!
This is the official TMXTiledMapExample, but it doesn't contain A* pathfinding. It can teach you about tiled maps, though.
Here is another example from the forums which does contain it. It isn't really an example, but the pathfinding code provided there works. I don't think there is any real example of A* pathfinding, never seen any tutorial of it (The best way to learn is to read the code yourself. Better take a look at AStarPathFinder.java code).
The important parts for you in the forum post are are (lines):
123: Initializing the AStarPathFinder
205 - 213: Converting screen/scene coordinates to map tiles and using the pathfinder.
224: The method loadPathFound - using the path returned by the pathfinder to move an entity.
The MyMap class in the third post.

andengine tilemap respawn

i'm starting to developt a android game using AndEngine gles2, it's a really good game engine and i found a lots of example of how use it. My game is a kind of RPG traditional game using tiled maps, sprite, etc.: my issue is how i can set a mounster respawn area(like the long grass areas on pokemon games) i read a lots of tile map example but in no one appears examples about this, i using a tiled map editor and there i can set properties to the layers and especify there if is a mounster respawn area or not, if can someone tell me how can i do this i will appreaciate so much.
Are you using the tilemapeditor found here:
http://www.mapeditor.org/
(note, you need to save it with the correct compression type or otherwise andengine will not parse it correctly, cant remember which one I got working but it takes a few minutes to try out).
Then you can rightclick on a specific tile and add properties to it such as:
IsMonsterSpawnArea value = true
Then you can check for "collision" with
if(pTMXTileProperties.containsTMXProperty("IsMonsterSpawnArea ", "true")) {
// SPAWN BIG UGLY MONSTER(or initiate fight!)
}
Check out the andengine TMX examples found in the andengine source, they can really help you get started.

Categories

Resources