MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Load

Method Load

Source/Objects/itemobject.cpp:1433–1472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1431}
1432
1433void ItemObject::Load(const std::string& item_path) {
1434 Textures* ti = Textures::Instance();
1435
1436 textures_.clear();
1437
1438 obj_file = item_path;
1439 // item_ref_ = Items::Instance()->ReturnRef(item_path);
1440 item_ref_ = Engine::Instance()->GetAssetManager()->LoadSync<Item>(item_path);
1441 // ofc_ = ObjectFiles::Instance()->ReturnRef(item_ref_->GetObjPath());
1442 ofc_ = Engine::Instance()->GetAssetManager()->LoadSync<ObjectFile>(item_ref_->GetObjPath());
1443
1444 if (ofc_->shader_name == "cubemap") {
1445 use_tangent_ = true;
1446 } else {
1447 use_tangent_ = false;
1448 }
1449
1450 char flags = _MDL_CENTER;
1451 if (use_tangent_) {
1452 flags |= _MDL_USE_TANGENT;
1453 }
1454 model_id_ = Models::Instance()->loadModel(ofc_->model_name.c_str(), flags);
1455 blood_surface_.AttachToModel(&Models::Instance()->GetModel(model_id_));
1456
1457 ti->setWrap(GL_REPEAT);
1458 if (!ofc_->color_map.empty()) {
1459 TextureAssetRef tex = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>(ofc_->color_map, PX_SRGB, 0x0);
1460 batch_.texture_ref[0] = tex->GetTextureRef();
1461 textures_.push_back(tex);
1462 }
1463 if (!ofc_->normal_map.empty()) {
1464 TextureAssetRef tex = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>(ofc_->normal_map);
1465 batch_.texture_ref[1] = tex->GetTextureRef();
1466 textures_.push_back(tex);
1467 }
1468 if (!ofc_->sharpness_map.empty()) {
1469 Models::Instance()->GetModel(model_id_).LoadAuxFromImage(ofc_->sharpness_map);
1470 }
1471 batch_.texture_ref[5] = ti->GetBlankTextureRef();
1472}
1473
1474void ItemObject::GetShaderNames(std::map<std::string, int>& preload_shaders) {
1475 if (use_tangent_)

Callers

nothing calls this directly

Calls 13

GetAssetManagerMethod · 0.80
GetObjPathMethod · 0.80
AttachToModelMethod · 0.80
setWrapMethod · 0.80
GetTextureRefMethod · 0.80
LoadAuxFromImageMethod · 0.80
GetBlankTextureRefMethod · 0.80
clearMethod · 0.45
loadModelMethod · 0.45
c_strMethod · 0.45
GetModelMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected