Can someone refresh me on indexing surfaces please

Blitz3D Forums/Blitz3D Programming/Can someone refresh me on indexing surfaces please

puki(Posted 2009) [#1]
Before people post - please take into account:

Blitz3D has had long-standing issues with the order that surfaces are located in memory. So unless you know about the 'order issues' then you probably cannot help.

I can already quite happily resolve this issue by loading a multi-object mesh via LoadAnimMesh. I can re-texture this on-the-fly by securing the surfaces via ChildMesh. I have no 'surface order issues' with this method.


What I want to do is to use a multi-object mesh that has been collapsed into a single mesh hierarchy - material names are in the mesh, so no problems there with regard to identifying surfaces. Once loaded into Blitz3D, I then want to be able to change the textures as and when I like to create multiple textured versions of the mesh.

NOTE: Anyone can paint the surfaces - the goal is to be able to do this, taking into account the 'surface order issues' when you re-run the program again (such as on another computer) in which case the order that the surfaces are stored in memory may have changed.

NOTE: I don't want a solution that involves re-saving the mesh out of Blitz3D.


I hope I made that clear enough.

I must be close to resolving it, but just missing or not remembering something. It's possible I achieved this before using a lib - maybe a "halo"/"jfk" one - not sure - possibly my multi-mesh resolution made me forget the single-mesh solution.


SoggyP(Posted 2009) [#2]
Hello.

Don't bother, just acquire someone else's ;o)

Goodbye.


Beaker(Posted 2009) [#3]
Can you not use GetBrushTexture()/TextureName() and allocate useful texture names (possibly with flags)?


puki(Posted 2009) [#4]
I can access the texture names; however, I am unclear as how to write them back to the surfaces whenever I like. Baring in mind that I need to be able to do this on different computers - ie the 'surface order issue'.

I understand that TextureName$ will return a 'static' texture name and that it will also (technically) relate to a surface; however, how do I access that particular surface and know it is the same surface again and again?


puki(Posted 2009) [#5]
Also, bare in mind I will be using different textures to the ones that the surfaces expect to be using. I will be using my own pool of textures.


puki(Posted 2009) [#6]
Doing this with a multi-object mesh, that is loaded via LoadAnimMesh, is as easy as:

child=FindChild(mesh,"whatever")
surface=GetSurface(child,1)

Blitz3D has no problems in handing the surface over via this method. This is transferrable and does not suffer the 'surface order issue'.

I just seem to be stumbling with a single object mesh, which is a collapsed hierarchy mesh, loaded via LoadMesh.


puki(Posted 2009) [#7]
Having said all that. Of course, Blitz3D automatically creates its own brushes and brush textures from a mesh. I assume that I should be going down the route of intercepting the autobrushes and the corresponding auto brush textures.

I shall dig deeper.


Beaker(Posted 2009) [#8]
Just keep a link between the surface, brush and texture name.
Type SurfTex
Field surf
Field texname$
;Field brush
End Type

Remember to free them when you are finished (GetBrushTexture, GetSurfaceBrush, GetEntityBrush create new copies).


puki(Posted 2009) [#9]
My brain is starting to remember this now - I think.

Your type example has led my brain back to creating arrays for the surfaces, brushes and textures - then, when you have the texture you want to replace, you just make sure that it's index is the same as the surface at that point in time.

I think I should be able to get this to work.


jfk EO-11110(Posted 2009) [#10]
You only have to identify the surfaces. Once you got them, you can use paintsurface with individually created brushes.

To gather all settings of a surface (to be able to reuse settings like Brushalpha, Blendmode or FX aso. and not to force some sort of default settings whenever the texture is replaced) the blitz3d command set alone is not enough, you gotta hack some values. You probably best take the B3D exporter code that I used to release (the latest one), it uses several tricks to find out as much as possible about the surfaces of a mesh, including texture flags etc. Instead of simply saving a mesh you may of course alter the settings, textures etc. before you save it. Note dds ist't really supported since you cannot access the texturebuffer of dds.


puki(Posted 2009) [#11]
I sorted it all out - I was trying to remember the link to the surfaces. Having sorted it all out, I decided I didn't need it for what I was doing.

Still, it is handy to know.