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

Method assembleMesh

Engine/source/ts/tsMesh.cpp:1861–1955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1859#define tsalloc TSShape::smTSAlloc
1860
1861TSMesh* TSMesh::assembleMesh( U32 meshType, bool skip )
1862{
1863 static TSMesh tempStandardMesh;
1864 static TSSkinMesh tempSkinMesh;
1865 static TSDecalMesh tempDecalMesh;
1866 static TSSortedMesh tempSortedMesh;
1867
1868 bool justSize = skip || !tsalloc.allocShape32(0); // if this returns NULL, we're just sizing memory block
1869
1870 // a little funny business because we pretend decals are derived from meshes
1871 S32 * ret = NULL;
1872 TSMesh * mesh = NULL;
1873 TSDecalMesh * decal = NULL;
1874
1875 if ( justSize )
1876 {
1877 switch ( meshType )
1878 {
1879 case StandardMeshType :
1880 {
1881 ret = (S32*)&tempStandardMesh;
1882 mesh = &tempStandardMesh;
1883 tsalloc.allocShape32( sizeof(TSMesh) >> 2 );
1884 break;
1885 }
1886 case SkinMeshType :
1887 {
1888 ret = (S32*)&tempSkinMesh;
1889 mesh = &tempSkinMesh;
1890 tsalloc.allocShape32( sizeof(TSSkinMesh) >> 2 );
1891 break;
1892 }
1893 case DecalMeshType :
1894 {
1895 ret = (S32*)&tempDecalMesh;
1896 decal = &tempDecalMesh;
1897 tsalloc.allocShape32( sizeof(TSDecalMesh) >> 2 );
1898 break;
1899 }
1900 case SortedMeshType :
1901 {
1902 ret = (S32*)&tempSortedMesh;
1903 mesh = &tempSortedMesh;
1904 tsalloc.allocShape32( sizeof(TSSortedMesh) >> 2 );
1905 break;
1906 }
1907 }
1908 }
1909 else
1910 {
1911 switch ( meshType )
1912 {
1913 case StandardMeshType :
1914 {
1915 ret = tsalloc.allocShape32( sizeof(TSMesh) >> 2 );
1916 constructInPlace( (TSMesh*)ret );
1917 mesh = (TSMesh*)ret;
1918 break;

Callers

nothing calls this directly

Calls 3

constructInPlaceFunction · 0.85
setSkipModeMethod · 0.80
assembleMethod · 0.45

Tested by

no test coverage detected