Most practical way for building/batching vertex/index data?

Hey there,

I couldn’t find anything about this:

I’m looking for a convinient class that would help me building multiple static meshes proceduraly, using a single vertex/index buffer. Something practical that would help me adding vertices/indices, while keeping track of the offsets of every meshes. Idealy something that would track duplicated vertices, that would adjust the buffers in an optimal way.

Something I would call a “MeshBuilder”, is there something dedicated for this?

Thanks

http://www.monogame.net/documentation/?page=M_Microsoft_Xna_Framework_Graphics_ModelMeshPartCollection__ctor

?

There is in XNA and IIRC there is a PR that started on the implementation, but the person that set up the PR got busy and never got back to it. Let me search for it :slight_smile:

= Pull Request from the Git Repository

There are beginners on here too, it does not help using Acronyms without first declaring them.

Here it is: [WIP] Mesh builder by mattiascibien · Pull Request #4078 · MonoGame/MonoGame · GitHub

And the XNA docs: XNA Game Studio 4.0 Refresh | Microsoft Learn

You’re right, sorry. Force of habit :stuck_out_tongue:

2 Likes

No worries, just helps create a resourceful environment when help is clear for new entrants :slight_smile: we cannot assume everybody is familiar with even what the meaning of Platforms is without them thinking it is a pair of shoes :stuck_out_tongue:

@Jjagg it is indeed exactly what I need :slight_smile:
How comes it’s not implemented? I thought Monogame was a 99% XNA implementation. Well the question now is whether I should try this unfinished PR.

So you really think beginners need to know what a PR is? :slight_smile:

@raizam try to picture if I told you to draw a car, without describing it or using the word CAR, :slight_smile:

1 Like

Exactly, it’s not completely finished :stuck_out_tongue: Another thing I know is missing is the Microphone class

1 Like

I fail to see the analogy here

Because you are no longer able to see things from a beginners perspective, that is why :slight_smile:

http://www.pinvoke.net/default.aspx/winmm/waveInOpen.html

Maybe people can use this on Windows if they’d like for now, but for the implementation in the core the audio frameworks we have in place should be used. XAudio2 for WinDX, OpenAL for GL platforms, MediaRecorder for Android, AVAudioRecorder for iOS… I think the implementations are pretty straightforward. It’s just that no one has taken the time to implement it yet.

@Jjagg If there was a guide to assist with implementation, it might actually happen, I found this an issue with my previous ‘platform’ toolset too, a lot of talk about using DLLs but there was never a solid guide or explanation, this resulted in the authors ending the platform too [Not because of the lack of documentation but it would have helped create more things if only they bothered making Modding easier…]

I have no idea what is involved with making MonoGame work, even if I had the skills to actually develop it… without a guide, only a select few can contribute… this is true of any project…

I guess we both agree on this :slight_smile:

EDIT

Hate this reply system… the Reply to post button should just be removed…

Let’s get back on topic please:
I need a MeshBuilder, you need a MeshBuilder, he needs a MeshBuilder, we need a MeshBuilder, they need a MeshBuilder :smile_cat:

I was full of hope when I discovered this but… out of luck

2 Likes

@raizam did the model mesh part collection link earlier not help at all?

:sweat_smile:
I need a class that allows me to create multiple sub-meshes, declared using a AddSubMesh, and AddTriangle() method, when done it compiles a single Vertex/IndexBuffer, without duplicates, and returns a collection of MeshModelPart all pointing to the same Vertex/Index buffer.

not sure i could be clear =)

@raizam what you need is a model creation tool :stuck_out_tongue:

But Yeah I can see what you need, hope you find a solution…

1 Like

The XNA implementation isn’t what I’m really looking for, as it returns a MeshContent while I’m looking for ModelMeshPart.

But now I’m discovering the MeshContent class, and it’s puzzling me, as it doesn’t seem to use ModelMeshPart.
MeshContent looks weird to me, as it seems more like some sort of ‘SceneGraphNode’ coupled with mesh data.
Anyone knows the history of this? it looks inconsistent with the ModelMesh approach.

The *Content classes represent data in an intermediate, design-time format in the Content Pipeline. I don’t think any are used at runtime.

MeshContent is used to build ModelMeshContent which “Stores design-time data for a ModelMesh asset”. ModelMeshContent has the MeshParts property, this is a basically just a collection of ModelMeshPartContent. ModelMeshPartContent in turn “Stores design-time data for a ModelMeshPart asset”.

It’s not completely clear from the documentation, but I think the MeshParts get populated when ModelMeshContent is created. The docs say that the ModeMeshContent property SourceMesh (of type MeshContent) is the “MeshContent source object used when creating this class”. That seems to imply it’s used to build the class but does not contain essential data after that. So my guess is the data in there is put in the MeshParts. I’m not sure if I got all that right, but that’s how I interpreted the docs.

1 Like

This completely makes sense.
Hence MeshBuilder is not what I’m looking for.
Hence I’m writing my own, it’s really not that hard.

My last question: Is there a mechanism to check Vector3s equality with close approximation?
Once I have that I think I’ll be all set :slight_smile: