-------------------------------------------------------------------------------- Description: Fill up mesh area vector given the hull and faction area data provided. --------------------------------------------------------------------------------
| 554 | // Fill up mesh area vector given the hull and faction area data provided. |
| 555 | // -------------------------------------------------------------------------------- |
| 556 | size_t EveSOF::FillMeshAreaVector( Tr2MeshAreaVector* meshAreaVector, TriBatchType areaType, const EveSOFDNAPtr dna, size_t hullIdx, size_t meshIndexOffset ) const |
| 557 | { |
| 558 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 559 | |
| 560 | const std::vector<EveSOFDataMgr::HullAreas>* hullAreas = dna->GetHullMeshAreas( areaType, hullIdx ); |
| 561 | for( auto area = hullAreas->begin(); area != hullAreas->end(); ++area ) |
| 562 | { |
| 563 | // find data on this shader from generics, we need it! |
| 564 | const EveSOFDataMgr::GenericShaderData* shaderData = dna->GetGenericAreaShaderData( area->shader ); |
| 565 | if( !shaderData ) |
| 566 | { |
| 567 | CCP_LOGERR( "EveSOF::FillMeshAreaVector: couldn't find generic info for shader %s", area->shader.c_str() ); |
| 568 | return 0; |
| 569 | } |
| 570 | |
| 571 | // every area has it's own shader, nothing we can share here |
| 572 | Tr2EffectPtr newShader; |
| 573 | newShader.CreateInstance(); |
| 574 | newShader->StartUpdate(); |
| 575 | |
| 576 | bool castsShadows = false; |
| 577 | switch( areaType ) |
| 578 | { |
| 579 | case TRIBATCHTYPE_DECAL: |
| 580 | newShader->SetOption( BlueSharedString( "SPACE_OBJECT_TRANSPARENCY" ), BlueSharedString( "SOT_CLIP" ) ); |
| 581 | castsShadows = g_alphaCutoutShadowsEnabled; |
| 582 | break; |
| 583 | case TRIBATCHTYPE_TRANSPARENT: |
| 584 | newShader->SetOption( BlueSharedString( "SPACE_OBJECT_TRANSPARENCY" ), BlueSharedString( "SOT_TRANSPARENT" ) ); |
| 585 | break; |
| 586 | case TRIBATCHTYPE_OPAQUE: |
| 587 | newShader->SetOption( BlueSharedString( "SPACE_OBJECT_TRANSPARENCY" ), BlueSharedString( "SOT_OPAQUE" ) ); |
| 588 | castsShadows = true; |
| 589 | break; |
| 590 | default: |
| 591 | break; |
| 592 | } |
| 593 | |
| 594 | // construct res path of the shader |
| 595 | newShader->SetEffectPathName( dna->GetCompleteShaderPath( area->shader.c_str() ).c_str() ); |
| 596 | |
| 597 | // parameters |
| 598 | for( auto shaderParamIt = shaderData->parameters.begin(); shaderParamIt != shaderData->parameters.end(); ++shaderParamIt ) |
| 599 | { |
| 600 | const Vector4* paramValue = dna->GetMeshAreaParameter( area->areaType, *shaderParamIt, &area->parameters, area->blockedMaterials ); |
| 601 | if( paramValue ) |
| 602 | { |
| 603 | newShader->AddParameterVector4( *shaderParamIt, paramValue ); |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | // shader textures from the hull data |
| 608 | for( auto it = area->textures.begin(); it != area->textures.end(); ++it ) |
| 609 | { |
| 610 | CCP_STATS_ZONE( "texture" ); |
| 611 | |
| 612 | // res path how it is from hull data |
| 613 | std::string highResPath = it->second.resFilePath; |
nothing calls this directly
no test coverage detected