New XML converter param: -merge

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4148
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 270
Contact:

New XML converter param: -merge

Post by dark_sylinc » Sun Dec 09, 2012 12:42 am

I just added to v1.9 a new param:

Usage:

Code: Select all

ogrexmlconverter -merge 0,1 myFile.mesh.xml
This will merge two texture coordinates into one: float1 Texcoord0 and float2 Texcoord1 become float3 Texcoord0.
This is very useful to save interpolators. Some GPUs work faster (negligible gain probably, though), but more importantly, this makes a lot easier to handle shader permutations when you write complex übershaders.

The merge happens after generating the tangents (otherwise it may get screwed?)

Note that the merge doesn't happen if the following rules aren't met:
  • Both texcoords. must be in the same buffer source.
  • Both texcoords. must be adjancent in memory (i.e. nothing between them).
  • Both texcoords. must be of the same type (you can't mix short with float)
  • There has to be enough room. You can't merge float2 with float3 because there is no float5. The merge will fail.
Since all known exporters export following these rules, you shouldn't have much of a problem. The merge only runs once, but running the converter multiple times you can collapse more than two texcoords.

This is a long shot from the "vertex.layout" I want for 2.x; but it satisfies our current, more urgent needs; and probably other people too.

Enjoy!
0 x

bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia

Re: New XML converter param: -merge

Post by bstone » Sun Dec 09, 2012 10:35 am

This might be handy, no doubt.
0 x

Post Reply