MCPcopy Create free account
hub / github.com/carbonengine/trinity / RequestReversedIndexBuffers

Method RequestReversedIndexBuffers

trinity/Resources/TriGeometryRes.cpp:1865–1933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1863}
1864
1865void TriGeometryRes::RequestReversedIndexBuffers()
1866{
1867 if( !m_isGood )
1868 {
1869 return;
1870 }
1871 if( m_reversedIndexBuffersRequested )
1872 {
1873 return;
1874 }
1875 m_reversedIndexBuffersRequested = true;
1876 if( !m_isPrepared )
1877 {
1878 return;
1879 }
1880
1881 if( IsUsingCMF() && m_sourceGranny )
1882 {
1883 if( !m_sourceGranny->GetCMFData() )
1884 {
1885 return;
1886 }
1887
1888 USE_MAIN_THREAD_RENDER_CONTEXT();
1889
1890 CCP_ASSERT_M( m_meshes.size() == m_sourceGranny->GetCMFData()->meshes.size(), "Amount of meshes should match!" );
1891 for( uint32_t i = 0; i < m_meshes.size(); i++ )
1892 {
1893 auto& mesh = m_meshes[i];
1894 auto& cmfMesh = m_sourceGranny->GetCMFData()->meshes[i];
1895
1896 // this assertion assumes that gTriDev->GetMinimumModelLOD() has not changed since last call to SetupMeshes. Not sure if this holds true.
1897 int minimumLOD = gTriDev->GetMinimumModelLOD() < 0 ? 0 : min( gTriDev->GetMinimumModelLOD(), (int)cmfMesh.lods.size() - 1 );
1898 CCP_ASSERT_M( mesh->m_lods.size() == cmfMesh.lods.size() - minimumLOD, "Amount of mesh lods should match!" );
1899
1900 for( const auto& lod : mesh->m_lods )
1901 {
1902 auto& cmfLod = cmfMesh.lods[lod->m_originalLodIndex];
1903 ReverseIndexBuffer( *lod, m_sourceGranny->GetCMFViewData( cmfLod.ib ), cmfLod, renderContext );
1904 }
1905 }
1906 }
1907#if WITH_GRANNY
1908 else if( !IsUsingCMF() && m_sourceGranny )
1909 {
1910 granny_file* f = m_sourceGranny->GetGrannyFile();
1911 if( !f )
1912 {
1913 return;
1914 }
1915 granny_file_info* gi = GrannyGetFileInfo( f );
1916
1917 USE_MAIN_THREAD_RENDER_CONTEXT();
1918
1919 for( auto& mesh : m_meshes )
1920 {
1921 for( auto& lod : mesh->m_lods )
1922 {

Callers 4

ReverseIndexBuffersMethod · 0.80
SetGeometryResMethod · 0.80
SetLowResGeometryResMethod · 0.80
ReverseIndexBuffersMethod · 0.80

Calls 6

IsUsingCMFFunction · 0.85
ReverseIndexBufferFunction · 0.85
sizeMethod · 0.80
GetMinimumModelLODMethod · 0.80
GetCMFViewDataMethod · 0.80
GetCMFDataMethod · 0.45

Tested by

no test coverage detected