Android Example min3D framework Samples

Sample 1

A wrap for this Github project. Posting:
1. B4A sample project
2. Java Code - check the code inside the wrapper vs the Java sample code.
3. B4A lib files

A nice spinning earth with clouds where the earth is rotating faster than the clouds - a sample of Texture Offset.

1.png


The wrapper wraps the "RenderActivity" and then uses the sample code in the java sample project in methods "initScene" and "updateScene" inside the wrapper:

Sample code from ExampleTextureOffset.java:
    public void initScene()
    {
        Light light = new Light();
        light.ambient.setAll((short)64, (short)64, (short)64, (short)255);
        light.position.setAll(3, 3, 3);
        scene.lights().add(light);

        _earth = new Sphere(1.2f, 15, 10);
        scene.addChild(_earth);

        Bitmap b = Utils.makeBitmapFromResourceId(BA.applicationContext, R.drawable.earth);
        Shared.textureManager().addTextureId(b, "jupiter", false);
        b.recycle();

        b = Utils.makeBitmapFromResourceId(BA.applicationContext, R.drawable.clouds_alpha2b);
        Shared.textureManager().addTextureId(b, "clouds", false);
        b.recycle();

        TextureVo t = new TextureVo("jupiter");
        _earth.textures().add(t);

        _cloudTexture = new TextureVo("clouds");
        _cloudTexture.textureEnvs.get(0).param = GL10.GL_DECAL;
        _cloudTexture.repeatU = true; // .. this is the default, but just to be explicit

        _earth.textures().add(_cloudTexture);

        _count = 0;
    }
 
    @Override
    public void updateScene()
    {
        _earth.rotation().y += 1.0f;
     
        // Animate texture offset
        _cloudTexture.offsetU += 0.001f;    
     
        _count++;
    }

Change the wrapper code to your liking and compile your amended wrapper code into a B4A library - very easy to do with NotePad++ and SimpleLibraryCompiler (SLC)

I have no intention to support this whatsoever. This is just samples for those that maybe want to modify it and make use of it. I will post some additional samples as what time allows.
 

Attachments

  • b4aExampleTextureOffset.zip
    188 KB · Views: 147
  • b4aLibFiles.zip
    87.1 KB · Views: 132
  • JavaCode.zip
    61.8 KB · Views: 125
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Sample 2 - loading an obj , mtl, and png

A spinning Camaro.....


1.png


2.png


3.png
 

Attachments

  • b4aLibFiles.zip
    86.5 KB · Views: 45
  • b4aExampleLoadObjFile.zip
    83.1 KB · Views: 50
  • JavaCode.zip
    61.7 KB · Views: 42
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Sample 3 - rotating/orbiting Earth, Moon, Jupiter


1.png


2.png


3.png
 

Attachments

  • b4aLibFiles.zip
    87 KB · Views: 40
  • b4aExampleRotatingPlanets.zip
    105.5 KB · Views: 45
  • JavaCode.zip
    62 KB · Views: 67
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Animated gif? Video?

(as soon as you have read it, I will delete this post, so as not to dirty this thread)
Best is to download it and run it to see the 3D in action. My AVD manager does not run so cannot make a short gif. Video file is too big to upload. Should be simple to download and run it. Just copy the Jar and Xml to your additional libs folder.

I will at some stage work all the wrappers into a single library and post it as a grand finale 🎯
 
Top