Is there some sort of a spec for the material definition format?
Also, I’m trying to figure out how to load a mesh with a vertex buffer with a type not explicitly enumerated in the VertexBuffer.Type enum. Right now, I’m just abusing Color and Normal to pass in the data I need, but it feels dirty.
Yes, I’ve read all that. Several times.
It talks about JME3 vertex attributes, but it doesn’t say anything about user-defined attributes. And the page on material definitions actually doesn’t discuss writing a new one in any way. It just talks about using one.
I’ve managed to cobble together a matdef and shader by looking at existing ones, but I can’t find one that uses a vertex attribute that isn’t already defined by the VertexBuffer.Type enum. And, I can’t figure out how to load a VertexBuffer into a Mesh unless it already corresponds to one of the existing types–which is a problem, because the type/format of the buffer seems to be checked for the various types, so I can’t even just abuse, for instance, the Normal enum to pass a vec4 instead of a vec3.
No you just use uniforms for your own variables.
I was asking about that in the past
http://hub.jmonkeyengine.org/groups/graphics/forum/topic/per-vertex-attribute-to-vertex-program/
Seems that there is no official way for that right now. There are few things like texcoord2 which you can misuse (and you can put any type inside, doesn’t have to be tex).
Yeah, okay. So the answer is basically that what I’m doing now (abusing pre-defined attributes) is the only way to do what I want to do.
Alrighty then.
The predefined attributes should suffice for most cases. If you do need to have special attributes just use Color, TexCoord, etc that are already there. You can use Vec4 normals or use any type or format if you wanted, you just need to make sure the shader itself can handle it.