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

Method SetupCustomMask

trinity/Eve/SpaceObjectFactory/EveSOF.cpp:2322–2362  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Add the ppt to the ship --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2320// Add the ppt to the ship
2321// --------------------------------------------------------------------------------
2322void EveSOF::SetupCustomMask( EveSpaceObject2Ptr obj, const EveSOFDNAPtr dna ) const
2323{
2324 bool deletePatterData = false;
2325 const EveSOFDataMgr::PatternApplicationData* data = dna->GetPatternApplicationData( deletePatterData );
2326
2327 if( data )
2328 {
2329 size_t layerCount = dna->GetPatternLayerCount();
2330 for( size_t i = 0; i < layerCount; ++i )
2331 {
2332 auto patternProjectionData = dna->GetPatternProjectionData( data, i );
2333
2334 if( patternProjectionData && patternProjectionData->enabled )
2335 {
2336 const EveSOFDataMgr::PatternLayerData* patternLayerData = dna->GetPatternLayerData( data, i );
2337
2338 if( patternLayerData )
2339 {
2340 Vector4 materialTargets = dna->GetMaterialTargets( patternLayerData );
2341
2342 EveCustomMaskPtr customMask;
2343 customMask.CreateInstance();
2344 customMask->Setup(
2345 patternProjectionData->position,
2346 patternProjectionData->scaling,
2347 patternProjectionData->rotation,
2348 patternProjectionData->isMirrored,
2349 patternLayerData->projectionAddressModeU == Tr2RenderContextEnum::TA_CLAMP,
2350 patternLayerData->projectionAddressModeV == Tr2RenderContextEnum::TA_CLAMP,
2351 patternLayerData->materialSourceID,
2352 materialTargets );
2353 obj->AddCustomMask( customMask );
2354 }
2355 }
2356 }
2357 if( deletePatterData )
2358 {
2359 delete data;
2360 }
2361 }
2362}
2363
2364// --------------------------------------------------------------------------------
2365// Description:

Callers

nothing calls this directly

Calls 8

GetPatternLayerCountMethod · 0.80
GetPatternLayerDataMethod · 0.80
GetMaterialTargetsMethod · 0.80
CreateInstanceMethod · 0.80
AddCustomMaskMethod · 0.80
SetupMethod · 0.45

Tested by

no test coverage detected