I need help Can someone explain to me what this code is doing?
From a quick look eighter something magic or something strange.
For sure nothing common.
Whats strange is, that the finVert buffer is sized one vec3 larger then the other vertex data buffers
In the last element the world position gets written.
At least inside that function the value is never accessed.
As far i know there is also no way the value could get accessed on the shader side, but i would have to check how the indices are calculated and take a look at the shaders.
Do you search for something specific?
I give it a look when i am at the pc.
Thank you for your reply
So this wasnāt an area of code that I wrote and I havenāt experimented much with it. Taking a quick lookā¦ iād be surprised if that class works at all. It SHOULD emit meshes as particles, but it doesnāt look like it would do that correctly.
It can actually do that by sending out grids in the form of particles.
Iām currently using it but I think there are some problems with this class.
When I set emitterMesh. SetEmitFromWorldSpace (false);
ParticleDataTemplateMesh. Java has some problems
Itās more the boundsā¦ I think it would error out because itās not sizing the buffers correctly. Iāll have to look into the set emit from world space later. It probably just needs the code copied from the other Particle Mesh classes.
Having larger buffers then you need will not cause any issues. Even setting indices that are out of bounds will not cause opengl to crash.
i guess it is defined as āundefined behaviourā
The code actually creates a new mesh with numParticle times the base mesh in it.
The question is, whats wrong? Whats the error?
Itās a float buffer so it actually needs to be MeshVertCount * numParticles * 3.
no, the name is misleading. it accesses the position buffer directly, so .capacity() includes the * 3
FloatBuffer sourceBuffer;
FloatBuffer targetBuffer = BufferUtils.createFloatBuffer(sourceBuffer.capacity()*numParticles);
for (int j = 0; j < numParticles; j++) {
for (int i = 0; i <sourceBuffer.capacity(); i++) {
targetBuffer.put(sourceBuffer.get(i));
}
}
it comes down to this logic, plus some āmagicā
//Add:
One hell of an example on when to use instancing instead of batching
Thank you for your reply
Oooo you are right. Missed that. Yea, this is an area that really should use instancing.
I seem to understand some of the key information about this class.
But this class doesnāt seem to be what Iām looking for.
To my surprise, this class seems to be unusable and yet I keep using it with no errors.
Here are the questions I want to ask
I want to know the SetEmitFromWorldSpace of Particle monkey Whether it corresponds to the function.
SetEmitFromWorldSpace =false; the position of the particles seems to be wrong.
Maybe itās my misunderstanding, but I hope that when āSetEmitFromWorldSpace =falseā, set to false, the particles will emit in local space and when the emitter is moved,so are all the particles that were emitted previously
Which emitter shape are you using?
EmitterMesh
ļ¼The vast majority of the conversation is done through translation software There may be communication differencesļ¼Please point out if you donāt understand anything about my questionsļ¼Thank you for your helpļ¼