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

Method Load

Source/Objects/riggedobject.cpp:1528–1883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1526} // namespace
1527
1528void RiggedObject::Load(const std::string& character_path, vec3 pos, SceneGraph* scenegraph_ptr, OGPalette& palette) {
1529 // CharacterRef char_ref = Characters::Instance()->ReturnRef(character_path);
1530 CharacterRef char_ref = Engine::Instance()->GetAssetManager()->LoadSync<Character>(character_path);
1531 scenegraph_ = scenegraph_ptr;
1532
1533 // ofc = ObjectFiles::Instance()->ReturnRef(char_ref->GetObjPath());
1534 ofc = Engine::Instance()->GetAssetManager()->LoadSync<ObjectFile>(char_ref->GetObjPath());
1535
1536 if (ofc->shader_name.empty() || ofc->shader_name == "cubemapobjchar") {
1537 ofc->shader_name = "envobject #CHARACTER";
1538 }
1539
1540 bool use_tangent = false;
1541 if (ofc->shader_name.find("#TANGENT") != std::string::npos) {
1542 use_tangent = true;
1543 }
1544
1545 char flags = 0;
1546 if (use_tangent) {
1547 flags = flags | _MDL_USE_TANGENT;
1548 }
1549 flags |= _MDL_CENTER;
1550
1551 Models* mi = Models::Instance();
1552 int the_model_id = mi->loadModel(ofc->model_name, flags);
1553 model_id[0] = the_model_id;
1554
1555 Textures* ti = Textures::Instance();
1556 texture_ref = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>(ofc->color_map, PX_SRGB, 0x0);
1557 normal_texture_ref = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>(ofc->normal_map);
1558
1559 if (!ofc->palette_map_path.empty()) {
1560 palette_texture_ref = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>(ofc->palette_map_path);
1561 for (int i = 0; i < max_palette_elements; ++i) {
1562 if (!ofc->palette_label[i].empty()) {
1563 LabeledColor lc;
1564 lc.label = ofc->palette_label[i];
1565 lc.channel = i;
1566 lc.color = vec3(1.0f);
1567 palette.push_back(lc);
1568 }
1569 }
1570 }
1571
1572 model_id[0] = Models::Instance()->CopyModel(the_model_id);
1573 Model* model = &Models::Instance()->GetModel(model_id[0]);
1574 floor_height = model->min_coords[1];
1575
1576 UpdateGPUSkinning();
1577 SetTranslation(pos);
1578
1579 skeleton_.SetBulletWorld(scenegraph_->bullet_world_);
1580
1581 const std::string& skeleton_path = char_ref->GetSkeletonPath();
1582
1583 FZXAssetRef fzx_ref;
1584 std::string fzx_path = ofc->model_name.substr(0, ofc->model_name.size() - 3) + "fzx";
1585 if (FileExists(fzx_path.c_str(), kDataPaths | kModPaths)) {

Callers

nothing calls this directly

Calls 15

FileExistsFunction · 0.85
IsMainThreadFunction · 0.85
ASGetBindMatrixFunction · 0.85
FormatStringFunction · 0.85
GetMorphPathFunction · 0.85
FindFilePathFunction · 0.85
ChecksumFunction · 0.85
GetAssetManagerMethod · 0.80
GetObjPathMethod · 0.80
CopyModelMethod · 0.80
SetBulletWorldMethod · 0.80

Tested by

no test coverage detected