MCPcopy Create free account
hub / github.com/OpenMW/openmw / isArrayCompatible

Function isArrayCompatible

components/sceneutil/optimizer.cpp:1094–1104  ·  view source on GitHub ↗

When merging geometries, tests if two arrays can be merged, regarding to their number of components, and the number of vertices.

Source from the content-addressed store, hash-verified

1092
1093/// When merging geometries, tests if two arrays can be merged, regarding to their number of components, and the number of vertices.
1094bool isArrayCompatible(unsigned int numVertice1, unsigned int numVertice2, const osg::Array* compare1, const osg::Array* compare2)
1095{
1096 // Sumed up truth table:
1097 // If array (1 or 2) not empty and vertices empty => error, should not happen (allows simplification in formulae below)
1098 // If one side has both vertices and array, and the other side has only vertices => then arrays cannot be merged
1099 // Else, arrays can be merged
1100 //assert(numVertice1 || !getSize(compare1));
1101 //assert(numVertice2 || !getSize(compare2));
1102 return !( (numVertice1 && !getSize(compare1) && getSize(compare2))
1103 || (numVertice2 && !getSize(compare2) && getSize(compare1)) );
1104}
1105
1106/// Return true only if both geometries have same array type and if arrays (such as TexCoords) are compatible (i.e. both empty or both filled)
1107bool isAbleToMerge(const osg::Geometry& g1, const osg::Geometry& g2)

Callers 1

isAbleToMergeFunction · 0.85

Calls 1

getSizeFunction · 0.70

Tested by

no test coverage detected