Rendering only visible Geometries: How to improve performances by rendering managment?

ok

how do I find a single block coordinate while generating the world using your library? Thanks :smiley:

Iā€™m not sure I understand what you mean but read the code of the interfaces:
public Integer getBlock(Vector3f location);
public Vector3f getPointedBlockLocation(Vector3f collisionContactPoint, boolean getNeighborLocation);

No, Iā€™ll try to say that in a better way.
Your library generates world in chunks, doesnā€™t it?
While itā€™s generating a chunk, how do I know what block itā€™s generating? Just for adding gen features like trees and some other things :wink:

While itā€™s generating a chunk itā€™s generating all the blocks that are in the generated chunkā€¦
But you donā€™t have to worry about chunks if you need information on blocks you can use the VoxelSystem interface methods.
For example if you want to know the type of the voxel in location 2,2,2 you can use something like ā€œvoxelSystem.getBlock(new Vecto3f(2f,2f,2f));ā€ and thatā€™s it.

Ok, but I need something more dinamic. Iā€™ll try to explain it:
The code is generating a chunk, it uses the addChunk(ā€¦) method.
While generating the chunk, how do i know what is the current block that is generating? I need it so I can teel if up to that block thereā€™s another block, and so generate a tree, and some other cool things! Thanks :smiley:

So you call voxelSystem.getHeight(x, y); to get the height of the ground at the location (x, y) where you want to put the tree. If you want to had a lot of block made things donā€™t add them like that, use the VoxelNoise.
I need to document those thingsā€¦

Yeah, you should, all will be much simpler. Hope youā€™ll do it soon, it will give me a huge help, and I will not inoppurtune anymore you, consulting the documentation :wink:

Hello again and sorry againā€¦ How do I change the texture of a block? I mean, ingame, when I place a block, how to I decide its texture?

Just another thing: there is a NullPointerException when using Landscape.getHeight(), how do I solve? Iā€™m calling it from GreedyMeshChunk.initVoxels(). Hereā€™s the error message from console:

dic 18, 2016 12:57:58 PM com.jme3.app.Application handleError
Grave: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at voxelEngine.Landscape.getHeight(Landscape.java:169)
at voxelEngine.GreedyMeshChunk.initVoxels(GreedyMeshChunk.java:84)
at voxelEngine.GreedyMeshChunk.init(GreedyMeshChunk.java:69)
at voxelEngine.Landscape.addChunk(Landscape.java:328)
at voxelEngine.Landscape.initBeforeStart(Landscape.java:264)
at voxelEngine.Landscape.(Landscape.java:105)
at test.TestLandscape.simpleInitApp(TestLandscape.java:90)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:744)

Landscape line 169 is inside getHeight() method and is:
int height = getChunk(x / chunkWidth, z / chunkWidth, iChunk).getHeight(blockX, blockZ);

The block types are define by implementing the interfaces VoxelTypes and FaceTypes, look at the test implementations.

Fine. What about the NullPointerException?

I suppose your coordinates are outside the voxel world.
Put your game code only in interfaces implementation, never in the engine classes. (So not in GreedyMeshChunk.initVoxels)

Nothing to do. Tried to set all coords to 1, but always obtained NullPointerExcpetion. If i put that code into LandScape or in GreedyMeshChunk, I obtained NullPointerException, but I put it in the simpleInitApp() method, the whole goes well

I suppose I found the error. When you call getHeight(), you also call chunkWidth and ChunkHeight, maybe that two variables where not defined when you call the method

But I repeat you donā€™t need to put any code in my codeā€¦ You donā€™t have to put code in Landscape or in GreedyMeshChunk.
Everything that is in the package test is the game stuff and everything that is in the package voxelEngine is the engine stuff.
The class with a name beginning by ā€œTestā€ are the one you need to care about (to understand them and make your own).

Iā€™m basing my game on yuor engine

Yes but it is designed to be used as a library. You donā€™t modify jMonkeyEngine when you make a game, itā€™s the same for my project. Of course you could contribute but it is best that it says separated projects. To make updates but more importantly to build abstraction (so we donā€™t have to think about chunk management when we try to put trees on a landscape).

ok

Just one thing (another one :slight_smile: ): how do I load a 3d model (.obj) as block?