MCPcopy Create free account
hub / github.com/Segs/Segs / initLoadedModel

Function initLoadedModel

Projects/CoX/Common/Runtime/Model.cpp:445–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443}
444
445void initLoadedModel(std::function<HTexture (const QString &)> funcloader,Model *model,const std::vector<HTexture> &textures)
446{
447 model->blend_mode = CoHBlendMode::MULTIPLY_REG;
448 bool isgeo=false;
449 if(model->name.startsWith("GEO_",Qt::CaseInsensitive))
450 {
451 model->flags |= OBJ_DRAW_AS_ENT;
452 isgeo = true;
453 if(model->name.contains("eyes",Qt::CaseInsensitive) )
454 {
455 if(!model->trck_node)
456 model->trck_node = new ModelModifiers;
457 model->trck_node->_TrickFlags |= DoubleSided;
458 }
459 }
460 assert(model->num_textures==model->texture_bind_info.size());
461 for(TextureBind tbind : model->texture_bind_info)
462 {
463 HTexture seltex = textures[tbind.tex_idx];
464 if(!seltex)
465 {
466 // missing texture, nothing to do here
467 continue;
468 }
469
470 TextureWrapper &base_tex(seltex.get());
471 if(!isgeo && base_tex.info)
472 {
473 auto blend = CoHBlendMode(base_tex.info->BlendType);
474 if(blend == CoHBlendMode::ADDGLOW || blend == CoHBlendMode::COLORBLEND_DUAL ||
475 blend == CoHBlendMode::ALPHADETAIL)
476 seltex = funcloader(base_tex.detailname);
477 if(seltex && seltex->flags & TextureWrapper::ALPHA)
478 model->flags |= OBJ_ALPHASORT;
479 }
480
481 if( base_tex.flags & TextureWrapper::DUAL )
482 {
483 model->flags |= OBJ_DUALTEXTURE;
484 if( base_tex.BlendType != CoHBlendMode::MULTIPLY )
485 model->blend_mode = base_tex.BlendType;
486 }
487
488 if( !base_tex.bumpmap.isEmpty() )
489 {
490 HTexture wrap = funcloader(base_tex.bumpmap);
491 if( wrap->flags & TextureWrapper::BUMPMAP )
492 {
493 model->flags |= OBJ_BUMPMAP;
494 model->blend_mode = (model->blend_mode == CoHBlendMode::COLORBLEND_DUAL) ?
495 CoHBlendMode::BUMPMAP_COLORBLEND_DUAL : CoHBlendMode::BUMPMAP_MULTIPLY;
496 }
497 if( base_tex.flags & TextureWrapper::CUBEMAPFACE || (wrap->flags & TextureWrapper::CUBEMAPFACE) )
498 model->flags |= OBJ_CUBEMAP;
499 }
500 }
501
502 if( model->trck_node && model->trck_node->info)

Callers 2

buildModelFunction · 0.85

Calls 4

CoHBlendModeEnum · 0.70
sizeMethod · 0.45
getMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected