MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / canWriteOldFormat

Method canWriteOldFormat

Engine/source/ts/tsShape.cpp:1833–1864  ·  view source on GitHub ↗

------------------------------------------------- write whole shape ------------------------------------------------- Determine whether we can write this shape in TSTPRO compatible format */

Source from the content-addressed store, hash-verified

1831//-------------------------------------------------
1832/** Determine whether we can write this shape in TSTPRO compatible format */
1833bool TSShape::canWriteOldFormat() const
1834{
1835 // Cannot use old format if using autobillboard details
1836 for (S32 i = 0; i < details.size(); i++)
1837 {
1838 if (details[i].subShapeNum < 0)
1839 return false;
1840 }
1841
1842 for (S32 i = 0; i < meshes.size(); i++)
1843 {
1844 if (!meshes[i])
1845 continue;
1846
1847 // Cannot use old format if using the new functionality (COLORs, 2nd UV set)
1848 if (meshes[i]->mTverts2.size() || meshes[i]->mColors.size())
1849 return false;
1850
1851 // Cannot use old format if any primitive has too many triangles
1852 // (ie. cannot fit in a S16)
1853 for (S32 j = 0; j < meshes[i]->mPrimitives.size(); j++)
1854 {
1855 if ((meshes[i]->mPrimitives[j].start +
1856 meshes[i]->mPrimitives[j].numElements) >= (1 << 15))
1857 {
1858 return false;
1859 }
1860 }
1861 }
1862
1863 return true;
1864}
1865
1866void TSShape::write(Stream * s, bool saveOldFormat)
1867{

Callers 1

TorqueMainFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected